Layout cleanup

This commit is contained in:
Piotr Siuszko 2022-09-25 23:42:32 +02:00
parent eb125d9719
commit f1735beaa8
4 changed files with 31 additions and 34 deletions

View File

@ -154,16 +154,25 @@ impl HubClient {
ui.add_space(VERTICAL_SPACING); ui.add_space(VERTICAL_SPACING);
}); });
header.col(|ui| { header.col(|ui| {
ui.vertical_centered_justified(|ui| {
ui.heading("Version"); ui.heading("Version");
ui.add_space(VERTICAL_SPACING); ui.add_space(VERTICAL_SPACING);
}); });
});
header.col(|ui| { header.col(|ui| {
ui.vertical_centered_justified(|ui| {
ui.heading("Branch"); ui.heading("Branch");
ui.add_space(VERTICAL_SPACING); ui.add_space(VERTICAL_SPACING);
}); });
});
header.col(|ui| { header.col(|ui| {
ui.with_layout(
Layout::top_down_justified(eframe::emath::Align::Max),
|ui| {
ui.heading("Directory"); ui.heading("Directory");
ui.add_space(VERTICAL_SPACING); ui.add_space(VERTICAL_SPACING);
},
);
}); });
}) })
.body(|body| { .body(|body| {
@ -284,15 +293,11 @@ impl HubClient {
row.col(|ui| { row.col(|ui| {
ui.vertical_centered_justified(|ui| { ui.vertical_centered_justified(|ui| {
ui.add_space(VERTICAL_SPACING); ui.add_space(VERTICAL_SPACING);
if ui.button("Refresh").clicked() { if ui
self.hub.update_info(); .button("Add new path")
} .on_hover_text("Add new editor search path")
}); .clicked()
}); {
row.col(|ui| {
ui.vertical_centered_justified(|ui| {
ui.add_space(VERTICAL_SPACING);
if ui.button("Add new").clicked() {
let directory = FileDialog::new().pick_folder(); let directory = FileDialog::new().pick_folder();
if let Some(dir) = directory { if let Some(dir) = directory {
self.hub self.hub
@ -304,6 +309,7 @@ impl HubClient {
} }
}); });
}); });
row.col(|_ui| {});
}); });
}); });
} }
@ -316,11 +322,14 @@ impl HubClient {
row.col(|ui| { row.col(|ui| {
add_header(ui); add_header(ui);
}); });
row.col(|_ui| {});
row.col(|ui| { row.col(|ui| {
ui.vertical_centered_justified(|ui| { ui.vertical_centered_justified(|ui| {
ui.add_space(VERTICAL_SPACING); 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(); let directory = FileDialog::new().pick_folder();
if let Some(dir) = directory { 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), Layout::top_down_justified(eframe::emath::Align::Min),
|ui| { |ui| {
ui.add_space(VERTICAL_SPACING); ui.add_space(VERTICAL_SPACING);
let button = egui::Button::new(egui::RichText::new("📦 Projects").heading()) let button = egui::Button::new(egui::RichText::new("📦 Projects").heading())
.frame(&self.current_tab == &WindowTab::Projects); .frame(&self.current_tab == &WindowTab::Projects);
if ui if ui
@ -388,7 +397,7 @@ fn build_header_table(ui: &mut Ui) -> TableBuilder {
.cell_layout(egui::Layout::left_to_right(egui::Align::Center)) .cell_layout(egui::Layout::left_to_right(egui::Align::Center))
.column(Size::remainder().at_least(150.0)) .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(100.0).at_most(100.0)) .column(Size::initial(5.0).at_most(5.0))
.resizable(false); .resizable(false);
table table
} }

View File

@ -25,8 +25,8 @@ fn main() {
decorated: true, decorated: true,
fullscreen: false, fullscreen: false,
drag_and_drop_support: false, drag_and_drop_support: false,
initial_window_size: Some(egui::vec2(820.0, 400.0)), initial_window_size: Some(egui::vec2(850.0, 400.0)),
min_window_size: Some(egui::vec2(720.0, 400.0)), min_window_size: Some(egui::vec2(850.0, 400.0)),
icon_data: Some(icon), icon_data: Some(icon),
..NativeOptions::default() ..NativeOptions::default()
}; };

View File

@ -36,10 +36,7 @@ impl Configuration {
fn is_unity_dir(entry: &DirEntry) -> bool { fn is_unity_dir(entry: &DirEntry) -> bool {
let uninstall_exists = entry.path().clone().join("Uninstall.exe").exists(); let uninstall_exists = entry.path().clone().join("Uninstall.exe").exists();
let unity_exe_exists = entry.path().clone().join("Unity.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 uninstall_exists && unity_exe_exists
} }
@ -63,10 +60,6 @@ impl Configuration {
} }
} }
} }
println!("Result paths are:");
for path in &result_paths {
println!("- {}", path);
}
result_paths result_paths
} }
} }

View File

@ -40,11 +40,6 @@ impl UnityEditor {
version = Some(short.to_string()); version = Some(short.to_string());
} }
} }
// println!(
// "Printing info for {}: \n{:#?}\n\n",
// base_path.display(),
// hashmap
// );
} }
if version.is_none() { if version.is_none() {