Commit 58d5e813 authored by Christian Fibich's avatar Christian Fibich Committed by Stefan Tauner
Browse files

Scrolled Notebook tabs for FIJIEE, calculate initial size for tabs

parent 3d7961a7
......@@ -422,9 +422,6 @@ sub _populate_widget {
eval {
# central control frame
$self->{'fr_download'} = $self->Frame();
my $adj = $self->Adjuster();
$self->{'fr_download'}->pack(-fill => "both", -expand => "1");
$adj->packAfter($self->{'fr_download'});
$self->{'notebook'} = $self->{'fr_download'}->NoteBook();
......@@ -432,8 +429,6 @@ sub _populate_widget {
$self->parent->bind('<Alt-Key-Left>' => [\&_switchtab, $self->{'notebook'} , -1]);
$self->parent->bind('<Alt-Key-Right>' => [\&_switchtab, $self->{'notebook'} , 1]);
#---
# bottom frame for control buttons
$self->{'fr_buttons'} = $self->Frame(-borderwidth => 1, -relief => 'raised',)->pack(
-side => "bottom",
......@@ -507,14 +502,20 @@ sub _populate_widget {
-msg => "CRC",
);
#---
#--- Container for logging window
my $text_scrolled = $self->Scrolled('ROText', -scrollbars => "oe", -width => 80, -height => 10);
$text_scrolled->pack(
-fill => 'both',
-expand => 1,
-side => 'bottom',
);
#--- Adjuster bar between logging window container and notebook container
my $adj = $self->Adjuster();
$adj->packAfter($text_scrolled, -side=>'bottom');
$self->{'fr_download'}->pack(-fill => "both", -expand => "1",-side=>'bottom');
#---
# Configure logging window
#
......@@ -546,19 +547,31 @@ sub _populate_widget {
# fill the notebook with pages, one page for each test mode
for my $mode (sort(keys(%{$modes_ref}))) {
my $page = $self->{'pages'}->{$mode} = $self->{'notebook'} ->add(
my $pg = $self->{'notebook'} ->add(
$mode,
-label => TESTGUIMODES->{$mode}->{'title'},
-raisecmd => [\&update, $self]
); # to sync changes from textbuttons in other
# tabs that also exist in this tab
$page->gridColumnconfigure(2, -weight => 1);
my $sp = $pg->Scrolled('Pane', '-scrollbars'=>'osoe', '-sticky'=>'nwse')->pack(-fill=>'both',-expand=>1);
Tk::FIJIUtils::bind_mousewheel($sp->MainWindow,$sp);
my $page = $self->{'pages'}->{$mode} = $sp->Frame();
$page->gridColumnconfigure(0, -weight => 1);
$page->gridColumnconfigure(1, -weight => 1);
$page->gridColumnconfigure(2, -weight => 2);
my $row = 0;
my $i = 0;
# calculate the height of all widgets combined to set the height of the pane
my $total_height = 0;
# fill the current page with widgets representing test settings
for my $k (@tcm_keys_sorted) {
my $entry;
# this variable will be filled with the tallest generated widget's reqheight
my $widget_height;
if (defined TESTCONSTMAP->{$k}->{'gui_modes'}) {
for my $m (@{TESTCONSTMAP->{$k}->{'gui_modes'}}) {
if ($m eq $mode) {
......@@ -609,6 +622,7 @@ sub _populate_widget {
'-column' => 2,
'-sticky' => 'w'
);
$widget_height = $label->reqheight;
} elsif (defined($type) && $type eq 'autocomplete') {
my $options = TESTCONSTMAP->{$k}->{'values'};
$entry = $page->Frame();
......@@ -634,6 +648,9 @@ sub _populate_widget {
'-sticky' => "w",
);
$options = $options->();
$widget_height = $b->reqheight;
} else {
$widget_height = $complete->Subwidget('entry')->reqheight;
}
$complete->configure('-choices' => $options);
......@@ -681,6 +698,7 @@ sub _populate_widget {
'-column' => 2,
'-sticky' => 'w'
);
$widget_height = $opts->reqheight;
} elsif (defined($type) && $type eq 'file') {
$entry = $page->Frame();
my $filetypes = [['All files', '*']];
......@@ -720,6 +738,7 @@ sub _populate_widget {
-column => 2,
'-sticky' => 'ew'
);
$widget_height = $b->reqheight;
} else {
$entry = $page->Entry('-state' => $en ? "normal" : "readonly");
$entry->configure(
......@@ -731,6 +750,7 @@ sub _populate_widget {
-column => 2,
'-sticky' => 'ew'
);
$widget_height = $entry->reqheight;
}
if (defined(TESTCONSTMAP->{$k}->{'matching'})) {
push @{$self->{'matching'}->{TESTCONSTMAP->{$k}->{'matching'}}}, $entry;
......@@ -741,7 +761,6 @@ sub _populate_widget {
if (defined(TESTCONSTMAP->{$k}->{'forbidden_by'})) {
push @{$self->{'forbidden_by'}->{TESTCONSTMAP->{$k}->{'forbidden_by'}}}, $entry;
}
# add tooltip for widget
if (defined TESTCONSTMAP->{$k}->{'help'}) {
$b->attach(
......@@ -771,11 +790,12 @@ sub _populate_widget {
$entry->{'description'} = TESTCONSTMAP->{$k}->{'description'};
push @{$self->{'widgets'}}, $entry;
$row++;
$widget_background = $entry->cget('-bg');
$total_height += $widget_height;
}
}
}
$sp->configure(-height=>$total_height);
}
# extra widgets and settings for the test modes
if ($mode eq "auto") {
......@@ -795,9 +815,11 @@ sub _populate_widget {
$self->{'manual_test_frame'}->grid(-row => 1, -column => 0, -columnspan => 3, -ipady => 10, -ipadx => 10, -pady => 10, -padx => 10, -sticky => "nsew");
}
$page->gridRowconfigure($row, -weight => 1);
$page->pack(-fill=>'both',-expand=>1);
}
$self->{'notebook'}->pack(-anchor => "nw", -side => "bottom", -fill => "both", -expand => 1);
};
if ($@ ne "") {
# The message might be nonsense, e.g. if Log::Dispatch::QueueAppender is not available"
# and Perl:Tk(?) might wreck havoc anyway... *shrug*
......@@ -905,6 +927,7 @@ sub update {
my $test_ref = @{$self->{'tests'}->{'tests'}}[$i];
$self->_add_test($test_ref, $i);
}
$self->_check_change();
}
......
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