diff --git a/advotracker/src/main.rs b/advotracker/src/main.rs index b10d1a7..8d2260b 100644 --- a/advotracker/src/main.rs +++ b/advotracker/src/main.rs @@ -18,11 +18,7 @@ use serde::Deserialize; //use std::process; use tracing::{trace, Level}; -use orbtk::{ - prelude::*, - //theme::{COLORS_RON, DARK_THEME_RON, FONTS_RON}, - //theming::config::ThemeConfig, -}; +use orbtk::prelude::*; // The Main view use advotracker::{ @@ -41,24 +37,6 @@ struct Environment { rust_log: String, } -// lazy_static! { -// static ref LANG: String + 'static = { -// let mut lang = env::var("LANG").unwrap_or("en".to_string()) -// }; -// static ref TEST_LANG: String + 'static = { -// let mut test_lang = { -// // testing environment: read from .env file -// dotenv().ok(); -// match envy::from_env::() { -// Ok(environment) => { -// if environment.test_lang != lang { lang = environment.test_lang; } -// }, -// Err(e) => { debug!(target: "advotracker", "{}", e); } -// } -// } -// }; -// } - fn main() -> Result<(), Box> { use parse_args::parse_args; use tracing_subscriber::fmt; @@ -72,13 +50,6 @@ fn main() -> Result<(), Box> { "unknown/unsupported" }; - //use advotracker::callbacks::policy_check::is_valid; - //use advotracker::data::structures::{PolicyCode, PolicyDataList, PolicyList}; - // WIP: can't push pointer by value to widget, call import in widget callback for now - //use advotracker::services::imports::allianzdirectcall::*; - - //static DEFAULT_FILTER: &str = concat!(module_path!(), "=", "trace"); - // respect dotenv environment (e.g for testing) // -> overwrites the preset default values let rust_log = dotenv::var("RUST_LOG").unwrap_or_else(|_| String::from("None")); @@ -86,7 +57,6 @@ fn main() -> Result<(), Box> { // initialize the tracing subsystem // a drop in replacement for classical logging // reference: https://tokio.rs/blog/2019-08-tracing/ - let span = tracing::span!(Level::TRACE, "advotracker"); let _enter = span.enter(); let subscriber = fmt::Subscriber::builder() @@ -113,15 +83,6 @@ fn main() -> Result<(), Box> { // initialize viperus structure let mut viperus = Viperus::new(); - // lazy_static! { - // static ref HASHMAP: HashMap = { - // let mut policy_numbers = HashMap::new(); - // policy_numbers - // } - // static ref COUNT: usize = HASHMAP.len(); - // println!("The map has {} entries.", *COUNT); - // } - // parse commandline arguments res = t!("parse.arguments", lang); state = t!("state.started", lang); @@ -130,52 +91,12 @@ fn main() -> Result<(), Box> { let _ = parse_args(&mut viperus); state = t!("state.finished", lang); trace!(target: "advotracker", process = ?res, state = ?state); - //trace!(target: "Viperus", "Count of Config parameters: {:?}", VIPERUS_COUNT); // main tasks res = t!("main.started", lang); state = t!("state.started", lang); trace!(target: "advotracker", process = ?res, state = ?state); - // WIP: can't push pointer by value to widget, call import in widget callback for now - // // importing policy code elements from csv-file - // let policy_list = PolicyList::new("Allianz Versicherungsnummen-List"); - // println!("Policy List {:?} ", policy_list.name); - - // let mut policy_data = PolicyDataList::new("Allianz-Import 20200628"); - // println!("Policy Data List {:?} ", policy_data.name); - - // let mut policy_numbers : HashMap = HashMap::new(); - - // let mut csv_import_path = viperus.get::("import_file").unwrap(); - // match import(&mut csv_import_path, &mut policy_data, - // &mut policy_numbers, lang) { - // Ok(count) => { - // println!("Imported {:?} records", count); - // } - // Err(err) => { - // println!("error running Advotracker: {}", err); - // process::exit(1); - // } - //} - - // // test if policy_number is_valid - // let test_policy_number = VIPERUS.get::("test_policy_number").unwrap() as usize; - // trace!(target: "advotracker", test_policy_number = ?test_policy_number); - // match policy_numbers.get(&test_policy_number) { - // Some(&policy_code) => { - // let res = t!("policy.validation.success", lang); - // println!("{:?}", res); - // println!("policy_number: {} ({:?})", - // test_policy_number, policy_code); - // } - // _ => { - // let res = t!("policy.validation.failed", lang); - // println!("{:?}", res); - // //println!("Nuup! Number isn't valid!"); - // }, - //} - Application::from_name("nwx.advotracker") .theme(PolicyCheckState::theme()) .window(|ctx| { @@ -197,7 +118,6 @@ fn main() -> Result<(), Box> { }); Ok(()) - } #[cfg(test)]