diff --git a/gramps/gui/clipboard.py b/gramps/gui/clipboard.py index c1d437fb3..0469f6e10 100644 --- a/gramps/gui/clipboard.py +++ b/gramps/gui/clipboard.py @@ -1532,7 +1532,8 @@ class MultiTreeView(Gtk.TreeView): if popup.get_children(): # Show the popup menu: popup.popup(None, None, None, None, 3, event.time) return True - elif event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + elif (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): model, paths = self.get_selection().get_selected_rows() for path in paths: node = model.get_iter(path) diff --git a/gramps/gui/dbman.py b/gramps/gui/dbman.py index d5e215ebd..8a377a1a1 100644 --- a/gramps/gui/dbman.py +++ b/gramps/gui/dbman.py @@ -248,7 +248,8 @@ class DbManager(CLIDbManager, ManagedWindow): treat a double click as if it was OK button press. However, we have to make sure that an item was selected first. """ - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): if self.connect_btn.get_property('sensitive'): self.top.response(Gtk.ResponseType.OK) return True diff --git a/gramps/gui/editors/displaytabs/buttontab.py b/gramps/gui/editors/displaytabs/buttontab.py index f590915e2..789d7a276 100644 --- a/gramps/gui/editors/displaytabs/buttontab.py +++ b/gramps/gui/editors/displaytabs/buttontab.py @@ -193,7 +193,8 @@ class ButtonTab(GrampsTab): Handles the double click on list. If the double click occurs, the Edit button handler is called """ - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): try: self.edit_button_clicked(obj) except WindowActiveError: diff --git a/gramps/gui/editors/displaytabs/gallerytab.py b/gramps/gui/editors/displaytabs/gallerytab.py index 5ef44a4a5..68e6592f8 100644 --- a/gramps/gui/editors/displaytabs/gallerytab.py +++ b/gramps/gui/editors/displaytabs/gallerytab.py @@ -110,7 +110,8 @@ class GalleryTab(ButtonTab, DbGUIElement): Handle the button press event: double click or right click on iconlist. If the double click occurs, the Edit button handler is called. """ - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): self.edit_button_clicked(obj) return True elif is_right_click(event): diff --git a/gramps/gui/editors/editmedia.py b/gramps/gui/editors/editmedia.py index 33ff35fd3..392811a64 100644 --- a/gramps/gui/editors/editmedia.py +++ b/gramps/gui/editors/editmedia.py @@ -241,7 +241,8 @@ class EditMedia(EditPrimary): return (_('Edit Media Object'), self.get_menu_title()) def button_press_event(self, obj, event): - if event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): self.view_media(obj) def view_media(self, obj): diff --git a/gramps/gui/editors/editmediaref.py b/gramps/gui/editors/editmediaref.py index e746fa0bd..23e567bd6 100644 --- a/gramps/gui/editors/editmediaref.py +++ b/gramps/gui/editors/editmediaref.py @@ -412,7 +412,8 @@ class EditMediaRef(EditReference): return (_('Media Reference Editor'),submenu_label) def button_press_event(self, obj, event): - if event.button==1 and event.type == Gdk.EventType._2BUTTON_PRESS: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): photo_path = media_path_full(self.db, self.source.get_path()) open_file_with_default_application(photo_path, self.uistate) diff --git a/gramps/gui/editors/editperson.py b/gramps/gui/editors/editperson.py index fb6fd7ab7..15f34ed8f 100644 --- a/gramps/gui/editors/editperson.py +++ b/gramps/gui/editors/editperson.py @@ -608,7 +608,8 @@ class EditPerson(EditPrimary): main form. """ - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): media_list = self.obj.get_media_list() if media_list: diff --git a/gramps/gui/editors/filtereditor.py b/gramps/gui/editors/filtereditor.py index 6f932e7a7..702b9659f 100644 --- a/gramps/gui/editors/filtereditor.py +++ b/gramps/gui/editors/filtereditor.py @@ -702,7 +702,8 @@ class EditRule(ManagedWindow): self.selection.select_iter(iter) def _button_press(self, obj, event): - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): return self.expand_collapse() def _key_press(self, obj, event): diff --git a/gramps/gui/listmodel.py b/gramps/gui/listmodel.py index 9f4643284..e96a5396e 100644 --- a/gramps/gui/listmodel.py +++ b/gramps/gui/listmodel.py @@ -481,7 +481,8 @@ class ListModel: Called when a button press is executed """ from .utils import is_right_click - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): if self.double_click: self.double_click(obj) return True diff --git a/gramps/gui/plug/_windows.py b/gramps/gui/plug/_windows.py index 8219b2b9d..431468008 100644 --- a/gramps/gui/plug/_windows.py +++ b/gramps/gui/plug/_windows.py @@ -550,7 +550,8 @@ class PluginStatus(ManagedWindow): def button_press(self, obj, event): """ Callback function from the user clicking on a line """ - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): model, node = self.selection.get_selected() data = model.get_value(node, 3) name = model.get_value(node, 1) @@ -560,7 +561,8 @@ class PluginStatus(ManagedWindow): def button_press_reg(self, obj, event): """ Callback function from the user clicking on a line in reg plugin """ - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): self.__info(obj, self.list_reg, 4) def button_press_addon(self, obj): @@ -830,7 +832,7 @@ class ToolManagedWindowBase(ManagedWindow): if iter.has_tag(tag): person = self.db.get_person_from_handle(person_handle) if event.button == 1: - if event.type == Gdk.EventType._2BUTTON_PRESS: + if event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS: try: EditPerson(self.dbstate, self.uistate, [], person) except WindowActiveError: diff --git a/gramps/gui/plug/report/_bookdialog.py b/gramps/gui/plug/report/_bookdialog.py index c7650ab66..a5822f891 100644 --- a/gramps/gui/plug/report/_bookdialog.py +++ b/gramps/gui/plug/report/_bookdialog.py @@ -257,7 +257,8 @@ class BookListDisplay: Checks for a double click event. In the list, we want to treat a double click as if it was OK button press. """ - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): store, the_iter = self.blist.get_selected() if not the_iter: return False @@ -601,7 +602,8 @@ class BookSelector(ManagedWindow): Double-click on the current book selection is the same as setup. Right click evokes the context menu. """ - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): self.on_setup_clicked(obj) elif is_right_click(event): self.build_book_context_menu(event) @@ -611,7 +613,8 @@ class BookSelector(ManagedWindow): Double-click on the available selection is the same as add. Right click evokes the context menu. """ - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): self.on_add_clicked(obj) elif is_right_click(event): self.build_avail_context_menu(event) diff --git a/gramps/gui/plug/report/_styleeditor.py b/gramps/gui/plug/report/_styleeditor.py index c712d111a..b087f3ea3 100644 --- a/gramps/gui/plug/report/_styleeditor.py +++ b/gramps/gui/plug/report/_styleeditor.py @@ -160,7 +160,8 @@ class StyleListDisplay(ManagedWindow): log.error("Failed to save stylesheet", exc_info=True) def on_button_press(self, obj, event): - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): self.on_edit_clicked(obj) def on_edit_clicked(self, obj): diff --git a/gramps/gui/views/listview.py b/gramps/gui/views/listview.py index a286838d1..34dd7ef05 100644 --- a/gramps/gui/views/listview.py +++ b/gramps/gui/views/listview.py @@ -848,7 +848,8 @@ class ListView(NavigationView): if not self.dbstate.is_open(): return False menu = self.uimanager.get_widget('Popup') - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): if self.model.get_flags() & Gtk.TreeModelFlags.LIST_ONLY: self.edit(obj) return True diff --git a/gramps/gui/widgets/grampletpane.py b/gramps/gui/widgets/grampletpane.py index f5640fabb..8d8354199 100644 --- a/gramps/gui/widgets/grampletpane.py +++ b/gramps/gui/widgets/grampletpane.py @@ -644,7 +644,7 @@ class GuiGramplet: person = self.dbstate.db.get_person_from_handle(handle) if person is not None: if event.button == 1: # left mouse - if event.type == Gdk.EventType._2BUTTON_PRESS: # double + if event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS: try: EditPerson(self.dbstate, self.uistate, @@ -652,7 +652,7 @@ class GuiGramplet: return True # handled event except WindowActiveError: pass - elif event.type == Gdk.EventType.BUTTON_PRESS: # single + elif event.type == Gdk.EventType.BUTTON_PRESS: self.uistate.set_active(handle, 'Person') return True # handled event elif is_right_click(event): @@ -666,7 +666,7 @@ class GuiGramplet: pass elif link_type == 'Surname': if event.button == 1: # left mouse - if event.type == Gdk.EventType._2BUTTON_PRESS: # double + if event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS: run_quick_report_by_name(self.dbstate, self.uistate, 'samesurnames', @@ -674,7 +674,7 @@ class GuiGramplet: return True elif link_type == 'Given': if event.button == 1: # left mouse - if event.type == Gdk.EventType._2BUTTON_PRESS: # double + if event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS: run_quick_report_by_name(self.dbstate, self.uistate, 'samegivens_misc', @@ -682,7 +682,7 @@ class GuiGramplet: return True elif link_type == 'Filter': if event.button == 1: # left mouse - if event.type == Gdk.EventType._2BUTTON_PRESS: # double + if event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS: run_quick_report_by_name(self.dbstate, self.uistate, 'filterbyname', @@ -707,7 +707,7 @@ class GuiGramplet: family = self.dbstate.db.get_family_from_handle(handle) if family is not None: if event.button == 1: # left mouse - if event.type == Gdk.EventType._2BUTTON_PRESS: # double + if event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS: try: EditFamily(self.dbstate, self.uistate, @@ -715,7 +715,7 @@ class GuiGramplet: return True # handled event except WindowActiveError: pass - elif event.type == Gdk.EventType.BUTTON_PRESS: # single + elif event.type == Gdk.EventType.BUTTON_PRESS: self.uistate.set_active(handle, 'Family') return True # handle event elif is_right_click(event): @@ -729,7 +729,7 @@ class GuiGramplet: pass elif link_type == 'PersonList': if event.button == 1: # left mouse - if event.type == Gdk.EventType._2BUTTON_PRESS: # double + if event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS: run_quick_report_by_name(self.dbstate, self.uistate, 'filterbyname', @@ -738,7 +738,7 @@ class GuiGramplet: return True elif link_type == 'Attribute': if event.button == 1: # left mouse - if event.type == Gdk.EventType._2BUTTON_PRESS: # double + if event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS: run_quick_report_by_name(self.dbstate, self.uistate, 'attribute_match', diff --git a/gramps/gui/widgets/photo.py b/gramps/gui/widgets/photo.py index 08d8fd192..fd22c7f54 100644 --- a/gramps/gui/widgets/photo.py +++ b/gramps/gui/widgets/photo.py @@ -77,7 +77,8 @@ class Photo(Gtk.EventBox): """ Display the image with the default external viewer. """ - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): open_file_with_default_application(self.full_path, self.uistate) return True elif is_right_click(event): diff --git a/gramps/plugins/gramplet/leak.py b/gramps/plugins/gramplet/leak.py index 11b36c48b..949531cf7 100644 --- a/gramps/plugins/gramplet/leak.py +++ b/gramps/plugins/gramplet/leak.py @@ -124,7 +124,8 @@ class Leak(Gramplet): # self.display() # We should only run this on demand def _button_press(self, obj, event): - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): self.referenced_in() return True elif is_right_click(event): diff --git a/gramps/plugins/tool/removeunused.py b/gramps/plugins/tool/removeunused.py index d41412426..7ad01fca0 100644 --- a/gramps/plugins/tool/removeunused.py +++ b/gramps/plugins/tool/removeunused.py @@ -341,7 +341,8 @@ class RemoveUnused(tool.Tool, ManagedWindow, UpdateCallback): row[RemoveUnused.MARK_COL] = not row[RemoveUnused.MARK_COL] def double_click(self, obj, event): - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): (model, node) = self.selection.get_selected() if not node: return diff --git a/gramps/plugins/tool/verify.py b/gramps/plugins/tool/verify.py index 2f5205e5a..f3e84d988 100644 --- a/gramps/plugins/tool/verify.py +++ b/gramps/plugins/tool/verify.py @@ -708,7 +708,8 @@ class VerifyResults(ManagedWindow): def double_click(self, obj, event): """ the user wants to edit the selected person or family """ - if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): (model, node) = self.selection.get_selected() if not node: return diff --git a/gramps/plugins/view/pedigreeview.py b/gramps/plugins/view/pedigreeview.py index 3bb59e9a7..1cb4f5684 100644 --- a/gramps/plugins/view/pedigreeview.py +++ b/gramps/plugins/view/pedigreeview.py @@ -1478,7 +1478,8 @@ class PedigreeView(NavigationView): self.cb_build_full_nav_menu(obj, event, person_handle, family_handle) return True - elif event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS: + elif (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): self.cb_edit_person(obj, person_handle) return True return True @@ -1492,7 +1493,8 @@ class PedigreeView(NavigationView): if is_right_click(event): self.cb_build_relation_nav_menu(obj, event, family_handle) return True - elif event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS: + elif (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): self.cb_edit_family(obj, family_handle) return True return True @@ -1503,7 +1505,8 @@ class PedigreeView(NavigationView): Call function for not full family for mouse left button double click on missing persons or call submenu for mouse right click. """ - if event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS: + if (event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS + and event.button == 1): self.cb_add_parents(obj, person_handle, family_handle) return True elif is_right_click(event):