4166: Export Assistant crashes when closing or cancelling using the mouse
svn: r15738
This commit is contained in:
parent
ee9649f5b3
commit
02c68684d6
@ -94,6 +94,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
#override predefined do_xxx signal handlers
|
||||||
__gsignals__ = {"apply": "override", "cancel": "override",
|
__gsignals__ = {"apply": "override", "cancel": "override",
|
||||||
"close": "override", "prepare": "override"}
|
"close": "override", "prepare": "override"}
|
||||||
|
|
||||||
@ -116,6 +117,13 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
|||||||
self.forward_button = None
|
self.forward_button = None
|
||||||
gtk.Assistant.forall(self, self.get_forward_button)
|
gtk.Assistant.forall(self, self.get_forward_button)
|
||||||
## end
|
## 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
|
#set up ManagedWindow
|
||||||
self.top_title = _("Export Assistant")
|
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':
|
if isinstance(arg, gtk.Button) and arg.get_label() == 'gtk-go-forward':
|
||||||
self.forward_button = arg
|
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):
|
def build_menu_names(self, obj):
|
||||||
"""Override ManagedWindow method."""
|
"""Override ManagedWindow method."""
|
||||||
return (self.top_title, None)
|
return (self.top_title, None)
|
||||||
@ -388,18 +412,19 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
|||||||
def do_apply(self):
|
def do_apply(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def do_cancel(self):
|
|
||||||
if self.writestarted :
|
|
||||||
return True
|
|
||||||
else :
|
|
||||||
self.close()
|
|
||||||
|
|
||||||
def do_close(self):
|
def do_close(self):
|
||||||
if self.writestarted :
|
if self.writestarted :
|
||||||
return True
|
pass
|
||||||
else :
|
else :
|
||||||
|
## avoid bug http://www.gramps-project.org/bugs/view.php?id=4166
|
||||||
|
self.cancel_button.hide()
|
||||||
|
self.close_button.hide()
|
||||||
|
## end
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
def do_cancel(self):
|
||||||
|
self.do_close()
|
||||||
|
|
||||||
def do_prepare(self, page):
|
def do_prepare(self, page):
|
||||||
"""
|
"""
|
||||||
The "prepare" signal is emitted when a new page is set as the
|
The "prepare" signal is emitted when a new page is set as the
|
||||||
|
Loading…
Reference in New Issue
Block a user