From 02c68684d677ef53445167c111f481739b0fc772 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Sun, 15 Aug 2010 11:59:23 +0000 Subject: [PATCH] 4166: Export Assistant crashes when closing or cancelling using the mouse svn: r15738 --- src/ExportAssistant.py | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/ExportAssistant.py b/src/ExportAssistant.py index 5ebcc41b0..dbcd306e3 100644 --- a/src/ExportAssistant.py +++ b/src/ExportAssistant.py @@ -94,6 +94,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) : """ + #override predefined do_xxx signal handlers __gsignals__ = {"apply": "override", "cancel": "override", "close": "override", "prepare": "override"} @@ -116,6 +117,13 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) : self.forward_button = None gtk.Assistant.forall(self, self.get_forward_button) ## end + ##workaround for bug with cancel/close button clicked + ##see bug http://www.gramps-project.org/bugs/view.php?id=4166 + self.cancel_button = None + gtk.Assistant.forall(self, self.get_cancel_button) + self.close_button = None + gtk.Assistant.forall(self, self.get_close_button) + ## end #set up ManagedWindow self.top_title = _("Export Assistant") @@ -166,6 +174,22 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) : if isinstance(arg, gtk.Button) and arg.get_label() == 'gtk-go-forward': self.forward_button = arg + def get_cancel_button(self, arg): + if isinstance(arg, gtk.HBox): + arg.forall(self._cancel_btn) + + def _cancel_btn(self, arg): + if isinstance(arg, gtk.Button) and arg.get_label() == 'gtk-cancel': + self.cancel_button = arg + + def get_close_button(self, arg): + if isinstance(arg, gtk.HBox): + arg.forall(self._close_btn) + + def _close_btn(self, arg): + if isinstance(arg, gtk.Button) and arg.get_label() == 'gtk-close': + self.close_button = arg + def build_menu_names(self, obj): """Override ManagedWindow method.""" return (self.top_title, None) @@ -388,18 +412,19 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) : def do_apply(self): pass - def do_cancel(self): - if self.writestarted : - return True - else : - self.close() - def do_close(self): if self.writestarted : - return True - else : + pass + else : + ## avoid bug http://www.gramps-project.org/bugs/view.php?id=4166 + self.cancel_button.hide() + self.close_button.hide() + ## end self.close() + def do_cancel(self): + self.do_close() + def do_prepare(self, page): """ The "prepare" signal is emitted when a new page is set as the