Format and clean warnings
This commit is contained in:
parent
afc06d7dd5
commit
37da146940
|
@ -17,7 +17,7 @@ use crate::data::plate_instances::PlateInstance;
|
||||||
#[function_component]
|
#[function_component]
|
||||||
pub fn MainWindow() -> Html {
|
pub fn MainWindow() -> Html {
|
||||||
let (main_state, main_dispatch) = use_store::<MainState>();
|
let (main_state, main_dispatch) = use_store::<MainState>();
|
||||||
let (ct_state, ct_dispatch) = use_store::<CurrentTransfer>();
|
let (_, ct_dispatch) = use_store::<CurrentTransfer>();
|
||||||
|
|
||||||
let source_plate_instance: Option<PlateInstance> = main_state
|
let source_plate_instance: Option<PlateInstance> = main_state
|
||||||
.source_plates
|
.source_plates
|
||||||
|
@ -152,8 +152,7 @@ pub fn MainWindow() -> Html {
|
||||||
let main_dispatch = main_dispatch.clone(); // Clone to satisfy FnMut
|
let main_dispatch = main_dispatch.clone(); // Clone to satisfy FnMut
|
||||||
// trait
|
// trait
|
||||||
let modal = modal.clone();
|
let modal = modal.clone();
|
||||||
let onload = Closure::<dyn FnMut(_)>::new(move |e: Event| {
|
let onload = Closure::<dyn FnMut(_)>::new(move |_: Event| {
|
||||||
log::debug!("{:?}", &fr1.result());
|
|
||||||
if let Some(value) =
|
if let Some(value) =
|
||||||
&fr1.result().ok().and_then(|v| v.as_string())
|
&fr1.result().ok().and_then(|v| v.as_string())
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ use web_sys::{EventTarget, FormData, HtmlDialogElement, HtmlFormElement};
|
||||||
|
|
||||||
use crate::components::states::MainState;
|
use crate::components::states::MainState;
|
||||||
use crate::data::plate::*;
|
use crate::data::plate::*;
|
||||||
use crate::data::{plate_instances::PlateInstance, transfer::Transfer};
|
use crate::data::plate_instances::PlateInstance;
|
||||||
|
|
||||||
#[derive(PartialEq, Properties)]
|
#[derive(PartialEq, Properties)]
|
||||||
pub struct NewPlateDialogProps {
|
pub struct NewPlateDialogProps {
|
||||||
|
@ -15,7 +15,7 @@ pub struct NewPlateDialogProps {
|
||||||
|
|
||||||
#[function_component]
|
#[function_component]
|
||||||
pub fn NewPlateDialog(props: &NewPlateDialogProps) -> Html {
|
pub fn NewPlateDialog(props: &NewPlateDialogProps) -> Html {
|
||||||
let (state, dispatch) = use_store::<MainState>();
|
let (_, dispatch) = use_store::<MainState>();
|
||||||
|
|
||||||
let new_plate_callback = {
|
let new_plate_callback = {
|
||||||
let dispatch = dispatch.clone();
|
let dispatch = dispatch.clone();
|
||||||
|
@ -62,7 +62,7 @@ pub fn NewPlateDialog(props: &NewPlateDialogProps) -> Html {
|
||||||
|
|
||||||
let onclose = {
|
let onclose = {
|
||||||
let close_callback = props.close_callback.clone();
|
let close_callback = props.close_callback.clone();
|
||||||
Callback::from(move |e: Event| {
|
Callback::from(move |_: Event| {
|
||||||
close_callback.emit(());
|
close_callback.emit(());
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@ use yewdux::prelude::*;
|
||||||
|
|
||||||
use crate::components::states::{CurrentTransfer, MainState};
|
use crate::components::states::{CurrentTransfer, MainState};
|
||||||
use crate::data::plate_instances::PlateInstance;
|
use crate::data::plate_instances::PlateInstance;
|
||||||
use crate::data::transfer_region::{Region, TransferRegion};
|
use crate::data::transfer_region::Region;
|
||||||
|
|
||||||
// Color Palette for the Source Plates, can be changed here
|
// Color Palette for the Source Plates, can be changed here
|
||||||
use crate::components::plates::util::Palettes;
|
use crate::components::plates::util::Palettes;
|
||||||
|
|
|
@ -6,7 +6,7 @@ use yewdux::prelude::*;
|
||||||
|
|
||||||
use crate::components::states::{CurrentTransfer, MainState};
|
use crate::components::states::{CurrentTransfer, MainState};
|
||||||
use crate::data::plate_instances::PlateInstance;
|
use crate::data::plate_instances::PlateInstance;
|
||||||
use crate::data::transfer_region::{Region, TransferRegion};
|
use crate::data::transfer_region::Region;
|
||||||
|
|
||||||
// Color Palette for the Source Plates, can be changed here
|
// Color Palette for the Source Plates, can be changed here
|
||||||
use crate::components::plates::util::Palettes;
|
use crate::components::plates::util::Palettes;
|
||||||
|
|
|
@ -11,7 +11,7 @@ pub struct ColorPalette {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ColorPalette {
|
impl ColorPalette {
|
||||||
pub fn new(a: [f64; 3], b: [f64; 3], c: [f64; 3], d: [f64; 3]) -> Self {
|
pub fn _new(a: [f64; 3], b: [f64; 3], c: [f64; 3], d: [f64; 3]) -> Self {
|
||||||
ColorPalette { a, b, c, d }
|
ColorPalette { a, b, c, d }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use yewdux::{prelude::*, storage};
|
use yewdux::{prelude::*, storage};
|
||||||
|
|
||||||
use super::transfer_menu::RegionDisplay;
|
|
||||||
use crate::data::plate::*;
|
use crate::data::plate::*;
|
||||||
use crate::data::plate_instances::PlateInstance;
|
use crate::data::plate_instances::PlateInstance;
|
||||||
use crate::data::transfer::Transfer;
|
use crate::data::transfer::Transfer;
|
||||||
|
@ -32,13 +31,6 @@ impl Store for MainState {
|
||||||
storage::load(storage::Area::Local)
|
storage::load(storage::Area::Local)
|
||||||
.expect("Unable to load state")
|
.expect("Unable to load state")
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
/*
|
|
||||||
Self {
|
|
||||||
source_plates: Vec::new(),
|
|
||||||
destination_plates: Vec::new(),
|
|
||||||
transfers: Vec::new(),
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn should_notify(&self, old: &Self) -> bool {
|
fn should_notify(&self, old: &Self) -> bool {
|
||||||
|
@ -47,7 +39,7 @@ impl Store for MainState {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MainState {
|
impl MainState {
|
||||||
pub fn purge_transfers(&mut self) {
|
pub fn _purge_transfers(&mut self) {
|
||||||
// Removes any transfers for which the associated plates are gone
|
// Removes any transfers for which the associated plates are gone
|
||||||
self.transfers = self
|
self.transfers = self
|
||||||
.transfers
|
.transfers
|
||||||
|
|
|
@ -136,10 +136,14 @@ pub fn TransferMenu() -> Html {
|
||||||
|
|
||||||
let on_volume_change = {
|
let on_volume_change = {
|
||||||
let ct_dispatch = ct_dispatch.clone();
|
let ct_dispatch = ct_dispatch.clone();
|
||||||
|
|
||||||
Callback::from(move |e: Event| {
|
Callback::from(move |e: Event| {
|
||||||
let input = e.target().expect("Event must have target")
|
let input = e
|
||||||
.dyn_into::<HtmlInputElement>().ok().expect("Must have been emitted by input");
|
.target()
|
||||||
|
.expect("Event must have target")
|
||||||
|
.dyn_into::<HtmlInputElement>()
|
||||||
|
.ok()
|
||||||
|
.expect("Must have been emitted by input");
|
||||||
if let Ok(num) = input.value().parse::<f32>() {
|
if let Ok(num) = input.value().parse::<f32>() {
|
||||||
ct_dispatch.reduce_mut(|state| {
|
ct_dispatch.reduce_mut(|state| {
|
||||||
state.transfer.volume = num;
|
state.transfer.volume = num;
|
||||||
|
|
|
@ -7,7 +7,6 @@ use yew::prelude::*;
|
||||||
use yewdux::prelude::*;
|
use yewdux::prelude::*;
|
||||||
|
|
||||||
use crate::components::states::{CurrentTransfer, MainState};
|
use crate::components::states::{CurrentTransfer, MainState};
|
||||||
use crate::components::transfer_menu::RegionDisplay;
|
|
||||||
use crate::data::transfer_region::Region;
|
use crate::data::transfer_region::Region;
|
||||||
|
|
||||||
#[derive(PartialEq, Properties)]
|
#[derive(PartialEq, Properties)]
|
||||||
|
@ -18,7 +17,7 @@ pub struct TreeProps {
|
||||||
#[function_component]
|
#[function_component]
|
||||||
pub fn Tree(props: &TreeProps) -> Html {
|
pub fn Tree(props: &TreeProps) -> Html {
|
||||||
let (main_state, main_dispatch) = use_store::<MainState>();
|
let (main_state, main_dispatch) = use_store::<MainState>();
|
||||||
let (ct_state, ct_dispatch) = use_store::<CurrentTransfer>();
|
let (_, ct_dispatch) = use_store::<CurrentTransfer>();
|
||||||
let plate_modal_id: UseStateHandle<Option<Uuid>> = use_state(|| None);
|
let plate_modal_id: UseStateHandle<Option<Uuid>> = use_state(|| None);
|
||||||
|
|
||||||
let open_plate_info_callback = {
|
let open_plate_info_callback = {
|
||||||
|
|
|
@ -63,18 +63,6 @@ impl std::fmt::Display for PlateFormat {
|
||||||
|
|
||||||
impl PlateFormat {
|
impl PlateFormat {
|
||||||
pub fn size(&self) -> (u8, u8) {
|
pub fn size(&self) -> (u8, u8) {
|
||||||
/*
|
|
||||||
match self {
|
|
||||||
PlateFormat::W6 => (3, 2),
|
|
||||||
PlateFormat::W12 => (4, 3),
|
|
||||||
PlateFormat::W24 => (6, 4),
|
|
||||||
PlateFormat::W48 => (8, 6),
|
|
||||||
PlateFormat::W96 => (12, 8),
|
|
||||||
PlateFormat::W384 => (24, 16),
|
|
||||||
PlateFormat::W1536 => (48, 32),
|
|
||||||
PlateFormat::W3456 => (72, 48),
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
match self {
|
match self {
|
||||||
PlateFormat::W6 => (2, 3),
|
PlateFormat::W6 => (2, 3),
|
||||||
PlateFormat::W12 => (3, 4),
|
PlateFormat::W12 => (3, 4),
|
||||||
|
|
|
@ -165,11 +165,6 @@ impl TransferRegion {
|
||||||
(s_dims.1 + il_source.1.abs() as u8 - 1)
|
(s_dims.1 + il_source.1.abs() as u8 - 1)
|
||||||
.div_euclid(il_source.1.abs() as u8),
|
.div_euclid(il_source.1.abs() as u8),
|
||||||
);
|
);
|
||||||
let D_per_replicate = (
|
|
||||||
// How many wells are used per replicate?
|
|
||||||
(N_s.0 * (il_dest.0.abs() as u8)),
|
|
||||||
(N_s.1 * (il_dest.1.abs() as u8)),
|
|
||||||
);
|
|
||||||
let count = (
|
let count = (
|
||||||
// How many times can we replicate?
|
// How many times can we replicate?
|
||||||
(1..)
|
(1..)
|
||||||
|
@ -191,7 +186,6 @@ impl TransferRegion {
|
||||||
let j = j
|
let j = j
|
||||||
.saturating_sub(s_ul.1)
|
.saturating_sub(s_ul.1)
|
||||||
.saturating_div(il_source.1.abs() as u8);
|
.saturating_div(il_source.1.abs() as u8);
|
||||||
// log::debug!("N_s: {:?}, d_dims: {:?}, D_per: {:?}, count: {:?}", N_s, d_dims, D_per_replicate, count);
|
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
possible_destination_wells
|
possible_destination_wells
|
||||||
|
@ -259,40 +253,6 @@ impl TransferRegion {
|
||||||
// log::debug!("s1.1: {}, max.1: {}", s1.1, source_max.1);
|
// log::debug!("s1.1: {}, max.1: {}", s1.1, source_max.1);
|
||||||
return Err("Source region is out-of-bounds! (Too wide)");
|
return Err("Source region is out-of-bounds! (Too wide)");
|
||||||
}
|
}
|
||||||
// Check that source lengths divide destination lengths
|
|
||||||
/* This section is disabled because it's not
|
|
||||||
* strictly necessary to have this property (divisibility)
|
|
||||||
match &self.dest_region {
|
|
||||||
Region::Point(_) => (),
|
|
||||||
Region::Rect(d1, d2) => {
|
|
||||||
// If we consider interleaves, it's slightly more
|
|
||||||
// complicated to compute the true dimensions of
|
|
||||||
// each region.
|
|
||||||
// (dim)*(il) - (il - 1)
|
|
||||||
let dest_dim_i = u8::abs_diff(d1.0, d2.0)+1;
|
|
||||||
let dest_dim_j = u8::abs_diff(d1.1, d2.1)+1;
|
|
||||||
let source_dim_i = ((il_source.0.abs() as u8) * u8::abs_diff(s1.0, s2.0))
|
|
||||||
.checked_sub(il_source.0.abs() as u8 - 1)
|
|
||||||
.expect("Dimension is somehow negative?")
|
|
||||||
+ 1;
|
|
||||||
let source_dim_j = ((il_source.1.abs() as u8) * u8::abs_diff(s1.1, s2.1))
|
|
||||||
.checked_sub(il_source.1.abs() as u8 - 1)
|
|
||||||
.expect("Dimension is somehow negative?")
|
|
||||||
+ 1;
|
|
||||||
|
|
||||||
if dest_dim_i % (source_dim_i+il_dest.0.abs() as u8) != 0 {
|
|
||||||
eprintln!("{} % {} = {}", dest_dim_i,
|
|
||||||
source_dim_i+il_dest.0.abs() as u8,
|
|
||||||
dest_dim_i % (source_dim_i+il_dest.0.abs() as u8));
|
|
||||||
return Err("Replicate region has indivisible height!");
|
|
||||||
}
|
|
||||||
if dest_dim_j % (source_dim_j+il_dest.1.abs() as u8) != 0 {
|
|
||||||
eprintln!("{} {}", source_dim_j, source_dim_j);
|
|
||||||
return Err("Replicate region has indivisible width!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,18 +269,6 @@ impl TransferRegion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn in_region(pt: (u8, u8), r: &Region) -> bool {
|
|
||||||
match r {
|
|
||||||
Region::Rect(c1, c2) => {
|
|
||||||
pt.0 <= u8::max(c1.0, c2.0)
|
|
||||||
&& pt.0 >= u8::min(c1.0, c2.0)
|
|
||||||
&& pt.1 <= u8::max(c1.1, c2.1)
|
|
||||||
&& pt.1 >= u8::min(c1.1, c2.1)
|
|
||||||
}
|
|
||||||
Region::Point((i, j)) => pt.0 == *i && pt.1 == *j,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_dense_rectangle(c1: &(u8, u8), c2: &(u8, u8)) -> Vec<(u8, u8)> {
|
fn create_dense_rectangle(c1: &(u8, u8), c2: &(u8, u8)) -> Vec<(u8, u8)> {
|
||||||
// Creates a vector of every point between two corners
|
// Creates a vector of every point between two corners
|
||||||
let (c1, c2) = standardize_rectangle(c1, c2);
|
let (c1, c2) = standardize_rectangle(c1, c2);
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
use plate_tool::plate_test;
|
|
||||||
|
|
||||||
use plate_tool::App;
|
use plate_tool::App;
|
||||||
use wasm_logger;
|
use wasm_logger;
|
||||||
use yew::prelude::*;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
wasm_logger::init(wasm_logger::Config::default());
|
wasm_logger::init(wasm_logger::Config::default());
|
||||||
yew::Renderer::<App>::new().render();
|
yew::Renderer::<App>::new().render();
|
||||||
//plate_test();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue