v0.6.3
This commit is contained in:
parent
89c1c8f396
commit
54012ab960
9 changed files with 1337 additions and 336 deletions
323
patient-monitor-simulation-v0.6.1-to-v0.6.2.patch
Normal file
323
patient-monitor-simulation-v0.6.1-to-v0.6.2.patch
Normal file
|
|
@ -0,0 +1,323 @@
|
||||||
|
--- a/Cargo.toml
|
||||||
|
+++ b/Cargo.toml
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
[package]
|
||||||
|
name = "patient-monitor-simulation"
|
||||||
|
-version = "0.6.1"
|
||||||
|
+version = "0.6.2"
|
||||||
|
edition = "2021"
|
||||||
|
license = "MIT"
|
||||||
|
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
|
||||||
|
--- a/README.de.md
|
||||||
|
+++ b/README.de.md
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-# Patient Monitor Simulation (PaMSim) — v0.6.1
|
||||||
|
+# Patient Monitor Simulation (PaMSim) — v0.6.2
|
||||||
|
|
||||||
|
Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenstern für die Lehre unter Fedora Linux.
|
||||||
|
|
||||||
|
@@ -72,6 +72,17 @@
|
||||||
|
eine bereits laufende Messung nicht abgebrochen. **Measure now** funktioniert
|
||||||
|
auch bei ausgeschalteter Automatik. Dann bleibt die Intervallanzeige leer
|
||||||
|
und der Monitor zeigt `AUTO OFF`.
|
||||||
|
+
|
||||||
|
+### Anordnung der ART-Alarmgrenzen (v0.6.2)
|
||||||
|
+
|
||||||
|
+Das Touchmenü für die invasive arterielle Druckmessung ordnet **SYS, MAP und
|
||||||
|
+DIA** in drei Spalten an. Die obere Bedienzeile enthält die **oberen (↑)**
|
||||||
|
+Alarmgrenzen, die zweite die **unteren (↓)** Alarmgrenzen. **PPV** folgt unter
|
||||||
|
+SYS mit eigenen oberen und unteren Grenzwerten. Die bisherigen großen
|
||||||
|
+**+ / Wert / − / EIN-AUS**-Schaltflächen und ihre Bedienlogik bleiben erhalten.
|
||||||
|
+Die Gestaltung verwendet weiterhin Schwarz, Hellgrau und schmale Rahmenlinien.
|
||||||
|
+Alle anderen Parametermenüs bleiben unverändert. Alarmverarbeitung und
|
||||||
|
+Voreinstellungen sind von dieser Layoutänderung nicht betroffen.
|
||||||
|
|
||||||
|
## Thoraxkompressionen (v0.5.4)
|
||||||
|
|
||||||
|
--- a/README.md
|
||||||
|
+++ b/README.md
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-# Patient Monitor Simulation (PaMSim) — v0.6.1
|
||||||
|
+# Patient Monitor Simulation (PaMSim) — v0.6.2
|
||||||
|
|
||||||
|
A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.
|
||||||
|
|
||||||
|
@@ -66,6 +66,17 @@
|
||||||
|
cycle already in progress. Manual measurement remains possible while Auto
|
||||||
|
is off. The interval bar is empty and the monitor displays `AUTO OFF`
|
||||||
|
whenever automatic measurements are disabled.
|
||||||
|
+
|
||||||
|
+### ART alarm-limit arrangement (v0.6.2)
|
||||||
|
+
|
||||||
|
+The ART touchscreen alarm panel groups **SYS, MAP and DIA** in three
|
||||||
|
+side-by-side columns. The first control row adjusts their **upper (↑)** limits;
|
||||||
|
+the second adjusts their **lower (↓)** limits. **PPV** appears below SYS, with
|
||||||
|
+its own upper and lower controls. Each bound retains the existing large
|
||||||
|
+**+ / value / − / ON-OFF** buttons, including previous-value restoration.
|
||||||
|
+The groups share the monitor's neutral black/grey palette and thin borders.
|
||||||
|
+All other module menus retain their previous arrangement. This is a layout
|
||||||
|
+change only; thresholds, presets and alarm evaluation are unchanged.
|
||||||
|
|
||||||
|
## Chest compressions (v0.5.4)
|
||||||
|
|
||||||
|
--- a/src/ui.rs
|
||||||
|
+++ b/src/ui.rs
|
||||||
|
@@ -608,7 +608,16 @@
|
||||||
|
window.ecg-settings button.ecg-apply {
|
||||||
|
color: #000000; background-color: #e5e9eb; font-weight: bold;
|
||||||
|
}
|
||||||
|
- window.ecg-settings button.ecg-close { background-color: #171717; }"
|
||||||
|
+ window.ecg-settings button.ecg-close { background-color: #171717; }
|
||||||
|
+ window.ecg-settings box.art-limit-frame {
|
||||||
|
+ border: 0.8px solid #6b757d; padding: 12px;
|
||||||
|
+ }
|
||||||
|
+ window.ecg-settings label.art-limit-heading {
|
||||||
|
+ font-weight: bold; font-size: 17px;
|
||||||
|
+ }
|
||||||
|
+ window.ecg-settings label.art-limit-arrow {
|
||||||
|
+ font-size: 21px;
|
||||||
|
+ }"
|
||||||
|
);
|
||||||
|
gtk::style_context_add_provider_for_display(
|
||||||
|
&display, &provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
@@ -969,6 +978,127 @@
|
||||||
|
state
|
||||||
|
}
|
||||||
|
|
||||||
|
+/// ART-only keyboard-free limit editor: the existing button appearance and
|
||||||
|
+/// callback semantics are retained, but its widgets are stacked vertically
|
||||||
|
+/// for the SYS/MAP/DIA columns and the PPV controls below them.
|
||||||
|
+#[allow(clippy::too_many_arguments)]
|
||||||
|
+fn art_touch_limit(grid: >k::Grid, column: i32, row: i32,
|
||||||
|
+ initial: Option<i32>, fallback: i32,
|
||||||
|
+ step: i32, maximum: i32) -> Rc<Cell<Option<i32>>> {
|
||||||
|
+ let state = Rc::new(Cell::new(initial));
|
||||||
|
+ let previous = Rc::new(Cell::new(initial.unwrap_or(fallback)));
|
||||||
|
+ let controls = gtk::Box::new(Orientation::Vertical, 7);
|
||||||
|
+ controls.set_halign(gtk::Align::Center);
|
||||||
|
+ controls.set_hexpand(true);
|
||||||
|
+
|
||||||
|
+ let plus = gtk::Button::with_label("+");
|
||||||
|
+ plus.set_size_request(54, 50);
|
||||||
|
+ plus.set_halign(gtk::Align::Center);
|
||||||
|
+ controls.append(&plus);
|
||||||
|
+
|
||||||
|
+ let display = gtk::Label::new(None);
|
||||||
|
+ display.add_css_class("ecg-limit-value");
|
||||||
|
+ display.set_width_chars(5);
|
||||||
|
+ display.set_xalign(0.5);
|
||||||
|
+ controls.append(&display);
|
||||||
|
+
|
||||||
|
+ let minus = gtk::Button::with_label("−");
|
||||||
|
+ minus.set_size_request(54, 50);
|
||||||
|
+ minus.set_halign(gtk::Align::Center);
|
||||||
|
+ controls.append(&minus);
|
||||||
|
+
|
||||||
|
+ let toggle = gtk::Button::new();
|
||||||
|
+ toggle.set_size_request(78, 50);
|
||||||
|
+ toggle.set_halign(gtk::Align::Center);
|
||||||
|
+ show_touch_hr_limit(initial, &display, &toggle);
|
||||||
|
+ controls.append(&toggle);
|
||||||
|
+
|
||||||
|
+ for (button, direction) in [(plus, 1), (minus, -1)] {
|
||||||
|
+ let state = state.clone();
|
||||||
|
+ let previous = previous.clone();
|
||||||
|
+ let display = display.clone();
|
||||||
|
+ let toggle = toggle.clone();
|
||||||
|
+ button.connect_clicked(move |_| {
|
||||||
|
+ let new_value = state.get().map_or(previous.get(), |current| {
|
||||||
|
+ (current + direction * step).clamp(0, maximum)
|
||||||
|
+ });
|
||||||
|
+ state.set(Some(new_value));
|
||||||
|
+ previous.set(new_value);
|
||||||
|
+ show_touch_hr_limit(Some(new_value), &display, &toggle);
|
||||||
|
+ });
|
||||||
|
+ }
|
||||||
|
+ toggle.connect_clicked({
|
||||||
|
+ let state = state.clone();
|
||||||
|
+ let previous = previous.clone();
|
||||||
|
+ let display = display.clone();
|
||||||
|
+ move |button| {
|
||||||
|
+ let new_value = match state.get() {
|
||||||
|
+ Some(value) => { previous.set(value); None }
|
||||||
|
+ None => Some(previous.get()),
|
||||||
|
+ };
|
||||||
|
+ state.set(new_value);
|
||||||
|
+ show_touch_hr_limit(new_value, &display, button);
|
||||||
|
+ }
|
||||||
|
+ });
|
||||||
|
+ grid.attach(&controls, column, row, 1, 1);
|
||||||
|
+ state
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/// Map the four ART parameters to the three-column alarm grid. Row 1 is
|
||||||
|
+/// upper thresholds, row 2 lower; PPV occupies column SYS in rows 4 and 5.
|
||||||
|
+fn art_alarm_position(index: usize) -> (i32, i32, i32, i32, &'static str) {
|
||||||
|
+ match index {
|
||||||
|
+ 0 => (1, 0, 1, 2, "SYS"),
|
||||||
|
+ 1 => (2, 0, 1, 2, "MAP"),
|
||||||
|
+ 2 => (3, 0, 1, 2, "DIA"),
|
||||||
|
+ 3 => (1, 3, 4, 5, "PPV"),
|
||||||
|
+ _ => unreachable!("ART has exactly four alarm parameters"),
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/// The ART alarm menu groups SYS/MAP/DIA into columns with upper limits in
|
||||||
|
+/// the first row and lower limits in the second; PPV occupies the first
|
||||||
|
+/// parameter column beneath them. It reuses the same alarm draft/Apply path.
|
||||||
|
+fn art_alarm_grid(specs: Vec<TouchAlarmSpec>, drafts: &mut Vec<TouchAlarmDraft>) -> gtk::Box {
|
||||||
|
+ let frame = gtk::Box::new(Orientation::Vertical, 16);
|
||||||
|
+ frame.add_css_class("art-limit-frame");
|
||||||
|
+ frame.set_hexpand(true);
|
||||||
|
+
|
||||||
|
+ let heading = gtk::Label::new(Some("Alarm Limits"));
|
||||||
|
+ heading.add_css_class("art-limit-heading");
|
||||||
|
+ heading.set_xalign(0.0);
|
||||||
|
+ frame.append(&heading);
|
||||||
|
+
|
||||||
|
+ let grid = gtk::Grid::new();
|
||||||
|
+ grid.set_hexpand(true);
|
||||||
|
+ grid.set_column_spacing(12);
|
||||||
|
+ grid.set_row_spacing(23);
|
||||||
|
+
|
||||||
|
+ for (row, arrow) in [(1, "↑"), (2, "↓"), (4, "↑"), (5, "↓")] {
|
||||||
|
+ let label = gtk::Label::new(Some(arrow));
|
||||||
|
+ label.add_css_class("art-limit-arrow");
|
||||||
|
+ label.set_width_chars(2);
|
||||||
|
+ grid.attach(&label, 0, row, 1, 1);
|
||||||
|
+ }
|
||||||
|
+ for (i, spec) in specs.into_iter().enumerate() {
|
||||||
|
+ let (column, title_row, upper_row, lower_row, title) = art_alarm_position(i);
|
||||||
|
+ let label = gtk::Label::new(Some(title));
|
||||||
|
+ label.add_css_class("art-limit-heading");
|
||||||
|
+ label.set_hexpand(true);
|
||||||
|
+ grid.attach(&label, column, title_row, 1, 1);
|
||||||
|
+
|
||||||
|
+ let upper = art_touch_limit(&grid, column, upper_row, spec.limits.upper,
|
||||||
|
+ spec.restore_upper, spec.step, spec.maximum);
|
||||||
|
+ let lower = art_touch_limit(&grid, column, lower_row, spec.limits.lower,
|
||||||
|
+ spec.restore_lower, spec.step, spec.maximum);
|
||||||
|
+ drafts.push(TouchAlarmDraft {
|
||||||
|
+ name: spec.name, lower, upper, apply: spec.apply,
|
||||||
|
+ });
|
||||||
|
+ }
|
||||||
|
+ frame.append(&grid);
|
||||||
|
+ frame
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/// A monitor-side menu may change only alarm limits. All patient and
|
||||||
|
/// measurement configuration (including NIBP scheduling) stays Admin-only.
|
||||||
|
fn apply_module_alarm_changes(
|
||||||
|
@@ -1006,8 +1136,8 @@
|
||||||
|
.transient_for(monitor)
|
||||||
|
.modal(true)
|
||||||
|
.resizable(true)
|
||||||
|
- .default_width(560)
|
||||||
|
- .default_height(if channel == render::TouchChannel::Art { 720 } else { 610 })
|
||||||
|
+ .default_width(if channel == render::TouchChannel::Art { 720 } else { 560 })
|
||||||
|
+ .default_height(if channel == render::TouchChannel::Art { 790 } else { 610 })
|
||||||
|
.build();
|
||||||
|
dialog.add_css_class("ecg-settings");
|
||||||
|
dialog.set_decorated(false);
|
||||||
|
@@ -1039,25 +1169,42 @@
|
||||||
|
// Every numeric alarm has two optional bounds, editable without a keyboard.
|
||||||
|
let specs = module_alarm_specs(channel, ¤t);
|
||||||
|
let mut alarm_drafts = Vec::new();
|
||||||
|
- for spec in specs {
|
||||||
|
- let label = gtk::Label::new(Some(&format!("{} alarm limits · {}", spec.name, spec.unit)));
|
||||||
|
- label.set_xalign(0.0);
|
||||||
|
- inner.append(&label);
|
||||||
|
- let lower = module_touch_limit(&inner, "↓ Lower", spec.limits.lower,
|
||||||
|
- spec.restore_lower, spec.step, spec.maximum);
|
||||||
|
- let upper = module_touch_limit(&inner, "↑ Upper", spec.limits.upper,
|
||||||
|
- spec.restore_upper, spec.step, spec.maximum);
|
||||||
|
- alarm_drafts.push(TouchAlarmDraft {
|
||||||
|
- name: spec.name, lower, upper, apply: spec.apply,
|
||||||
|
- });
|
||||||
|
- inner.append(&ecg_menu_divider());
|
||||||
|
+ if channel == render::TouchChannel::Art {
|
||||||
|
+ // The ART panel uses the requested column/row arrangement. Other
|
||||||
|
+ // channels retain their current one-parameter-at-a-time layout.
|
||||||
|
+ inner.append(&art_alarm_grid(specs, &mut alarm_drafts));
|
||||||
|
+ } else {
|
||||||
|
+ for spec in specs {
|
||||||
|
+ let label = gtk::Label::new(Some(&format!("{} alarm limits · {}", spec.name, spec.unit)));
|
||||||
|
+ label.set_xalign(0.0);
|
||||||
|
+ inner.append(&label);
|
||||||
|
+ let lower = module_touch_limit(&inner, "↓ Lower", spec.limits.lower,
|
||||||
|
+ spec.restore_lower, spec.step, spec.maximum);
|
||||||
|
+ let upper = module_touch_limit(&inner, "↑ Upper", spec.limits.upper,
|
||||||
|
+ spec.restore_upper, spec.step, spec.maximum);
|
||||||
|
+ alarm_drafts.push(TouchAlarmDraft {
|
||||||
|
+ name: spec.name, lower, upper, apply: spec.apply,
|
||||||
|
+ });
|
||||||
|
+ inner.append(&ecg_menu_divider());
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
let error = gtk::Label::new(None);
|
||||||
|
error.set_xalign(0.0);
|
||||||
|
error.add_css_class("menu-error");
|
||||||
|
error.set_wrap(true);
|
||||||
|
- inner.append(&error);
|
||||||
|
+ // The ART layout is taller; keep validation and buttons visible while
|
||||||
|
+ // the alarm-limit controls scroll on smaller monitor touchscreens.
|
||||||
|
+ let footer = gtk::Box::new(Orientation::Vertical, 8);
|
||||||
|
+ if channel == render::TouchChannel::Art {
|
||||||
|
+ footer.set_margin_start(20);
|
||||||
|
+ footer.set_margin_end(20);
|
||||||
|
+ footer.set_margin_top(8);
|
||||||
|
+ footer.set_margin_bottom(12);
|
||||||
|
+ footer.append(&error);
|
||||||
|
+ } else {
|
||||||
|
+ inner.append(&error);
|
||||||
|
+ }
|
||||||
|
let buttons = gtk::Box::new(Orientation::Horizontal, 12);
|
||||||
|
buttons.set_halign(gtk::Align::End);
|
||||||
|
let cancel = gtk::Button::with_label("Cancel");
|
||||||
|
@@ -1097,7 +1244,12 @@
|
||||||
|
});
|
||||||
|
buttons.append(&cancel);
|
||||||
|
buttons.append(&apply);
|
||||||
|
- inner.append(&buttons);
|
||||||
|
+ if channel == render::TouchChannel::Art {
|
||||||
|
+ footer.append(&buttons);
|
||||||
|
+ content.append(&footer);
|
||||||
|
+ } else {
|
||||||
|
+ inner.append(&buttons);
|
||||||
|
+ }
|
||||||
|
dialog.set_child(Some(&content));
|
||||||
|
|
||||||
|
let escape = gtk::EventControllerKey::new();
|
||||||
|
@@ -1131,6 +1283,31 @@
|
||||||
|
assert_eq!(specs.len(), expected);
|
||||||
|
assert!(specs.iter().all(|spec| spec.maximum > 0 && spec.step > 0));
|
||||||
|
}
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ #[test]
|
||||||
|
+ fn art_menu_columns_follow_sys_map_dia_and_ppv_order() {
|
||||||
|
+ assert_eq!(art_alarm_position(0), (1, 0, 1, 2, "SYS"));
|
||||||
|
+ assert_eq!(art_alarm_position(1), (2, 0, 1, 2, "MAP"));
|
||||||
|
+ assert_eq!(art_alarm_position(2), (3, 0, 1, 2, "DIA"));
|
||||||
|
+ assert_eq!(art_alarm_position(3), (1, 3, 4, 5, "PPV"));
|
||||||
|
+ let specs = module_alarm_specs(render::TouchChannel::Art, &Parameters::default());
|
||||||
|
+ assert_eq!(specs.iter().map(|spec| spec.name).collect::<Vec<_>>(),
|
||||||
|
+ ["ART systolic", "ART MAP", "ART diastolic", "PPV"]);
|
||||||
|
+ let mut alarms = AlarmSettings::default();
|
||||||
|
+ let limits = [
|
||||||
|
+ AlarmLimits { lower: Some(80), upper: Some(180) },
|
||||||
|
+ AlarmLimits { lower: Some(60), upper: Some(100) },
|
||||||
|
+ AlarmLimits { lower: None, upper: None },
|
||||||
|
+ AlarmLimits { lower: None, upper: Some(10) },
|
||||||
|
+ ];
|
||||||
|
+ for (spec, value) in specs.into_iter().zip(limits.iter().copied()) {
|
||||||
|
+ (spec.apply)(&mut alarms, value);
|
||||||
|
+ }
|
||||||
|
+ assert_eq!(alarms.art_sys, limits[0]);
|
||||||
|
+ assert_eq!(alarms.art_map, limits[1]);
|
||||||
|
+ assert_eq!(alarms.art_dia, limits[2]);
|
||||||
|
+ assert_eq!(alarms.ppv, limits[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
752
patient-monitor-simulation-v0.6.2-to-v0.6.3.patch
Normal file
752
patient-monitor-simulation-v0.6.2-to-v0.6.3.patch
Normal file
|
|
@ -0,0 +1,752 @@
|
||||||
|
--- a/Cargo.toml
|
||||||
|
+++ b/Cargo.toml
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
[package]
|
||||||
|
name = "patient-monitor-simulation"
|
||||||
|
-version = "0.6.2"
|
||||||
|
+version = "0.6.3"
|
||||||
|
edition = "2021"
|
||||||
|
license = "MIT"
|
||||||
|
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
|
||||||
|
--- a/README.de.md
|
||||||
|
+++ b/README.de.md
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-# Patient Monitor Simulation (PaMSim) — v0.6.2
|
||||||
|
+# Patient Monitor Simulation (PaMSim) — v0.6.3
|
||||||
|
|
||||||
|
Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenstern für die Lehre unter Fedora Linux.
|
||||||
|
|
||||||
|
@@ -73,16 +73,18 @@
|
||||||
|
auch bei ausgeschalteter Automatik. Dann bleibt die Intervallanzeige leer
|
||||||
|
und der Monitor zeigt `AUTO OFF`.
|
||||||
|
|
||||||
|
-### Anordnung der ART-Alarmgrenzen (v0.6.2)
|
||||||
|
-
|
||||||
|
-Das Touchmenü für die invasive arterielle Druckmessung ordnet **SYS, MAP und
|
||||||
|
-DIA** in drei Spalten an. Die obere Bedienzeile enthält die **oberen (↑)**
|
||||||
|
-Alarmgrenzen, die zweite die **unteren (↓)** Alarmgrenzen. **PPV** folgt unter
|
||||||
|
-SYS mit eigenen oberen und unteren Grenzwerten. Die bisherigen großen
|
||||||
|
-**+ / Wert / − / EIN-AUS**-Schaltflächen und ihre Bedienlogik bleiben erhalten.
|
||||||
|
-Die Gestaltung verwendet weiterhin Schwarz, Hellgrau und schmale Rahmenlinien.
|
||||||
|
-Alle anderen Parametermenüs bleiben unverändert. Alarmverarbeitung und
|
||||||
|
-Voreinstellungen sind von dieser Layoutänderung nicht betroffen.
|
||||||
|
+### Horizontale Matrix für Alarmgrenzen (v0.6.3)
|
||||||
|
+
|
||||||
|
+Alle fünf Touchmenüs des Monitors verwenden dieselbe kompakte Matrix.
|
||||||
|
+Jeder Parameter belegt eine Zeile (bei ART: **SYS**, **MAP**, **DIA**,
|
||||||
|
+**PPV**); die **untere (↓)** und **obere (↑)** Alarmgrenze stehen
|
||||||
|
+nebeneinander. Die Schaltflächen jedes Grenzwerts sind von links nach
|
||||||
|
+rechts **+ · Wert · − · OFF/ON** angeordnet. Die Schaltfläche zum
|
||||||
|
+Deaktivieren liegt unmittelbar rechts von Minus. Größe, Gestaltung,
|
||||||
|
+Schrittweite, Wiederherstellung des letzten Werts sowie Apply/Cancel
|
||||||
|
+bleiben erhalten. Bei Platzmangel lässt sich die Matrix scrollen, während
|
||||||
|
+Apply und Cancel zugänglich bleiben. Andere Einstellungen bleiben dem
|
||||||
|
+Admin-Fenster vorbehalten.
|
||||||
|
|
||||||
|
## Thoraxkompressionen (v0.5.4)
|
||||||
|
|
||||||
|
--- a/README.md
|
||||||
|
+++ b/README.md
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-# Patient Monitor Simulation (PaMSim) — v0.6.2
|
||||||
|
+# Patient Monitor Simulation (PaMSim) — v0.6.3
|
||||||
|
|
||||||
|
A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.
|
||||||
|
|
||||||
|
@@ -67,16 +67,17 @@
|
||||||
|
is off. The interval bar is empty and the monitor displays `AUTO OFF`
|
||||||
|
whenever automatic measurements are disabled.
|
||||||
|
|
||||||
|
-### ART alarm-limit arrangement (v0.6.2)
|
||||||
|
-
|
||||||
|
-The ART touchscreen alarm panel groups **SYS, MAP and DIA** in three
|
||||||
|
-side-by-side columns. The first control row adjusts their **upper (↑)** limits;
|
||||||
|
-the second adjusts their **lower (↓)** limits. **PPV** appears below SYS, with
|
||||||
|
-its own upper and lower controls. Each bound retains the existing large
|
||||||
|
-**+ / value / − / ON-OFF** buttons, including previous-value restoration.
|
||||||
|
-The groups share the monitor's neutral black/grey palette and thin borders.
|
||||||
|
-All other module menus retain their previous arrangement. This is a layout
|
||||||
|
-change only; thresholds, presets and alarm evaluation are unchanged.
|
||||||
|
+### Horizontal touchscreen alarm matrix (v0.6.3)
|
||||||
|
+
|
||||||
|
+All five monitor touch menus now share a compact horizontal alarm-limit matrix.
|
||||||
|
+Each parameter occupies its own row (for ART: **SYS**, **MAP**, **DIA**,
|
||||||
|
+**PPV**), with **↓ Lower** and **↑ Upper** displayed in adjacent columns.
|
||||||
|
+Within each limit cell, the touch controls are ordered **+ · value · − ·
|
||||||
|
+OFF/ON** (the OFF/ON button is immediately right of minus). The original
|
||||||
|
+large button styling, per-parameter increments, last-value restoration,
|
||||||
|
+optional bounds and Apply/Cancel semantics are unchanged. The matrix scrolls
|
||||||
|
+if necessary while Apply and Cancel remain accessible below it. Other
|
||||||
|
+physiological and NIBP controls remain Admin-only.
|
||||||
|
|
||||||
|
## Chest compressions (v0.5.4)
|
||||||
|
|
||||||
|
--- a/src/ui.rs
|
||||||
|
+++ b/src/ui.rs
|
||||||
|
@@ -122,12 +122,9 @@
|
||||||
|
let p = params.borrow();
|
||||||
|
render::monitor_hit_test(x, y, canvas.width(), canvas.height(), &p)
|
||||||
|
};
|
||||||
|
- match touched {
|
||||||
|
- Some(render::TouchChannel::Ecg) => open_ecg_menu(&app, &window,
|
||||||
|
- params.clone(), admin_changed.clone(), monitor_menu.clone()),
|
||||||
|
- Some(channel) => open_module_menu(&app, &window, params.clone(),
|
||||||
|
- admin_changed.clone(), monitor_menu.clone(), channel),
|
||||||
|
- None => (),
|
||||||
|
+ if let Some(channel) = touched {
|
||||||
|
+ open_module_menu(&app, &window, params.clone(),
|
||||||
|
+ admin_changed.clone(), monitor_menu.clone(), channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@@ -609,14 +606,14 @@
|
||||||
|
color: #000000; background-color: #e5e9eb; font-weight: bold;
|
||||||
|
}
|
||||||
|
window.ecg-settings button.ecg-close { background-color: #171717; }
|
||||||
|
- window.ecg-settings box.art-limit-frame {
|
||||||
|
+ window.ecg-settings box.alarm-limit-frame {
|
||||||
|
border: 0.8px solid #6b757d; padding: 12px;
|
||||||
|
}
|
||||||
|
- window.ecg-settings label.art-limit-heading {
|
||||||
|
+ window.ecg-settings label.alarm-limit-heading {
|
||||||
|
font-weight: bold; font-size: 17px;
|
||||||
|
}
|
||||||
|
- window.ecg-settings label.art-limit-arrow {
|
||||||
|
- font-size: 21px;
|
||||||
|
+ window.ecg-settings label.alarm-limit-column-heading {
|
||||||
|
+ font-size: 15px; font-weight: bold;
|
||||||
|
}"
|
||||||
|
);
|
||||||
|
gtk::style_context_add_provider_for_display(
|
||||||
|
@@ -641,14 +638,12 @@
|
||||||
|
separator
|
||||||
|
}
|
||||||
|
|
||||||
|
-const TOUCH_HR_STEP: i32 = 5;
|
||||||
|
-const MAX_HR_ALARM: i32 = 240;
|
||||||
|
-
|
||||||
|
-/// When a limit is OFF, either +/- first restores its previous value (or
|
||||||
|
-/// a sensible initial value). Subsequent presses adjust it by 5 bpm.
|
||||||
|
-fn stepped_hr_limit(current: Option<i32>, last_enabled: i32, direction: i32) -> i32 {
|
||||||
|
- current.map_or(last_enabled, |value| {
|
||||||
|
- (value + TOUCH_HR_STEP * direction).clamp(0, MAX_HR_ALARM)
|
||||||
|
+/// Apply a touchscreen step to an alarm value. When the alarm is disabled,
|
||||||
|
+/// either +/- first restores its last enabled value (unchanged behavior).
|
||||||
|
+fn stepped_alarm_limit(current: Option<i32>, previous: i32,
|
||||||
|
+ direction: i32, step: i32, maximum: i32) -> i32 {
|
||||||
|
+ current.map_or(previous, |value| {
|
||||||
|
+ (value + step * direction).clamp(0, maximum)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -658,200 +653,23 @@
|
||||||
|
toggle.set_label(if value.is_some() { "OFF" } else { "ON" });
|
||||||
|
}
|
||||||
|
|
||||||
|
-/// Large, keyboard-free +/- and ON/OFF controls. Returning a Cell permits
|
||||||
|
-/// Apply to read the draft value without changing the shared configuration.
|
||||||
|
-fn ecg_touch_limit(parent: >k::Box, caption: &str,
|
||||||
|
- initial: Option<i32>, default: i32) -> Rc<Cell<Option<i32>>> {
|
||||||
|
- let state = Rc::new(Cell::new(initial));
|
||||||
|
- let previous = Rc::new(Cell::new(initial.unwrap_or(default)));
|
||||||
|
- let row = gtk::Box::new(Orientation::Horizontal, 10);
|
||||||
|
-
|
||||||
|
- let heading = gtk::Label::new(Some(caption));
|
||||||
|
- heading.set_xalign(0.0);
|
||||||
|
- heading.set_width_chars(10);
|
||||||
|
- row.append(&heading);
|
||||||
|
-
|
||||||
|
- let minus = gtk::Button::with_label("−");
|
||||||
|
- minus.set_tooltip_text(Some("Decrease alarm limit by 5 bpm"));
|
||||||
|
- minus.set_size_request(54, 50);
|
||||||
|
- row.append(&minus);
|
||||||
|
-
|
||||||
|
- let display = gtk::Label::new(None);
|
||||||
|
- display.add_css_class("ecg-limit-value");
|
||||||
|
- display.set_width_chars(5);
|
||||||
|
- display.set_xalign(0.5);
|
||||||
|
- row.append(&display);
|
||||||
|
-
|
||||||
|
- let plus = gtk::Button::with_label("+");
|
||||||
|
- plus.set_tooltip_text(Some("Increase alarm limit by 5 bpm"));
|
||||||
|
- plus.set_size_request(54, 50);
|
||||||
|
- row.append(&plus);
|
||||||
|
-
|
||||||
|
- let enable_toggle = gtk::Button::new();
|
||||||
|
- enable_toggle.set_tooltip_text(Some("Enable or disable this alarm limit"));
|
||||||
|
- enable_toggle.set_size_request(78, 50);
|
||||||
|
- row.append(&enable_toggle);
|
||||||
|
- show_touch_hr_limit(initial, &display, &enable_toggle);
|
||||||
|
-
|
||||||
|
- for (button, direction) in [(minus, -1), (plus, 1)] {
|
||||||
|
- let state = state.clone();
|
||||||
|
- let previous = previous.clone();
|
||||||
|
- let display = display.clone();
|
||||||
|
- let enable_toggle = enable_toggle.clone();
|
||||||
|
- button.connect_clicked(move |_| {
|
||||||
|
- let next = stepped_hr_limit(state.get(), previous.get(), direction);
|
||||||
|
- state.set(Some(next));
|
||||||
|
- previous.set(next);
|
||||||
|
- show_touch_hr_limit(Some(next), &display, &enable_toggle);
|
||||||
|
- });
|
||||||
|
- }
|
||||||
|
- enable_toggle.connect_clicked({
|
||||||
|
- let state = state.clone();
|
||||||
|
- let previous = previous.clone();
|
||||||
|
- let display = display.clone();
|
||||||
|
- move |button| {
|
||||||
|
- let new_value = match state.get() {
|
||||||
|
- Some(value) => {
|
||||||
|
- previous.set(value);
|
||||||
|
- None
|
||||||
|
- }
|
||||||
|
- None => Some(previous.get()),
|
||||||
|
- };
|
||||||
|
- state.set(new_value);
|
||||||
|
- show_touch_hr_limit(new_value, &display, button);
|
||||||
|
- }
|
||||||
|
- });
|
||||||
|
- parent.append(&row);
|
||||||
|
- state
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-/// Displayed only for touches in the ECG row. The monitor window can remain
|
||||||
|
-/// fullscreen. The dialog is modal to that monitor, including on Wayland.
|
||||||
|
-fn open_ecg_menu(app: &Application, monitor: &ApplicationWindow,
|
||||||
|
- params: SharedParams, on_change: AdminChanged,
|
||||||
|
- open_menu: MonitorMenuHandle) {
|
||||||
|
- if let Some(existing) = open_menu.borrow().as_ref().and_then(|weak| weak.upgrade()) {
|
||||||
|
- existing.present();
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
- let limits = params.borrow().alarms.hr;
|
||||||
|
- let dialog = gtk::Window::builder()
|
||||||
|
- .application(app)
|
||||||
|
- .title("ECG settings")
|
||||||
|
- .transient_for(monitor)
|
||||||
|
- .modal(true)
|
||||||
|
- .resizable(false)
|
||||||
|
- .default_width(550)
|
||||||
|
- .default_height(345)
|
||||||
|
- .build();
|
||||||
|
- dialog.add_css_class("ecg-settings");
|
||||||
|
- dialog.set_decorated(false);
|
||||||
|
- *open_menu.borrow_mut() = Some(dialog.downgrade());
|
||||||
|
-
|
||||||
|
- let content = gtk::Box::new(Orientation::Vertical, 12);
|
||||||
|
- content.add_css_class("ecg-panel");
|
||||||
|
- content.set_margin_top(1);
|
||||||
|
- content.set_margin_bottom(1);
|
||||||
|
- content.set_margin_start(1);
|
||||||
|
- content.set_margin_end(1);
|
||||||
|
- // Inner padding keeps controls away from the thin panel border.
|
||||||
|
- let inner = gtk::Box::new(Orientation::Vertical, 12);
|
||||||
|
- inner.set_margin_top(20);
|
||||||
|
- inner.set_margin_bottom(20);
|
||||||
|
- inner.set_margin_start(20);
|
||||||
|
- inner.set_margin_end(20);
|
||||||
|
- content.append(&inner);
|
||||||
|
-
|
||||||
|
- let title = gtk::Label::new(Some("ECG / SETTINGS"));
|
||||||
|
- title.set_xalign(0.0);
|
||||||
|
- title.add_css_class("title-2");
|
||||||
|
- inner.append(&title);
|
||||||
|
- inner.append(&ecg_menu_divider());
|
||||||
|
-
|
||||||
|
- let limits_header = gtk::Label::new(Some("HR alarm limits · bpm"));
|
||||||
|
- limits_header.set_xalign(0.0);
|
||||||
|
- inner.append(&limits_header);
|
||||||
|
- let lower = ecg_touch_limit(&inner, "↓ Lower", limits.lower, 60);
|
||||||
|
- let upper = ecg_touch_limit(&inner, "↑ Upper", limits.upper, 100);
|
||||||
|
- let hint = gtk::Label::new(Some(
|
||||||
|
- "+/− adjusts by 5 bpm. OFF disables the limit; ON restores it."
|
||||||
|
- ));
|
||||||
|
- hint.set_wrap(true);
|
||||||
|
- hint.set_xalign(0.0);
|
||||||
|
- inner.append(&hint);
|
||||||
|
- inner.append(&ecg_menu_divider());
|
||||||
|
-
|
||||||
|
- let error = gtk::Label::new(None);
|
||||||
|
- error.add_css_class("menu-error");
|
||||||
|
- error.set_xalign(0.0);
|
||||||
|
- error.set_wrap(true);
|
||||||
|
- inner.append(&error);
|
||||||
|
-
|
||||||
|
- let buttons = gtk::Box::new(Orientation::Horizontal, 12);
|
||||||
|
- buttons.set_halign(gtk::Align::End);
|
||||||
|
- let cancel = gtk::Button::with_label("Cancel");
|
||||||
|
- cancel.add_css_class("ecg-close");
|
||||||
|
- cancel.connect_clicked({
|
||||||
|
- let weak = dialog.downgrade();
|
||||||
|
- move |_| { if let Some(window) = weak.upgrade() { window.close(); } }
|
||||||
|
- });
|
||||||
|
- let apply = gtk::Button::with_label("Apply");
|
||||||
|
- apply.add_css_class("ecg-apply");
|
||||||
|
- apply.connect_clicked({
|
||||||
|
- let weak = dialog.downgrade();
|
||||||
|
- move |_| {
|
||||||
|
- let new_limits = AlarmLimits { lower: lower.get(), upper: upper.get() };
|
||||||
|
- if !new_limits.valid() {
|
||||||
|
- error.set_text("The lower limit must not exceed the upper limit.");
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
- let alarm_changed = {
|
||||||
|
- let mut p = params.borrow_mut();
|
||||||
|
- let changed = p.alarms.hr != new_limits;
|
||||||
|
- p.alarms.hr = new_limits;
|
||||||
|
- changed
|
||||||
|
- };
|
||||||
|
- if let Some(callback) = on_change.borrow().as_ref() {
|
||||||
|
- callback(alarm_changed);
|
||||||
|
- }
|
||||||
|
- if let Some(window) = weak.upgrade() { window.close(); }
|
||||||
|
- }
|
||||||
|
- });
|
||||||
|
- buttons.append(&cancel);
|
||||||
|
- buttons.append(&apply);
|
||||||
|
- inner.append(&buttons);
|
||||||
|
- dialog.set_child(Some(&content));
|
||||||
|
-
|
||||||
|
- let escape = gtk::EventControllerKey::new();
|
||||||
|
- escape.connect_key_pressed({
|
||||||
|
- let weak = dialog.downgrade();
|
||||||
|
- move |_, key, _, _| {
|
||||||
|
- if key == gdk::Key::Escape {
|
||||||
|
- if let Some(window) = weak.upgrade() { window.close(); }
|
||||||
|
- glib::Propagation::Stop
|
||||||
|
- } else { glib::Propagation::Proceed }
|
||||||
|
- }
|
||||||
|
- });
|
||||||
|
- dialog.add_controller(escape);
|
||||||
|
- dialog.present();
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
#[cfg(test)]
|
||||||
|
mod ecg_touch_menu_tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
- fn touch_step_uses_five_bpm_and_respects_bounds() {
|
||||||
|
- assert_eq!(stepped_hr_limit(Some(60), 60, 1), 65);
|
||||||
|
- assert_eq!(stepped_hr_limit(Some(60), 60, -1), 55);
|
||||||
|
- assert_eq!(stepped_hr_limit(Some(240), 240, 1), 240);
|
||||||
|
- assert_eq!(stepped_hr_limit(Some(0), 0, -1), 0);
|
||||||
|
+ fn touch_step_preserves_per_parameter_increment_and_bounds() {
|
||||||
|
+ assert_eq!(stepped_alarm_limit(Some(60), 60, 1, 5, 240), 65);
|
||||||
|
+ assert_eq!(stepped_alarm_limit(Some(60), 60, -1, 5, 240), 55);
|
||||||
|
+ assert_eq!(stepped_alarm_limit(Some(240), 240, 1, 5, 240), 240);
|
||||||
|
+ assert_eq!(stepped_alarm_limit(Some(0), 0, -1, 5, 240), 0);
|
||||||
|
+ assert_eq!(stepped_alarm_limit(Some(90), 90, 1, 1, 100), 91);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn disabled_alarm_reenables_at_last_saved_value() {
|
||||||
|
- assert_eq!(stepped_hr_limit(None, 60, 1), 60);
|
||||||
|
- assert_eq!(stepped_hr_limit(None, 100, -1), 100);
|
||||||
|
+ assert_eq!(stepped_alarm_limit(None, 60, 1, 5, 240), 60);
|
||||||
|
+ assert_eq!(stepped_alarm_limit(None, 100, -1, 5, 240), 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
@@ -896,6 +714,9 @@
|
||||||
|
};
|
||||||
|
}
|
||||||
|
match channel {
|
||||||
|
+ render::TouchChannel::Ecg => {
|
||||||
|
+ limits!("HR", "bpm", hr, 240, 5, 60, 100);
|
||||||
|
+ }
|
||||||
|
render::TouchChannel::Spo2 => {
|
||||||
|
limits!("SpO₂", "%", spo2, 100, 1, 90, 100);
|
||||||
|
limits!("Pulse rate", "bpm", pr, 240, 5, 50, 120);
|
||||||
|
@@ -915,102 +736,40 @@
|
||||||
|
limits!("NIBP MAP", "mmHg", nibp_map, 260, 5, 60, 100);
|
||||||
|
limits!("NIBP diastolic", "mmHg", nibp_dia, 260, 5, 40, 100);
|
||||||
|
}
|
||||||
|
- render::TouchChannel::Ecg => {}
|
||||||
|
}
|
||||||
|
specs
|
||||||
|
}
|
||||||
|
|
||||||
|
-/// Generic unit-aware limit control with large +/- and ON/OFF touch buttons.
|
||||||
|
-/// Unlike the ECG-only helper, the increment and permitted range are per value.
|
||||||
|
+/// A compact alarm-limit cell: [+] value [−] [OFF/ON]. Its buttons retain
|
||||||
|
+/// the old size/style, step size, last-value restoration and draft semantics.
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
-fn module_touch_limit(parent: >k::Box, caption: &str, initial: Option<i32>,
|
||||||
|
- fallback: i32, step: i32, maximum: i32) -> Rc<Cell<Option<i32>>> {
|
||||||
|
+fn alarm_matrix_cell(initial: Option<i32>, fallback: i32, step: i32,
|
||||||
|
+ maximum: i32) -> (gtk::Box, Rc<Cell<Option<i32>>>) {
|
||||||
|
let state = Rc::new(Cell::new(initial));
|
||||||
|
let previous = Rc::new(Cell::new(initial.unwrap_or(fallback)));
|
||||||
|
- let row = gtk::Box::new(Orientation::Horizontal, 10);
|
||||||
|
- let caption_label = gtk::Label::new(Some(caption));
|
||||||
|
- caption_label.set_width_chars(10);
|
||||||
|
- caption_label.set_xalign(0.0);
|
||||||
|
- row.append(&caption_label);
|
||||||
|
- let minus = gtk::Button::with_label("−");
|
||||||
|
- minus.set_size_request(54, 50);
|
||||||
|
- let display = gtk::Label::new(None);
|
||||||
|
- display.add_css_class("ecg-limit-value");
|
||||||
|
- display.set_xalign(0.5);
|
||||||
|
- display.set_width_chars(5);
|
||||||
|
+ let controls = gtk::Box::new(Orientation::Horizontal, 5);
|
||||||
|
+ controls.set_hexpand(true);
|
||||||
|
+ controls.set_halign(gtk::Align::Center);
|
||||||
|
+
|
||||||
|
let plus = gtk::Button::with_label("+");
|
||||||
|
plus.set_size_request(54, 50);
|
||||||
|
- let toggle = gtk::Button::new();
|
||||||
|
- toggle.set_size_request(78, 50);
|
||||||
|
- show_touch_hr_limit(initial, &display, &toggle);
|
||||||
|
- row.append(&minus);
|
||||||
|
- row.append(&display);
|
||||||
|
- row.append(&plus);
|
||||||
|
- row.append(&toggle);
|
||||||
|
- for (button, direction) in [(minus, -1), (plus, 1)] {
|
||||||
|
- let state = state.clone();
|
||||||
|
- let previous = previous.clone();
|
||||||
|
- let display = display.clone();
|
||||||
|
- let toggle = toggle.clone();
|
||||||
|
- button.connect_clicked(move |_| {
|
||||||
|
- let new_value = state.get().map_or(previous.get(), |current| {
|
||||||
|
- (current + direction * step).clamp(0, maximum)
|
||||||
|
- });
|
||||||
|
- state.set(Some(new_value));
|
||||||
|
- previous.set(new_value);
|
||||||
|
- show_touch_hr_limit(Some(new_value), &display, &toggle);
|
||||||
|
- });
|
||||||
|
- }
|
||||||
|
- toggle.connect_clicked({
|
||||||
|
- let state = state.clone();
|
||||||
|
- let previous = previous.clone();
|
||||||
|
- let display = display.clone();
|
||||||
|
- move |button| {
|
||||||
|
- let new_value = match state.get() {
|
||||||
|
- Some(value) => { previous.set(value); None }
|
||||||
|
- None => Some(previous.get()),
|
||||||
|
- };
|
||||||
|
- state.set(new_value);
|
||||||
|
- show_touch_hr_limit(new_value, &display, button);
|
||||||
|
- }
|
||||||
|
- });
|
||||||
|
- parent.append(&row);
|
||||||
|
- state
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-/// ART-only keyboard-free limit editor: the existing button appearance and
|
||||||
|
-/// callback semantics are retained, but its widgets are stacked vertically
|
||||||
|
-/// for the SYS/MAP/DIA columns and the PPV controls below them.
|
||||||
|
-#[allow(clippy::too_many_arguments)]
|
||||||
|
-fn art_touch_limit(grid: >k::Grid, column: i32, row: i32,
|
||||||
|
- initial: Option<i32>, fallback: i32,
|
||||||
|
- step: i32, maximum: i32) -> Rc<Cell<Option<i32>>> {
|
||||||
|
- let state = Rc::new(Cell::new(initial));
|
||||||
|
- let previous = Rc::new(Cell::new(initial.unwrap_or(fallback)));
|
||||||
|
- let controls = gtk::Box::new(Orientation::Vertical, 7);
|
||||||
|
- controls.set_halign(gtk::Align::Center);
|
||||||
|
- controls.set_hexpand(true);
|
||||||
|
-
|
||||||
|
- let plus = gtk::Button::with_label("+");
|
||||||
|
- plus.set_size_request(54, 50);
|
||||||
|
- plus.set_halign(gtk::Align::Center);
|
||||||
|
- controls.append(&plus);
|
||||||
|
-
|
||||||
|
+ plus.set_tooltip_text(Some("Increase alarm limit"));
|
||||||
|
let display = gtk::Label::new(None);
|
||||||
|
display.add_css_class("ecg-limit-value");
|
||||||
|
display.set_width_chars(5);
|
||||||
|
display.set_xalign(0.5);
|
||||||
|
- controls.append(&display);
|
||||||
|
-
|
||||||
|
let minus = gtk::Button::with_label("−");
|
||||||
|
minus.set_size_request(54, 50);
|
||||||
|
- minus.set_halign(gtk::Align::Center);
|
||||||
|
- controls.append(&minus);
|
||||||
|
-
|
||||||
|
+ minus.set_tooltip_text(Some("Decrease alarm limit"));
|
||||||
|
let toggle = gtk::Button::new();
|
||||||
|
toggle.set_size_request(78, 50);
|
||||||
|
- toggle.set_halign(gtk::Align::Center);
|
||||||
|
+ toggle.set_tooltip_text(Some("Enable or disable this alarm limit"));
|
||||||
|
show_touch_hr_limit(initial, &display, &toggle);
|
||||||
|
+
|
||||||
|
+ // Requested left-to-right order: plus, value, minus, OFF.
|
||||||
|
+ controls.append(&plus);
|
||||||
|
+ controls.append(&display);
|
||||||
|
+ controls.append(&minus);
|
||||||
|
controls.append(&toggle);
|
||||||
|
|
||||||
|
for (button, direction) in [(plus, 1), (minus, -1)] {
|
||||||
|
@@ -1019,12 +778,11 @@
|
||||||
|
let display = display.clone();
|
||||||
|
let toggle = toggle.clone();
|
||||||
|
button.connect_clicked(move |_| {
|
||||||
|
- let new_value = state.get().map_or(previous.get(), |current| {
|
||||||
|
- (current + direction * step).clamp(0, maximum)
|
||||||
|
- });
|
||||||
|
- state.set(Some(new_value));
|
||||||
|
- previous.set(new_value);
|
||||||
|
- show_touch_hr_limit(Some(new_value), &display, &toggle);
|
||||||
|
+ let next = stepped_alarm_limit(state.get(), previous.get(),
|
||||||
|
+ direction, step, maximum);
|
||||||
|
+ state.set(Some(next));
|
||||||
|
+ previous.set(next);
|
||||||
|
+ show_touch_hr_limit(Some(next), &display, &toggle);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
toggle.connect_clicked({
|
||||||
|
@@ -1032,65 +790,74 @@
|
||||||
|
let previous = previous.clone();
|
||||||
|
let display = display.clone();
|
||||||
|
move |button| {
|
||||||
|
- let new_value = match state.get() {
|
||||||
|
+ let next = match state.get() {
|
||||||
|
Some(value) => { previous.set(value); None }
|
||||||
|
None => Some(previous.get()),
|
||||||
|
};
|
||||||
|
- state.set(new_value);
|
||||||
|
- show_touch_hr_limit(new_value, &display, button);
|
||||||
|
- }
|
||||||
|
- });
|
||||||
|
- grid.attach(&controls, column, row, 1, 1);
|
||||||
|
- state
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-/// Map the four ART parameters to the three-column alarm grid. Row 1 is
|
||||||
|
-/// upper thresholds, row 2 lower; PPV occupies column SYS in rows 4 and 5.
|
||||||
|
-fn art_alarm_position(index: usize) -> (i32, i32, i32, i32, &'static str) {
|
||||||
|
- match index {
|
||||||
|
- 0 => (1, 0, 1, 2, "SYS"),
|
||||||
|
- 1 => (2, 0, 1, 2, "MAP"),
|
||||||
|
- 2 => (3, 0, 1, 2, "DIA"),
|
||||||
|
- 3 => (1, 3, 4, 5, "PPV"),
|
||||||
|
- _ => unreachable!("ART has exactly four alarm parameters"),
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-/// The ART alarm menu groups SYS/MAP/DIA into columns with upper limits in
|
||||||
|
-/// the first row and lower limits in the second; PPV occupies the first
|
||||||
|
-/// parameter column beneath them. It reuses the same alarm draft/Apply path.
|
||||||
|
-fn art_alarm_grid(specs: Vec<TouchAlarmSpec>, drafts: &mut Vec<TouchAlarmDraft>) -> gtk::Box {
|
||||||
|
- let frame = gtk::Box::new(Orientation::Vertical, 16);
|
||||||
|
- frame.add_css_class("art-limit-frame");
|
||||||
|
+ state.set(next);
|
||||||
|
+ show_touch_hr_limit(next, &display, button);
|
||||||
|
+ }
|
||||||
|
+ });
|
||||||
|
+ (controls, state)
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/// Short names in the alarm matrix; full labels remain available as tooltips.
|
||||||
|
+fn alarm_matrix_label(name: &str) -> &str {
|
||||||
|
+ match name {
|
||||||
|
+ "ART systolic" | "NIBP systolic" => "SYS",
|
||||||
|
+ "ART MAP" | "NIBP MAP" => "MAP",
|
||||||
|
+ "ART diastolic" | "NIBP diastolic" => "DIA",
|
||||||
|
+ "Pulse rate" => "PR",
|
||||||
|
+ "Respiratory rate" => "RR",
|
||||||
|
+ other => other,
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/// Common touchscreen matrix for ECG, SpO2, ART, CO2 and NIBP.
|
||||||
|
+/// Each parameter occupies one horizontal row; lower and upper limits have
|
||||||
|
+/// identical columns and the action order [+] value [−] [OFF/ON].
|
||||||
|
+fn alarm_limit_matrix(specs: Vec<TouchAlarmSpec>,
|
||||||
|
+ drafts: &mut Vec<TouchAlarmDraft>) -> gtk::Box {
|
||||||
|
+ let frame = gtk::Box::new(Orientation::Vertical, 8);
|
||||||
|
+ frame.add_css_class("alarm-limit-frame");
|
||||||
|
frame.set_hexpand(true);
|
||||||
|
|
||||||
|
let heading = gtk::Label::new(Some("Alarm Limits"));
|
||||||
|
- heading.add_css_class("art-limit-heading");
|
||||||
|
+ heading.add_css_class("alarm-limit-heading");
|
||||||
|
heading.set_xalign(0.0);
|
||||||
|
frame.append(&heading);
|
||||||
|
|
||||||
|
let grid = gtk::Grid::new();
|
||||||
|
grid.set_hexpand(true);
|
||||||
|
- grid.set_column_spacing(12);
|
||||||
|
- grid.set_row_spacing(23);
|
||||||
|
-
|
||||||
|
- for (row, arrow) in [(1, "↑"), (2, "↓"), (4, "↑"), (5, "↓")] {
|
||||||
|
- let label = gtk::Label::new(Some(arrow));
|
||||||
|
- label.add_css_class("art-limit-arrow");
|
||||||
|
- label.set_width_chars(2);
|
||||||
|
- grid.attach(&label, 0, row, 1, 1);
|
||||||
|
- }
|
||||||
|
- for (i, spec) in specs.into_iter().enumerate() {
|
||||||
|
- let (column, title_row, upper_row, lower_row, title) = art_alarm_position(i);
|
||||||
|
- let label = gtk::Label::new(Some(title));
|
||||||
|
- label.add_css_class("art-limit-heading");
|
||||||
|
- label.set_hexpand(true);
|
||||||
|
- grid.attach(&label, column, title_row, 1, 1);
|
||||||
|
-
|
||||||
|
- let upper = art_touch_limit(&grid, column, upper_row, spec.limits.upper,
|
||||||
|
+ grid.set_column_spacing(8);
|
||||||
|
+ grid.set_row_spacing(8);
|
||||||
|
+
|
||||||
|
+ for (column, text) in [(1, "↓ Lower"), (2, "↑ Upper")] {
|
||||||
|
+ let label = gtk::Label::new(Some(text));
|
||||||
|
+ label.add_css_class("alarm-limit-column-heading");
|
||||||
|
+ label.set_halign(gtk::Align::Center);
|
||||||
|
+ grid.attach(&label, column, 0, 1, 1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (index, spec) in specs.into_iter().enumerate() {
|
||||||
|
+ // An empty narrow divider row keeps each parameter visually distinct.
|
||||||
|
+ let base = 1 + (index as i32) * 2;
|
||||||
|
+ if index > 0 {
|
||||||
|
+ grid.attach(&ecg_menu_divider(), 0, base - 1, 3, 1);
|
||||||
|
+ }
|
||||||
|
+ let label = gtk::Label::new(Some(alarm_matrix_label(spec.name)));
|
||||||
|
+ label.set_xalign(0.0);
|
||||||
|
+ label.set_tooltip_text(Some(&format!("{} ({})", spec.name, spec.unit)));
|
||||||
|
+ label.add_css_class("alarm-limit-heading");
|
||||||
|
+ label.set_width_chars(5);
|
||||||
|
+ grid.attach(&label, 0, base, 1, 1);
|
||||||
|
+
|
||||||
|
+ let (lower_controls, lower) = alarm_matrix_cell(spec.limits.lower,
|
||||||
|
+ spec.restore_lower, spec.step, spec.maximum);
|
||||||
|
+ let (upper_controls, upper) = alarm_matrix_cell(spec.limits.upper,
|
||||||
|
spec.restore_upper, spec.step, spec.maximum);
|
||||||
|
- let lower = art_touch_limit(&grid, column, lower_row, spec.limits.lower,
|
||||||
|
- spec.restore_lower, spec.step, spec.maximum);
|
||||||
|
+ grid.attach(&lower_controls, 1, base, 1, 1);
|
||||||
|
+ grid.attach(&upper_controls, 2, base, 1, 1);
|
||||||
|
drafts.push(TouchAlarmDraft {
|
||||||
|
name: spec.name, lower, upper, apply: spec.apply,
|
||||||
|
});
|
||||||
|
@@ -1128,7 +895,7 @@
|
||||||
|
render::TouchChannel::Art => "ART / SETTINGS",
|
||||||
|
render::TouchChannel::Capno => "CO₂ / SETTINGS",
|
||||||
|
render::TouchChannel::Nibp => "NIBP / SETTINGS",
|
||||||
|
- render::TouchChannel::Ecg => return,
|
||||||
|
+ render::TouchChannel::Ecg => "ECG / SETTINGS",
|
||||||
|
};
|
||||||
|
let dialog = gtk::Window::builder()
|
||||||
|
.application(app)
|
||||||
|
@@ -1136,8 +903,13 @@
|
||||||
|
.transient_for(monitor)
|
||||||
|
.modal(true)
|
||||||
|
.resizable(true)
|
||||||
|
- .default_width(if channel == render::TouchChannel::Art { 720 } else { 560 })
|
||||||
|
- .default_height(if channel == render::TouchChannel::Art { 790 } else { 610 })
|
||||||
|
+ .default_width(800)
|
||||||
|
+ .default_height(match channel {
|
||||||
|
+ render::TouchChannel::Art => 560,
|
||||||
|
+ render::TouchChannel::Nibp => 490,
|
||||||
|
+ render::TouchChannel::Ecg => 310,
|
||||||
|
+ _ => 420,
|
||||||
|
+ })
|
||||||
|
.build();
|
||||||
|
dialog.add_css_class("ecg-settings");
|
||||||
|
dialog.set_decorated(false);
|
||||||
|
@@ -1166,45 +938,22 @@
|
||||||
|
inner.append(&heading);
|
||||||
|
inner.append(&ecg_menu_divider());
|
||||||
|
|
||||||
|
- // Every numeric alarm has two optional bounds, editable without a keyboard.
|
||||||
|
+ // A shared horizontal matrix is used in every monitor-side touch menu.
|
||||||
|
let specs = module_alarm_specs(channel, ¤t);
|
||||||
|
let mut alarm_drafts = Vec::new();
|
||||||
|
- if channel == render::TouchChannel::Art {
|
||||||
|
- // The ART panel uses the requested column/row arrangement. Other
|
||||||
|
- // channels retain their current one-parameter-at-a-time layout.
|
||||||
|
- inner.append(&art_alarm_grid(specs, &mut alarm_drafts));
|
||||||
|
- } else {
|
||||||
|
- for spec in specs {
|
||||||
|
- let label = gtk::Label::new(Some(&format!("{} alarm limits · {}", spec.name, spec.unit)));
|
||||||
|
- label.set_xalign(0.0);
|
||||||
|
- inner.append(&label);
|
||||||
|
- let lower = module_touch_limit(&inner, "↓ Lower", spec.limits.lower,
|
||||||
|
- spec.restore_lower, spec.step, spec.maximum);
|
||||||
|
- let upper = module_touch_limit(&inner, "↑ Upper", spec.limits.upper,
|
||||||
|
- spec.restore_upper, spec.step, spec.maximum);
|
||||||
|
- alarm_drafts.push(TouchAlarmDraft {
|
||||||
|
- name: spec.name, lower, upper, apply: spec.apply,
|
||||||
|
- });
|
||||||
|
- inner.append(&ecg_menu_divider());
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
+ inner.append(&alarm_limit_matrix(specs, &mut alarm_drafts));
|
||||||
|
|
||||||
|
let error = gtk::Label::new(None);
|
||||||
|
error.set_xalign(0.0);
|
||||||
|
error.add_css_class("menu-error");
|
||||||
|
error.set_wrap(true);
|
||||||
|
- // The ART layout is taller; keep validation and buttons visible while
|
||||||
|
- // the alarm-limit controls scroll on smaller monitor touchscreens.
|
||||||
|
+ // Validation and Apply/Cancel stay fixed when the matrix scrolls.
|
||||||
|
let footer = gtk::Box::new(Orientation::Vertical, 8);
|
||||||
|
- if channel == render::TouchChannel::Art {
|
||||||
|
- footer.set_margin_start(20);
|
||||||
|
- footer.set_margin_end(20);
|
||||||
|
- footer.set_margin_top(8);
|
||||||
|
- footer.set_margin_bottom(12);
|
||||||
|
- footer.append(&error);
|
||||||
|
- } else {
|
||||||
|
- inner.append(&error);
|
||||||
|
- }
|
||||||
|
+ footer.set_margin_start(20);
|
||||||
|
+ footer.set_margin_end(20);
|
||||||
|
+ footer.set_margin_top(8);
|
||||||
|
+ footer.set_margin_bottom(12);
|
||||||
|
+ footer.append(&error);
|
||||||
|
let buttons = gtk::Box::new(Orientation::Horizontal, 12);
|
||||||
|
buttons.set_halign(gtk::Align::End);
|
||||||
|
let cancel = gtk::Button::with_label("Cancel");
|
||||||
|
@@ -1244,12 +993,8 @@
|
||||||
|
});
|
||||||
|
buttons.append(&cancel);
|
||||||
|
buttons.append(&apply);
|
||||||
|
- if channel == render::TouchChannel::Art {
|
||||||
|
- footer.append(&buttons);
|
||||||
|
- content.append(&footer);
|
||||||
|
- } else {
|
||||||
|
- inner.append(&buttons);
|
||||||
|
- }
|
||||||
|
+ footer.append(&buttons);
|
||||||
|
+ content.append(&footer);
|
||||||
|
dialog.set_child(Some(&content));
|
||||||
|
|
||||||
|
let escape = gtk::EventControllerKey::new();
|
||||||
|
@@ -1286,21 +1031,29 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
- fn art_menu_columns_follow_sys_map_dia_and_ppv_order() {
|
||||||
|
- assert_eq!(art_alarm_position(0), (1, 0, 1, 2, "SYS"));
|
||||||
|
- assert_eq!(art_alarm_position(1), (2, 0, 1, 2, "MAP"));
|
||||||
|
- assert_eq!(art_alarm_position(2), (3, 0, 1, 2, "DIA"));
|
||||||
|
- assert_eq!(art_alarm_position(3), (1, 3, 4, 5, "PPV"));
|
||||||
|
- let specs = module_alarm_specs(render::TouchChannel::Art, &Parameters::default());
|
||||||
|
- assert_eq!(specs.iter().map(|spec| spec.name).collect::<Vec<_>>(),
|
||||||
|
- ["ART systolic", "ART MAP", "ART diastolic", "PPV"]);
|
||||||
|
- let mut alarms = AlarmSettings::default();
|
||||||
|
+ fn alarm_matrix_order_and_labels() {
|
||||||
|
+ let p = Parameters::default();
|
||||||
|
+ for (channel, names) in [
|
||||||
|
+ (render::TouchChannel::Ecg, vec!["HR"]),
|
||||||
|
+ (render::TouchChannel::Spo2, vec!["SpO₂", "PR"]),
|
||||||
|
+ (render::TouchChannel::Art, vec!["SYS", "MAP", "DIA", "PPV"]),
|
||||||
|
+ (render::TouchChannel::Capno, vec!["EtCO₂", "RR"]),
|
||||||
|
+ (render::TouchChannel::Nibp, vec!["SYS", "MAP", "DIA"]),
|
||||||
|
+ ] {
|
||||||
|
+ let specs = module_alarm_specs(channel, &p);
|
||||||
|
+ let actual: Vec<_> = specs.iter()
|
||||||
|
+ .map(|spec| alarm_matrix_label(spec.name)).collect();
|
||||||
|
+ assert_eq!(actual, names);
|
||||||
|
+ }
|
||||||
|
+ // Same underlying ART alarm setters are retained after rearrangement.
|
||||||
|
+ let specs = module_alarm_specs(render::TouchChannel::Art, &p);
|
||||||
|
let limits = [
|
||||||
|
AlarmLimits { lower: Some(80), upper: Some(180) },
|
||||||
|
AlarmLimits { lower: Some(60), upper: Some(100) },
|
||||||
|
AlarmLimits { lower: None, upper: None },
|
||||||
|
AlarmLimits { lower: None, upper: Some(10) },
|
||||||
|
];
|
||||||
|
+ let mut alarms = AlarmSettings::default();
|
||||||
|
for (spec, value) in specs.into_iter().zip(limits.iter().copied()) {
|
||||||
|
(spec.apply)(&mut alarms, value);
|
||||||
|
}
|
||||||
2
patient-monitor-simulation/Cargo.lock
generated
2
patient-monitor-simulation/Cargo.lock
generated
|
|
@ -438,7 +438,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "patient-monitor-simulation"
|
name = "patient-monitor-simulation"
|
||||||
version = "0.6.1"
|
version = "0.6.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gtk4",
|
"gtk4",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "patient-monitor-simulation"
|
name = "patient-monitor-simulation"
|
||||||
version = "0.6.1"
|
version = "0.6.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
|
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,19 @@ eine bereits laufende Messung nicht abgebrochen. **Measure now** funktioniert
|
||||||
auch bei ausgeschalteter Automatik. Dann bleibt die Intervallanzeige leer
|
auch bei ausgeschalteter Automatik. Dann bleibt die Intervallanzeige leer
|
||||||
und der Monitor zeigt `AUTO OFF`.
|
und der Monitor zeigt `AUTO OFF`.
|
||||||
|
|
||||||
|
### Horizontale Matrix für Alarmgrenzen (v0.6.3)
|
||||||
|
|
||||||
|
Alle fünf Touchmenüs des Monitors verwenden dieselbe kompakte Matrix.
|
||||||
|
Jeder Parameter belegt eine Zeile (bei ART: **SYS**, **MAP**, **DIA**,
|
||||||
|
**PPV**); die **untere (↓)** und **obere (↑)** Alarmgrenze stehen
|
||||||
|
nebeneinander. Die Schaltflächen jedes Grenzwerts sind von links nach
|
||||||
|
rechts **+ · Wert · − · OFF/ON** angeordnet. Die Schaltfläche zum
|
||||||
|
Deaktivieren liegt unmittelbar rechts von Minus. Größe, Gestaltung,
|
||||||
|
Schrittweite, Wiederherstellung des letzten Werts sowie Apply/Cancel
|
||||||
|
bleiben erhalten. Bei Platzmangel lässt sich die Matrix scrollen, während
|
||||||
|
Apply und Cancel zugänglich bleiben. Andere Einstellungen bleiben dem
|
||||||
|
Admin-Fenster vorbehalten.
|
||||||
|
|
||||||
## Thoraxkompressionen (v0.5.4)
|
## Thoraxkompressionen (v0.5.4)
|
||||||
|
|
||||||
Im Admin-Bereich **Chest compressions** startet die grüne Schaltfläche
|
Im Admin-Bereich **Chest compressions** startet die grüne Schaltfläche
|
||||||
|
|
|
||||||
|
|
@ -26,80 +26,63 @@ vierten Feldes; die gesamte untere Wertezeile bleibt bestehen.
|
||||||
Beim Ausblenden anderer Parameter werden die verbleibenden Kurvenzeilen wie
|
Beim Ausblenden anderer Parameter werden die verbleibenden Kurvenzeilen wie
|
||||||
bisher dynamisch verteilt.
|
bisher dynamisch verteilt.
|
||||||
|
|
||||||
## EKG-Bedienung direkt am Monitor (v0.5.9)
|
## Touch-Bedienung am Monitor: ausschließlich Alarmgrenzen (v0.6.1)
|
||||||
|
|
||||||
Durch Berühren oder Anklicken der **EKG-Zeile** öffnet sich ein eigenes
|
Durch Berühren oder Anklicken der **Kurve oder des numerischen Wertefeldes**
|
||||||
Einstellfenster mit **hellgrauer Schrift auf schwarzem Hintergrund**. Die gesamte
|
von EKG, SpO₂, ART oder CO₂ öffnet sich das entsprechende Alarmmenü. Bei
|
||||||
EKG-Zeile ist aktiv, sowohl die Kurve links (75 %) als auch das numerische
|
NIBP ist das **rechte Viertel der untersten Wertezeile** aktiv. Die übrigen
|
||||||
Herzfrequenzfeld rechts (25 %). Die Bedienung ist auch im Vollbildmodus möglich.
|
drei Wertefelder der untersten Zeile bleiben vorerst ohne Touch-Funktion.
|
||||||
Bei ausgeblendetem EKG ist die Interaktionsfläche deaktiviert.
|
Die Menüs funktionieren auch im Vollbildmodus und verwenden **schwarzen
|
||||||
|
Hintergrund, sehr hellgraue Schrift sowie 0,8 Pixel breite Begrenzungs-
|
||||||
|
und Trennlinien** wie der Hauptmonitor.
|
||||||
|
|
||||||
Im Einstellfenster stehen folgende Optionen zur Verfügung:
|
**Am Monitor können ausschließlich Alarmgrenzen eingestellt werden.**
|
||||||
|
Für jede untere und obere Alarmgrenze stehen große **−/+**-Tasten sowie
|
||||||
|
separate **ON/OFF**-Tasten zur Verfügung. Nicht gesetzte Grenzwerte sind
|
||||||
|
deaktiviert. Ein unterer Grenzwert darf den oberen nicht überschreiten.
|
||||||
|
Eine Bildschirmtastatur ist nicht erforderlich.
|
||||||
|
|
||||||
- **ECG lead:** I, II (Voreinstellung), III, aVR, aVL, aVF und V1–V6. Nach
|
| Monitorbereich | Einstellbare Alarmgrenzen | Schrittweite |
|
||||||
**Apply** ändert sich die Ableitungsbezeichnung im Monitor sowie die
|
|
||||||
schematische Polarität/Amplitude der Kurve. Es handelt sich **nicht** um
|
|
||||||
eine klinisch validierte 12-Kanal-EKG-Ableitung. Frequenz, QRS-Zeitpunkte
|
|
||||||
und mechanische Pulskopplung bleiben unverändert.
|
|
||||||
- **HR alarm limits:** unabhängig einstellbare untere (↓) und obere (↑)
|
|
||||||
Herzfrequenzgrenze in /min. Große Tasten **− / +** ändern den jeweiligen
|
|
||||||
Grenzwert in **5er-Schritten** zwischen 0 und 240. Mit **OFF** lässt sich
|
|
||||||
jede Grenze einzeln deaktivieren; **ON** aktiviert den vorherigen Wert
|
|
||||||
erneut (bei anfänglich nicht gesetzten Werten 60 bzw. 100 /min).
|
|
||||||
Die untere Grenze darf die obere nicht überschreiten.
|
|
||||||
- **Apply** übernimmt beide Alarmgrenzen und die Ableitung gemeinsam;
|
|
||||||
**Cancel** oder **Esc** verwirft die noch nicht übernommenen Eingaben.
|
|
||||||
|
|
||||||
Die Bedienelemente sind ohne Tastatur verwendbar. Schmale hellgraue
|
|
||||||
Begrenzungslinien und Trennlinien orientieren sich an der Gestaltung des
|
|
||||||
Monitors; die EKG-spezifische grüne Textfarbe wird hier nicht verwendet.
|
|
||||||
|
|
||||||
Die Einstellungen werden mit der Admin-Oberfläche synchronisiert. Eine am
|
|
||||||
Monitor geänderte Alarmgrenze schaltet die Alarmvoreinstellung auf **Custom**.
|
|
||||||
Auch in der Admin-Oberfläche ist die EKG-Ableitung auswählbar. Die anderen
|
|
||||||
Monitorparameter besitzen ab v0.6.0 ebenfalls berührungsempfindliche Menüs.
|
|
||||||
|
|
||||||
## Weitere Touch-Menüs am Monitor (v0.6.0)
|
|
||||||
|
|
||||||
Ein Tipp auf die **Kurve oder die numerischen Werte** von SpO₂, ART oder CO₂
|
|
||||||
öffnet das zugehörige Einstellfenster. Für NIBP ist das **rechte Viertel der
|
|
||||||
untersten Messwertzeile** aktiv. Die Felder CO/CI, SVRI/GEDI/ELWI und das
|
|
||||||
unbelegte dritte Feld erhalten noch keine Touch-Bedienung. Alle Menüs
|
|
||||||
verwenden das Design des EKG-Menüs: **schwarzer Hintergrund, hellgraue Schrift
|
|
||||||
und 0,8 Pixel breite Trennlinien**. Eine Bildschirmtastatur ist nicht nötig.
|
|
||||||
|
|
||||||
| Bereich | Alarmgrenzen | Weitere Einstellungen |
|
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| SpO₂ | SpO₂, Pulsfrequenz (PR) | Signalqualität, Sensor angeschlossen/nicht angeschlossen |
|
| EKG | Herzfrequenz (HR) | 5/min |
|
||||||
| ART | SYS, MAP, DIA, PPV | Form der arteriellen Druckkurve |
|
| SpO₂ | SpO₂; Pulsfrequenz (PR) | 1 % SpO₂; 5/min PR |
|
||||||
| CO₂ | EtCO₂, Atemfrequenz (RR) | Normales oder obstruktives Kapnogramm |
|
| ART | SYS; MAP; DIA; PPV | 5 mmHg Druck; 1 % PPV |
|
||||||
| NIBP | SYS, MAP, DIA | Intervall 1/3/5/10/20/30/60 min, Auto ON/OFF, Messausfall, Manschettenlokalisation und **Measure now** |
|
| CO₂ | EtCO₂; Atemfrequenz (RR) | 1 mmHg EtCO₂; 1/min RR |
|
||||||
|
| NIBP | SYS; MAP; DIA | 5 mmHg |
|
||||||
|
|
||||||
Die einzelnen unteren und oberen Alarmgrenzen werden mit großen **−/+**-
|
**Apply** übernimmt die Alarmgrenzen und synchronisiert das Admin-Fenster.
|
||||||
und **ON/OFF**-Tasten verändert. Die Schrittweiten betragen 5 /min bei PR,
|
Bei manueller Änderung wechselt das Alarm-Preset zu **Custom**. Mit
|
||||||
1 % bei SpO₂ und PPV, 5 mmHg bei ART/NIBP, 1 mmHg bei EtCO₂ und
|
**Cancel** oder **Esc** werden nicht übernommene Änderungen verworfen.
|
||||||
1 /min bei der Atemfrequenz. Eine untere Grenze darf nicht höher liegen
|
|
||||||
als die obere.
|
|
||||||
|
|
||||||
Mit **Apply** werden die Änderungen übernommen und zugleich die Admin-
|
Die Auswahl der EKG-Ableitung, SpO₂-Signalqualität und Sensorverbindung,
|
||||||
Oberfläche aktualisiert; eine geänderte Alarmgrenze setzt das Preset auf
|
der arteriellen Kurvenform, der Kapnogrammform sowie **sämtliche NIBP-
|
||||||
**Custom**. **Cancel** verwirft die Eingaben, **Esc** schließt das Fenster.
|
Messfunktionen** sind ausschließlich im **Admin-Fenster** verfügbar. Dazu
|
||||||
Die Schaltfläche **Measure now** führt dagegen eine sofortige NIBP-Messung
|
zählen Messintervall, automatische Messung, **Measure now**, simulierter
|
||||||
mit den *bereits übernommenen* Einstellungen aus. Änderungen für diese
|
Messausfall und Manschettenlokalisation. Diese Parameter können über die
|
||||||
Messung müssen daher zuerst mit **Apply** bestätigt werden.
|
Alarmmenüs am Monitor nicht verändert werden.
|
||||||
|
|
||||||
### NIBP beim Programmstart
|
### NIBP beim Programmstart
|
||||||
|
|
||||||
Die **automatische NIBP-Messung ist beim Start ausgeschaltet**. Anfangs
|
Die **automatische NIBP-Messung ist beim Start ausgeschaltet**. Anfangs
|
||||||
zeigt der Monitor `---/---` (MAP `---`); es wird keine Messung durchgeführt.
|
zeigt der Monitor `---/---` (MAP `---`); es findet keine Messung statt.
|
||||||
Erst **Measure now** oder das Aktivieren von **Automatic measurement**
|
Die erste Messung wird über **Measure now** im Admin-Fenster oder durch
|
||||||
im NIBP-Touch-Menü (alternativ im Admin-Fenster) startet eine erste Messung.
|
Aktivieren von **Automatic NIBP measurement** ausgelöst. Beim Einschalten
|
||||||
Wird Auto eingeschaltet, beginnt der erste Zyklus sofort; danach wird das
|
von Auto beginnt sofort ein Messzyklus; das Intervall zählt anschließend
|
||||||
eingestellte Intervall jeweils ab Ende der letzten Messung gezählt.
|
jeweils ab Ende der vorherigen Messung. Beim Ausschalten von Auto wird
|
||||||
Das Ausschalten von Auto verhindert neue automatische Messungen, bricht
|
eine bereits laufende Messung nicht abgebrochen. **Measure now** funktioniert
|
||||||
einen bereits begonnenen Zyklus jedoch nicht ab. **Measure now** bleibt
|
auch bei ausgeschalteter Automatik. Dann bleibt die Intervallanzeige leer
|
||||||
bei ausgeschalteter Automatik nutzbar, solange keine Messung läuft.
|
und der Monitor zeigt `AUTO OFF`.
|
||||||
Bei Auto OFF ist der Intervallbalken leer und `AUTO OFF` wird angezeigt.
|
|
||||||
|
### Anordnung der ART-Alarmgrenzen (v0.6.2)
|
||||||
|
|
||||||
|
Das Touchmenü für die invasive arterielle Druckmessung ordnet **SYS, MAP und
|
||||||
|
DIA** in drei Spalten an. Die obere Bedienzeile enthält die **oberen (↑)**
|
||||||
|
Alarmgrenzen, die zweite die **unteren (↓)** Alarmgrenzen. **PPV** folgt unter
|
||||||
|
SYS mit eigenen oberen und unteren Grenzwerten. Die bisherigen großen
|
||||||
|
**+ / Wert / − / EIN-AUS**-Schaltflächen und ihre Bedienlogik bleiben erhalten.
|
||||||
|
Die Gestaltung verwendet weiterhin Schwarz, Hellgrau und schmale Rahmenlinien.
|
||||||
|
Alle anderen Parametermenüs bleiben unverändert. Alarmverarbeitung und
|
||||||
|
Voreinstellungen sind von dieser Layoutänderung nicht betroffen.
|
||||||
|
|
||||||
## Thoraxkompressionen (v0.5.4)
|
## Thoraxkompressionen (v0.5.4)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,8 @@
|
||||||
--- README.de.md
|
--- README.de.md
|
||||||
+++ README.de.md
|
+++ README.de.md
|
||||||
@@ -1,4 +1,4 @@
|
@@ -1,4 +1,4 @@
|
||||||
-# Patient Monitor Simulation (PaMSim) — v0.6.0
|
-# Patient Monitor Simulation (PaMSim) — v0.6.2
|
||||||
+# Patient Monitor Simulation (PaMSim) — v0.6.1
|
+# Patient Monitor Simulation (PaMSim) — v0.6.3
|
||||||
|
|
||||||
Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenstern für die Lehre unter Fedora Linux.
|
Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenstern für die Lehre unter Fedora Linux.
|
||||||
|
|
||||||
@@ -586,3 +558,11 @@
|
|
||||||
kein NIBP-Messwert vorhanden; der erste Zyklus muss manuell oder durch
|
|
||||||
Aktivieren der Automatik gestartet werden. Die bisherige NIBP-Messlogik
|
|
||||||
wird ansonsten unverändert weiterverwendet.
|
|
||||||
+
|
|
||||||
+### v0.6.1 – Touch-Menüs ausschließlich für Alarmgrenzen
|
|
||||||
+
|
|
||||||
+Alle Touch-Menüs für EKG, SpO₂, ART, CO₂ und NIBP enthalten jetzt nur noch
|
|
||||||
+untere und obere Alarmgrenzen. EKG-Ableitung, Signal- und Sensoreinstellungen,
|
|
||||||
+Kurvenformen sowie NIBP-Messfunktionen wurden aus den Monitor-Menüs entfernt
|
|
||||||
+und bleiben im Admin-Fenster verfügbar. Die Simulationslogik, Alarmprüfung
|
|
||||||
+und das NIBP-Startverhalten wurden nicht verändert.
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Patient Monitor Simulation (PaMSim) — v0.6.1
|
# Patient Monitor Simulation (PaMSim) — v0.6.3
|
||||||
|
|
||||||
A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.
|
A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.
|
||||||
|
|
||||||
|
|
@ -67,6 +67,18 @@ cycle already in progress. Manual measurement remains possible while Auto
|
||||||
is off. The interval bar is empty and the monitor displays `AUTO OFF`
|
is off. The interval bar is empty and the monitor displays `AUTO OFF`
|
||||||
whenever automatic measurements are disabled.
|
whenever automatic measurements are disabled.
|
||||||
|
|
||||||
|
### Horizontal touchscreen alarm matrix (v0.6.3)
|
||||||
|
|
||||||
|
All five monitor touch menus now share a compact horizontal alarm-limit matrix.
|
||||||
|
Each parameter occupies its own row (for ART: **SYS**, **MAP**, **DIA**,
|
||||||
|
**PPV**), with **↓ Lower** and **↑ Upper** displayed in adjacent columns.
|
||||||
|
Within each limit cell, the touch controls are ordered **+ · value · − ·
|
||||||
|
OFF/ON** (the OFF/ON button is immediately right of minus). The original
|
||||||
|
large button styling, per-parameter increments, last-value restoration,
|
||||||
|
optional bounds and Apply/Cancel semantics are unchanged. The matrix scrolls
|
||||||
|
if necessary while Apply and Cancel remain accessible below it. Other
|
||||||
|
physiological and NIBP controls remain Admin-only.
|
||||||
|
|
||||||
## Chest compressions (v0.5.4)
|
## Chest compressions (v0.5.4)
|
||||||
|
|
||||||
The **Chest compressions** Admin group provides a large **Start Chest Compressions**
|
The **Chest compressions** Admin group provides a large **Start Chest Compressions**
|
||||||
|
|
|
||||||
|
|
@ -122,12 +122,9 @@ fn create_monitor(app: &Application, params: SharedParams,
|
||||||
let p = params.borrow();
|
let p = params.borrow();
|
||||||
render::monitor_hit_test(x, y, canvas.width(), canvas.height(), &p)
|
render::monitor_hit_test(x, y, canvas.width(), canvas.height(), &p)
|
||||||
};
|
};
|
||||||
match touched {
|
if let Some(channel) = touched {
|
||||||
Some(render::TouchChannel::Ecg) => open_ecg_menu(&app, &window,
|
open_module_menu(&app, &window, params.clone(),
|
||||||
params.clone(), admin_changed.clone(), monitor_menu.clone()),
|
admin_changed.clone(), monitor_menu.clone(), channel);
|
||||||
Some(channel) => open_module_menu(&app, &window, params.clone(),
|
|
||||||
admin_changed.clone(), monitor_menu.clone(), channel),
|
|
||||||
None => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -608,7 +605,16 @@ fn install_ecg_menu_style() {
|
||||||
window.ecg-settings button.ecg-apply {
|
window.ecg-settings button.ecg-apply {
|
||||||
color: #000000; background-color: #e5e9eb; font-weight: bold;
|
color: #000000; background-color: #e5e9eb; font-weight: bold;
|
||||||
}
|
}
|
||||||
window.ecg-settings button.ecg-close { background-color: #171717; }"
|
window.ecg-settings button.ecg-close { background-color: #171717; }
|
||||||
|
window.ecg-settings box.alarm-limit-frame {
|
||||||
|
border: 0.8px solid #6b757d; padding: 12px;
|
||||||
|
}
|
||||||
|
window.ecg-settings label.alarm-limit-heading {
|
||||||
|
font-weight: bold; font-size: 17px;
|
||||||
|
}
|
||||||
|
window.ecg-settings label.alarm-limit-column-heading {
|
||||||
|
font-size: 15px; font-weight: bold;
|
||||||
|
}"
|
||||||
);
|
);
|
||||||
gtk::style_context_add_provider_for_display(
|
gtk::style_context_add_provider_for_display(
|
||||||
&display, &provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION);
|
&display, &provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
|
@ -632,14 +638,12 @@ fn ecg_menu_divider() -> gtk::DrawingArea {
|
||||||
separator
|
separator
|
||||||
}
|
}
|
||||||
|
|
||||||
const TOUCH_HR_STEP: i32 = 5;
|
/// Apply a touchscreen step to an alarm value. When the alarm is disabled,
|
||||||
const MAX_HR_ALARM: i32 = 240;
|
/// either +/- first restores its last enabled value (unchanged behavior).
|
||||||
|
fn stepped_alarm_limit(current: Option<i32>, previous: i32,
|
||||||
/// When a limit is OFF, either +/- first restores its previous value (or
|
direction: i32, step: i32, maximum: i32) -> i32 {
|
||||||
/// a sensible initial value). Subsequent presses adjust it by 5 bpm.
|
current.map_or(previous, |value| {
|
||||||
fn stepped_hr_limit(current: Option<i32>, last_enabled: i32, direction: i32) -> i32 {
|
(value + step * direction).clamp(0, maximum)
|
||||||
current.map_or(last_enabled, |value| {
|
|
||||||
(value + TOUCH_HR_STEP * direction).clamp(0, MAX_HR_ALARM)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -649,200 +653,23 @@ fn show_touch_hr_limit(value: Option<i32>, number: >k::Label,
|
||||||
toggle.set_label(if value.is_some() { "OFF" } else { "ON" });
|
toggle.set_label(if value.is_some() { "OFF" } else { "ON" });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Large, keyboard-free +/- and ON/OFF controls. Returning a Cell permits
|
|
||||||
/// Apply to read the draft value without changing the shared configuration.
|
|
||||||
fn ecg_touch_limit(parent: >k::Box, caption: &str,
|
|
||||||
initial: Option<i32>, default: i32) -> Rc<Cell<Option<i32>>> {
|
|
||||||
let state = Rc::new(Cell::new(initial));
|
|
||||||
let previous = Rc::new(Cell::new(initial.unwrap_or(default)));
|
|
||||||
let row = gtk::Box::new(Orientation::Horizontal, 10);
|
|
||||||
|
|
||||||
let heading = gtk::Label::new(Some(caption));
|
|
||||||
heading.set_xalign(0.0);
|
|
||||||
heading.set_width_chars(10);
|
|
||||||
row.append(&heading);
|
|
||||||
|
|
||||||
let minus = gtk::Button::with_label("−");
|
|
||||||
minus.set_tooltip_text(Some("Decrease alarm limit by 5 bpm"));
|
|
||||||
minus.set_size_request(54, 50);
|
|
||||||
row.append(&minus);
|
|
||||||
|
|
||||||
let display = gtk::Label::new(None);
|
|
||||||
display.add_css_class("ecg-limit-value");
|
|
||||||
display.set_width_chars(5);
|
|
||||||
display.set_xalign(0.5);
|
|
||||||
row.append(&display);
|
|
||||||
|
|
||||||
let plus = gtk::Button::with_label("+");
|
|
||||||
plus.set_tooltip_text(Some("Increase alarm limit by 5 bpm"));
|
|
||||||
plus.set_size_request(54, 50);
|
|
||||||
row.append(&plus);
|
|
||||||
|
|
||||||
let enable_toggle = gtk::Button::new();
|
|
||||||
enable_toggle.set_tooltip_text(Some("Enable or disable this alarm limit"));
|
|
||||||
enable_toggle.set_size_request(78, 50);
|
|
||||||
row.append(&enable_toggle);
|
|
||||||
show_touch_hr_limit(initial, &display, &enable_toggle);
|
|
||||||
|
|
||||||
for (button, direction) in [(minus, -1), (plus, 1)] {
|
|
||||||
let state = state.clone();
|
|
||||||
let previous = previous.clone();
|
|
||||||
let display = display.clone();
|
|
||||||
let enable_toggle = enable_toggle.clone();
|
|
||||||
button.connect_clicked(move |_| {
|
|
||||||
let next = stepped_hr_limit(state.get(), previous.get(), direction);
|
|
||||||
state.set(Some(next));
|
|
||||||
previous.set(next);
|
|
||||||
show_touch_hr_limit(Some(next), &display, &enable_toggle);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
enable_toggle.connect_clicked({
|
|
||||||
let state = state.clone();
|
|
||||||
let previous = previous.clone();
|
|
||||||
let display = display.clone();
|
|
||||||
move |button| {
|
|
||||||
let new_value = match state.get() {
|
|
||||||
Some(value) => {
|
|
||||||
previous.set(value);
|
|
||||||
None
|
|
||||||
}
|
|
||||||
None => Some(previous.get()),
|
|
||||||
};
|
|
||||||
state.set(new_value);
|
|
||||||
show_touch_hr_limit(new_value, &display, button);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
parent.append(&row);
|
|
||||||
state
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Displayed only for touches in the ECG row. The monitor window can remain
|
|
||||||
/// fullscreen. The dialog is modal to that monitor, including on Wayland.
|
|
||||||
fn open_ecg_menu(app: &Application, monitor: &ApplicationWindow,
|
|
||||||
params: SharedParams, on_change: AdminChanged,
|
|
||||||
open_menu: MonitorMenuHandle) {
|
|
||||||
if let Some(existing) = open_menu.borrow().as_ref().and_then(|weak| weak.upgrade()) {
|
|
||||||
existing.present();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let limits = params.borrow().alarms.hr;
|
|
||||||
let dialog = gtk::Window::builder()
|
|
||||||
.application(app)
|
|
||||||
.title("ECG settings")
|
|
||||||
.transient_for(monitor)
|
|
||||||
.modal(true)
|
|
||||||
.resizable(false)
|
|
||||||
.default_width(550)
|
|
||||||
.default_height(345)
|
|
||||||
.build();
|
|
||||||
dialog.add_css_class("ecg-settings");
|
|
||||||
dialog.set_decorated(false);
|
|
||||||
*open_menu.borrow_mut() = Some(dialog.downgrade());
|
|
||||||
|
|
||||||
let content = gtk::Box::new(Orientation::Vertical, 12);
|
|
||||||
content.add_css_class("ecg-panel");
|
|
||||||
content.set_margin_top(1);
|
|
||||||
content.set_margin_bottom(1);
|
|
||||||
content.set_margin_start(1);
|
|
||||||
content.set_margin_end(1);
|
|
||||||
// Inner padding keeps controls away from the thin panel border.
|
|
||||||
let inner = gtk::Box::new(Orientation::Vertical, 12);
|
|
||||||
inner.set_margin_top(20);
|
|
||||||
inner.set_margin_bottom(20);
|
|
||||||
inner.set_margin_start(20);
|
|
||||||
inner.set_margin_end(20);
|
|
||||||
content.append(&inner);
|
|
||||||
|
|
||||||
let title = gtk::Label::new(Some("ECG / SETTINGS"));
|
|
||||||
title.set_xalign(0.0);
|
|
||||||
title.add_css_class("title-2");
|
|
||||||
inner.append(&title);
|
|
||||||
inner.append(&ecg_menu_divider());
|
|
||||||
|
|
||||||
let limits_header = gtk::Label::new(Some("HR alarm limits · bpm"));
|
|
||||||
limits_header.set_xalign(0.0);
|
|
||||||
inner.append(&limits_header);
|
|
||||||
let lower = ecg_touch_limit(&inner, "↓ Lower", limits.lower, 60);
|
|
||||||
let upper = ecg_touch_limit(&inner, "↑ Upper", limits.upper, 100);
|
|
||||||
let hint = gtk::Label::new(Some(
|
|
||||||
"+/− adjusts by 5 bpm. OFF disables the limit; ON restores it."
|
|
||||||
));
|
|
||||||
hint.set_wrap(true);
|
|
||||||
hint.set_xalign(0.0);
|
|
||||||
inner.append(&hint);
|
|
||||||
inner.append(&ecg_menu_divider());
|
|
||||||
|
|
||||||
let error = gtk::Label::new(None);
|
|
||||||
error.add_css_class("menu-error");
|
|
||||||
error.set_xalign(0.0);
|
|
||||||
error.set_wrap(true);
|
|
||||||
inner.append(&error);
|
|
||||||
|
|
||||||
let buttons = gtk::Box::new(Orientation::Horizontal, 12);
|
|
||||||
buttons.set_halign(gtk::Align::End);
|
|
||||||
let cancel = gtk::Button::with_label("Cancel");
|
|
||||||
cancel.add_css_class("ecg-close");
|
|
||||||
cancel.connect_clicked({
|
|
||||||
let weak = dialog.downgrade();
|
|
||||||
move |_| { if let Some(window) = weak.upgrade() { window.close(); } }
|
|
||||||
});
|
|
||||||
let apply = gtk::Button::with_label("Apply");
|
|
||||||
apply.add_css_class("ecg-apply");
|
|
||||||
apply.connect_clicked({
|
|
||||||
let weak = dialog.downgrade();
|
|
||||||
move |_| {
|
|
||||||
let new_limits = AlarmLimits { lower: lower.get(), upper: upper.get() };
|
|
||||||
if !new_limits.valid() {
|
|
||||||
error.set_text("The lower limit must not exceed the upper limit.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let alarm_changed = {
|
|
||||||
let mut p = params.borrow_mut();
|
|
||||||
let changed = p.alarms.hr != new_limits;
|
|
||||||
p.alarms.hr = new_limits;
|
|
||||||
changed
|
|
||||||
};
|
|
||||||
if let Some(callback) = on_change.borrow().as_ref() {
|
|
||||||
callback(alarm_changed);
|
|
||||||
}
|
|
||||||
if let Some(window) = weak.upgrade() { window.close(); }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
buttons.append(&cancel);
|
|
||||||
buttons.append(&apply);
|
|
||||||
inner.append(&buttons);
|
|
||||||
dialog.set_child(Some(&content));
|
|
||||||
|
|
||||||
let escape = gtk::EventControllerKey::new();
|
|
||||||
escape.connect_key_pressed({
|
|
||||||
let weak = dialog.downgrade();
|
|
||||||
move |_, key, _, _| {
|
|
||||||
if key == gdk::Key::Escape {
|
|
||||||
if let Some(window) = weak.upgrade() { window.close(); }
|
|
||||||
glib::Propagation::Stop
|
|
||||||
} else { glib::Propagation::Proceed }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dialog.add_controller(escape);
|
|
||||||
dialog.present();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod ecg_touch_menu_tests {
|
mod ecg_touch_menu_tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn touch_step_uses_five_bpm_and_respects_bounds() {
|
fn touch_step_preserves_per_parameter_increment_and_bounds() {
|
||||||
assert_eq!(stepped_hr_limit(Some(60), 60, 1), 65);
|
assert_eq!(stepped_alarm_limit(Some(60), 60, 1, 5, 240), 65);
|
||||||
assert_eq!(stepped_hr_limit(Some(60), 60, -1), 55);
|
assert_eq!(stepped_alarm_limit(Some(60), 60, -1, 5, 240), 55);
|
||||||
assert_eq!(stepped_hr_limit(Some(240), 240, 1), 240);
|
assert_eq!(stepped_alarm_limit(Some(240), 240, 1, 5, 240), 240);
|
||||||
assert_eq!(stepped_hr_limit(Some(0), 0, -1), 0);
|
assert_eq!(stepped_alarm_limit(Some(0), 0, -1, 5, 240), 0);
|
||||||
|
assert_eq!(stepped_alarm_limit(Some(90), 90, 1, 1, 100), 91);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn disabled_alarm_reenables_at_last_saved_value() {
|
fn disabled_alarm_reenables_at_last_saved_value() {
|
||||||
assert_eq!(stepped_hr_limit(None, 60, 1), 60);
|
assert_eq!(stepped_alarm_limit(None, 60, 1, 5, 240), 60);
|
||||||
assert_eq!(stepped_hr_limit(None, 100, -1), 100);
|
assert_eq!(stepped_alarm_limit(None, 100, -1, 5, 240), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
@ -887,6 +714,9 @@ fn module_alarm_specs(channel: render::TouchChannel, p: &Parameters) -> Vec<Touc
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
match channel {
|
match channel {
|
||||||
|
render::TouchChannel::Ecg => {
|
||||||
|
limits!("HR", "bpm", hr, 240, 5, 60, 100);
|
||||||
|
}
|
||||||
render::TouchChannel::Spo2 => {
|
render::TouchChannel::Spo2 => {
|
||||||
limits!("SpO₂", "%", spo2, 100, 1, 90, 100);
|
limits!("SpO₂", "%", spo2, 100, 1, 90, 100);
|
||||||
limits!("Pulse rate", "bpm", pr, 240, 5, 50, 120);
|
limits!("Pulse rate", "bpm", pr, 240, 5, 50, 120);
|
||||||
|
|
@ -906,50 +736,53 @@ fn module_alarm_specs(channel: render::TouchChannel, p: &Parameters) -> Vec<Touc
|
||||||
limits!("NIBP MAP", "mmHg", nibp_map, 260, 5, 60, 100);
|
limits!("NIBP MAP", "mmHg", nibp_map, 260, 5, 60, 100);
|
||||||
limits!("NIBP diastolic", "mmHg", nibp_dia, 260, 5, 40, 100);
|
limits!("NIBP diastolic", "mmHg", nibp_dia, 260, 5, 40, 100);
|
||||||
}
|
}
|
||||||
render::TouchChannel::Ecg => {}
|
|
||||||
}
|
}
|
||||||
specs
|
specs
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generic unit-aware limit control with large +/- and ON/OFF touch buttons.
|
/// A compact alarm-limit cell: [+] value [−] [OFF/ON]. Its buttons retain
|
||||||
/// Unlike the ECG-only helper, the increment and permitted range are per value.
|
/// the old size/style, step size, last-value restoration and draft semantics.
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn module_touch_limit(parent: >k::Box, caption: &str, initial: Option<i32>,
|
fn alarm_matrix_cell(initial: Option<i32>, fallback: i32, step: i32,
|
||||||
fallback: i32, step: i32, maximum: i32) -> Rc<Cell<Option<i32>>> {
|
maximum: i32) -> (gtk::Box, Rc<Cell<Option<i32>>>) {
|
||||||
let state = Rc::new(Cell::new(initial));
|
let state = Rc::new(Cell::new(initial));
|
||||||
let previous = Rc::new(Cell::new(initial.unwrap_or(fallback)));
|
let previous = Rc::new(Cell::new(initial.unwrap_or(fallback)));
|
||||||
let row = gtk::Box::new(Orientation::Horizontal, 10);
|
let controls = gtk::Box::new(Orientation::Horizontal, 5);
|
||||||
let caption_label = gtk::Label::new(Some(caption));
|
controls.set_hexpand(true);
|
||||||
caption_label.set_width_chars(10);
|
controls.set_halign(gtk::Align::Center);
|
||||||
caption_label.set_xalign(0.0);
|
|
||||||
row.append(&caption_label);
|
|
||||||
let minus = gtk::Button::with_label("−");
|
|
||||||
minus.set_size_request(54, 50);
|
|
||||||
let display = gtk::Label::new(None);
|
|
||||||
display.add_css_class("ecg-limit-value");
|
|
||||||
display.set_xalign(0.5);
|
|
||||||
display.set_width_chars(5);
|
|
||||||
let plus = gtk::Button::with_label("+");
|
let plus = gtk::Button::with_label("+");
|
||||||
plus.set_size_request(54, 50);
|
plus.set_size_request(54, 50);
|
||||||
|
plus.set_tooltip_text(Some("Increase alarm limit"));
|
||||||
|
let display = gtk::Label::new(None);
|
||||||
|
display.add_css_class("ecg-limit-value");
|
||||||
|
display.set_width_chars(5);
|
||||||
|
display.set_xalign(0.5);
|
||||||
|
let minus = gtk::Button::with_label("−");
|
||||||
|
minus.set_size_request(54, 50);
|
||||||
|
minus.set_tooltip_text(Some("Decrease alarm limit"));
|
||||||
let toggle = gtk::Button::new();
|
let toggle = gtk::Button::new();
|
||||||
toggle.set_size_request(78, 50);
|
toggle.set_size_request(78, 50);
|
||||||
|
toggle.set_tooltip_text(Some("Enable or disable this alarm limit"));
|
||||||
show_touch_hr_limit(initial, &display, &toggle);
|
show_touch_hr_limit(initial, &display, &toggle);
|
||||||
row.append(&minus);
|
|
||||||
row.append(&display);
|
// Requested left-to-right order: plus, value, minus, OFF.
|
||||||
row.append(&plus);
|
controls.append(&plus);
|
||||||
row.append(&toggle);
|
controls.append(&display);
|
||||||
for (button, direction) in [(minus, -1), (plus, 1)] {
|
controls.append(&minus);
|
||||||
|
controls.append(&toggle);
|
||||||
|
|
||||||
|
for (button, direction) in [(plus, 1), (minus, -1)] {
|
||||||
let state = state.clone();
|
let state = state.clone();
|
||||||
let previous = previous.clone();
|
let previous = previous.clone();
|
||||||
let display = display.clone();
|
let display = display.clone();
|
||||||
let toggle = toggle.clone();
|
let toggle = toggle.clone();
|
||||||
button.connect_clicked(move |_| {
|
button.connect_clicked(move |_| {
|
||||||
let new_value = state.get().map_or(previous.get(), |current| {
|
let next = stepped_alarm_limit(state.get(), previous.get(),
|
||||||
(current + direction * step).clamp(0, maximum)
|
direction, step, maximum);
|
||||||
});
|
state.set(Some(next));
|
||||||
state.set(Some(new_value));
|
previous.set(next);
|
||||||
previous.set(new_value);
|
show_touch_hr_limit(Some(next), &display, &toggle);
|
||||||
show_touch_hr_limit(Some(new_value), &display, &toggle);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
toggle.connect_clicked({
|
toggle.connect_clicked({
|
||||||
|
|
@ -957,16 +790,80 @@ fn module_touch_limit(parent: >k::Box, caption: &str, initial: Option<i32>,
|
||||||
let previous = previous.clone();
|
let previous = previous.clone();
|
||||||
let display = display.clone();
|
let display = display.clone();
|
||||||
move |button| {
|
move |button| {
|
||||||
let new_value = match state.get() {
|
let next = match state.get() {
|
||||||
Some(value) => { previous.set(value); None }
|
Some(value) => { previous.set(value); None }
|
||||||
None => Some(previous.get()),
|
None => Some(previous.get()),
|
||||||
};
|
};
|
||||||
state.set(new_value);
|
state.set(next);
|
||||||
show_touch_hr_limit(new_value, &display, button);
|
show_touch_hr_limit(next, &display, button);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
parent.append(&row);
|
(controls, state)
|
||||||
state
|
}
|
||||||
|
|
||||||
|
/// Short names in the alarm matrix; full labels remain available as tooltips.
|
||||||
|
fn alarm_matrix_label(name: &str) -> &str {
|
||||||
|
match name {
|
||||||
|
"ART systolic" | "NIBP systolic" => "SYS",
|
||||||
|
"ART MAP" | "NIBP MAP" => "MAP",
|
||||||
|
"ART diastolic" | "NIBP diastolic" => "DIA",
|
||||||
|
"Pulse rate" => "PR",
|
||||||
|
"Respiratory rate" => "RR",
|
||||||
|
other => other,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Common touchscreen matrix for ECG, SpO2, ART, CO2 and NIBP.
|
||||||
|
/// Each parameter occupies one horizontal row; lower and upper limits have
|
||||||
|
/// identical columns and the action order [+] value [−] [OFF/ON].
|
||||||
|
fn alarm_limit_matrix(specs: Vec<TouchAlarmSpec>,
|
||||||
|
drafts: &mut Vec<TouchAlarmDraft>) -> gtk::Box {
|
||||||
|
let frame = gtk::Box::new(Orientation::Vertical, 8);
|
||||||
|
frame.add_css_class("alarm-limit-frame");
|
||||||
|
frame.set_hexpand(true);
|
||||||
|
|
||||||
|
let heading = gtk::Label::new(Some("Alarm Limits"));
|
||||||
|
heading.add_css_class("alarm-limit-heading");
|
||||||
|
heading.set_xalign(0.0);
|
||||||
|
frame.append(&heading);
|
||||||
|
|
||||||
|
let grid = gtk::Grid::new();
|
||||||
|
grid.set_hexpand(true);
|
||||||
|
grid.set_column_spacing(8);
|
||||||
|
grid.set_row_spacing(8);
|
||||||
|
|
||||||
|
for (column, text) in [(1, "↓ Lower"), (2, "↑ Upper")] {
|
||||||
|
let label = gtk::Label::new(Some(text));
|
||||||
|
label.add_css_class("alarm-limit-column-heading");
|
||||||
|
label.set_halign(gtk::Align::Center);
|
||||||
|
grid.attach(&label, column, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (index, spec) in specs.into_iter().enumerate() {
|
||||||
|
// An empty narrow divider row keeps each parameter visually distinct.
|
||||||
|
let base = 1 + (index as i32) * 2;
|
||||||
|
if index > 0 {
|
||||||
|
grid.attach(&ecg_menu_divider(), 0, base - 1, 3, 1);
|
||||||
|
}
|
||||||
|
let label = gtk::Label::new(Some(alarm_matrix_label(spec.name)));
|
||||||
|
label.set_xalign(0.0);
|
||||||
|
label.set_tooltip_text(Some(&format!("{} ({})", spec.name, spec.unit)));
|
||||||
|
label.add_css_class("alarm-limit-heading");
|
||||||
|
label.set_width_chars(5);
|
||||||
|
grid.attach(&label, 0, base, 1, 1);
|
||||||
|
|
||||||
|
let (lower_controls, lower) = alarm_matrix_cell(spec.limits.lower,
|
||||||
|
spec.restore_lower, spec.step, spec.maximum);
|
||||||
|
let (upper_controls, upper) = alarm_matrix_cell(spec.limits.upper,
|
||||||
|
spec.restore_upper, spec.step, spec.maximum);
|
||||||
|
grid.attach(&lower_controls, 1, base, 1, 1);
|
||||||
|
grid.attach(&upper_controls, 2, base, 1, 1);
|
||||||
|
drafts.push(TouchAlarmDraft {
|
||||||
|
name: spec.name, lower, upper, apply: spec.apply,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
frame.append(&grid);
|
||||||
|
frame
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A monitor-side menu may change only alarm limits. All patient and
|
/// A monitor-side menu may change only alarm limits. All patient and
|
||||||
|
|
@ -998,7 +895,7 @@ fn open_module_menu(app: &Application, monitor: &ApplicationWindow,
|
||||||
render::TouchChannel::Art => "ART / SETTINGS",
|
render::TouchChannel::Art => "ART / SETTINGS",
|
||||||
render::TouchChannel::Capno => "CO₂ / SETTINGS",
|
render::TouchChannel::Capno => "CO₂ / SETTINGS",
|
||||||
render::TouchChannel::Nibp => "NIBP / SETTINGS",
|
render::TouchChannel::Nibp => "NIBP / SETTINGS",
|
||||||
render::TouchChannel::Ecg => return,
|
render::TouchChannel::Ecg => "ECG / SETTINGS",
|
||||||
};
|
};
|
||||||
let dialog = gtk::Window::builder()
|
let dialog = gtk::Window::builder()
|
||||||
.application(app)
|
.application(app)
|
||||||
|
|
@ -1006,8 +903,13 @@ fn open_module_menu(app: &Application, monitor: &ApplicationWindow,
|
||||||
.transient_for(monitor)
|
.transient_for(monitor)
|
||||||
.modal(true)
|
.modal(true)
|
||||||
.resizable(true)
|
.resizable(true)
|
||||||
.default_width(560)
|
.default_width(800)
|
||||||
.default_height(if channel == render::TouchChannel::Art { 720 } else { 610 })
|
.default_height(match channel {
|
||||||
|
render::TouchChannel::Art => 560,
|
||||||
|
render::TouchChannel::Nibp => 490,
|
||||||
|
render::TouchChannel::Ecg => 310,
|
||||||
|
_ => 420,
|
||||||
|
})
|
||||||
.build();
|
.build();
|
||||||
dialog.add_css_class("ecg-settings");
|
dialog.add_css_class("ecg-settings");
|
||||||
dialog.set_decorated(false);
|
dialog.set_decorated(false);
|
||||||
|
|
@ -1036,28 +938,22 @@ fn open_module_menu(app: &Application, monitor: &ApplicationWindow,
|
||||||
inner.append(&heading);
|
inner.append(&heading);
|
||||||
inner.append(&ecg_menu_divider());
|
inner.append(&ecg_menu_divider());
|
||||||
|
|
||||||
// Every numeric alarm has two optional bounds, editable without a keyboard.
|
// A shared horizontal matrix is used in every monitor-side touch menu.
|
||||||
let specs = module_alarm_specs(channel, ¤t);
|
let specs = module_alarm_specs(channel, ¤t);
|
||||||
let mut alarm_drafts = Vec::new();
|
let mut alarm_drafts = Vec::new();
|
||||||
for spec in specs {
|
inner.append(&alarm_limit_matrix(specs, &mut alarm_drafts));
|
||||||
let label = gtk::Label::new(Some(&format!("{} alarm limits · {}", spec.name, spec.unit)));
|
|
||||||
label.set_xalign(0.0);
|
|
||||||
inner.append(&label);
|
|
||||||
let lower = module_touch_limit(&inner, "↓ Lower", spec.limits.lower,
|
|
||||||
spec.restore_lower, spec.step, spec.maximum);
|
|
||||||
let upper = module_touch_limit(&inner, "↑ Upper", spec.limits.upper,
|
|
||||||
spec.restore_upper, spec.step, spec.maximum);
|
|
||||||
alarm_drafts.push(TouchAlarmDraft {
|
|
||||||
name: spec.name, lower, upper, apply: spec.apply,
|
|
||||||
});
|
|
||||||
inner.append(&ecg_menu_divider());
|
|
||||||
}
|
|
||||||
|
|
||||||
let error = gtk::Label::new(None);
|
let error = gtk::Label::new(None);
|
||||||
error.set_xalign(0.0);
|
error.set_xalign(0.0);
|
||||||
error.add_css_class("menu-error");
|
error.add_css_class("menu-error");
|
||||||
error.set_wrap(true);
|
error.set_wrap(true);
|
||||||
inner.append(&error);
|
// Validation and Apply/Cancel stay fixed when the matrix scrolls.
|
||||||
|
let footer = gtk::Box::new(Orientation::Vertical, 8);
|
||||||
|
footer.set_margin_start(20);
|
||||||
|
footer.set_margin_end(20);
|
||||||
|
footer.set_margin_top(8);
|
||||||
|
footer.set_margin_bottom(12);
|
||||||
|
footer.append(&error);
|
||||||
let buttons = gtk::Box::new(Orientation::Horizontal, 12);
|
let buttons = gtk::Box::new(Orientation::Horizontal, 12);
|
||||||
buttons.set_halign(gtk::Align::End);
|
buttons.set_halign(gtk::Align::End);
|
||||||
let cancel = gtk::Button::with_label("Cancel");
|
let cancel = gtk::Button::with_label("Cancel");
|
||||||
|
|
@ -1097,7 +993,8 @@ fn open_module_menu(app: &Application, monitor: &ApplicationWindow,
|
||||||
});
|
});
|
||||||
buttons.append(&cancel);
|
buttons.append(&cancel);
|
||||||
buttons.append(&apply);
|
buttons.append(&apply);
|
||||||
inner.append(&buttons);
|
footer.append(&buttons);
|
||||||
|
content.append(&footer);
|
||||||
dialog.set_child(Some(&content));
|
dialog.set_child(Some(&content));
|
||||||
|
|
||||||
let escape = gtk::EventControllerKey::new();
|
let escape = gtk::EventControllerKey::new();
|
||||||
|
|
@ -1133,6 +1030,39 @@ mod module_touch_menu_tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn alarm_matrix_order_and_labels() {
|
||||||
|
let p = Parameters::default();
|
||||||
|
for (channel, names) in [
|
||||||
|
(render::TouchChannel::Ecg, vec!["HR"]),
|
||||||
|
(render::TouchChannel::Spo2, vec!["SpO₂", "PR"]),
|
||||||
|
(render::TouchChannel::Art, vec!["SYS", "MAP", "DIA", "PPV"]),
|
||||||
|
(render::TouchChannel::Capno, vec!["EtCO₂", "RR"]),
|
||||||
|
(render::TouchChannel::Nibp, vec!["SYS", "MAP", "DIA"]),
|
||||||
|
] {
|
||||||
|
let specs = module_alarm_specs(channel, &p);
|
||||||
|
let actual: Vec<_> = specs.iter()
|
||||||
|
.map(|spec| alarm_matrix_label(spec.name)).collect();
|
||||||
|
assert_eq!(actual, names);
|
||||||
|
}
|
||||||
|
// Same underlying ART alarm setters are retained after rearrangement.
|
||||||
|
let specs = module_alarm_specs(render::TouchChannel::Art, &p);
|
||||||
|
let limits = [
|
||||||
|
AlarmLimits { lower: Some(80), upper: Some(180) },
|
||||||
|
AlarmLimits { lower: Some(60), upper: Some(100) },
|
||||||
|
AlarmLimits { lower: None, upper: None },
|
||||||
|
AlarmLimits { lower: None, upper: Some(10) },
|
||||||
|
];
|
||||||
|
let mut alarms = AlarmSettings::default();
|
||||||
|
for (spec, value) in specs.into_iter().zip(limits.iter().copied()) {
|
||||||
|
(spec.apply)(&mut alarms, value);
|
||||||
|
}
|
||||||
|
assert_eq!(alarms.art_sys, limits[0]);
|
||||||
|
assert_eq!(alarms.art_map, limits[1]);
|
||||||
|
assert_eq!(alarms.art_dia, limits[2]);
|
||||||
|
assert_eq!(alarms.ppv, limits[3]);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn touchscreen_applies_only_alarm_limits_and_preserves_other_controls() {
|
fn touchscreen_applies_only_alarm_limits_and_preserves_other_controls() {
|
||||||
let mut p = Parameters::default();
|
let mut p = Parameters::default();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue