From 9019c689af4d98a60acd8284525555de10f2f6a6 Mon Sep 17 00:00:00 2001 From: Valeria Fadeeva Date: Fri, 24 Jan 2025 01:56:40 +0500 Subject: [PATCH] Update --- .trunk/.gitignore | 9 ++++ .trunk/configs/.markdownlint.yaml | 2 + .trunk/configs/.rustfmt.toml | 1 + .trunk/configs/.shellcheckrc | 7 +++ .trunk/configs/svgo.config.js | 14 +++++ .trunk/trunk.yaml | 38 ++++++++++++++ assets/text/about_en.txt | 31 +++++++++++ assets/text/{about.txt => about_ru.txt} | 39 -------------- src/main.rs | 69 +++++++++++++++++++++---- 9 files changed, 160 insertions(+), 50 deletions(-) create mode 100644 .trunk/.gitignore create mode 100644 .trunk/configs/.markdownlint.yaml create mode 100644 .trunk/configs/.rustfmt.toml create mode 100644 .trunk/configs/.shellcheckrc create mode 100644 .trunk/configs/svgo.config.js create mode 100644 .trunk/trunk.yaml create mode 100644 assets/text/about_en.txt rename assets/text/{about.txt => about_ru.txt} (62%) diff --git a/.trunk/.gitignore b/.trunk/.gitignore new file mode 100644 index 0000000..15966d0 --- /dev/null +++ b/.trunk/.gitignore @@ -0,0 +1,9 @@ +*out +*logs +*actions +*notifications +*tools +plugins +user_trunk.yaml +user.yaml +tmp diff --git a/.trunk/configs/.markdownlint.yaml b/.trunk/configs/.markdownlint.yaml new file mode 100644 index 0000000..b40ee9d --- /dev/null +++ b/.trunk/configs/.markdownlint.yaml @@ -0,0 +1,2 @@ +# Prettier friendly markdownlint config (all formatting rules disabled) +extends: markdownlint/style/prettier diff --git a/.trunk/configs/.rustfmt.toml b/.trunk/configs/.rustfmt.toml new file mode 100644 index 0000000..3a26366 --- /dev/null +++ b/.trunk/configs/.rustfmt.toml @@ -0,0 +1 @@ +edition = "2021" diff --git a/.trunk/configs/.shellcheckrc b/.trunk/configs/.shellcheckrc new file mode 100644 index 0000000..8c7b1ad --- /dev/null +++ b/.trunk/configs/.shellcheckrc @@ -0,0 +1,7 @@ +enable=all +source-path=SCRIPTDIR +disable=SC2154 + +# If you're having issues with shellcheck following source, disable the errors via: +# disable=SC1090 +# disable=SC1091 diff --git a/.trunk/configs/svgo.config.js b/.trunk/configs/svgo.config.js new file mode 100644 index 0000000..b257d13 --- /dev/null +++ b/.trunk/configs/svgo.config.js @@ -0,0 +1,14 @@ +module.exports = { + plugins: [ + { + name: "preset-default", + params: { + overrides: { + removeViewBox: false, // https://github.com/svg/svgo/issues/1128 + sortAttrs: true, + removeOffCanvasPaths: true, + }, + }, + }, + ], +}; diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml new file mode 100644 index 0000000..f8dfcf8 --- /dev/null +++ b/.trunk/trunk.yaml @@ -0,0 +1,38 @@ +# This file controls the behavior of Trunk: https://docs.trunk.io/cli +# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml +version: 0.1 +cli: + version: 1.22.9 +# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins) +plugins: + sources: + - id: trunk + ref: v1.6.6 + uri: https://github.com/trunk-io/plugins +# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes) +runtimes: + enabled: + - go@1.21.0 + - node@18.20.5 + - python@3.10.8 +# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration) +lint: + enabled: + - clippy@1.65.0 + - git-diff-check + - markdownlint@0.43.0 + - osv-scanner@1.9.2 + - prettier@3.4.2 + - rustfmt@1.65.0 + - shellcheck@0.10.0 + - shfmt@3.6.0 + - svgo@3.3.2 + - taplo@0.9.3 + - trufflehog@3.88.2 +actions: + disabled: + - trunk-announce + - trunk-check-pre-push + - trunk-fmt-pre-commit + enabled: + - trunk-upgrade-available diff --git a/assets/text/about_en.txt b/assets/text/about_en.txt new file mode 100644 index 0000000..78cf3cc --- /dev/null +++ b/assets/text/about_en.txt @@ -0,0 +1,31 @@ +A Linux distribution is a selected set of Linux operating system components assembled into a distribution package — the kernel, libraries and utilities of the GNU project, the installation program, other utilities and programs for Linux. + +Typically, a Linux distribution contains basic components, including a boot loader, Linux kernel, init system, daemons, a graphical server and applications. + +Linux distributions are designed to meet various user needs, from servers and desktop computers to embedded systems. For example, server distributions include various server software (web servers, DBMS), while desktop distributions include desktop environments, office suites, and multimedia players. + +A Linux derivative is an operating system created by modifying an existing Linux distribution to meet specific user goals or needs. + +Derivative developers often change software packages, configurations, and system behavior to create customized solutions. + +---------------------------------------------- + +Product from girls and boys, from the creators of non boring wallpapers, distributions from Vasyans, including Linus Torvalds was Vasyan, who made the kernel of the operating system on his home computer, as opposed to the paid kernel of the Unix system at that time, and many, many others. + +„If you criticize someone else's, offer your own. Offer — do it.“ +— Sergey Pavlovich Korolev is a Soviet scientist, design engineer, the main organizer of the production of rocket and space technology and rocket weapons in the USSR and the founder of practical cosmonautics. + +30.12.1906 — 14.01.1966 + + +„Rejecting — offer, offering — act.“ +— Paul Valéry — French poet, essayist, philosopher. + +30.10.1871 — 20.07.1945 + +---------------------------------------------- + +Don't Worry, Be Happy! :D"; + + +---------------------------------------------- diff --git a/assets/text/about.txt b/assets/text/about_ru.txt similarity index 62% rename from assets/text/about.txt rename to assets/text/about_ru.txt index d795bdb..bc1d3ec 100644 --- a/assets/text/about.txt +++ b/assets/text/about_ru.txt @@ -1,42 +1,3 @@ ----------------------------------------------- -EN ----------------------------------------------- - -A Linux distribution is a selected set of Linux operating system components assembled into a distribution package — the kernel, libraries and utilities of the GNU project, the installation program, other utilities and programs for Linux. - -Typically, a Linux distribution contains basic components, including a boot loader, Linux kernel, init system, daemons, a graphical server and applications. - -Linux distributions are designed to meet various user needs, from servers and desktop computers to embedded systems. For example, server distributions include various server software (web servers, DBMS), while desktop distributions include desktop environments, office suites, and multimedia players. - -A Linux derivative is an operating system created by modifying an existing Linux distribution to meet specific user goals or needs. - -Derivative developers often change software packages, configurations, and system behavior to create customized solutions. - ----------------------------------------------- - -Product from girls and boys, from the creators of non boring wallpapers, distributions from Vasyans, including Linus Torvalds was Vasyan, who made the kernel of the operating system on his home computer, as opposed to the paid kernel of the Unix system at that time, and many, many others. - -„If you criticize someone else's, offer your own. Offer — do it.“ -— Sergey Pavlovich Korolev is a Soviet scientist, design engineer, the main organizer of the production of rocket and space technology and rocket weapons in the USSR and the founder of practical cosmonautics. - -30.12.1906 — 14.01.1966 - - -„Rejecting — offer, offering — act.“ -— Paul Valéry — French poet, essayist, philosopher. - -30.10.1871 — 20.07.1945 - ----------------------------------------------- - -Don't Worry, Be Happy! :D"; - - - ----------------------------------------------- -RU ----------------------------------------------- - Дистрибутив Linux — это скомпонованный в дистрибутивный пакет подобранный набор компонентов операционной системы Linux — ядро, библиотеки и утилиты проекта GNU, программа установки, другие утилиты и программы для Linux. Как правило, дистрибутив Linux содержит базовые компоненты, в том числе загрузчик, ядро Linux, систему инициализации, программы-демоны, графический сервер и приложения. diff --git a/src/main.rs b/src/main.rs index 1f09537..a158d7a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,6 +46,9 @@ fn run_cmd(cmd_string: &str, lang_env_var: Option<&str>) { } fn main() { + let current_date = chrono::Utc::now(); + let current_year = format!("{}", current_date.year()); + let width = 800; let height = 700; @@ -387,6 +390,8 @@ fn main() { }); }); + let row_help = Flex::default().row(); + let mut btn_get_help = Button::default().with_label("I need help"); btn_get_help.set_callback(move |b| { @@ -432,6 +437,11 @@ fn main() { }); }); + row_help.end(); + + + let row_telegram = Flex::default().row(); + let mut btn_telegram_channel = Button::default().with_label("Telegram Channel"); btn_telegram_channel.set_callback(move |b| { @@ -462,6 +472,10 @@ fn main() { }); }); + row_telegram.end(); + + let row_other_media = Flex::default().row(); + let mut btn_youtube = Button::default().with_label("YouTube"); btn_youtube.set_callback(move |b| { @@ -507,6 +521,8 @@ fn main() { }); }); + row_other_media.end(); + col_information.end(); grp_information.end(); @@ -516,29 +532,60 @@ fn main() { .with_label("About\t\t") .column(); + let mut tabs_mini_about = Tabs::default_fill(); - 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 grp_mini_about_en = Flex::default_fill() + .with_label("EN\t\t") + .column(); - if let Ok(lines) = read_lines("/usr/share/melawy-linux-welcome/assets/text/about.txt") { + let mut term_en = terminal::Terminal::default_fill(); + term_en.set_color(Color::Light1); + term_en.set_text_color(Color::Gray0); + term_en.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()); + term_en.append(format!("{}\n", text_string).as_str()); } } } - let current_date = chrono::Utc::now(); - let current_year = format!("{}", current_date.year()); - let copyright_en = format!("\n(с) Valeria Fadeeva, 2023 - {}\n", current_year.clone()); + + term_en.append(copyright_en.as_str()); + + grp_mini_about_en.end(); + + // ----------------------------------------------------------- + + let grp_mini_about_ru = Flex::default_fill() + .with_label("RU\t\t") + .column(); + + let mut term_ru = terminal::Terminal::default_fill(); + term_ru.set_color(Color::Light1); + term_ru.set_text_color(Color::Gray0); + term_ru.set_redraw_style(RedrawStyle::PerWrite); + + 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_ru.append(format!("{}\n", text_string).as_str()); + } + } + } + let copyright_ru = format!("\n(с) Валерия Фадеева, 2023 - {}\n", current_year.clone()); - term.append(copyright_en.as_str()); - term.append(copyright_ru.as_str()); + term_ru.append(copyright_ru.as_str()); + + grp_mini_about_ru.end(); + + tabs_mini_about.end(); + tabs_mini_about.auto_layout(); grp_about.end();