From 307bed5e446d8c1faf9da09731c2dd2dc60f8443 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sun, 4 Jan 2015 20:09:02 +0000 Subject: [PATCH] Convert update addons dialog to no longer be a ManagedWindow --- gramps/gui/configure.py | 6 +----- gramps/gui/plug/_windows.py | 29 ++++++++++++++--------------- gramps/gui/viewmanager.py | 7 +------ 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index f3ed69485..912081455 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -1344,11 +1344,7 @@ class GrampsPreferences(ConfigureDialog): return if len(addon_update_list) > 0: - try: - PluginWindows.UpdateAddons(self.uistate, [], addon_update_list, - parent=self.window) - except WindowActiveError: - pass + PluginWindows.UpdateAddons(addon_update_list, self.window) else: check_types = config.get('behavior.check-for-update-types') OkDialog(_("There are no available addons of this type"), diff --git a/gramps/gui/plug/_windows.py b/gramps/gui/plug/_windows.py index 9d9a098db..a45bc152a 100644 --- a/gramps/gui/plug/_windows.py +++ b/gramps/gui/plug/_windows.py @@ -1068,20 +1068,16 @@ class ToolManagedWindow(tool.Tool, ToolManagedWindowBase): # UpdateAddons # #------------------------------------------------------------------------- -class UpdateAddons(ManagedWindow): +class UpdateAddons(): - def __init__(self, uistate, track, addon_update_list, parent=None): + def __init__(self, addon_update_list, parent_window): self.title = _('Available Gramps Updates for Addons') - ManagedWindow.__init__(self, uistate, track, self.__class__) glade = Glade("updateaddons.glade") - self.update_dialog = glade.toplevel - self.set_window(self.update_dialog, glade.get_object('title'), - self.title) + self.window = glade.toplevel + self.window.set_title(self.title) self.window.set_size_request(750, 400) - - if win(): - self.window.set_transient_for(parent) + self.window.set_transient_for(parent_window) apply_button = glade.get_object('apply') cancel_button = glade.get_object('cancel') @@ -1135,11 +1131,14 @@ class UpdateAddons(ManagedWindow): pos = iter if pos: self.list.selection.select_iter(pos) - self.update_dialog.run() + self.window.run() + + def close(self, widget): + """ + Close the dialog. + """ + self.window.destroy() - def build_menu_names(self, obj): - return (self.title, "") - def select_all_clicked(self, widget): """ Select all of the addons for download. @@ -1158,7 +1157,7 @@ class UpdateAddons(ManagedWindow): """ Process all of the selected addons. """ - self.update_dialog.hide() + self.window.hide() model = self.list.model iter = model.get_iter_first() @@ -1211,7 +1210,7 @@ class UpdateAddons(ManagedWindow): OkDialog(_("Done downloading and installing addons"), _("No addons were installed."), self.window) - self.close() + self.window.destroy() #------------------------------------------------------------------------- # diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index a41876eff..97adf4766 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -343,12 +343,7 @@ class ViewManager(CLIManager): """ Called when add-on updates are available. """ - try: - PluginWindows.UpdateAddons(self.uistate, [], addon_update_list, - parent=self.window) - except WindowActiveError: - pass - + PluginWindows.UpdateAddons(addon_update_list, self.window) self.do_reg_plugins(self.dbstate, self.uistate) def _errordialog(self, title, errormessage):