refactor: remove redundant argument; feat(infobar): add infobar for testing

This commit is contained in:
doryan 2024-07-27 22:20:21 +04:00
parent 5972d589fe
commit cb2a52cc7b

View File

@ -6,14 +6,17 @@ use std::{str::FromStr, time::Duration};
use crate::{ use crate::{
event_handlers::button_event_handlers::BtnEventHandler, event_handlers::button_event_handlers::BtnEventHandler,
model::{builder_traits::Product, models::*}, model::{builder_traits::Product, models::*},
view::{components::input::Input, properties::*}, view::{
components::{info_bar::InfoBar, input::Input},
properties::*,
},
}; };
use gtk::{ use gtk::{
prelude::{BoxExt, GridExt, TextBufferExt, TextViewExt}, prelude::{BoxExt, GridExt, TextBufferExt, TextViewExt},
Align, WrapMode, *, Align, WrapMode, *,
}; };
pub fn signal_reducing_page(wrapper: &Box, info_bar: Revealer) { pub fn signal_reducing_page(wrapper: &Box) {
let (input_height, monospace, input_alignment, input_wrapping): (i32, bool, Align, WrapMode) = let (input_height, monospace, input_alignment, input_wrapping): (i32, bool, Align, WrapMode) =
(24, true, Align::Fill, WrapMode::Word); (24, true, Align::Fill, WrapMode::Word);
@ -66,7 +69,7 @@ pub fn signal_reducing_page(wrapper: &Box, info_bar: Revealer) {
let calculate_button = Button::builder().label("Расчитать").build(); let calculate_button = Button::builder().label("Расчитать").build();
// TODO: Make asynchronious auto-hide info bar. // TODO: Make asynchronious auto-hide info bar.
let test = info_bar.clone(); let test = InfoBar::get_instance();
// let (tx, rx) = std::sync::mpsc::channel::<bool>(); // let (tx, rx) = std::sync::mpsc::channel::<bool>();
@ -88,8 +91,8 @@ pub fn signal_reducing_page(wrapper: &Box, info_bar: Revealer) {
if let Ok(value) = try_extract_value { if let Ok(value) = try_extract_value {
values[i] = value; values[i] = value;
} else { } else {
test.set_text_label(Some("Вы ввели некорректное значение поля."));
test.set_reveal_child(true); test.set_reveal_child(true);
// TODO: Make asynchronious auto-hide info bar. // TODO: Make asynchronious auto-hide info bar.
// let transmitter = tx.clone(); // let transmitter = tx.clone();
// //