From b966ba74af00aaae65d2692623a380d25173c212 Mon Sep 17 00:00:00 2001 From: Josip Date: Sun, 10 May 2015 20:14:13 +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 | 11 ++++++++++- gramps/gui/widgets/grampletbar.py | 10 +++++++++- gramps/plugins/sidebar/dropdownsidebar.py | 10 +++++++++- gramps/plugins/sidebar/expandersidebar.py | 10 +++++++++- 5 files changed, 46 insertions(+), 5 deletions(-) diff --git a/gramps/gui/navigator.py b/gramps/gui/navigator.py index 81dc41735..5de121605 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 43a72664c..1485ce7cc 100644 --- a/gramps/gui/views/tags.py +++ b/gramps/gui/views/tags.py @@ -276,10 +276,19 @@ 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 ae51dd520..649c88fcd 100644 --- a/gramps/gui/widgets/grampletbar.py +++ b/gramps/gui/widgets/grampletbar.py @@ -730,10 +730,18 @@ class TabLabel(Gtk.Box): 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 88f6330d7..dd5edf58a 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 4cdd4beb4..af538d0fd 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