Added UndoableBuffer for notes that allows undo (control+z) and redo (control+shift+z)
svn: r15751
This commit is contained in:
@@ -412,6 +412,8 @@ class StyledTextEditor(gtk.TextView):
|
||||
_('Bold'), self._on_toggle_action_activate),
|
||||
(str(StyledTextTagType.UNDERLINE), gtk.STOCK_UNDERLINE, None, None,
|
||||
_('Underline'), self._on_toggle_action_activate),
|
||||
("Undo", gtk.STOCK_UNDO, None, None, _('Undo'), self.undo),
|
||||
("Redo", gtk.STOCK_REDO, None, None, _('Redo'), self.redo),
|
||||
]
|
||||
|
||||
self.toggle_actions = [action[0] for action in format_toggle_actions]
|
||||
@@ -461,6 +463,8 @@ class StyledTextEditor(gtk.TextView):
|
||||
'<Control>i': str(StyledTextTagType.ITALIC),
|
||||
'<Control>b': str(StyledTextTagType.BOLD),
|
||||
'<Control>u': str(StyledTextTagType.UNDERLINE),
|
||||
'<Control>z' : "Undo",
|
||||
'<Control><Shift>z': "Redo",
|
||||
}
|
||||
|
||||
# create the action group and insert all the actions
|
||||
@@ -731,6 +735,12 @@ class StyledTextEditor(gtk.TextView):
|
||||
"""
|
||||
return self.toolbar
|
||||
|
||||
def undo(self, obj):
|
||||
self.textbuffer.undo()
|
||||
|
||||
def redo(self, obj):
|
||||
self.textbuffer.redo()
|
||||
|
||||
def uri_dialog(self, uri, callback):
|
||||
"""
|
||||
Function to spawn the link editor.
|
||||
|
Reference in New Issue
Block a user