Convert update addons dialog to no longer be a ManagedWindow

This commit is contained in:
Nick Hall 2015-01-04 20:09:02 +00:00 committed by Nick Hall
parent e7cf8fe70c
commit 307bed5e44
3 changed files with 16 additions and 26 deletions

View File

@ -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"),

View File

@ -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,10 +1131,13 @@ class UpdateAddons(ManagedWindow):
pos = iter
if pos:
self.list.selection.select_iter(pos)
self.update_dialog.run()
self.window.run()
def build_menu_names(self, obj):
return (self.title, "")
def close(self, widget):
"""
Close the dialog.
"""
self.window.destroy()
def select_all_clicked(self, widget):
"""
@ -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()
#-------------------------------------------------------------------------
#

View File

@ -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):