diff --git a/locales/app.yml b/locales/app.yml index 4f23d1c..fbfdcab 100644 --- a/locales/app.yml +++ b/locales/app.yml @@ -71,8 +71,8 @@ button.update_system_alter: ru_RU.UTF-8: "Обновить систему \n(Eсли обновление с осноновной кнопки приводит к ошибке)" button.update_system_overwrite: - en: "Update system \n(If there are file conflicts that you want to overwrite on top.\nAll actions are at your own risk.)" - ru_RU.UTF-8: "Обновить систему \n(Ecли существуют конфликты файлов, которые вы хотите перезаписать поверх.\nВсе действия вы совершаете на свой страх и риск.)" + en: "Update system \n(If there are file conflicts \nthat you want to overwrite on top.\nAll actions are at your own risk)" + ru_RU.UTF-8: "Обновить систему \n(Ecли существуют конфликты файлов, \nкоторые вы хотите перезаписать поверх.\nВсе действия вы совершаете на свой страх и риск)" button.unlock_repo_databases: en: Unlock repo databases diff --git a/src/main.rs b/src/main.rs index 8e2a260..1fd955b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,12 +14,12 @@ use fltk::{ image::*, menu::*, prelude::*, - terminal::{self, RedrawStyle}, + text, window::{DoubleWindow, Window}, }; use fltk_theme::{ - /*color_themes, widget_themes, ColorTheme, SchemeType,*/ ThemeType, + /*color_themes, widget_themes, ColorTheme, SchemeType, */ ThemeType, /*WidgetScheme,*/ WidgetTheme, }; @@ -84,7 +84,7 @@ fn main() { let padding: i32 = 10; - let title_and_panel_h: i32 = 68; + let title_and_panel_h: i32 = 36 * 2; // let (w, h) = app::screen_size(); // println!("{} {}", w, h); @@ -105,6 +105,7 @@ fn main() { } } + width = width / 3 * 2 as i32; height = height - title_and_panel_h; let application = App::default(); @@ -768,48 +769,41 @@ fn main() { // ----------------------------------------------------------- let mut grp_about = Flex::default_fill().with_label(&t!("tab.about")).row(); - // grp_about.set_margin(padding); + grp_about.set_margin(padding); grp_about.set_pad(padding); - if locale == "ru_RU.UTF-8" { - let mut term = terminal::Terminal::default_fill(); - term.set_color(Color::Light1); - term.set_text_color(Color::Gray0); - term.set_redraw_style(RedrawStyle::PerWrite); + let about_filename = if locale == "ru_RU.UTF-8" { + "/usr/share/melawy-linux-welcome/assets/text/about_ru.txt" + } else { + "/usr/share/melawy-linux-welcome/assets/text/about_en.txt" + }; - if let Ok(lines) = read_lines("/usr/share/melawy-linux-welcome/assets/text/about_ru.txt") { - // Получает итератор, который возвращает Option - for line in lines { - if let Ok(text_string) = line { - term.append(format!("{}\n", text_string).as_str()); - } + let mut buf = text::TextBuffer::default(); + buf.set_text(""); + + let mut term = text::TextDisplay::default_fill(); + term.set_color(Color::Light1); + term.set_text_color(Color::Gray0); + + if let Ok(lines) = read_lines(about_filename) { + // Получает итератор, который возвращает Option + for line in lines { + if let Ok(text_string) = line { + buf.append(format!("{}\n", text_string).as_str()); } } - - let copyright = format!("\n(с) Валерия Фадеева, 2023 - {}\n", current_year.clone()); - - term.append(copyright.as_str()); } - // ----------------------------------------------------------- - else { - let mut term = terminal::Terminal::default_fill(); - term.set_color(Color::Light1); - term.set_text_color(Color::Gray0); - term.set_redraw_style(RedrawStyle::PerWrite); - if let Ok(lines) = read_lines("/usr/share/melawy-linux-welcome/assets/text/about_en.txt") { - // Получает итератор, который возвращает Option - for line in lines { - if let Ok(text_string) = line { - term.append(format!("{}\n", text_string).as_str()); - } - } - } + let copyright = if locale == "ru_RU.UTF-8" { + format!("\n(с) Валерия Фадеева, 2023 - {}\n", current_year.clone()) + } else { + format!("\n(с) Valeria Fadeeva, 2023 - {}\n", current_year.clone()) + }; - let copyright = format!("\n(с) Valeria Fadeeva, 2023 - {}\n", current_year.clone()); + buf.append(copyright.as_str()); - term.append(copyright.as_str()); - } + term.set_buffer(buf); + term.wrap_mode(text::WrapMode::AtBounds, 0); grp_about.end();