test
This commit is contained in:
parent
24b60e74a0
commit
269b30312d
|
@ -21,10 +21,11 @@ extern crate gio;
|
||||||
use gio::ListStore;
|
use gio::ListStore;
|
||||||
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
prelude::{BoxExt, ButtonExt, Cast, CastNone, GridExt, ListItemExt, ListModelExt, SorterExt},
|
prelude::{BoxExt, ButtonExt, Cast, CastNone, GridExt, ListItemExt, SorterExt},
|
||||||
Align, WrapMode, *,
|
Align, WrapMode, *,
|
||||||
};
|
};
|
||||||
use gtk4 as gtk;
|
use gtk4 as gtk;
|
||||||
|
use prelude::ListModelExt;
|
||||||
|
|
||||||
pub fn signal_reducing_page(wrapper: &Box) {
|
pub fn signal_reducing_page(wrapper: &Box) {
|
||||||
let values = Rc::new(Cell::new(SignalReduce::default()));
|
let values = Rc::new(Cell::new(SignalReduce::default()));
|
||||||
|
@ -68,6 +69,7 @@ pub fn signal_reducing_page(wrapper: &Box) {
|
||||||
let result_table_headers_labels: [&str; 4] = ["f, МГц", "Xc, Ом", "Vп, мВ", "ζ"];
|
let result_table_headers_labels: [&str; 4] = ["f, МГц", "Xc, Ом", "Vп, мВ", "ζ"];
|
||||||
|
|
||||||
let model = ListStore::new::<Frequency>();
|
let model = ListStore::new::<Frequency>();
|
||||||
|
|
||||||
let model_for_events = model.clone();
|
let model_for_events = model.clone();
|
||||||
|
|
||||||
for number in (0..=100).step_by(5) {
|
for number in (0..=100).step_by(5) {
|
||||||
|
@ -98,13 +100,12 @@ pub fn signal_reducing_page(wrapper: &Box) {
|
||||||
result_table.connect_activate(clone!(
|
result_table.connect_activate(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
numeric_sorter,
|
numeric_sorter,
|
||||||
move |_, _| {
|
move |_, _| numeric_sorter.changed(SorterChange::Different)
|
||||||
numeric_sorter.changed(SorterChange::Different);
|
|
||||||
}
|
|
||||||
));
|
));
|
||||||
|
|
||||||
for label in result_table_headers_labels {
|
for label in result_table_headers_labels {
|
||||||
let factory = SignalListItemFactory::new();
|
let factory = SignalListItemFactory::new();
|
||||||
|
let values_for_factory = values.clone();
|
||||||
|
|
||||||
factory.connect_setup(move |_, list_item| {
|
factory.connect_setup(move |_, list_item| {
|
||||||
list_item
|
list_item
|
||||||
|
@ -113,8 +114,6 @@ pub fn signal_reducing_page(wrapper: &Box) {
|
||||||
.set_child(Some(&Label::new(None)));
|
.set_child(Some(&Label::new(None)));
|
||||||
});
|
});
|
||||||
|
|
||||||
let values_for_factory = values.clone();
|
|
||||||
|
|
||||||
factory.connect_bind(move |_, list_item| {
|
factory.connect_bind(move |_, list_item| {
|
||||||
let cell_value = list_item
|
let cell_value = list_item
|
||||||
.downcast_ref::<ListItem>()
|
.downcast_ref::<ListItem>()
|
||||||
|
@ -211,9 +210,10 @@ pub fn signal_reducing_page(wrapper: &Box) {
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
model_for_events.append(&Frequency::new(values.get().frequency));
|
model_for_events.append(&Frequency::new(values.get().frequency));
|
||||||
|
let a = model_for_events.n_items();
|
||||||
|
|
||||||
model_for_events.items_changed(0, 0, 1);
|
model_for_events.items_changed(0, 0, a - 1);
|
||||||
model_for_events.items_changed(1, 1, 0);
|
model_for_events.items_changed(a - 1, a - 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue