diff --git a/ChangeLog b/ChangeLog index fb71bcd4f..25fc5a5eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2006-10-31 Don Allingham - * src/Reorder.py: Allow for reordering of relationships + * src/Reorder.py: Allow for reordering of relationships, enhance + buttons * src/DataViews/_RelationView.py: add reorder support * src/glade/gramps.glade: reorder dialog * src/Makefile.am: install Reorder.py diff --git a/src/DataViews/_RelationView.py b/src/DataViews/_RelationView.py index f4961fc79..1a0a6c1cd 100644 --- a/src/DataViews/_RelationView.py +++ b/src/DataViews/_RelationView.py @@ -262,9 +262,12 @@ class RelationshipView(PageView.PersonNavView): def define_actions(self): PageView.PersonNavView.define_actions(self) - self.add_action('ChangeOrder', gtk.STOCK_SORT_ASCENDING, _("_Reorder"), - tip=_("Reorder the relationships"), - callback=self.reorder) + self.order_action = gtk.ActionGroup(self.title + '/ChangeOrder') + self.order_action.add_actions([ + ('ChangeOrder', gtk.STOCK_SORT_ASCENDING, _('_Reorder'), None , + _("Reorder the relationships"), self.reorder) + ]) + self.add_action_group(self.order_action) self.add_toggle_action('Details', None, _('Show details'), None, None, self.details_toggle, @@ -335,7 +338,12 @@ class RelationshipView(PageView.PersonNavView): self.attach = AttachList() self.row = 1 + + family_handle_list = person.get_parent_family_handle_list() + + sensitive = len(family_handle_list)> 1 + if family_handle_list: for family_handle in family_handle_list: if family_handle: @@ -345,6 +353,10 @@ class RelationshipView(PageView.PersonNavView): self.row += 1 family_handle_list = person.get_family_handle_list() + + if not sensitive: + sensitive = len(family_handle_list)> 1 + if family_handle_list: for family_handle in family_handle_list: if family_handle: @@ -391,6 +403,9 @@ class RelationshipView(PageView.PersonNavView): self.vbox.pack_start(self.child, False) self.redrawing = False self.uistate.modify_statusbar(self.dbstate) + + self.order_action.set_sensitive(sensitive) + return True def write_title(self, person): diff --git a/src/Reorder.py b/src/Reorder.py index f63e5d768..6d78ae967 100644 --- a/src/Reorder.py +++ b/src/Reorder.py @@ -41,6 +41,12 @@ class Reorder(ManagedWindow.ManagedWindow): ManagedWindow.ManagedWindow.__init__(self, uistate, track, self) self.person = self.dbstate.db.get_person_from_handle(handle) + self.parent_list = self.person.get_parent_family_handle_list() + self.family_list = self.person.get_family_handle_list() + + penable = len(self.parent_list) > 1 + fenable = len(self.family_list) > 1 + self.set_window(top, None, _("Reorder Relationships")) self.ptree = xml.get_widget('ptree') @@ -51,13 +57,23 @@ class Reorder(ManagedWindow.ManagedWindow): xml.get_widget('ok').connect('clicked', self.ok_clicked) xml.get_widget('cancel').connect('clicked', self.cancel_clicked) - xml.get_widget('fup').connect('clicked', self.fup_clicked) - xml.get_widget('fdown').connect('clicked', self.fdown_clicked) - xml.get_widget('pup').connect('clicked', self.pup_clicked) - xml.get_widget('pdown').connect('clicked', self.pdown_clicked) - self.parent_list = self.person.get_parent_family_handle_list() - self.family_list = self.person.get_family_handle_list() + fup = xml.get_widget('fup') + fup.connect('clicked', self.fup_clicked) + fup.set_sensitive(fenable) + + fdown = xml.get_widget('fdown') + fdown.connect('clicked', self.fdown_clicked) + fdown.set_sensitive(fenable) + + pup = xml.get_widget('pup') + pup.connect('clicked', self.pup_clicked) + pup.set_sensitive(penable) + + pdown = xml.get_widget('pdown') + pdown.connect('clicked', self.pdown_clicked) + pdown.set_sensitive(penable) + self.fill_data() self.show()