From 58d66f67083db24eab64657164464faa037ea99b Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 13 Jan 2006 20:53:10 +0000 Subject: [PATCH] * src/ViewManager.py: Proper label change for Undo/Redo. svn: r5748 --- gramps2/ChangeLog | 3 +++ gramps2/src/ViewManager.py | 43 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index c2b7f9292..2c7a7810e 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,6 @@ +2006-01-13 Alex Roitman + * src/ViewManager.py: Proper label change for Undo/Redo. + 2006-01-13 Richard Taylor * src/ObjectSelector/_IntEdit.py: added int only edit diff --git a/gramps2/src/ViewManager.py b/gramps2/src/ViewManager.py index e5b86ec25..c4e399fe6 100644 --- a/gramps2/src/ViewManager.py +++ b/gramps2/src/ViewManager.py @@ -288,6 +288,8 @@ class ViewManager: self.actiongroup = gtk.ActionGroup('MainWindow') self.fileactions = gtk.ActionGroup('FileWindow') + self.undoactions = gtk.ActionGroup('Undo') + self.redoactions = gtk.ActionGroup('Redo') self.fileactions.add_actions([ ('FileMenu', None, '_File'), @@ -314,8 +316,6 @@ class ViewManager: ('SaveAs', gtk.STOCK_SAVE_AS, '_Save As'), ('Export', gtk.STOCK_SAVE_AS, '_Export', "e", None, self.export_data), ('Abandon', gtk.STOCK_REVERT_TO_SAVED, '_Abandon changes and quit'), - ('Undo', gtk.STOCK_UNDO, '_Undo', 'z', None, self.undo), - ('Redo', gtk.STOCK_REDO, '_Redo', 'z', None, self.redo), ('CmpMerge', None, '_Compare and merge'), ('FastMerge', None, '_Fast merge'), ('ScratchPad', gtk.STOCK_PASTE, '_ScratchPad', None, None, self.scratchpad), @@ -342,10 +342,20 @@ class ViewManager: ), ]) + self.undoactions.add_actions([ + ('Undo',gtk.STOCK_UNDO,'_Undo','z',None,self.undo)]) + self.undoactions.set_sensitive(False) + self.redoactions.add_actions([ + ('Redo',gtk.STOCK_REDO,'_Redo','z',None,self.redo) + ]) + self.redoactions.set_sensitive(False) + merge_id = self.uimanager.add_ui_from_string(uidefault) self.uimanager.insert_action_group(self.fileactions,1) self.uimanager.insert_action_group(self.actiongroup,1) + self.uimanager.insert_action_group(self.undoactions,1) + self.uimanager.insert_action_group(self.redoactions,1) def home_page_activate(self,obj): GrampsDisplay.url(const.url_homepage) @@ -777,9 +787,38 @@ class ViewManager: self.relationship = self.RelClass(self.state.db) self.state.change_active_person(self.find_initial_person()) self.change_page(None,None) + self.state.db.undo_callback = self.change_undo_label + self.state.db.redo_callback = self.change_redo_label self.actiongroup.set_visible(True) return True + def change_undo_label(self,label): + self.uimanager.remove_action_group(self.undoactions) + self.undoactions = gtk.ActionGroup('Undo') + if label: + self.undoactions.add_actions([ + ('Undo',gtk.STOCK_UNDO,label,'z',None,self.undo)]) + else: + self.undoactions.add_actions([ + ('Undo',gtk.STOCK_UNDO,'_Undo', + 'z',None,self.undo)]) + self.undoactions.set_sensitive(False) + self.uimanager.insert_action_group(self.undoactions,1) + + def change_redo_label(self,label): + self.uimanager.remove_action_group(self.redoactions) + self.redoactions = gtk.ActionGroup('Redo') + if label: + self.redoactions.add_actions([ + ('Redo',gtk.STOCK_REDO,label,'z', + None,self.redo)]) + else: + self.redoactions.add_actions([ + ('Redo',gtk.STOCK_UNDO,'_Redo', + 'z',None,self.redo)]) + self.redoactions.set_sensitive(False) + self.uimanager.insert_action_group(self.redoactions,1) + def setup_bookmarks(self): self.bookmarks = Bookmarks.Bookmarks(self.state,self.uimanager, self.state.db.get_bookmarks())