Update
This commit is contained in:
parent
a050f2c4a1
commit
9319f9aa4c
|
@ -0,0 +1,4 @@
|
|||
# RUN="sudo"
|
||||
# PARAM="/usr/bin/pacman -Syu --needed --noconfirm"
|
||||
RUN="find"
|
||||
PARAM=".git"
|
|
@ -9,7 +9,7 @@ edition = "2021"
|
|||
[dependencies]
|
||||
futures = "^0.3"
|
||||
fltk = { version = "^1.4", features = ["fltk-bundled"] }
|
||||
# fltk-theme = "^0.7"
|
||||
tokio = { version = "1.28.1", features = ["full"] }
|
||||
fltk-theme = "^0.7"
|
||||
tokio = { version = "^1.33", features = ["full"] }
|
||||
# bytes = "^1.4"
|
||||
dotenv = "^0.15"
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="512"
|
||||
height="512"
|
||||
viewBox="0 0 135.46667 135.46667"
|
||||
version="1.1"
|
||||
id="svg331"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
sodipodi:docname="Me.svg"
|
||||
inkscape:export-filename="Me.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview333"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#505050"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.73673541"
|
||||
inkscape:cx="396.34311"
|
||||
inkscape:cy="236.85573"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1006"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs328" />
|
||||
<g
|
||||
inkscape:label="Слой 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<path
|
||||
fill-rule="nonzero"
|
||||
fill="#ff5555"
|
||||
fill-opacity="1"
|
||||
d="M 8.0074472,107.79389 V 35.971926 H 23.959151 v 7.936563 h 8.015143 v 8.015143 h 7.936563 V 43.908489 H 47.926 V 35.971926 H 63.877703 V 107.79389 H 47.926 V 67.875335 h -8.015143 v 8.015143 H 31.974294 V 67.875335 H 23.959151 V 107.79389 Z M 71.873202,99.778745 v -31.90341 h 8.015143 V 59.860192 H 119.8069 v 8.015143 h 7.93657 V 83.827041 H 87.824908 v 15.951704 h 23.966852 v -7.936561 h 15.95171 v 7.936561 h -7.93657 v 8.015145 H 79.888345 v -8.015145 z m 15.951706,-31.90341 v 8.015143 H 111.79176 V 67.875335 Z M 8.0074472,27.956783"
|
||||
id="path2"
|
||||
style="display:inline;stroke-width:0.50291" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
21
src/main.rs
21
src/main.rs
|
@ -2,7 +2,8 @@
|
|||
|
||||
extern crate dotenv;
|
||||
|
||||
use fltk::{prelude::*, app, text::SimpleTerminal, frame::Frame, window::Window};
|
||||
use fltk::{prelude::*, app, text::SimpleTerminal, enums::Color, frame, window, /*button,*/ image};
|
||||
use fltk_theme::{/*ColorTheme, color_themes, widget_themes, */WidgetTheme, ThemeType, /*WidgetScheme, SchemeType*/};
|
||||
|
||||
use tokio::io::{self, BufReader, AsyncBufReadExt};
|
||||
use tokio::process::Command;
|
||||
|
@ -14,6 +15,7 @@ use std::path::Path;
|
|||
|
||||
async fn run_process() -> tokio::process::Child {
|
||||
let env_path = Path::new("/etc/arch-linux-updater/.env");
|
||||
// let env_path = Path::new(".env_debug");
|
||||
|
||||
dotenv::from_path(env_path).unwrap();
|
||||
|
||||
|
@ -73,18 +75,29 @@ async fn gui() -> io::Result<()> {
|
|||
let height = 700;
|
||||
|
||||
let app = app::App::default();
|
||||
let mut wind: fltk::window::DoubleWindow = Window::default()
|
||||
// let app = app::App::default().with_scheme(app::Scheme::Gtk); // Base, Gleam, Gtk, Oxy, Plastic
|
||||
|
||||
let widget_theme = WidgetTheme::new(ThemeType::Dark);
|
||||
widget_theme.apply();
|
||||
|
||||
let mut wind: fltk::window::DoubleWindow = window::Window::default()
|
||||
.with_size(width, height)
|
||||
.center_screen()
|
||||
.with_label("Arch Linux Updater");
|
||||
|
||||
let frame = Frame::default_fill()
|
||||
let image = image::PngImage::load("assets/icons/Melawy.png").unwrap();
|
||||
// let image = image::PngImage::load(&std::path::Path::new("assets/icons/Melawy.png")).unwrap();
|
||||
wind.set_icon(Some(image));
|
||||
|
||||
let frame = frame::Frame::default_fill()
|
||||
.with_size(width, height)
|
||||
.center_of(&wind);
|
||||
|
||||
let mut terminal: SimpleTerminal = SimpleTerminal::default_fill()
|
||||
.with_size(width, height)
|
||||
.center_of(&frame);
|
||||
terminal.set_color(Color::Background2);
|
||||
terminal.set_text_color(Color::Light2);
|
||||
|
||||
wind.make_resizable(true);
|
||||
wind.end();
|
||||
|
@ -94,6 +107,8 @@ async fn gui() -> io::Result<()> {
|
|||
|
||||
let mut lines: io::Lines<BufReader<tokio::process::ChildStdout>> = get_lines().await;
|
||||
|
||||
|
||||
// app.run().unwrap();
|
||||
while app.wait() {
|
||||
if let Some(line) = get_line(&mut lines).await? {
|
||||
terminal.append(format!("{}\n", line).as_str());
|
||||
|
|
Loading…
Reference in New Issue