Icon, minor improvements
This commit is contained in:
parent
ffb7baaaa1
commit
f80fbb7f5c
|
|
@ -257,6 +257,12 @@ dependencies = [
|
|||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "color_quant"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "4.6.6"
|
||||
|
|
@ -850,6 +856,20 @@ dependencies = [
|
|||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.24.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e30ca2ecf7666107ff827a8e481de6a132a9b687ed3bb20bb1c144a36c00964"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"byteorder",
|
||||
"color_quant",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
"png",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "instant"
|
||||
version = "0.1.12"
|
||||
|
|
@ -1155,6 +1175,17 @@ dependencies = [
|
|||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.15"
|
||||
|
|
@ -1414,6 +1445,7 @@ name = "rusty_hub_egui"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"eframe",
|
||||
"image",
|
||||
"rusty_hub",
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -16,3 +16,4 @@ opt-level = 2
|
|||
[dependencies]
|
||||
eframe = "0.19.0"
|
||||
rusty_hub = { path="../rusty_hub" }
|
||||
image = { version = "0.24.0", default-features = false, features = ["png"] }
|
||||
|
|
@ -1,10 +1,31 @@
|
|||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
|
||||
use eframe::egui;
|
||||
use eframe::{egui, IconData, NativeOptions};
|
||||
use rusty_hub::hub::Hub;
|
||||
use std::io::Cursor;
|
||||
|
||||
fn main() {
|
||||
let options = eframe::NativeOptions::default();
|
||||
let img = image::io::Reader::new(Cursor::new(include_bytes!("../static/hub.png")))
|
||||
.with_guessed_format()
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
let icon = IconData {
|
||||
width: 32,
|
||||
height: 32,
|
||||
rgba: img.into_rgba8().into_raw(),
|
||||
};
|
||||
let options = NativeOptions {
|
||||
always_on_top: false,
|
||||
maximized: false,
|
||||
decorated: true,
|
||||
fullscreen: false,
|
||||
drag_and_drop_support: false,
|
||||
initial_window_size: Some(egui::vec2(920.0, 400.0)),
|
||||
resizable: false,
|
||||
icon_data: Some(icon),
|
||||
..NativeOptions::default()
|
||||
};
|
||||
eframe::run_native(
|
||||
"Rusty Hub",
|
||||
options,
|
||||
|
|
@ -42,7 +63,6 @@ fn setup_custom_fonts(ctx: &egui::Context) {
|
|||
}
|
||||
|
||||
struct MyApp {
|
||||
text: String,
|
||||
hub: Hub,
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +70,6 @@ impl MyApp {
|
|||
fn new(cc: &eframe::CreationContext<'_>) -> Self {
|
||||
setup_custom_fonts(&cc.egui_ctx);
|
||||
Self {
|
||||
text: "Edit this text field if you want".to_owned(),
|
||||
hub: Hub::default(),
|
||||
}
|
||||
}
|
||||
|
|
@ -58,25 +77,41 @@ impl MyApp {
|
|||
|
||||
impl eframe::App for MyApp {
|
||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||
egui::SidePanel::left("dsadsa").show(ctx, |ui| {
|
||||
ui.set_height(25.0);
|
||||
ui.add_space(14.0);
|
||||
ui.button("Projects");
|
||||
ui.add_space(14.0);
|
||||
ui.button("Editors");
|
||||
});
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
egui::Grid::new("some_unique_id")
|
||||
.striped(true)
|
||||
.min_row_height(30.0)
|
||||
.max_col_width(500.0)
|
||||
.min_col_width(150.0)
|
||||
.max_col_width(800.0)
|
||||
.num_columns(3)
|
||||
.show(ui, |ui| {
|
||||
let mut index: usize = 0;
|
||||
for project in &self.hub.projects {
|
||||
if self.hub.editor_for_project(project).is_some() {
|
||||
if ui.button("run").clicked() {
|
||||
ui.set_row_height(40.0);
|
||||
ui.scope(|ui| {
|
||||
ui.set_enabled(self.hub.editor_for_project(project).is_some());
|
||||
if ui
|
||||
.button(format!("Open {}", &project.title))
|
||||
.on_disabled_hover_text(format!("Select different Unity version"))
|
||||
.clicked()
|
||||
{
|
||||
self.hub.run_project_nr(index);
|
||||
}
|
||||
}
|
||||
ui.label(&project.title);
|
||||
ui.set_enabled(true);
|
||||
});
|
||||
|
||||
let version_response =
|
||||
ui.add(egui::Label::new(&project.version).sense(egui::Sense::click()));
|
||||
version_response.context_menu(|ui| {
|
||||
for editor in &self.hub.config.editors_configurations {
|
||||
if ui.button(format!("Open in {}", editor.version)).clicked() {
|
||||
if ui.button(format!("Open in {}", &editor.version)).clicked() {
|
||||
Hub::run_project(&editor, &project);
|
||||
ui.close_menu();
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 674 B |
|
|
@ -30,6 +30,9 @@ impl UnityEditor {
|
|||
let hashmap = string_file_info.children[0].string_map();
|
||||
if let Some(result_version) = hashmap.get("ProductVersion") {
|
||||
version = Some(result_version.clone());
|
||||
if let Some(short) = result_version.clone().split("_").take(1).next() {
|
||||
version = Some(short.to_string());
|
||||
}
|
||||
}
|
||||
// println!(
|
||||
// "Printing info for {}: \n{:#?}\n\n",
|
||||
|
|
|
|||
Loading…
Reference in New Issue