Revised undo/redo for different versions of gtk

svn: r15762
This commit is contained in:
Doug Blank 2010-08-17 14:18:04 +00:00
parent 5ae9f75ded
commit 726da689c6
2 changed files with 13 additions and 16 deletions

View File

@ -389,17 +389,16 @@ class GuiGramplet(object):
Handle formatting shortcuts. Handle formatting shortcuts.
""" """
if ((gtk.gdk.keyval_name(event.keyval) == 'z') and if ((gtk.gdk.keyval_name(event.keyval) == 'Z') and
(event.state & gtk.gdk.CONTROL_MASK) and (event.state & gtk.gdk.CONTROL_MASK) and
(event.state & gtk.gdk.MOD2_MASK)): (event.state & gtk.gdk.SHIFT_MASK)):
self.undo()
return True
elif ((gtk.gdk.keyval_name(event.keyval) == 'Z') and
(event.state & gtk.gdk.CONTROL_MASK) and
(event.state & gtk.gdk.MOD2_MASK) and
(event.state & gtk.gdk.SHIFT_MASK)):
self.redo() self.redo()
return True return True
elif ((gtk.gdk.keyval_name(event.keyval) == 'z') and
(event.state & gtk.gdk.CONTROL_MASK)):
self.undo()
return True
return False return False
def edit_title(self, widget): def edit_title(self, widget):

View File

@ -240,17 +240,15 @@ class StyledTextEditor(gtk.TextView):
Handle formatting shortcuts. Handle formatting shortcuts.
""" """
if ((gtk.gdk.keyval_name(event.keyval) == 'z') and if ((gtk.gdk.keyval_name(event.keyval) == 'Z') and
(event.state & gtk.gdk.CONTROL_MASK) and (event.state & gtk.gdk.CONTROL_MASK) and
(event.state & gtk.gdk.MOD2_MASK)): (event.state & gtk.gdk.SHIFT_MASK)):
self.undo()
return True
elif ((gtk.gdk.keyval_name(event.keyval) == 'Z') and
(event.state & gtk.gdk.CONTROL_MASK) and
(event.state & gtk.gdk.MOD2_MASK) and
(event.state & gtk.gdk.SHIFT_MASK)):
self.redo() self.redo()
return True return True
elif ((gtk.gdk.keyval_name(event.keyval) == 'z') and
(event.state & gtk.gdk.CONTROL_MASK)):
self.undo()
return True
else: else:
for accel, accel_name in self.action_accels.iteritems(): for accel, accel_name in self.action_accels.iteritems():
key, mod = gtk.accelerator_parse(accel) key, mod = gtk.accelerator_parse(accel)