From 3d043a7b5302702a241d45ea64a8c309560ab095 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 bddf9d7b9..ae67cf890 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -1352,11 +1352,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 1a2d9498e..26c0a1522 100644 --- a/gramps/gui/plug/_windows.py +++ b/gramps/gui/plug/_windows.py @@ -1061,20 +1061,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') @@ -1128,11 +1124,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. @@ -1151,7 +1150,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() @@ -1212,7 +1211,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 c16cba8d1..7b5493abc 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):