* src/FilterEditor/_FilterEditor.py (clone_filter): Add method;

Support clone-and-edit functionality.
	* src/glade/rule.glade (filter_list): Add clone button.


svn: r7250
This commit is contained in:
Alex Roitman 2006-08-23 20:17:02 +00:00
parent ddd39b682c
commit 9a506c0fc1
3 changed files with 49 additions and 0 deletions

View File

@ -1,4 +1,7 @@
2006-08-23 Alex Roitman <shura@gramps-project.org> 2006-08-23 Alex Roitman <shura@gramps-project.org>
* 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/plugins/ChangeTypes.py (run_tool): Compare English strings.
* src/Editors/_EditPerson.py (_image_callback): Take three * src/Editors/_EditPerson.py (_image_callback): Take three
arguments; correctly call load_photo(); rebuild gallery. arguments; correctly call load_photo(); rebuild gallery.

View File

@ -78,10 +78,12 @@ class FilterEditor(ManagedWindow.ManagedWindow):
self.define_glade('filter_list', const.rule_glade) self.define_glade('filter_list', const.rule_glade)
self.filter_list = self.get_widget('filters') self.filter_list = self.get_widget('filters')
self.edit = self.get_widget('edit') self.edit = self.get_widget('edit')
self.clone = self.get_widget('clone')
self.delete = self.get_widget('delete') self.delete = self.get_widget('delete')
self.test = self.get_widget('test') self.test = self.get_widget('test')
self.edit.set_sensitive(False) self.edit.set_sensitive(False)
self.clone.set_sensitive(False)
self.delete.set_sensitive(False) self.delete.set_sensitive(False)
self.test.set_sensitive(False) self.test.set_sensitive(False)
@ -90,6 +92,7 @@ class FilterEditor(ManagedWindow.ManagedWindow):
_('%s filters') % _(self.space)) _('%s filters') % _(self.space))
self.edit.connect('clicked', self.edit_filter) self.edit.connect('clicked', self.edit_filter)
self.clone.connect('clicked', self.clone_filter)
self.test.connect('clicked', self.test_clicked) self.test.connect('clicked', self.test_clicked)
self.delete.connect('clicked', self.delete_filter) self.delete.connect('clicked', self.delete_filter)
@ -116,10 +119,12 @@ class FilterEditor(ManagedWindow.ManagedWindow):
store,node = self.clist.get_selected() store,node = self.clist.get_selected()
if node: if node:
self.edit.set_sensitive(True) self.edit.set_sensitive(True)
self.clone.set_sensitive(True)
self.delete.set_sensitive(True) self.delete.set_sensitive(True)
self.test.set_sensitive(True) self.test.set_sensitive(True)
else: else:
self.edit.set_sensitive(False) self.edit.set_sensitive(False)
self.clone.set_sensitive(False)
self.delete.set_sensitive(False) self.delete.set_sensitive(False)
self.test.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, EditFilter(self.space, self.dbstate, self.uistate, self.track,
gfilter, self.filterdb, self.draw_filters) 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): def test_clicked(self,obj):
store,node = self.clist.get_selected() store,node = self.clist.get_selected()
if node: if node:

View File

@ -706,6 +706,36 @@ Exactly one rule must apply</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkButton" id="clone">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">Clone the selected filter</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_clone_clicked" last_modification_time="Wed, 23 Aug 2006 20:05:14 GMT"/>
<child>
<widget class="GtkImage" id="image9">
<property name="visible">True</property>
<property name="stock">gtk-copy</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child> <child>
<widget class="GtkButton" id="test"> <widget class="GtkButton" id="test">
<property name="visible">True</property> <property name="visible">True</property>