Compare commits

..

No commits in common. "5f541f4009ce29aea9752f97d448f7e6b48da2ea" and "52594361bd8a38baa2b8ddcae2d593b001d66a0b" have entirely different histories.

3 changed files with 11 additions and 36 deletions

View file

@ -26,4 +26,3 @@ clap = { version = "4.5.15", features = ["derive"] }
image = "0.25.2" image = "0.25.2"
rand = "0.8.5" rand = "0.8.5"
rfd = "0.14.1" rfd = "0.14.1"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

View file

@ -23,9 +23,8 @@ pub struct RollatorApp {
#[command(flatten)] #[command(flatten)]
pub(crate) verbosity: VerbosityLevel, pub(crate) verbosity: VerbosityLevel,
/// open the informations window on start
#[serde(skip)] #[serde(skip)]
#[arg(short = 'i', long = "info")] #[clap(skip)]
show_info_window: bool, show_info_window: bool,
} }
@ -65,9 +64,9 @@ impl RollatorApp {
pub fn info_diag(&mut self, ctx: &egui::Context) { pub fn info_diag(&mut self, ctx: &egui::Context) {
trace!("rendering info dialogue"); trace!("rendering info dialogue");
ctx.show_viewport_immediate( ctx.show_viewport_immediate(
egui::ViewportId::from_hash_of(format!("{TITLE}: Information")), egui::ViewportId::from_hash_of("immediate_viewport"),
egui::ViewportBuilder::default() egui::ViewportBuilder::default()
.with_title(format!("{TITLE}: Information")) .with_title("Immediate Viewport")
.with_inner_size([500.0, 200.0]), .with_inner_size([500.0, 200.0]),
|ctx, class| { |ctx, class| {
assert!( assert!(
@ -76,6 +75,7 @@ impl RollatorApp {
); );
egui::CentralPanel::default().show(ctx, |ui| { egui::CentralPanel::default().show(ctx, |ui| {
ui.spacing_mut().item_spacing.x = 0.0;
ui.label(format!("{TITLE} v{}", env!("CARGO_PKG_VERSION"))); ui.label(format!("{TITLE} v{}", env!("CARGO_PKG_VERSION")));
ui.hyperlink_to("Source Code\n", env!("CARGO_PKG_REPOSITORY")); ui.hyperlink_to("Source Code\n", env!("CARGO_PKG_REPOSITORY"));
ui.label(format!("Author: {}", env!("CARGO_PKG_AUTHORS"))); ui.label(format!("Author: {}", env!("CARGO_PKG_AUTHORS")));
@ -86,17 +86,7 @@ impl RollatorApp {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
ui.horizontal(|ui| { bottom_label(ui);
ui.spacing_mut().item_spacing.x = 0.0;
ui.label("Powered by ");
ui.hyperlink_to("egui", "https://github.com/emilk/egui");
ui.label(" and ");
ui.hyperlink_to(
"eframe",
"https://github.com/emilk/egui/tree/master/crates/eframe",
);
ui.label(".");
});
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
}); });
@ -173,7 +163,7 @@ impl eframe::App for RollatorApp {
fn bottom_label(ui: &mut egui::Ui) { fn bottom_label(ui: &mut egui::Ui) {
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 0.0; ui.spacing_mut().item_spacing.x = 0.0;
ui.label(format!("{TITLE} v{}", env!("CARGO_PKG_VERSION"))); ui.hyperlink_to("Source Code ", env!("CARGO_PKG_REPOSITORY"));
ui.label("| Powered by "); ui.label("| Powered by ");
ui.hyperlink_to("egui", "https://github.com/emilk/egui"); ui.hyperlink_to("egui", "https://github.com/emilk/egui");
ui.label(" and "); ui.label(" and ");

View file

@ -6,26 +6,12 @@ mod app;
// When compiling natively: // When compiling natively:
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
fn main() -> eframe::Result { fn main() -> eframe::Result {
use libpt::log::debug;
use tracing_subscriber::util::SubscriberInitExt;
let mut app = app::RollatorApp::new_with_cli(); let mut app = app::RollatorApp::new_with_cli();
let filter = tracing_subscriber::EnvFilter::builder() let _logger = libpt::log::Logger::builder()
.with_default_directive(tracing_subscriber::filter::LevelFilter::WARN.into()) .set_level(app.verbosity.level())
.from_env() .build()
.expect("could not init logger") .expect("could not init logging");
.add_directive(
format!("rollator={}", app.verbosity.level())
.parse()
.expect("could not init logger"),
);
tracing_subscriber::fmt::Subscriber::builder()
.with_env_filter(filter)
.finish()
.set_default();
debug!("logging initialized!");
let native_options = eframe::NativeOptions { let native_options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default() viewport: egui::ViewportBuilder::default()