feat(rename): rename signal_reduce_inpur_utils.rs to signal_reduce_utils.rs

This commit is contained in:
doryan 2024-08-15 23:18:55 +04:00
parent ac9e8953a9
commit e9764cf0e8
2 changed files with 9 additions and 21 deletions

View File

@ -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];

View File

@ -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,
}
}