Commit e614f5ab authored by Stefan Tauner's avatar Stefan Tauner
Browse files

fiji_scripts: disable GUI elements according to initial data as well

parent 6b72bf35
......@@ -262,7 +262,6 @@ sub _add_fiu ($$) {
'-width' => -1,
'-justify' => 'center',
);
my $lbl = $fr_fius->Label(
'-text' => "FIU$i",
);
......@@ -279,32 +278,6 @@ sub _add_fiu ($$) {
# '-side' => 'left',
# '-expand' => 1,
);
$model_menu->configure(
-command => sub {
my $logger = get_logger();
my $model = shift;
$logger->trace("model is now: $model");
if ($model eq 'RUNTIME' ||
$model eq 'STUCK_OPEN') {
$self->_set_fields(1, $lfsr_button, $so_entry);
$self->_set_fields_by_button($lfsr_button, $mask_entry); # do not hard-enable $mask_entry
} elsif ($model eq 'PASS_THRU') {
$self->_set_fields(0, $lfsr_button, $mask_entry, $so_entry);
} elsif ($model eq 'STUCK_AT_0' ||
$model eq 'STUCK_AT_1' ||
$model eq 'DELAY' ||
$model eq 'SEU') {
$self->_set_fields(0, $so_entry);
$self->_set_fields(1, $lfsr_button, $mask_entry);
} else {
$logger->error("Unknown model selected: $model");
}
}
);
$lfsr_button->configure(
'-variable' => \$fiu->{'FIU_LFSR_EN'},
'-command' => [\&_set_fields_by_button, $self, $lfsr_button, $mask_entry ],
);
my $def_button = $fr_fius->Button(
'-text' => 'Defaults',
# -command => [\&_save, $self],
......@@ -316,6 +289,27 @@ sub _add_fiu ($$) {
$self->update();
},
);
$model_menu->configure(
-command => sub {
my $logger = get_logger();
my $model = shift;
$logger->trace("model is now: $model");
$self->_update_fields(
$lbl,
$net_entry,
$model_menu,
$lfsr_button,
$mask_entry,
$so_entry,
$def_button,
$del_button,
);
}
);
$lfsr_button->configure(
'-variable' => \$fiu->{'FIU_LFSR_EN'},
'-command' => [\&_set_fields_by_button, $self, $lfsr_button, $mask_entry ],
);
Tk::grid(
$lbl,
$net_entry,
......@@ -327,6 +321,50 @@ sub _add_fiu ($$) {
$del_button,
'-sticky' => 'ew'
);
$self->_update_fields(
$lbl,
$net_entry,
$model_menu,
$lfsr_button,
$mask_entry,
$so_entry,
$def_button,
$del_button,
);
}
sub _update_fields {
my($self,
$lbl,
$net_entry,
$model_menu,
$lfsr_button,
$mask_entry,
$so_entry,
$def_button,
$del_button,
) = @_;
my $logger = get_logger();
# update LFSR mask first
$self->_set_fields_by_button($lfsr_button, $mask_entry);
my $model = ${$model_menu->cget('-variable')};
if ($model eq 'RUNTIME' ||
$model eq 'STUCK_OPEN') {
$self->_set_fields(1, $lfsr_button, $so_entry);
$self->_set_fields_by_button($lfsr_button, $mask_entry); # do not hard-enable $mask_entry
} elsif ($model eq 'PASS_THRU') {
$self->_set_fields(0, $lfsr_button, $mask_entry, $so_entry);
} elsif ($model eq 'STUCK_AT_0' ||
$model eq 'STUCK_AT_1' ||
$model eq 'DELAY' ||
$model eq 'SEU') {
$self->_set_fields(0, $so_entry);
$self->_set_fields(1, $lfsr_button, $mask_entry);
} else {
$logger->error("Unknown model selected: $model");
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment