Compare commits
2 commits
e554dc30d0
...
f78fc95c50
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f78fc95c50 | ||
![]() |
82b69bd6b9 |
1 changed files with 13 additions and 4 deletions
|
@ -352,8 +352,9 @@ fn model(app: &App) -> GuiModel {
|
||||||
// A user-interface to tweak the settings.
|
// A user-interface to tweak the settings.
|
||||||
let window = app.window(w_id_lasersettings).unwrap();
|
let window = app.window(w_id_lasersettings).unwrap();
|
||||||
let egui = Egui::from_window(&window);
|
let egui = Egui::from_window(&window);
|
||||||
// egui.ctx().set_fonts(fonts());
|
|
||||||
egui.ctx().set_style(style());
|
let egui_ctx = egui.ctx();
|
||||||
|
egui_ctx.set_style(style());
|
||||||
|
|
||||||
let current_lines = RenderableLines::new(); //Vec::new();
|
let current_lines = RenderableLines::new(); //Vec::new();
|
||||||
|
|
||||||
|
@ -393,7 +394,6 @@ fn laser_frame_producer(model: &mut LaserModel, frame: &mut laser::Frame){
|
||||||
// println!("Cropped Points {} (was: {})", new_laser_points.len(), pointno);
|
// println!("Cropped Points {} (was: {})", new_laser_points.len(), pointno);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
frame.add_lines(new_laser_points);
|
frame.add_lines(new_laser_points);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -628,12 +628,21 @@ fn update(_app: &App, model: &mut GuiModel, update: Update) {
|
||||||
);
|
);
|
||||||
|
|
||||||
for (dac_id, _config) in per_laser_config.iter() {
|
for (dac_id, _config) in per_laser_config.iter() {
|
||||||
|
let is_available = laser_streams.contains_key(&dac_id);
|
||||||
|
ui.style_mut().visuals.override_text_color = if is_available {Some(egui::Color32::GREEN)} else {None};
|
||||||
|
ui.style_mut().visuals.widgets.inactive.bg_stroke = if is_available {egui::Stroke::new(2.0, egui::Color32::GREEN)} else {egui::Stroke::NONE};
|
||||||
|
let name = if let Some(config) = per_laser_config.get(&dac_id) { config.name.clone() } else { "DAC".into() };
|
||||||
|
let indicator = if is_available{" 🔌"}else{""};
|
||||||
|
// egui::widgets::SelectableLabel cannot have border unless hovered/highlighted
|
||||||
|
// TODO: alternatively underscore with ui.painter().rect/hline(ui.selectable_value().rect.max/min, ....)
|
||||||
ui.selectable_value(
|
ui.selectable_value(
|
||||||
selected_stream,
|
selected_stream,
|
||||||
Some(dac_id.clone()),
|
Some(dac_id.clone()),
|
||||||
if let Some(config) = per_laser_config.get(&dac_id) { config.name.clone() } else { "DAC".into() }
|
format!("{name}{indicator}")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// reset
|
||||||
|
ui.style_mut().visuals.override_text_color = None;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue