From 402a078370cb59b302f2a4befa87ce0eea4579eb Mon Sep 17 00:00:00 2001 From: Shawn Laffan Date: Sun, 1 Nov 2020 15:48:56 +1100 Subject: [PATCH] GUI: add scrolled window parent to import parameters table widget height is tracked under #777 Updates #770 --- bin/ui/dlgImportParameters.ui | 36 +++++++++++++++++++-------- lib/Biodiverse/GUI/BasedataImport.pm | 14 +++++------ lib/Biodiverse/GUI/ParametersTable.pm | 5 ++-- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/bin/ui/dlgImportParameters.ui b/bin/ui/dlgImportParameters.ui index 223498626..76523a29e 100644 --- a/bin/ui/dlgImportParameters.ui +++ b/bin/ui/dlgImportParameters.ui @@ -1,18 +1,21 @@ - + + + 700 False 5 Import options center-on-parent + True dialog - + True False 2 - + True False end @@ -106,14 +109,27 @@ 0 12 - + True - False - 2 - 3 - 3 + True + in - + + True + False + 2 + 2 + 2 + + + + + + + + + + @@ -129,7 +145,7 @@ - False + True True 2 diff --git a/lib/Biodiverse/GUI/BasedataImport.pm b/lib/Biodiverse/GUI/BasedataImport.pm index bec71cd44..601f7b654 100644 --- a/lib/Biodiverse/GUI/BasedataImport.pm +++ b/lib/Biodiverse/GUI/BasedataImport.pm @@ -1157,7 +1157,7 @@ sub show_expl_dialog { #$scroll->set_policy('never', 'automatic'); #$dlg->vbox->pack_start($scroll, 1, 1, 5); - $dlg->vbox->pack_start( $table, 1, 1, 5 ); + $dlg->get_content_area->pack_start( $table, 1, 1, 5 ); my $col = 0; @@ -1580,16 +1580,16 @@ sub make_columns_dialog { my $file_title = Gtk3::Label->new('Files:'); $file_title->set_use_markup(1); $file_title->set_alignment( 0, 1 ); - $dlg->vbox->pack_start( $file_title, 0, 0, 0 ); + $dlg->get_content_area->pack_start( $file_title, 0, 0, 0 ); my $file_list_label = Gtk3::Label->new( $file_list . "\n\n" ); $file_list_label->set_alignment( 0, 1 ); - $dlg->vbox->pack_start( $file_list_label, 0, 0, 0 ); + $dlg->get_content_area->pack_start( $file_list_label, 0, 0, 0 ); } my $label = Gtk3::Label->new('Set column options'); $label->set_use_markup(1); - $dlg->vbox->pack_start( $label, 0, 0, 0 ); + $dlg->get_content_area->pack_start( $label, 0, 0, 0 ); # Make table my $table = Gtk3::Table->new( $num_columns + 1, 8, 0 ); @@ -1600,7 +1600,7 @@ sub make_columns_dialog { my $scroll = Gtk3::ScrolledWindow->new; $scroll->add_with_viewport($table); $scroll->set_policy( 'never', 'automatic' ); - $dlg->vbox->pack_start( $scroll, 1, 1, 5 ); + $dlg->get_content_area->pack_start( $scroll, 1, 1, 5 ); my $col = 0; @@ -1983,7 +1983,7 @@ sub make_remap_columns_dialog { ); my $label = Gtk3::Label->new("Select column types"); $label->set_use_markup(1); - $dlg->vbox->pack_start( $label, 0, 0, 0 ); + $dlg->get_content_area->pack_start( $label, 0, 0, 0 ); # Make table my $table = Gtk3::Table->new( $num_columns + 1, 8, 0 ); @@ -1994,7 +1994,7 @@ sub make_remap_columns_dialog { my $scroll = Gtk3::ScrolledWindow->new; $scroll->add_with_viewport($table); $scroll->set_policy( 'never', 'automatic' ); - $dlg->vbox->pack_start( $scroll, 1, 1, 5 ); + $dlg->get_content_area->pack_start( $scroll, 1, 1, 5 ); my $col = 0; diff --git a/lib/Biodiverse/GUI/ParametersTable.pm b/lib/Biodiverse/GUI/ParametersTable.pm index 7391c11de..0da1e198d 100644 --- a/lib/Biodiverse/GUI/ParametersTable.pm +++ b/lib/Biodiverse/GUI/ParametersTable.pm @@ -112,6 +112,7 @@ sub fill { #$label->set_text( $label_text ); my $fill_flags = 'fill'; + my $fill_flags = [qw/expand fill/]; if ($param->{type} =~ 'text') { $fill_flags = ['expand', 'fill'] } @@ -156,8 +157,8 @@ sub fill { else { $rows++; $table->set('n-rows' => $rows); - $table->attach($label, 0, 1, $rows, $rows + 1, 'fill', [], 0, 0); - $table->attach($widget, 1, 2, $rows, $rows + 1, $fill_flags, [], 0, 0); + $table->attach($label, 0, 1, $rows, $rows + 1, $fill_flags, [qw /shrink/], 0, 0); + $table->attach($widget, 1, 2, $rows, $rows + 1, [qw/shrink fill/], [qw /shrink/], 0, 0); } # Add a tooltip