merge stable version #2
|
@ -1,24 +1,3 @@
|
||||||
use gtk4 as gtk;
|
|
||||||
|
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
use gtk::{
|
|
||||||
prelude::{TextBufferExt, TextViewExt},
|
|
||||||
TextBuffer,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
|
||||||
model::{models::SignalReduce, Error, Result},
|
|
||||||
view::components::input::Input,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn get_error_message(error: Error) -> Option<&'static str> {
|
|
||||||
match error.to_string().as_str() {
|
|
||||||
"cannot parse float from empty string" => Some("Вы не ввели данные в поле/-я"),
|
|
||||||
"invalid float literal" => Some("Вы ввели не корректные данные в поле/-я"),
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parse_fields(all_inputs: Vec<Input>) -> Result<SignalReduce> {
|
pub fn parse_fields(all_inputs: Vec<Input>) -> Result<SignalReduce> {
|
||||||
let mut values: [f64; 6] = [0.0; 6];
|
let mut values: [f64; 6] = [0.0; 6];
|
||||||
|
|
|
@ -12,3 +12,12 @@ use gtk::{
|
||||||
prelude::{Cast, CastNone, EditableExt, ListItemExt, ObjectExt, WidgetExt},
|
prelude::{Cast, CastNone, EditableExt, ListItemExt, ObjectExt, WidgetExt},
|
||||||
ColumnView, Entry, Label, ListItem, SignalListItemFactory,
|
ColumnView, Entry, Label, ListItem, SignalListItemFactory,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub fn get_error_message(error: Error) -> Option<&'static str> {
|
||||||
|
match error.to_string().as_str() {
|
||||||
|
"cannot parse float from empty string" => Some("Вы не ввели данные в поле/-я"),
|
||||||
|
"invalid float literal" => Some("Вы ввели не корректные данные в поле/-я"),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue