Permit toggling well volume display
This commit is contained in:
parent
844bd14b4f
commit
c28ec328f9
|
|
@ -5,6 +5,7 @@ use plate_tool_lib::transfer_region::Region;
|
|||
use plate_tool_lib::uuid::Uuid;
|
||||
use plate_tool_lib::Well;
|
||||
|
||||
use crate::main_state;
|
||||
use crate::transfer_menu::CurrentTransferState;
|
||||
|
||||
use std::sync::LazyLock;
|
||||
|
|
@ -56,6 +57,7 @@ impl WellInfo {
|
|||
#[derive(Clone, Copy, Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct PlateDisplayOptions {
|
||||
pub show_transfer_hashes: bool,
|
||||
pub show_well_volumes: bool,
|
||||
pub show_volume_heatmap: bool,
|
||||
pub show_coordinates: bool,
|
||||
}
|
||||
|
|
@ -63,6 +65,7 @@ impl Default for PlateDisplayOptions {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
show_transfer_hashes: true,
|
||||
show_well_volumes: true,
|
||||
show_volume_heatmap: false,
|
||||
show_coordinates: true,
|
||||
}
|
||||
|
|
@ -422,16 +425,18 @@ fn add_plate_sub(
|
|||
|
||||
// Draw volume text
|
||||
|
||||
if let Some(well_info) =
|
||||
well_infos[(c_row - 1) as usize * columns as usize + (c_column - 1) as usize]
|
||||
{
|
||||
painter.text(
|
||||
center,
|
||||
egui::Align2::CENTER_CENTER,
|
||||
format!("{:.1}", well_info.volume),
|
||||
egui::FontId::proportional(radius * 0.6),
|
||||
egui::Color32::BLACK,
|
||||
);
|
||||
if display_options.show_well_volumes {
|
||||
if let Some(well_info) =
|
||||
well_infos[(c_row - 1) as usize * columns as usize + (c_column - 1) as usize]
|
||||
{
|
||||
painter.text(
|
||||
center,
|
||||
egui::Align2::CENTER_CENTER,
|
||||
format!("{:.1}", well_info.volume),
|
||||
egui::FontId::proportional(radius * 0.6),
|
||||
egui::Color32::BLACK,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -127,7 +127,10 @@ fn render_export_menu(
|
|||
};
|
||||
if let Ok(data) = data {
|
||||
let bytes: &[u8] = data.as_bytes();
|
||||
log::info!("There are {} bytes to be written to chosen file", bytes.len());
|
||||
log::info!(
|
||||
"There are {} bytes to be written to chosen file",
|
||||
bytes.len()
|
||||
);
|
||||
save_file(bytes, Some("transfers.csv"));
|
||||
}
|
||||
}
|
||||
|
|
@ -158,7 +161,7 @@ fn render_import_menu(
|
|||
Ok(new_main_state) => {
|
||||
log::info!("Loaded new main state from file.");
|
||||
*main_state = new_main_state
|
||||
},
|
||||
}
|
||||
Err(e) => log::error!("Failed loading imported state JSON: {}", e),
|
||||
}
|
||||
}
|
||||
|
|
@ -176,7 +179,9 @@ fn render_import_menu(
|
|||
if let Ok(data) = String::from_utf8(data.to_vec()) {
|
||||
let auto_output = plate_tool_lib::csv::read_csv_auto(&data);
|
||||
main_state.source_plates.extend(auto_output.sources);
|
||||
main_state.destination_plates.extend(auto_output.destinations);
|
||||
main_state
|
||||
.destination_plates
|
||||
.extend(auto_output.destinations);
|
||||
main_state.transfers.extend(auto_output.transfers);
|
||||
}
|
||||
}
|
||||
|
|
@ -197,6 +202,10 @@ fn render_options_menu(
|
|||
&mut main_window_state.plate_display_options.show_transfer_hashes,
|
||||
"Toggle transfer hashes",
|
||||
);
|
||||
ui.toggle_value(
|
||||
&mut main_window_state.plate_display_options.show_well_volumes,
|
||||
"Show volumes in wells",
|
||||
);
|
||||
ui.toggle_value(
|
||||
&mut main_window_state.plate_display_options.show_volume_heatmap,
|
||||
"Toggle volume heatmap",
|
||||
|
|
|
|||
Loading…
Reference in New Issue