Skip to content

Commit

Permalink
GUI basedata trimming: reinstate stand alone tree trimming
Browse files Browse the repository at this point in the history
This is relatively commonly used so is
worth keeping as a distinct option.
  • Loading branch information
shawnlaffan committed Oct 23, 2023
1 parent 6816c53 commit 216ab23
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
9 changes: 9 additions & 0 deletions bin/ui/wndMain.ui
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ Skips any matrices already in the project.</property>
<signal handler="on_basedata_trim_using_object" name="activate"/>
</object>
</child>
<child>
<object class="GtkAction" id="menu_trim_basedata_to_match_tree">
<property name="name">menu_trim_basedata_to_match_tree</property>
<property name="tooltip" translatable="yes">Remove BaseData labels not in the selected tree</property>
<property name="label" translatable="yes">Trim to match tree nodes</property>
<signal handler="on_basedata_trim_to_match_tree" name="activate"/>
</object>
</child>
<child>
<object class="GtkAction" id="menu_basedata_export_groups">
<property name="name">menu_basedata_export_groups</property>
Expand Down Expand Up @@ -755,6 +763,7 @@ This cannot be undone. </property>
<menuitem action="menu_extract_embedded_trees"/>
<menuitem action="menu_extract_embedded_matrices"/>
<separator/>
<menuitem action="menu_trim_basedata_to_match_tree"/>
<menuitem action="menu_trim_basedata_using_object"/>
<separator/>
<menuitem action="menu_basedata_export_groups"/>
Expand Down
8 changes: 4 additions & 4 deletions lib/Biodiverse/GUI/Callbacks.pm
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ my %data_funcs = (
METHOD => 'do_basedata_trim_using_object',
ARGS => { option => 'keep' },
},
# on_basedata_trim_to_match_tree => {
# METHOD => 'do_basedata_trim_to_tree',
# ARGS => { option => 'keep' },
# },
on_basedata_trim_to_match_tree => {
METHOD => 'do_basedata_trim_to_tree',
ARGS => { option => 'keep' },
},
# on_basedata_trim_to_match_matrix => {
# METHOD => 'do_basedata_trim_to_matrix',
# ARGS => { option => 'keep' },
Expand Down
26 changes: 13 additions & 13 deletions lib/Biodiverse/GUI/Manager/BaseDatas.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1168,19 +1168,19 @@ sub do_basedata_trim_to_tree {
return;
}

sub do_basedata_trim_to_matrix {
my $self = shift;
my %args = @_; # keep or trim flag

my $bd = $self->{project}->get_selected_base_data;
my $mx = $self->{project}->get_selected_matrix;

return if !defined $bd || !defined $mx;

$self->do_trim_basedata( $bd, $mx, %args );

return;
}
# sub do_basedata_trim_to_matrix {
# my $self = shift;
# my %args = @_; # keep or trim flag
#
# my $bd = $self->{project}->get_selected_base_data;
# my $mx = $self->{project}->get_selected_matrix;
#
# return if !defined $bd || !defined $mx;
#
# $self->do_trim_basedata( $bd, $mx, %args );
#
# return;
# }

sub do_basedata_trim_using_object {
my $self = shift;
Expand Down
1 change: 1 addition & 0 deletions lib/Biodiverse/GUI/Project.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,7 @@ sub manage_empty_basedatas {
menu_delete_index
menu_extract_embedded_trees
menu_extract_embedded_matrices
menu_trim_basedata_using_tree
menu_trim_basedata_using_object
menu_rename_basedata_labels
menu_rename_basedata_groups
Expand Down

0 comments on commit 216ab23

Please sign in to comment.