Update
This commit is contained in:
parent
074f892f28
commit
d6fca2592e
47
src/main.rs
47
src/main.rs
|
@ -2,7 +2,10 @@
|
|||
|
||||
extern crate dotenv;
|
||||
|
||||
use fltk::{app, enums::Color, frame, /*button,*/ image, prelude::*, terminal::Terminal, window,};
|
||||
use fltk::{
|
||||
app, app::Screen, enums::Color, frame, /*button,*/ image, prelude::*, terminal::Terminal,
|
||||
window,
|
||||
};
|
||||
use fltk_theme::{
|
||||
SchemeType, ThemeType, WidgetScheme,
|
||||
/*ColorTheme, color_themes, widget_themes, */ WidgetTheme,
|
||||
|
@ -75,8 +78,30 @@ async fn get_line(
|
|||
}
|
||||
|
||||
async fn gui() -> io::Result<()> {
|
||||
let width = 1100;
|
||||
let height = 700;
|
||||
// let padding: i32 = 10;
|
||||
|
||||
let title_and_panel_h: i32 = 68;
|
||||
|
||||
// let (w, h) = app::screen_size();
|
||||
// println!("{} {}", w, h);
|
||||
|
||||
// let width = 1280;
|
||||
// let height = 720;
|
||||
|
||||
let screens = Screen::all_screens();
|
||||
|
||||
let mut width = 100000;
|
||||
let mut height = 100000;
|
||||
for s in screens {
|
||||
if s.work_area().w < width {
|
||||
width = s.work_area().w;
|
||||
}
|
||||
if s.work_area().h < height {
|
||||
height = s.work_area().h;
|
||||
}
|
||||
}
|
||||
|
||||
height = height - title_and_panel_h;
|
||||
|
||||
let app = app::App::default();
|
||||
// let app = app::App::default().with_scheme(app::Scheme::Gtk); // Base, Gleam, Gtk, Oxy, Plastic
|
||||
|
@ -87,29 +112,29 @@ async fn gui() -> io::Result<()> {
|
|||
let widget_scheme = WidgetScheme::new(SchemeType::Fluent);
|
||||
widget_scheme.apply();
|
||||
|
||||
let mut wind: fltk::window::DoubleWindow = window::Window::default()
|
||||
let mut win: fltk::window::DoubleWindow = window::Window::default()
|
||||
.with_size(width, height)
|
||||
.center_screen()
|
||||
.with_label("Melawy Linux Updater");
|
||||
|
||||
let image =
|
||||
image::SvgImage::load("/usr/share/melawy-linux-updater/assets/icons/Melawy.svg").unwrap();
|
||||
wind.set_icon(Some(image));
|
||||
win.set_icon(Some(image));
|
||||
|
||||
let frame = frame::Frame::default_fill()
|
||||
.with_size(width, height)
|
||||
.center_of(&wind);
|
||||
.with_size(win.width(), win.height())
|
||||
.center_of(&win);
|
||||
|
||||
let mut term: Terminal = Terminal::default_fill()
|
||||
.with_size(width, height)
|
||||
.with_size(win.width(), win.height())
|
||||
.center_of(&frame);
|
||||
term.set_color(Color::Background2);
|
||||
term.set_text_color(Color::Light2);
|
||||
term.set_history_rows(5000);
|
||||
|
||||
wind.make_resizable(true);
|
||||
wind.end();
|
||||
wind.show();
|
||||
win.make_resizable(true);
|
||||
win.end();
|
||||
win.show();
|
||||
|
||||
let mut printed_close_msg = false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue