From 45f82f1ec5bb95fa8336a907779023aaf81e1cdd Mon Sep 17 00:00:00 2001 From: Josip Date: Mon, 11 May 2015 17:45:42 +0200 Subject: [PATCH] Workaround for broken introspection 8474: Crash after merge places 8498: Crash when attempting to add gramplet 8536: clicking on tag icon in person view causes gramps to crash --- gramps/gui/navigator.py | 10 +++++++++- gramps/gui/views/tags.py | 10 +++++++++- gramps/gui/widgets/grampletbar.py | 10 +++++++++- gramps/plugins/sidebar/dropdownsidebar.py | 10 +++++++++- gramps/plugins/sidebar/expandersidebar.py | 10 +++++++++- 5 files changed, 45 insertions(+), 5 deletions(-) diff --git a/gramps/gui/navigator.py b/gramps/gui/navigator.py index 7e49aee41..82a278b7d 100644 --- a/gramps/gui/navigator.py +++ b/gramps/gui/navigator.py @@ -292,10 +292,18 @@ class Navigator(object): # Functions # #------------------------------------------------------------------------- -def cb_menu_position(menu, button): +def cb_menu_position(*args): """ Determine the position of the popup menu. """ + # takes two argument: menu, button + if len(args) == 2: + menu = args[0] + button = args[1] + # broken introspection can't handle MenuPositionFunc annotations corectly + else: + menu = args[0] + button = args[3] ret_val, x_pos, y_pos = button.get_window().get_origin() x_pos += button.get_allocation().x y_pos += button.get_allocation().y + button.get_allocation().height diff --git a/gramps/gui/views/tags.py b/gramps/gui/views/tags.py index f8326bb53..d24534a20 100644 --- a/gramps/gui/views/tags.py +++ b/gramps/gui/views/tags.py @@ -277,10 +277,18 @@ class Tags(DbGUIElement): view.add_tag(trans, object_handle, tag_handle) status.end() -def cb_menu_position(menu, button): +def cb_menu_position(*args): """ Determine the position of the popup menu. """ + # takes two argument: menu, button + if len(args) == 2: + menu = args[0] + button = args[1] + # broken introspection can't handle MenuPositionFunc annotations corectly + else: + menu = args[0] + button = args[3] ret_val, x_pos, y_pos = button.get_window().get_origin() x_pos += button.get_allocation().x y_pos += button.get_allocation().y + button.get_allocation().height diff --git a/gramps/gui/widgets/grampletbar.py b/gramps/gui/widgets/grampletbar.py index 7d0a2a112..88173c241 100644 --- a/gramps/gui/widgets/grampletbar.py +++ b/gramps/gui/widgets/grampletbar.py @@ -734,10 +734,18 @@ class TabLabel(Gtk.HBox): else: self.closebtn.hide() -def cb_menu_position(menu, button): +def cb_menu_position(*args): """ Determine the position of the popup menu. """ + # takes two argument: menu, button + if len(args) == 2: + menu = args[0] + button = args[1] + # broken introspection can't handle MenuPositionFunc annotations corectly + else: + menu = args[0] + button = args[3] ret_val, x_pos, y_pos = button.get_window().get_origin() x_pos += button.get_allocation().x y_pos += button.get_allocation().y + button.get_allocation().height diff --git a/gramps/plugins/sidebar/dropdownsidebar.py b/gramps/plugins/sidebar/dropdownsidebar.py index 4fefb2e0a..6cb8b6dff 100644 --- a/gramps/plugins/sidebar/dropdownsidebar.py +++ b/gramps/plugins/sidebar/dropdownsidebar.py @@ -205,10 +205,18 @@ class DropdownSidebar(BaseSidebar): self.viewmanager.notebook.set_current_page(page_no) self.__handlers_unblock() -def cb_menu_position(menu, button): +def cb_menu_position(*args): """ Determine the position of the popup menu. """ + # takes two argument: menu, button + if len(args) == 2: + menu = args[0] + button = args[1] + # broken introspection can't handle MenuPositionFunc annotations corectly + else: + menu = args[0] + button = args[3] ret_val, x_pos, y_pos = button.get_window().get_origin() x_pos += button.get_allocation().x y_pos += button.get_allocation().y + button.get_allocation().height diff --git a/gramps/plugins/sidebar/expandersidebar.py b/gramps/plugins/sidebar/expandersidebar.py index d152e69bb..21f9616e5 100644 --- a/gramps/plugins/sidebar/expandersidebar.py +++ b/gramps/plugins/sidebar/expandersidebar.py @@ -218,10 +218,18 @@ class ExpanderSidebar(BaseSidebar): self.viewmanager.notebook.set_current_page(page_no) self.__handlers_unblock() -def cb_menu_position(menu, button): +def cb_menu_position(*args): """ Determine the position of the popup menu. """ + # takes two argument: menu, button + if len(args) == 2: + menu = args[0] + button = args[1] + # broken introspection can't handle MenuPositionFunc annotations corectly + else: + menu = args[0] + button = args[3] ret_val, x_pos, y_pos = button.get_window().get_origin() x_pos += button.get_allocation().x y_pos += button.get_allocation().y + button.get_allocation().height