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 149b049650
commit 3d043a7b53
3 changed files with 16 additions and 26 deletions

View File

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

View File

@ -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()
#-------------------------------------------------------------------------
#

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