diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 9190f84..6fd7208 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -18,7 +18,7 @@ jobs: build-github-pages: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 # repo checkout + - uses: actions/checkout@v4 # repo checkout - uses: actions-rs/toolchain@v1 # get rust toolchain for wasm with: profile: minimal diff --git a/.gitignore b/.gitignore index 4f96631..b08a0dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /target /dist + +.idea \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 320bb99..a21bb57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -823,9 +823,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "ecolor" -version = "0.27.0" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c416b34b29e8f6b2492b5c80319cf9792d339550f0d75a54b53ed070045bbdeb" +checksum = "20930a432bbd57a6d55e07976089708d4893f3d556cf42a0d79e9e321fa73b10" dependencies = [ "bytemuck", "serde", @@ -833,9 +833,9 @@ dependencies = [ [[package]] name = "eframe" -version = "0.27.0" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86811b20df847cfa73637020ee78de780407110f49785df2dea6741146ea5aac" +checksum = "020e2ccef6bbcec71dbc542f7eed64a5846fc3076727f5746da8fd307c91bab2" dependencies = [ "bytemuck", "cocoa", @@ -867,23 +867,11 @@ dependencies = [ "winit", ] -[[package]] -name = "eframe_template" -version = "0.1.0" -dependencies = [ - "eframe", - "egui", - "env_logger", - "log", - "serde", - "wasm-bindgen-futures", -] - [[package]] name = "egui" -version = "0.27.0" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8e20541e5d3da08cf817eb5c8a2bc4024f21aad7acf98de201442d6d76e0ecc" +checksum = "584c5d1bf9a67b25778a3323af222dbe1a1feb532190e103901187f92c7fe29a" dependencies = [ "accesskit", "ahash", @@ -896,9 +884,9 @@ dependencies = [ [[package]] name = "egui-winit" -version = "0.27.0" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4fc01bc3617dba9280475e9ab2382015e298f401d2318c2a1d78c419b6dffe" +checksum = "2e3da0cbe020f341450c599b35b92de4af7b00abde85624fd16f09c885573609" dependencies = [ "accesskit_winit", "arboard", @@ -914,9 +902,9 @@ dependencies = [ [[package]] name = "egui_glow" -version = "0.27.0" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743380a1c0f1dbb7bfe29663ce62b10785adda51105c9bb4e544e2f9955b4958" +checksum = "e0e5d975f3c86edc3d35b1db88bb27c15dde7c55d3b5af164968ab5ede3f44ca" dependencies = [ "bytemuck", "egui", @@ -929,9 +917,9 @@ dependencies = [ [[package]] name = "emath" -version = "0.27.0" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87799f56edee11422267e1764dd0bf3fe1734888e8d2d0924a67b85f4998fbe" +checksum = "e4c3a552cfca14630702449d35f41c84a0d15963273771c6059175a803620f3f" dependencies = [ "bytemuck", "serde", @@ -984,9 +972,9 @@ dependencies = [ [[package]] name = "epaint" -version = "0.27.0" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "392eccd6d6b13fadccc268f4f61d9363775ec5711ffdece2a79006d676920bcf" +checksum = "b381f8b149657a4acf837095351839f32cd5c4aec1817fc4df84e18d76334176" dependencies = [ "ab_glyph", "ahash", @@ -1336,6 +1324,12 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.3.3" @@ -2124,6 +2118,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "same-file" version = "1.0.6" @@ -2133,6 +2133,20 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scheme_submission" +version = "0.1.0" +dependencies = [ + "eframe", + "egui", + "env_logger", + "log", + "serde", + "strum", + "strum_macros", + "wasm-bindgen-futures", +] + [[package]] name = "scoped-tls" version = "1.0.1" @@ -2293,6 +2307,25 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" +[[package]] +name = "strum" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" + +[[package]] +name = "strum_macros" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.48", +] + [[package]] name = "syn" version = "1.0.109" diff --git a/Cargo.toml b/Cargo.toml index d03ac38..178afc6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "eframe_template" +name = "scheme_submission" version = "0.1.0" -authors = ["Emil Ernerfeldt "] +authors = ["Reto Trappitsch "] edition = "2021" rust-version = "1.72" [dependencies] -egui = "0.27.0" -eframe = { version = "0.27.0", default-features = false, features = [ +egui = "0.27.2" +eframe = { version = "0.27.2", default-features = false, features = [ "accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies. "default_fonts", # Embed the default egui fonts. "glow", # Use the glow rendering backend. Alternative: "wgpu". @@ -18,6 +18,8 @@ log = "0.4" # You only need serde if you want app persistence: serde = { version = "1", features = ["derive"] } +strum = "0.26.2" +strum_macros = "0.26.2" # native: [target.'cfg(not(target_arch = "wasm32"))'.dependencies] diff --git a/assets/icon-1024.png b/assets/icon-1024.png deleted file mode 100644 index 1b5868a..0000000 Binary files a/assets/icon-1024.png and /dev/null differ diff --git a/assets/icon-256.png b/assets/icon-256.png deleted file mode 100644 index ae72287..0000000 Binary files a/assets/icon-256.png and /dev/null differ diff --git a/assets/icon_ios_touch_192.png b/assets/icon_ios_touch_192.png deleted file mode 100644 index 8472802..0000000 Binary files a/assets/icon_ios_touch_192.png and /dev/null differ diff --git a/assets/manifest.json b/assets/manifest.json index 2a137fb..579231c 100644 --- a/assets/manifest.json +++ b/assets/manifest.json @@ -1,24 +1,6 @@ { - "name": "egui Template PWA", - "short_name": "egui-template-pwa", - "icons": [ - { - "src": "./icon-256.png", - "sizes": "256x256", - "type": "image/png" - }, - { - "src": "./maskable_icon_x512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "any maskable" - }, - { - "src": "./icon-1024.png", - "sizes": "1024x1024", - "type": "image/png" - } - ], + "name": "Resonance Ionization Scheme Submission", + "short_name": "scheme_submission", "lang": "en-US", "id": "/index.html", "start_url": "./index.html", diff --git a/assets/maskable_icon_x512.png b/assets/maskable_icon_x512.png deleted file mode 100644 index db8df3e..0000000 Binary files a/assets/maskable_icon_x512.png and /dev/null differ diff --git a/assets/sw.js b/assets/sw.js index 7ecd229..04f88d0 100644 --- a/assets/sw.js +++ b/assets/sw.js @@ -1,9 +1,9 @@ -var cacheName = 'egui-template-pwa'; +var cacheName = 'scheme_submission'; var filesToCache = [ './', './index.html', - './eframe_template.js', - './eframe_template_bg.wasm', + './scheme_submission.js', + './scheme_submission_bg.wasm', ]; /* Start the service worker and cache all of the app's content */ diff --git a/index.html b/index.html index 872b4f4..a4a598e 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ - eframe template + Resonance Ionization Scheme Submission diff --git a/src/app.rs b/src/app.rs index 18dd259..c78cfce 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,20 +1,41 @@ +use egui::RichText; +use strum::IntoEnumIterator; + +use crate::{Elements, GroundState, Lasers, Transition, TransitionUnit}; + + /// We derive Deserialize/Serialize so we can persist app state on shutdown. #[derive(serde::Deserialize, serde::Serialize)] #[serde(default)] // if we add new fields, give them default values when deserializing old state pub struct TemplateApp { - // Example stuff: - label: String, - - #[serde(skip)] // This how you opt-out of serialization of a field - value: f32, + scheme_element: Elements, + scheme_gs: GroundState, + scheme_ip_term_symbol: String, + scheme_lasers: Lasers, + scheme_transitions: [Transition; 7], + scheme_unit: TransitionUnit, } impl Default for TemplateApp { fn default() -> Self { Self { - // Example stuff: - label: "Hello World!".to_owned(), - value: 2.7, + scheme_element: Elements::H, + scheme_gs: GroundState { + level: "0".to_owned(), + term_symbol: String::new(), + }, + scheme_ip_term_symbol: String::new(), + scheme_lasers: Lasers::TiSa, + scheme_transitions: [ + Transition::new_empty(), + Transition::new_empty(), + Transition::new_empty(), + Transition::new_empty(), + Transition::new_empty(), + Transition::new_empty(), + Transition::new_empty(), + ], + scheme_unit: TransitionUnit::CM1, } } } @@ -36,58 +57,153 @@ impl TemplateApp { } impl eframe::App for TemplateApp { - /// Called by the frame work to save state before shutdown. + /// Called by the framework to save state before shutdown. fn save(&mut self, storage: &mut dyn eframe::Storage) { eframe::set_value(storage, eframe::APP_KEY, self); } /// Called each time the UI needs repainting, which may be many times per second. fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { - // Put your widgets into a `SidePanel`, `TopBottomPanel`, `CentralPanel`, `Window` or `Area`. - // For inspiration and more examples, go to https://emilk.github.io/egui - egui::TopBottomPanel::top("top_panel").show(ctx, |ui| { - // The top panel is often a good place for a menu bar: - egui::menu::bar(ui, |ui| { - // NOTE: no File->Quit on web pages! - let is_web = cfg!(target_arch = "wasm32"); - if !is_web { - ui.menu_button("File", |ui| { - if ui.button("Quit").clicked() { - ctx.send_viewport_cmd(egui::ViewportCommand::Close); - } - }); - ui.add_space(16.0); - } - egui::widgets::global_dark_light_mode_buttons(ui); }); }); egui::CentralPanel::default().show(ctx, |ui| { // The central panel the region left after adding TopPanel's and SidePanel's - ui.heading("eframe template"); + ui.heading( + RichText::new("Resonance Ionization Scheme Submission") + .strong(), + ); + ui.add_space(VERTICAL_SPACE); + + ui.label(RichText::new(INTRO_MESSAGE).strong()); + ui.add_space(VERTICAL_SPACE); + + ui.collapsing("Usage", |ui| { ui.label(USAGE_MESSAGE_GENERAL); }); + ui.add_space(VERTICAL_SPACE); + + ui.separator(); + ui.add_space(VERTICAL_SPACE); + + ui.heading(RichText::new("Scheme").strong()); + ui.add_space(VERTICAL_SPACE); + ui.collapsing("Usage Scheme", |ui| { ui.label(USAGE_MESSAGE_SCHEME); }); + ui.add_space(VERTICAL_SPACE); + + // Element ui.horizontal(|ui| { - ui.label("Write something: "); - ui.text_edit_singleline(&mut self.label); + ui.label("Element:"); + egui::ComboBox::from_id_source("Element") + .selected_text(format!("{:?}", self.scheme_element)) + .show_ui(ui, |ui| { + for element in Elements::iter() { + let tmp_label = format!("{:?}", &element).to_owned(); + ui.selectable_value(&mut self.scheme_element, element, tmp_label); + } + }); }); + ui.add_space(VERTICAL_SPACE); - ui.add(egui::Slider::new(&mut self.value, 0.0..=10.0).text("value")); - if ui.button("Increment").clicked() { - self.value += 1.0; - } + // Units + ui.horizontal(|ui| { + ui.label("Unit:"); + ui.radio_value(&mut self.scheme_unit, TransitionUnit::CM1, TransitionUnit::CM1.to_string()); + ui.radio_value(&mut self.scheme_unit, TransitionUnit::NM, TransitionUnit::NM.to_string()); + }); + ui.add_space(VERTICAL_SPACE); + + // Grid with the scheme + egui::Grid::new("scheme_grid") + .min_col_width(COL_MIN_WIDTH) + .striped(true) + .show(ui, |ui| { + ui.label(""); + ui.label("Level"); + ui.label("Term Symbol"); + ui.label("Transition strength (1/s)"); + ui.label("Manifold"); + ui.label("Properties"); + ui.end_row(); + + ui.label("Ground state (1/cm):"); + ui.add(egui::TextEdit::singleline(&mut self.scheme_gs.level) + .desired_width(TEXT_INPUT_WIDTH) + .horizontal_align(egui::Align::RIGHT) + ); + ui.add(egui::TextEdit::singleline(&mut self.scheme_gs.term_symbol) + .desired_width(TEXT_INPUT_WIDTH) + .horizontal_align(egui::Align::RIGHT) + ); + ui.end_row(); + + for (it, trans) in self.scheme_transitions.iter_mut().enumerate() { + let unit: String; + if trans.low_lying { + unit = "1/cm".to_owned(); + } else { + unit = self.scheme_unit.to_string(); + } + ui.label(format!("Step {} ({}):", it + 1, unit)); + ui.add(egui::TextEdit::singleline(&mut trans.level) + .desired_width(TEXT_INPUT_WIDTH) + .horizontal_align(egui::Align::RIGHT) + ); + ui.add(egui::TextEdit::singleline(&mut trans.term_symbol) + .desired_width(TEXT_INPUT_WIDTH) + .horizontal_align(egui::Align::RIGHT) + ); + ui.add(egui::TextEdit::singleline(&mut trans.transition_strength) + .desired_width(TEXT_INPUT_WIDTH) + .horizontal_align(egui::Align::RIGHT) + ); + ui.checkbox(&mut trans.low_lying, "Low-lying"); + ui.checkbox(&mut trans.forbidden, "Forbidden"); + ui.end_row(); + }; + + ui.label("IP (1/cm):"); + ui.label(format!("{0:.3}", self.scheme_element.ip())); + ui.add(egui::TextEdit::singleline(&mut self.scheme_ip_term_symbol) + .desired_width(TEXT_INPUT_WIDTH) + .horizontal_align(egui::Align::RIGHT) + ); + ui.end_row(); + }); + ui.add_space(VERTICAL_SPACE); + + // Lasers + ui.horizontal(|ui| { + ui.label("Lasers:"); + egui::ComboBox::from_id_source("Lasers") + .selected_text(self.scheme_lasers.to_string()) + .show_ui(ui, |ui| { + ui.selectable_value(&mut self.scheme_lasers, Lasers::TiSa, Lasers::TiSa.to_string()); + ui.selectable_value(&mut self.scheme_lasers, Lasers::Dye, Lasers::Dye.to_string()); + ui.selectable_value(&mut self.scheme_lasers, Lasers::Both, Lasers::Both.to_string()); + }); + }); + ui.add_space(VERTICAL_SPACE); ui.separator(); - ui.add(egui::github_link_file!( - "https://github.com/emilk/eframe_template/blob/master/", - "Source code." - )); + ui.horizontal(|ui| { + if ui.button("Submit via GitHub").clicked() { + println!("Submit scheme via GitHub."); + } + if ui.button("Submit via E-Mail").clicked() { + println!("Submit scheme via e-mail."); + } + if ui.add(egui::Button::new("Clear all")).clicked() { + *self = Default::default(); + } + }); ui.with_layout(egui::Layout::bottom_up(egui::Align::LEFT), |ui| { powered_by_egui_and_eframe(ui); + ui.hyperlink_to("Source code", "https://github.com/RIMS-Code/rimsdb_scheme_submission"); egui::warn_if_debug_build(ui); }); }); @@ -107,3 +223,28 @@ fn powered_by_egui_and_eframe(ui: &mut egui::Ui) { ui.label("."); }); } + +// Constants to configure the App: +const INTRO_MESSAGE: &str = "You can use this form to submit a new resonance ionization scheme \ +to the database."; + +const USAGE_MESSAGE_GENERAL: &str = "If you have a config file that from the RIMSSchemeDrawer \ +software, you can upload it first. Then fill out any additional information you want to submit in \ +the form below.\n\n\ +Alternatively, you can skip the file upload and fill out the form from scratch. \n\n \ +Detailed information for each segment are given in the individual sections below."; + +const USAGE_MESSAGE_SCHEME: &str = "The scheme is the main part of the submission. \ +It should contain at a minimum the element, the ground state, as well as one or more transitions.\n \ +First select the units that you would like to use (nm or cm-1). Then fill out the \ +levels, optional term symbols, transmission strengths (in s-1), \ +and whether the level is a low-lying level or if the transition is forbidden. \ +Finally, select the lasers that were used for this scheme. \ +Further information can always be provided in the notes."; + +// const USAGE_MESSAGE_SATURATION: &str = "The saturation part of the submission is optional. \ +// Please select the units that you would like to use. Then fill out the ..."; + +const COL_MIN_WIDTH: f32 = 120.0; +const TEXT_INPUT_WIDTH: f32 = f32::INFINITY; +const VERTICAL_SPACE: f32 = 12.0; \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index fbae77a..a95bf5b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,294 @@ #![warn(clippy::all, rust_2018_idioms)] +use strum_macros::EnumIter; + mod app; + pub use app::TemplateApp; + +#[derive(Debug, PartialEq, serde::Deserialize, serde::Serialize, EnumIter)] +pub enum Elements { + H, + He, + Li, + Be, + B, + C, + N, + O, + F, + Ne, + Na, + Mg, + Al, + Si, + P, + S, + Cl, + Ar, + K, + Ca, + Sc, + Ti, + V, + Cr, + Mn, + Fe, + Co, + Ni, + Cu, + Zn, + Ga, + Ge, + As, + Se, + Br, + Kr, + Rb, + Sr, + Y, + Zr, + Nb, + Mo, + Tc, + Ru, + Rh, + Pd, + Ag, + Cd, + In, + Sn, + Sb, + Te, + I, + Xe, + Cs, + Ba, + La, + Ce, + Pr, + Nd, + Pm, + Sm, + Eu, + Gd, + Tb, + Dy, + Ho, + Er, + Tm, + Yb, + Lu, + Hf, + Ta, + W, + Re, + Os, + Ir, + Pt, + Au, + Hg, + Tl, + Pb, + Bi, + Po, + At, + Rn, + Fr, + Ra, + Ac, + Th, + Pa, + U, + Np, + Pu, + Am, + Cm, + Bk, + Cf, + Es, + Fm, + Md, + No, + Lr, + Rf, + Db, + Sg, + Bh, + Hs, +} + + +impl Elements { + pub fn ip(&self) -> f64 { + match self { + Elements::H => 109678.77174307, + Elements::He => 198310.66637, + Elements::Li => 43487.1142, + Elements::Be => 75192.64, + Elements::B => 66928.04, + Elements::C => 90820.348, + Elements::N => 117225.7, + Elements::O => 109837.02, + Elements::F => 140524.5, + Elements::Ne => 173929.75, + Elements::Na => 41449.451, + Elements::Mg => 61671.05, + Elements::Al => 48278.48, + Elements::Si => 65747.76, + Elements::P => 84580.83, + Elements::S => 83559.1, + Elements::Cl => 104591.01, + Elements::Ar => 127109.842, + Elements::K => 35009.814, + Elements::Ca => 49305.924, + Elements::Sc => 52922.0, + Elements::Ti => 55072.5, + Elements::V => 54411.67, + Elements::Cr => 54575.6, + Elements::Mn => 59959.56, + Elements::Fe => 63737.704, + Elements::Co => 63564.6, + Elements::Ni => 61619.77, + Elements::Cu => 62317.46, + Elements::Zn => 75769.31, + Elements::Ga => 48387.634, + Elements::Ge => 63713.24, + Elements::As => 78950.0, + Elements::Se => 78658.15, + Elements::Br => 95284.8, + Elements::Kr => 112914.433, + Elements::Rb => 33690.81, + Elements::Sr => 45932.2036, + Elements::Y => 50145.6, + Elements::Zr => 53507.832, + Elements::Nb => 54513.8, + Elements::Mo => 57204.3, + Elements::Tc => 57421.68, + Elements::Ru => 59366.4, + Elements::Rh => 60160.1, + Elements::Pd => 67241.14, + Elements::Ag => 61106.45, + Elements::Cd => 72540.05, + Elements::In => 46670.107, + Elements::Sn => 59232.69, + Elements::Sb => 69431.34, + Elements::Te => 72669.006, + Elements::I => 84294.9, + Elements::Xe => 97833.787, + Elements::Cs => 31406.4677325, + Elements::Ba => 42034.91, + Elements::La => 44981.0, + Elements::Ce => 44672.0, + Elements::Pr => 44120.0, + Elements::Nd => 44562.0, + Elements::Pm => 45020.8, + Elements::Sm => 45519.69, + Elements::Eu => 45734.74, + Elements::Gd => 49601.45, + Elements::Tb => 47295.0, + Elements::Dy => 47901.76, + Elements::Ho => 48567.0, + Elements::Er => 49262.0, + Elements::Tm => 49880.57, + Elements::Yb => 50443.2, + Elements::Lu => 43762.6, + Elements::Hf => 55047.9, + Elements::Ta => 60891.4, + Elements::W => 63427.7, + Elements::Re => 63181.6, + Elements::Os => 68058.9, + Elements::Ir => 72323.9, + Elements::Pt => 72257.8, + Elements::Au => 74409.11, + Elements::Hg => 84184.15, + Elements::Tl => 49266.66, + Elements::Pb => 59819.558, + Elements::Bi => 58761.65, + Elements::Po => 67896.31, + Elements::At => 75150.8, + Elements::Rn => 86692.5, + Elements::Fr => 32848.872, + Elements::Ra => 42573.36, + Elements::Ac => 43394.52, + Elements::Th => 50867.0, + Elements::Pa => 47500.0, + Elements::U => 49958.4, + Elements::Np => 50535.0, + Elements::Pu => 48601.0, + Elements::Am => 48182.0, + Elements::Cm => 48330.68, + Elements::Bk => 49989.0, + Elements::Cf => 50666.76, + Elements::Es => 51364.58, + Elements::Fm => 52400.0, + Elements::Md => 53100.0, + Elements::No => 53444.0, + Elements::Lr => 40005.0, + Elements::Rf => 48580.0, + Elements::Db => 55000.0, + Elements::Sg => 63000.0, + Elements::Bh => 62000.0, + Elements::Hs => 61000.0, + } + } +} + +#[derive(serde::Deserialize, serde::Serialize)] +pub struct GroundState { + pub level: String, + pub term_symbol: String, +} + +#[derive(Debug, PartialEq, serde::Deserialize, serde::Serialize)] +pub enum Lasers { + TiSa, + Dye, + Both +} + +impl Lasers { + pub fn to_string(&self) -> String { + match self { + Lasers::TiSa => "Ti:Sa".to_string(), + Lasers::Dye => "Dye".to_string(), + Lasers::Both => "Ti:Sa and Dye".to_string(), + } + } +} + +#[derive(PartialEq, serde::Deserialize, serde::Serialize)] +pub enum TransitionUnit { + NM, + CM1, +} + +impl TransitionUnit { + pub fn to_string(&self) -> String { + match self { + TransitionUnit::NM => "nm".to_string(), + TransitionUnit::CM1 => "1/cm".to_string(), + } + } +} + +#[derive(Debug, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct Transition { + pub level: String, + pub term_symbol: String, + pub transition_strength: String, + pub low_lying: bool, + pub forbidden: bool, +} + +impl Transition { + fn new_empty() -> Self { + Self { + level: String::new(), + term_symbol: String::new(), + transition_strength: String::new(), + low_lying: false, + forbidden: false, + } + } +} diff --git a/src/main.rs b/src/main.rs index 64989fd..93d63b9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,18 +9,13 @@ fn main() -> eframe::Result<()> { let native_options = eframe::NativeOptions { viewport: egui::ViewportBuilder::default() .with_inner_size([400.0, 300.0]) - .with_min_inner_size([300.0, 220.0]) - .with_icon( - // NOTE: Adding an icon is optional - eframe::icon_data::from_png_bytes(&include_bytes!("../assets/icon-256.png")[..]) - .unwrap(), - ), + .with_min_inner_size([300.0, 220.0]), ..Default::default() }; eframe::run_native( - "eframe template", + "Resonance Ionization Scheme Submission", native_options, - Box::new(|cc| Box::new(eframe_template::TemplateApp::new(cc))), + Box::new(|cc| Box::new(scheme_submission::TemplateApp::new(cc))), ) } @@ -37,7 +32,7 @@ fn main() { .start( "the_canvas_id", // hardcode it web_options, - Box::new(|cc| Box::new(eframe_template::TemplateApp::new(cc))), + Box::new(|cc| Box::new(scheme_submission::TemplateApp::new(cc))), ) .await .expect("failed to start eframe");