REFACTOR: clean code and some bug fixed

This commit is contained in:
2024-04-16 21:45:31 +04:00
parent 48057646a8
commit a58110a3f8
5 changed files with 93 additions and 112 deletions

View File

@@ -25,9 +25,6 @@ pub fn signal_reducing_page(wrapper: &Box) {
.build(monospace, input_wrapping, input_height)
.get();
wire_length_input.set_halign(input_alignment);
wire_length_input.set_hexpand(true);
let resistance_per_meter_input = Input::builder()
.set_label("Rм, Ом:")
.set_margins(MarginData::EqualsMargin(5))
@@ -35,9 +32,6 @@ pub fn signal_reducing_page(wrapper: &Box) {
.build(monospace, input_wrapping, input_height)
.get();
resistance_per_meter_input.set_halign(input_alignment);
resistance_per_meter_input.set_hexpand(true);
let capacity_per_meter_input = Input::builder()
.set_label("Cм, пФ:")
.set_margins(MarginData::EqualsMargin(5))
@@ -45,18 +39,24 @@ pub fn signal_reducing_page(wrapper: &Box) {
.build(monospace, input_wrapping, input_height)
.get();
capacity_per_meter_input.set_halign(input_alignment);
capacity_per_meter_input.set_hexpand(true);
let wrapper_first_row = Wrapper::col_builder()
.halign(Align::Fill)
.hexpand(true)
.spacing(5)
.build();
wrapper_first_row.append(&wire_length_input);
wrapper_first_row.append(&resistance_per_meter_input);
wrapper_first_row.append(&capacity_per_meter_input);
let first_row_elements: Vec<&Box> = vec![
&wire_length_input,
&resistance_per_meter_input,
&capacity_per_meter_input,
];
for elem in first_row_elements {
elem.set_halign(input_alignment);
elem.set_hexpand(true);
wrapper_first_row.append(elem);
}
let info_signal_voltage_input = Input::builder()
.set_label("Vи, мВ:")
@@ -65,9 +65,6 @@ pub fn signal_reducing_page(wrapper: &Box) {
.build(monospace, input_wrapping, input_height)
.get();
info_signal_voltage_input.set_halign(input_alignment);
info_signal_voltage_input.set_hexpand(true);
let resistance_of_info_voltage_source_input = Input::builder()
.set_label("Rи, Ом:")
.set_margins(MarginData::EqualsMargin(5))
@@ -75,9 +72,6 @@ pub fn signal_reducing_page(wrapper: &Box) {
.build(monospace, input_wrapping, input_height)
.get();
resistance_of_info_voltage_source_input.set_halign(input_alignment);
resistance_of_info_voltage_source_input.set_hexpand(true);
let info_voltage_source_frequency_input = Input::builder()
.set_label("f, мГц:")
.set_margins(MarginData::EqualsMargin(5))
@@ -85,18 +79,24 @@ pub fn signal_reducing_page(wrapper: &Box) {
.build(monospace, input_wrapping, input_height)
.get();
info_voltage_source_frequency_input.set_halign(input_alignment);
info_voltage_source_frequency_input.set_hexpand(true);
let wrapper_second_row = Wrapper::col_builder()
.halign(Align::Fill)
.hexpand(true)
.spacing(5)
.build();
wrapper_second_row.append(&info_signal_voltage_input);
wrapper_second_row.append(&resistance_of_info_voltage_source_input);
wrapper_second_row.append(&info_voltage_source_frequency_input);
let second_row_elements: Vec<&Box> = vec![
&info_signal_voltage_input,
&resistance_of_info_voltage_source_input,
&info_voltage_source_frequency_input,
];
for elem in second_row_elements {
elem.set_halign(input_alignment);
elem.set_hexpand(true);
wrapper_second_row.append(elem);
}
let main_wpapper = Wrapper::row_builder().spacing(5).build();