diff --git a/ChangeLog b/ChangeLog index 84e749686..c9cda9cf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ 2006-08-23 Alex Roitman + * src/FilterEditor/_FilterEditor.py (clone_filter): Add method; + Support clone-and-edit functionality. + * src/glade/rule.glade (filter_list): Add clone button. * src/plugins/ChangeTypes.py (run_tool): Compare English strings. * src/Editors/_EditPerson.py (_image_callback): Take three arguments; correctly call load_photo(); rebuild gallery. diff --git a/src/FilterEditor/_FilterEditor.py b/src/FilterEditor/_FilterEditor.py index 9a4d92659..89886bfb5 100644 --- a/src/FilterEditor/_FilterEditor.py +++ b/src/FilterEditor/_FilterEditor.py @@ -78,10 +78,12 @@ class FilterEditor(ManagedWindow.ManagedWindow): self.define_glade('filter_list', const.rule_glade) self.filter_list = self.get_widget('filters') self.edit = self.get_widget('edit') + self.clone = self.get_widget('clone') self.delete = self.get_widget('delete') self.test = self.get_widget('test') self.edit.set_sensitive(False) + self.clone.set_sensitive(False) self.delete.set_sensitive(False) self.test.set_sensitive(False) @@ -90,6 +92,7 @@ class FilterEditor(ManagedWindow.ManagedWindow): _('%s filters') % _(self.space)) self.edit.connect('clicked', self.edit_filter) + self.clone.connect('clicked', self.clone_filter) self.test.connect('clicked', self.test_clicked) self.delete.connect('clicked', self.delete_filter) @@ -116,10 +119,12 @@ class FilterEditor(ManagedWindow.ManagedWindow): store,node = self.clist.get_selected() if node: self.edit.set_sensitive(True) + self.clone.set_sensitive(True) self.delete.set_sensitive(True) self.test.set_sensitive(True) else: self.edit.set_sensitive(False) + self.clone.set_sensitive(False) self.delete.set_sensitive(False) self.test.set_sensitive(False) @@ -151,6 +156,17 @@ class FilterEditor(ManagedWindow.ManagedWindow): EditFilter(self.space, self.dbstate, self.uistate, self.track, gfilter, self.filterdb, self.draw_filters) + def clone_filter(self,obj): + store,node = self.clist.get_selected() + if node: + from _EditFilter import EditFilter + + old_filter = self.clist.get_object(node) + the_filter = GenericFilterFactory(self.space)(old_filter) + the_filter.set_name('') + EditFilter(self.space, self.dbstate, self.uistate, self.track, + the_filter, self.filterdb, self.draw_filters) + def test_clicked(self,obj): store,node = self.clist.get_selected() if node: diff --git a/src/glade/rule.glade b/src/glade/rule.glade index c53649cd0..bcc6faa1c 100644 --- a/src/glade/rule.glade +++ b/src/glade/rule.glade @@ -706,6 +706,36 @@ Exactly one rule must apply + + + True + False + Clone the selected filter + True + True + GTK_RELIEF_NORMAL + True + + + + + True + gtk-copy + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + False + + + True