From f1735beaa8620c5324524ac5b8ee1c6d80a71d78 Mon Sep 17 00:00:00 2001 From: Piotr Siuszko Date: Sun, 25 Sep 2022 23:42:32 +0200 Subject: [PATCH] Layout cleanup --- egui_client/src/hub_client.rs | 47 +++++++++++++++++++++-------------- egui_client/src/main.rs | 4 +-- rusty_hub/src/config.rs | 9 +------ rusty_hub/src/unity_editor.rs | 5 ---- 4 files changed, 31 insertions(+), 34 deletions(-) diff --git a/egui_client/src/hub_client.rs b/egui_client/src/hub_client.rs index 00fd186..a40e134 100644 --- a/egui_client/src/hub_client.rs +++ b/egui_client/src/hub_client.rs @@ -154,16 +154,25 @@ impl HubClient { ui.add_space(VERTICAL_SPACING); }); header.col(|ui| { - ui.heading("Version"); - ui.add_space(VERTICAL_SPACING); + ui.vertical_centered_justified(|ui| { + ui.heading("Version"); + ui.add_space(VERTICAL_SPACING); + }); }); header.col(|ui| { - ui.heading("Branch"); - ui.add_space(VERTICAL_SPACING); + ui.vertical_centered_justified(|ui| { + ui.heading("Branch"); + ui.add_space(VERTICAL_SPACING); + }); }); header.col(|ui| { - ui.heading("Directory"); - ui.add_space(VERTICAL_SPACING); + ui.with_layout( + Layout::top_down_justified(eframe::emath::Align::Max), + |ui| { + ui.heading("Directory"); + ui.add_space(VERTICAL_SPACING); + }, + ); }); }) .body(|body| { @@ -284,15 +293,11 @@ impl HubClient { row.col(|ui| { ui.vertical_centered_justified(|ui| { ui.add_space(VERTICAL_SPACING); - if ui.button("Refresh").clicked() { - self.hub.update_info(); - } - }); - }); - row.col(|ui| { - ui.vertical_centered_justified(|ui| { - ui.add_space(VERTICAL_SPACING); - if ui.button("Add new").clicked() { + if ui + .button("Add new path") + .on_hover_text("Add new editor search path") + .clicked() + { let directory = FileDialog::new().pick_folder(); if let Some(dir) = directory { self.hub @@ -304,6 +309,7 @@ impl HubClient { } }); }); + row.col(|_ui| {}); }); }); } @@ -316,11 +322,14 @@ impl HubClient { row.col(|ui| { add_header(ui); }); - row.col(|_ui| {}); row.col(|ui| { ui.vertical_centered_justified(|ui| { ui.add_space(VERTICAL_SPACING); - if ui.button("Import").clicked() { + if ui + .button("Scan") + .on_hover_text("Scan selected folder for projects") + .clicked() + { let directory = FileDialog::new().pick_folder(); if let Some(dir) = directory { @@ -348,6 +357,7 @@ impl HubClient { } }); }); + row.col(|_ui| {}); }); }); } @@ -356,7 +366,6 @@ impl HubClient { Layout::top_down_justified(eframe::emath::Align::Min), |ui| { ui.add_space(VERTICAL_SPACING); - let button = egui::Button::new(egui::RichText::new("📦 Projects").heading()) .frame(&self.current_tab == &WindowTab::Projects); if ui @@ -388,7 +397,7 @@ fn build_header_table(ui: &mut Ui) -> TableBuilder { .cell_layout(egui::Layout::left_to_right(egui::Align::Center)) .column(Size::remainder().at_least(150.0)) .column(Size::initial(100.0).at_most(100.0)) - .column(Size::initial(100.0).at_most(100.0)) + .column(Size::initial(5.0).at_most(5.0)) .resizable(false); table } diff --git a/egui_client/src/main.rs b/egui_client/src/main.rs index a550db4..98e1261 100644 --- a/egui_client/src/main.rs +++ b/egui_client/src/main.rs @@ -25,8 +25,8 @@ fn main() { decorated: true, fullscreen: false, drag_and_drop_support: false, - initial_window_size: Some(egui::vec2(820.0, 400.0)), - min_window_size: Some(egui::vec2(720.0, 400.0)), + initial_window_size: Some(egui::vec2(850.0, 400.0)), + min_window_size: Some(egui::vec2(850.0, 400.0)), icon_data: Some(icon), ..NativeOptions::default() }; diff --git a/rusty_hub/src/config.rs b/rusty_hub/src/config.rs index fbafb61..01247ea 100644 --- a/rusty_hub/src/config.rs +++ b/rusty_hub/src/config.rs @@ -36,10 +36,7 @@ impl Configuration { fn is_unity_dir(entry: &DirEntry) -> bool { let uninstall_exists = entry.path().clone().join("Uninstall.exe").exists(); let unity_exe_exists = entry.path().clone().join("Unity.exe").exists(); - // println!( - // "{}: Unity.exe {}, Uninstall.exe {}", entry.path().display(), - // unity_exe_exists, uninstall_exists - // ); + uninstall_exists && unity_exe_exists } @@ -63,10 +60,6 @@ impl Configuration { } } } - println!("Result paths are:"); - for path in &result_paths { - println!("- {}", path); - } result_paths } } diff --git a/rusty_hub/src/unity_editor.rs b/rusty_hub/src/unity_editor.rs index 4dec50e..04c116c 100644 --- a/rusty_hub/src/unity_editor.rs +++ b/rusty_hub/src/unity_editor.rs @@ -40,11 +40,6 @@ impl UnityEditor { version = Some(short.to_string()); } } - // println!( - // "Printing info for {}: \n{:#?}\n\n", - // base_path.display(), - // hashmap - // ); } if version.is_none() {