From 2a6790d795877cee278c3beba718e499cfb4f130 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Thu, 5 Jul 2012 03:15:26 +0000 Subject: [PATCH] convert KEY_PRESS svn: r19951 --- src/gui/clipboard.py | 2 +- src/gui/editors/displaytabs/buttontab.py | 2 +- src/gui/editors/displaytabs/grampstab.py | 2 +- src/gui/editors/displaytabs/surnametab.py | 2 +- src/gui/editors/editchildref.py | 2 +- src/gui/editors/editfamily.py | 2 +- src/gui/views/navigationview.py | 2 +- src/gui/views/pageview.py | 3 ++- src/gui/widgets/grampletpane.py | 2 +- src/gui/widgets/monitoredwidgets.py | 2 +- src/gui/widgets/multitreeview.py | 2 +- src/plugins/view/relview.py | 2 +- 12 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/gui/clipboard.py b/src/gui/clipboard.py index 84c4c3599..674c0138b 100644 --- a/src/gui/clipboard.py +++ b/src/gui/clipboard.py @@ -1403,7 +1403,7 @@ class MultiTreeView(Gtk.TreeView): self.defer_select = False def key_press_event(self, widget, event): - if event.type == Gdk.KEY_PRESS: + if event.type == Gdk.EventType.KEY_PRESS: if event.keyval == Gdk.KEY_Delete: model, paths = self.get_selection().get_selected_rows() # reverse, to delete from the end diff --git a/src/gui/editors/displaytabs/buttontab.py b/src/gui/editors/displaytabs/buttontab.py index 53ebe3b73..9c3d860d2 100644 --- a/src/gui/editors/displaytabs/buttontab.py +++ b/src/gui/editors/displaytabs/buttontab.py @@ -205,7 +205,7 @@ class ButtonTab(GrampsTab): Handles the return key being pressed on list. If the key is pressed, the Edit button handler is called """ - if event.type == Gdk.KEY_PRESS: + if event.type == Gdk.EventType.KEY_PRESS: #print 'key pressed', event.keyval, event.get_state(), _ADD if event.keyval in (_RETURN, _KP_ENTER): try: diff --git a/src/gui/editors/displaytabs/grampstab.py b/src/gui/editors/displaytabs/grampstab.py index 485f8cc94..83a547ee5 100644 --- a/src/gui/editors/displaytabs/grampstab.py +++ b/src/gui/editors/displaytabs/grampstab.py @@ -155,7 +155,7 @@ class GrampsTab(Gtk.VBox): The inheriting object must contain a widget that connects at mimimum to this method, eg an eventbox, tree, ... """ - if event.type == Gdk.KEY_PRESS: + if event.type == Gdk.EventType.KEY_PRESS: if event.keyval in (_LEFT,) and \ (event.get_state() & Gdk.ModifierType.MOD1_MASK): self.prev_page() diff --git a/src/gui/editors/displaytabs/surnametab.py b/src/gui/editors/displaytabs/surnametab.py index d58dc5a34..e307ecdc5 100644 --- a/src/gui/editors/displaytabs/surnametab.py +++ b/src/gui/editors/displaytabs/surnametab.py @@ -322,7 +322,7 @@ class SurnameTab(EmbeddedList): Here we make sure tab moves to next or previous value in row on TAB """ if not EmbeddedList.key_pressed(self, obj, event): - if event.type == Gdk.KEY_PRESS and event.keyval in (_TAB,): + if event.type == Gdk.EventType.KEY_PRESS and event.keyval in (_TAB,): if not (event.get_state() & (Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.CONTROL_MASK)): return self.next_cell() diff --git a/src/gui/editors/editchildref.py b/src/gui/editors/editchildref.py index fd59043f5..afba08325 100644 --- a/src/gui/editors/editchildref.py +++ b/src/gui/editors/editchildref.py @@ -208,7 +208,7 @@ class EditChildRef(EditSecondary): def button_activated(event, mouse_button): if (event.type == Gdk.EventType.BUTTON_PRESS and event.button == mouse_button) or \ - (event.type == Gdk.KEY_PRESS and + (event.type == Gdk.EventType.KEY_PRESS and event.keyval in (_RETURN, _KP_ENTER)): return True else: diff --git a/src/gui/editors/editfamily.py b/src/gui/editors/editfamily.py index 5e1ee38aa..52661ad53 100644 --- a/src/gui/editors/editfamily.py +++ b/src/gui/editors/editfamily.py @@ -1094,7 +1094,7 @@ class EditFamily(EditPrimary): def button_activated(event, mouse_button): if (event.type == Gdk.EventType.BUTTON_PRESS and event.button == mouse_button) or \ - (event.type == Gdk.KEY_PRESS and + (event.type == Gdk.EventType.KEY_PRESS and event.keyval in (_RETURN, _KP_ENTER)): return True else: diff --git a/src/gui/views/navigationview.py b/src/gui/views/navigationview.py index 16f3441b4..307349c3e 100644 --- a/src/gui/views/navigationview.py +++ b/src/gui/views/navigationview.py @@ -501,7 +501,7 @@ class NavigationView(PageView): Handle the control+c (copy) and control+v (paste), or pass it on. """ if self.active: - if event.type == Gdk.KEY_PRESS: + if event.type == Gdk.EventType.KEY_PRESS: if (event.keyval == Gdk.KEY_c and (event.get_state() & Gdk.ModifierType.CONTROL_MASK)): self.call_copy() diff --git a/src/gui/views/pageview.py b/src/gui/views/pageview.py index d2665ac42..917bb4df1 100644 --- a/src/gui/views/pageview.py +++ b/src/gui/views/pageview.py @@ -39,6 +39,7 @@ _LOG = logging.getLogger('.pageview') # #---------------------------------------------------------------- from gi.repository import Gtk +from gi.repository import Gdk from gen.ggettext import gettext as _ #---------------------------------------------------------------- @@ -214,7 +215,7 @@ class PageView(DbGUIElement): (paste). """ if self.active: - if event.type == Gdk.KEY_PRESS: + if event.type == Gdk.EventType.KEY_PRESS: if (event.keyval == Gdk.KEY_v and (event.get_state() & Gdk.ModifierType.CONTROL_MASK)): self.call_paste() diff --git a/src/gui/widgets/grampletpane.py b/src/gui/widgets/grampletpane.py index 2569a1cf8..13773420f 100644 --- a/src/gui/widgets/grampletpane.py +++ b/src/gui/widgets/grampletpane.py @@ -789,7 +789,7 @@ class GridGramplet(GuiGramplet): """ Edit the title, handle escape. """ - if event.type == Gdk.KEY_PRESS: + if event.type == Gdk.EventType.KEY_PRESS: if event.keyval == Gdk.KEY_Escape: self.titlelabel.show() widget.hide() diff --git a/src/gui/widgets/monitoredwidgets.py b/src/gui/widgets/monitoredwidgets.py index 6445208b6..df8626043 100644 --- a/src/gui/widgets/monitoredwidgets.py +++ b/src/gui/widgets/monitoredwidgets.py @@ -858,7 +858,7 @@ class MonitoredTagList(object): Invoke the tag editor. """ if (event.type == Gdk.EventType.BUTTON_PRESS or - (event.type == Gdk.KEY_PRESS and + (event.type == Gdk.EventType.KEY_PRESS and event.keyval in (_RETURN, _KP_ENTER))): from gui.editors import EditTagList editor = EditTagList(self.tag_list, self.all_tags, diff --git a/src/gui/widgets/multitreeview.py b/src/gui/widgets/multitreeview.py index eaa6fb597..21a420f29 100644 --- a/src/gui/widgets/multitreeview.py +++ b/src/gui/widgets/multitreeview.py @@ -43,7 +43,7 @@ class MultiTreeView(Gtk.TreeView): self.defer_select = False def key_press_event(self, widget, event): - if event.type == Gdk.KEY_PRESS: + if event.type == Gdk.EventType.KEY_PRESS: if event.keyval == Gdk.KEY_Delete: model, paths = self.get_selection().get_selected_rows() # reverse, to delete from the end diff --git a/src/plugins/view/relview.py b/src/plugins/view/relview.py index 71812476a..ccda1e5a7 100644 --- a/src/plugins/view/relview.py +++ b/src/plugins/view/relview.py @@ -1873,7 +1873,7 @@ def has_children(db,p): def button_activated(event, mouse_button): if (event.type == Gdk.EventType.BUTTON_PRESS and event.button == mouse_button) or \ - (event.type == Gdk.KEY_PRESS and + (event.type == Gdk.EventType.KEY_PRESS and event.keyval in (_RETURN, _KP_ENTER, _SPACE)): return True else: