Tidy up export assistant multiple inheritance

This commit is contained in:
Nick Hall 2016-12-13 23:26:13 +00:00
parent f01d469849
commit 93f59af9d8

View File

@ -79,7 +79,7 @@ _ExportAssistant_pages = {
'summary' : 5, 'summary' : 5,
} }
class ExportAssistant(Gtk.Assistant, ManagedWindow) : class ExportAssistant(ManagedWindow, Gtk.Assistant):
""" """
This class creates a GTK assistant to guide the user through the various This class creates a GTK assistant to guide the user through the various
Save as/Export options. Save as/Export options.
@ -120,8 +120,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
ManagedWindow.__init__(self, uistate, [], self.__class__, modal=True) ManagedWindow.__init__(self, uistate, [], self.__class__, modal=True)
#set_window is present in both parent classes #set_window is present in both parent classes
ManagedWindow.set_window(self, self, None, self.set_window(self, None, self.top_title, isWindow=True)
self.top_title, isWindow=True)
self.setup_configs('interface.exportassistant', 760, 500) self.setup_configs('interface.exportassistant', 760, 500)
#set up callback method for the export plugins #set up callback method for the export plugins
@ -155,7 +154,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
self.set_forward_page_func(self.forward_func, None) self.set_forward_page_func(self.forward_func, None)
#ManagedWindow show method #ManagedWindow show method
ManagedWindow.show(self) self.show()
def build_menu_names(self, obj): def build_menu_names(self, obj):
"""Override ManagedWindow method.""" """Override ManagedWindow method."""
@ -528,15 +527,6 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
#remember previous page for next time #remember previous page for next time
self.__previous_page = page_number self.__previous_page = page_number
def close(self, *obj) :
#clean up ManagedWindow menu, then destroy window, bring forward parent
real_width, real_height = self.get_size() # "destroy" changes them
real_x_pos, real_y_pos = self.get_position() # "destroy" changes them
Gtk.Assistant.destroy(self)
self.move(real_x_pos, real_y_pos) # "close" calls self._save_position()
self.resize(real_width, real_height) # "close" calls self._save_size()
ManagedWindow.close(self,*obj)
def get_intro_text(self): def get_intro_text(self):
return _('Under normal circumstances, Gramps does not require you ' return _('Under normal circumstances, Gramps does not require you '
'to directly save your changes. All changes you make are ' 'to directly save your changes. All changes you make are '
@ -625,20 +615,17 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
self.writestarted = False self.writestarted = False
def set_busy_cursor(self,value): def set_busy_cursor(self,value):
"""Set or unset the busy cursor while saving data. """
Set or unset the busy cursor while saving data.
Note : self.get_window() is the Gtk.Assistant Gtk.Window, not
a part of ManagedWindow
""" """
BUSY_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(), BUSY_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.WATCH) Gdk.CursorType.WATCH)
if value: if value:
self.get_window().set_cursor(BUSY_CURSOR) Gtk.Assistant.get_window(self).set_cursor(BUSY_CURSOR)
#self.set_sensitive(0) #self.set_sensitive(0)
else: else:
self.get_window().set_cursor(None) Gtk.Assistant.get_window(self).set_cursor(None)
#self.set_sensitive(1) #self.set_sensitive(1)
while Gtk.events_pending(): while Gtk.events_pending():