From 726da689c6b3148f245f966788773068217e1090 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Tue, 17 Aug 2010 14:18:04 +0000 Subject: [PATCH] Revised undo/redo for different versions of gtk svn: r15762 --- src/gui/widgets/grampletpane.py | 15 +++++++-------- src/gui/widgets/styledtexteditor.py | 14 ++++++-------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/gui/widgets/grampletpane.py b/src/gui/widgets/grampletpane.py index 0008f3c3f..3039dc9c1 100644 --- a/src/gui/widgets/grampletpane.py +++ b/src/gui/widgets/grampletpane.py @@ -389,17 +389,16 @@ class GuiGramplet(object): 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.MOD2_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)): + (event.state & gtk.gdk.SHIFT_MASK)): self.redo() return True + elif ((gtk.gdk.keyval_name(event.keyval) == 'z') and + (event.state & gtk.gdk.CONTROL_MASK)): + self.undo() + return True + return False def edit_title(self, widget): diff --git a/src/gui/widgets/styledtexteditor.py b/src/gui/widgets/styledtexteditor.py index 5afb1cc1a..db1ee3e92 100644 --- a/src/gui/widgets/styledtexteditor.py +++ b/src/gui/widgets/styledtexteditor.py @@ -240,17 +240,15 @@ class StyledTextEditor(gtk.TextView): 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.MOD2_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)): + (event.state & gtk.gdk.SHIFT_MASK)): self.redo() return True + elif ((gtk.gdk.keyval_name(event.keyval) == 'z') and + (event.state & gtk.gdk.CONTROL_MASK)): + self.undo() + return True else: for accel, accel_name in self.action_accels.iteritems(): key, mod = gtk.accelerator_parse(accel)