begin adding vte copycat
This commit is contained in:
parent
cb57cad9fa
commit
1e0c5cb510
61
Cargo.lock
generated
61
Cargo.lock
generated
@ -409,7 +409,7 @@ dependencies = [
|
|||||||
"gobject-sys 0.20.0",
|
"gobject-sys 0.20.0",
|
||||||
"libc",
|
"libc",
|
||||||
"system-deps 7.0.1",
|
"system-deps 7.0.1",
|
||||||
"windows-sys",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -871,7 +871,7 @@ version = "1.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5831952a9476f2fed74b77d74182fa5ddc4d21c72ec45a333b250e3ed0272804"
|
checksum = "5831952a9476f2fed74b77d74182fa5ddc4d21c72ec45a333b250e3ed0272804"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -882,12 +882,12 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "os_pipe"
|
name = "os_pipe"
|
||||||
version = "1.1.5"
|
version = "1.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "57119c3b893986491ec9aa85056780d3a0f3cf4da7cc09dd3650dbd6c6738fb9"
|
checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -930,6 +930,7 @@ dependencies = [
|
|||||||
"gnome-desktop",
|
"gnome-desktop",
|
||||||
"gtk4",
|
"gtk4",
|
||||||
"libadwaita",
|
"libadwaita",
|
||||||
|
"os_pipe",
|
||||||
"pretty-bytes",
|
"pretty-bytes",
|
||||||
"rust-i18n",
|
"rust-i18n",
|
||||||
"serde",
|
"serde",
|
||||||
@ -1529,14 +1530,24 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-targets"
|
name = "windows-sys"
|
||||||
version = "0.52.0"
|
version = "0.59.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows_aarch64_gnullvm",
|
"windows_aarch64_gnullvm",
|
||||||
"windows_aarch64_msvc",
|
"windows_aarch64_msvc",
|
||||||
"windows_i686_gnu",
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_gnullvm",
|
||||||
"windows_i686_msvc",
|
"windows_i686_msvc",
|
||||||
"windows_x86_64_gnu",
|
"windows_x86_64_gnu",
|
||||||
"windows_x86_64_gnullvm",
|
"windows_x86_64_gnullvm",
|
||||||
@ -1545,45 +1556,51 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_gnullvm"
|
name = "windows_aarch64_gnullvm"
|
||||||
version = "0.52.0"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
version = "0.52.0"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
version = "0.52.0"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
version = "0.52.0"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
version = "0.52.0"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
version = "0.52.0"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
version = "0.52.0"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
|
@ -20,3 +20,4 @@ gnome-desktop = "0.4.2"
|
|||||||
rust-i18n = "3.0.1"
|
rust-i18n = "3.0.1"
|
||||||
sys-locale = "0.3.1"
|
sys-locale = "0.3.1"
|
||||||
strfmt = "0.2.4"
|
strfmt = "0.2.4"
|
||||||
|
os_pipe = "1.2.1"
|
||||||
|
@ -70,6 +70,12 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
glib::set_prgname(Some(t!("application_name").to_string()));
|
glib::set_prgname(Some(t!("application_name").to_string()));
|
||||||
glib::set_application_name(&t!("application_name"));
|
glib::set_application_name(&t!("application_name"));
|
||||||
|
|
||||||
|
let (installation_log_loop_sender, installation_log_loop_receiver) = async_channel::unbounded();
|
||||||
|
let installation_log_loop_sender: async_channel::Sender<String> = installation_log_loop_sender.clone();
|
||||||
|
|
||||||
|
let (installation_log_status_loop_sender, installation_log_status_loop_receiver) = async_channel::unbounded();
|
||||||
|
let installation_log_status_loop_sender: async_channel::Sender<bool> = installation_log_status_loop_sender.clone();
|
||||||
|
|
||||||
let carousel = adw::Carousel::builder()
|
let carousel = adw::Carousel::builder()
|
||||||
.allow_long_swipes(false)
|
.allow_long_swipes(false)
|
||||||
.allow_mouse_drag(false)
|
.allow_mouse_drag(false)
|
||||||
@ -178,6 +184,7 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
&carousel,
|
&carousel,
|
||||||
&language_changed_action,
|
&language_changed_action,
|
||||||
&page_done_action,
|
&page_done_action,
|
||||||
|
installation_log_loop_sender,
|
||||||
&language_selection_text_refcell,
|
&language_selection_text_refcell,
|
||||||
&keymap_selection_text_refcell,
|
&keymap_selection_text_refcell,
|
||||||
&timezone_selection_text_refcell,
|
&timezone_selection_text_refcell,
|
||||||
@ -193,7 +200,7 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
&partition_method_manual_crypttab_entry_array_refcell,
|
&partition_method_manual_crypttab_entry_array_refcell,
|
||||||
);
|
);
|
||||||
|
|
||||||
installation_progress_page::installation_progress_page(&carousel, &language_changed_action);
|
installation_progress_page::installation_progress_page(&carousel, &language_changed_action, installation_log_loop_receiver);
|
||||||
|
|
||||||
window.present()
|
window.present()
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ use duct::cmd;
|
|||||||
pub fn installation_progress_page(
|
pub fn installation_progress_page(
|
||||||
main_carousel: &adw::Carousel,
|
main_carousel: &adw::Carousel,
|
||||||
language_changed_action: &gio::SimpleAction,
|
language_changed_action: &gio::SimpleAction,
|
||||||
|
installation_log_loop_receiver: async_channel::Receiver<String>,
|
||||||
) {
|
) {
|
||||||
let installation_progress_box = gtk::Box::builder()
|
let installation_progress_box = gtk::Box::builder()
|
||||||
.orientation(gtk::Orientation::Vertical)
|
.orientation(gtk::Orientation::Vertical)
|
||||||
@ -117,6 +118,39 @@ pub fn installation_progress_page(
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
installation_progress_log_terminal_buffer.connect_changed(clone!(
|
||||||
|
#[weak]
|
||||||
|
installation_progress_log_scroll,
|
||||||
|
move |_|
|
||||||
|
{
|
||||||
|
if installation_progress_log_scroll.vadjustment().upper() - installation_progress_log_scroll.vadjustment().value() < (installation_progress_log_scroll.size(gtk::Orientation::Vertical) as f64 * 1.2 ) {
|
||||||
|
installation_progress_log_scroll.vadjustment().set_value(installation_progress_log_scroll.vadjustment().upper())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
let installation_log_loop_context = glib::MainContext::default();
|
||||||
|
// The main loop executes the asynchronous block
|
||||||
|
installation_log_loop_context.spawn_local(
|
||||||
|
clone!(
|
||||||
|
#[weak]
|
||||||
|
installation_progress_log_terminal_buffer,
|
||||||
|
#[strong]
|
||||||
|
installation_progress_log_terminal_buffer,
|
||||||
|
async move
|
||||||
|
{
|
||||||
|
while let Ok(state) = installation_log_loop_receiver.recv().await {
|
||||||
|
installation_progress_log_terminal_buffer.insert(&mut installation_progress_log_terminal_buffer.end_iter(), &("\n".to_string() + &state))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
language_changed_action.connect_activate(clone!(
|
language_changed_action.connect_activate(clone!(
|
||||||
#[weak]
|
#[weak]
|
||||||
progress_log_button,
|
progress_log_button,
|
||||||
|
@ -7,19 +7,54 @@ use crate::{
|
|||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use glib::{clone, closure_local};
|
use glib::{clone, closure_local};
|
||||||
use gtk::{gio, glib};
|
use gtk::{gio, glib};
|
||||||
use std::{cell::RefCell, fs, ops::Deref, path::Path, process::Command, rc::Rc};
|
use std::{cell::RefCell, fs, ops::Deref, path::Path, process::Command, rc::Rc, thread};
|
||||||
|
|
||||||
mod script_gen;
|
mod script_gen;
|
||||||
|
|
||||||
/// DEBUG
|
/// DEBUG
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use duct::cmd;
|
use duct::cmd;
|
||||||
|
use std::io::prelude::*;
|
||||||
|
use std::io::BufReader;
|
||||||
|
use std::{
|
||||||
|
error::Error,
|
||||||
|
};
|
||||||
/// DEBUG END
|
/// DEBUG END
|
||||||
|
|
||||||
|
const GAMEUTILS_INSTALL_PROG: &str = r###"
|
||||||
|
#! /bin/bash
|
||||||
|
let i=0
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
echo $i
|
||||||
|
let i++
|
||||||
|
done
|
||||||
|
"###;
|
||||||
|
|
||||||
|
fn gameutils_install(
|
||||||
|
log_loop_sender: async_channel::Sender<String>,
|
||||||
|
) -> Result<(), std::boxed::Box<dyn Error + Send + Sync>> {
|
||||||
|
let (pipe_reader, pipe_writer) = os_pipe::pipe()?;
|
||||||
|
let child = cmd!("bash", "-c", GAMEUTILS_INSTALL_PROG)
|
||||||
|
.stderr_to_stdout()
|
||||||
|
.stdout_file(pipe_writer)
|
||||||
|
.start()?;
|
||||||
|
for line in BufReader::new(pipe_reader).lines() {
|
||||||
|
log_loop_sender
|
||||||
|
.send_blocking(line?)
|
||||||
|
.expect("Channel needs to be opened.")
|
||||||
|
}
|
||||||
|
child.wait()?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn installation_summary_page(
|
pub fn installation_summary_page(
|
||||||
main_carousel: &adw::Carousel,
|
main_carousel: &adw::Carousel,
|
||||||
language_changed_action: &gio::SimpleAction,
|
language_changed_action: &gio::SimpleAction,
|
||||||
page_done_action: &gio::SimpleAction,
|
page_done_action: &gio::SimpleAction,
|
||||||
|
installation_log_loop_sender: async_channel::Sender<String>,
|
||||||
language_selection_text_refcell: &Rc<RefCell<PikaLocale>>,
|
language_selection_text_refcell: &Rc<RefCell<PikaLocale>>,
|
||||||
keymap_selection_text_refcell: &Rc<RefCell<PikaKeymap>>,
|
keymap_selection_text_refcell: &Rc<RefCell<PikaKeymap>>,
|
||||||
timezone_selection_text_refcell: &Rc<RefCell<String>>,
|
timezone_selection_text_refcell: &Rc<RefCell<String>>,
|
||||||
@ -78,6 +113,10 @@ pub fn installation_summary_page(
|
|||||||
|
|
||||||
installation_summary_page.set_child_widget(&content_box);
|
installation_summary_page.set_child_widget(&content_box);
|
||||||
|
|
||||||
|
thread::spawn(|| {
|
||||||
|
gameutils_install(installation_log_loop_sender);
|
||||||
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
install_confirm_button.connect_clicked(clone!(
|
install_confirm_button.connect_clicked(clone!(
|
||||||
|
Loading…
Reference in New Issue
Block a user