mirror of
https://code.gri.mw/GUI/grim.git
synced 2026-07-18 20:59:23 +00:00
ui: update egui library, fix images loading and view rounding
This commit is contained in:
+1
-1
@@ -37,7 +37,7 @@ impl Default for AppConfig {
|
||||
Self {
|
||||
auto_start_node: false,
|
||||
chain_type: ChainTypes::default(),
|
||||
show_wallets_at_dual_panel: true,
|
||||
show_wallets_at_dual_panel: false,
|
||||
show_connections_network_panel: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::RwLock;
|
||||
|
||||
use egui::{Align2, RichText, Rounding, Stroke, Vec2};
|
||||
use egui::{Align2, Rect, RichText, Rounding, Stroke, Vec2};
|
||||
use egui::epaint::RectShape;
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
@@ -236,6 +236,8 @@ impl Modal {
|
||||
rounding,
|
||||
fill: Colors::FILL,
|
||||
stroke: Stroke::NONE,
|
||||
fill_texture_id: Default::default(),
|
||||
uv: Rect::ZERO
|
||||
};
|
||||
let bg_idx = ui.painter().add(bg_shape);
|
||||
|
||||
@@ -266,6 +268,8 @@ impl Modal {
|
||||
},
|
||||
fill: Colors::YELLOW,
|
||||
stroke: Stroke::NONE,
|
||||
fill_texture_id: Default::default(),
|
||||
uv: Rect::ZERO
|
||||
};
|
||||
let bg_idx = ui.painter().add(bg_shape);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
use std::sync::atomic::{AtomicI32, Ordering};
|
||||
|
||||
use egui::{Button, CursorIcon, PointerState, Response, RichText, Sense, Spinner, Widget};
|
||||
use egui::{Button, CursorIcon, PointerState, Rect, Response, RichText, Sense, Spinner, Widget};
|
||||
use egui::epaint::{CircleShape, Color32, FontId, RectShape, Rounding, Stroke};
|
||||
use egui::epaint::text::TextWrapping;
|
||||
use egui::text::{LayoutJob, TextFormat};
|
||||
@@ -325,6 +325,8 @@ impl View {
|
||||
},
|
||||
fill: Colors::TRANSPARENT,
|
||||
stroke: Self::ITEM_STROKE,
|
||||
fill_texture_id: Default::default(),
|
||||
uv: Rect::ZERO
|
||||
};
|
||||
let bg_idx = ui.painter().add(bg_shape);
|
||||
|
||||
|
||||
@@ -44,10 +44,7 @@ pub struct WalletCreation {
|
||||
/// Mnemonic phrase setup content.
|
||||
pub(crate) mnemonic_setup: MnemonicSetup,
|
||||
/// Network setup content.
|
||||
pub(crate) network_setup: ConnectionSetup,
|
||||
|
||||
/// App logo image.
|
||||
logo: RetainedImage,
|
||||
pub(crate) network_setup: ConnectionSetup
|
||||
}
|
||||
|
||||
impl Default for WalletCreation {
|
||||
@@ -59,11 +56,7 @@ impl Default for WalletCreation {
|
||||
pass_edit: String::from(""),
|
||||
hide_pass: true,
|
||||
mnemonic_setup: MnemonicSetup::default(),
|
||||
network_setup: ConnectionSetup::default(),
|
||||
logo: RetainedImage::from_image_bytes(
|
||||
"logo.png",
|
||||
include_bytes!("../../../../../img/logo.png"),
|
||||
).unwrap()
|
||||
network_setup: ConnectionSetup::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,7 +213,8 @@ impl WalletCreation {
|
||||
// Show wallet creation message if step is empty.
|
||||
View::center_content(ui, 415.0 + View::get_bottom_inset(), |ui| {
|
||||
ui.add(
|
||||
egui::Image::new(self.logo.texture_id(ui.ctx()), vec2(200.0, 200.0))
|
||||
egui::Image::new(egui::include_image!("../../../../../img/logo.png"))
|
||||
.fit_to_exact_size(vec2(200.0, 200.0))
|
||||
);
|
||||
ui.add_space(-15.0);
|
||||
ui.label(RichText::new("GRIM")
|
||||
|
||||
+10
-5
@@ -15,13 +15,18 @@
|
||||
#[macro_use]
|
||||
extern crate rust_i18n;
|
||||
|
||||
use eframe::wgpu;
|
||||
use egui::{Context, Stroke};
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
use winit::platform::android::activity::AndroidApp;
|
||||
|
||||
pub use config::AppConfig;
|
||||
pub use settings::Settings;
|
||||
|
||||
use crate::gui::{Colors, PlatformApp};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::View;
|
||||
use crate::node::Node;
|
||||
|
||||
i18n!("locales");
|
||||
@@ -30,12 +35,7 @@ mod node;
|
||||
mod wallet;
|
||||
|
||||
mod settings;
|
||||
pub use settings::Settings;
|
||||
|
||||
mod config;
|
||||
pub use config::AppConfig;
|
||||
use crate::gui::views::View;
|
||||
|
||||
pub mod gui;
|
||||
|
||||
// Include build information.
|
||||
@@ -87,8 +87,13 @@ fn android_main(app: AndroidApp) {
|
||||
pub fn app_creator<T: 'static>(app: PlatformApp<T>) -> eframe::AppCreator
|
||||
where PlatformApp<T>: eframe::App, T: PlatformCallbacks {
|
||||
Box::new(|cc| {
|
||||
// Setup images support.
|
||||
egui_extras::install_image_loaders(&cc.egui_ctx);
|
||||
// Setup visuals.
|
||||
setup_visuals(&cc.egui_ctx);
|
||||
// Setup fonts.
|
||||
setup_fonts(&cc.egui_ctx);
|
||||
// Return app instance.
|
||||
Box::new(app)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user