* src/ViewManager.py: Proper label change for Undo/Redo.

svn: r5748
This commit is contained in:
Alex Roitman 2006-01-13 20:53:10 +00:00
parent 244e17066a
commit 58d66f6708
2 changed files with 44 additions and 2 deletions

View File

@ -1,3 +1,6 @@
2006-01-13 Alex Roitman <shura@gramps-project.org>
* src/ViewManager.py: Proper label change for Undo/Redo.
2006-01-13 Richard Taylor <rjt-gramps@thegrindstone.me.uk> 2006-01-13 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/ObjectSelector/_IntEdit.py: added int only edit * src/ObjectSelector/_IntEdit.py: added int only edit

View File

@ -288,6 +288,8 @@ class ViewManager:
self.actiongroup = gtk.ActionGroup('MainWindow') self.actiongroup = gtk.ActionGroup('MainWindow')
self.fileactions = gtk.ActionGroup('FileWindow') self.fileactions = gtk.ActionGroup('FileWindow')
self.undoactions = gtk.ActionGroup('Undo')
self.redoactions = gtk.ActionGroup('Redo')
self.fileactions.add_actions([ self.fileactions.add_actions([
('FileMenu', None, '_File'), ('FileMenu', None, '_File'),
@ -314,8 +316,6 @@ class ViewManager:
('SaveAs', gtk.STOCK_SAVE_AS, '_Save As'), ('SaveAs', gtk.STOCK_SAVE_AS, '_Save As'),
('Export', gtk.STOCK_SAVE_AS, '_Export', "<control>e", None, self.export_data), ('Export', gtk.STOCK_SAVE_AS, '_Export', "<control>e", None, self.export_data),
('Abandon', gtk.STOCK_REVERT_TO_SAVED, '_Abandon changes and quit'), ('Abandon', gtk.STOCK_REVERT_TO_SAVED, '_Abandon changes and quit'),
('Undo', gtk.STOCK_UNDO, '_Undo', '<control>z', None, self.undo),
('Redo', gtk.STOCK_REDO, '_Redo', '<shift><control>z', None, self.redo),
('CmpMerge', None, '_Compare and merge'), ('CmpMerge', None, '_Compare and merge'),
('FastMerge', None, '_Fast merge'), ('FastMerge', None, '_Fast merge'),
('ScratchPad', gtk.STOCK_PASTE, '_ScratchPad', None, None, self.scratchpad), ('ScratchPad', gtk.STOCK_PASTE, '_ScratchPad', None, None, self.scratchpad),
@ -342,10 +342,20 @@ class ViewManager:
), ),
]) ])
self.undoactions.add_actions([
('Undo',gtk.STOCK_UNDO,'_Undo','<control>z',None,self.undo)])
self.undoactions.set_sensitive(False)
self.redoactions.add_actions([
('Redo',gtk.STOCK_REDO,'_Redo','<shift><control>z',None,self.redo)
])
self.redoactions.set_sensitive(False)
merge_id = self.uimanager.add_ui_from_string(uidefault) merge_id = self.uimanager.add_ui_from_string(uidefault)
self.uimanager.insert_action_group(self.fileactions,1) self.uimanager.insert_action_group(self.fileactions,1)
self.uimanager.insert_action_group(self.actiongroup,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): def home_page_activate(self,obj):
GrampsDisplay.url(const.url_homepage) GrampsDisplay.url(const.url_homepage)
@ -777,9 +787,38 @@ class ViewManager:
self.relationship = self.RelClass(self.state.db) self.relationship = self.RelClass(self.state.db)
self.state.change_active_person(self.find_initial_person()) self.state.change_active_person(self.find_initial_person())
self.change_page(None,None) 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) self.actiongroup.set_visible(True)
return 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,'<control>z',None,self.undo)])
else:
self.undoactions.add_actions([
('Undo',gtk.STOCK_UNDO,'_Undo',
'<control>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,'<shift><control>z',
None,self.redo)])
else:
self.redoactions.add_actions([
('Redo',gtk.STOCK_UNDO,'_Redo',
'<shift><control>z',None,self.redo)])
self.redoactions.set_sensitive(False)
self.uimanager.insert_action_group(self.redoactions,1)
def setup_bookmarks(self): def setup_bookmarks(self):
self.bookmarks = Bookmarks.Bookmarks(self.state,self.uimanager, self.bookmarks = Bookmarks.Bookmarks(self.state,self.uimanager,
self.state.db.get_bookmarks()) self.state.db.get_bookmarks())