Skip to content

Commit

Permalink
GUI: add scrolled window parent to import parameters table
Browse files Browse the repository at this point in the history
widget height is tracked under #777

Updates #770
  • Loading branch information
shawnlaffan committed Nov 1, 2020
1 parent f0d6876 commit 402a078
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
36 changes: 26 additions & 10 deletions bin/ui/dlgImportParameters.ui
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="dlgImportParameters">
<property name="height_request">700</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Import options</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="import_parameters_vbox">
<object class="GtkBox" id="import_parameters_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area17">
<object class="GtkButtonBox" id="dialog-action_area17">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
Expand Down Expand Up @@ -106,14 +109,27 @@
<property name="xalign">0</property>
<property name="left_padding">12</property>
<child>
<object class="GtkTable" id="tableImportParameters">
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_columns">2</property>
<property name="column_spacing">3</property>
<property name="row_spacing">3</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<placeholder/>
<object class="GtkTable" id="tableImportParameters">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_columns">2</property>
<property name="column_spacing">2</property>
<property name="row_spacing">2</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
Expand All @@ -129,7 +145,7 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
Expand Down
14 changes: 7 additions & 7 deletions lib/Biodiverse/GUI/BasedataImport.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -1580,16 +1580,16 @@ sub make_columns_dialog {
my $file_title = Gtk3::Label->new('<b>Files:</b>');
$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('<b>Set column options</b>');
$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 );
Expand All @@ -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;

Expand Down Expand Up @@ -1983,7 +1983,7 @@ sub make_remap_columns_dialog {
);
my $label = Gtk3::Label->new("<b>Select column types</b>");
$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 );
Expand All @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions lib/Biodiverse/GUI/ParametersTable.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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']
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 402a078

Please sign in to comment.