merge stable version #2

Merged
doryan merged 97 commits from experimental into main 2024-08-28 18:54:00 +03:00
Showing only changes of commit 2a88eeaf01 - Show all commits

View File

@ -178,12 +178,31 @@ pub fn signal_reducing_page(wrapper: &Box) {
.vexpand(true) .vexpand(true)
.build(); .build();
calculate_button.connect_clicked(move |_| match parse_fields(all_inputs.clone()) { calculate_button.connect_clicked(clone!(
#[strong]
model_for_events,
move |_| match parse_fields(all_inputs.clone()) {
Ok(results) => { Ok(results) => {
values.set(results); values.set(results);
model_for_events.items_changed(0, 0, 18); let new_elem = &Frequency::new(values.get().frequency);
model_for_events.items_changed(18, 18, 0);
let exist_elem_pos = model_for_events.find_with_equal_func(|elem| {
elem.downcast_ref::<Frequency>().unwrap().frequency() == new_elem.frequency()
});
match exist_elem_pos {
Some(_) => {
info_bar.set_text_label(Some("Данная частота уже была задана."));
info_bar.show_infobar(5u64);
}
None => {
model_for_events.append(&Frequency::new(values.get().frequency));
model_for_events.items_changed(0, 0, 1);
model_for_events.items_changed(1, 1, 0);
}
}
} }
Err(error) => { Err(error) => {
let error_kind: Option<&str> = get_error_message(error); let error_kind: Option<&str> = get_error_message(error);
@ -191,7 +210,8 @@ pub fn signal_reducing_page(wrapper: &Box) {
info_bar.set_text_label(error_kind); info_bar.set_text_label(error_kind);
info_bar.show_infobar(5u64); info_bar.show_infobar(5u64);
} }
}); }
));
wrapper.append(&input_block); wrapper.append(&input_block);
wrapper.append(&calculate_button); wrapper.append(&calculate_button);