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 return
if len(addon_update_list) > 0: if len(addon_update_list) > 0:
try: PluginWindows.UpdateAddons(addon_update_list, self.window)
PluginWindows.UpdateAddons(self.uistate, [], addon_update_list,
parent=self.window)
except WindowActiveError:
pass
else: else:
check_types = config.get('behavior.check-for-update-types') check_types = config.get('behavior.check-for-update-types')
OkDialog(_("There are no available addons of this type"), OkDialog(_("There are no available addons of this type"),

View File

@ -1061,20 +1061,16 @@ class ToolManagedWindow(tool.Tool, ToolManagedWindowBase):
# UpdateAddons # 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') self.title = _('Available Gramps Updates for Addons')
ManagedWindow.__init__(self, uistate, track, self.__class__)
glade = Glade("updateaddons.glade") glade = Glade("updateaddons.glade")
self.update_dialog = glade.toplevel self.window = glade.toplevel
self.set_window(self.update_dialog, glade.get_object('title'), self.window.set_title(self.title)
self.title)
self.window.set_size_request(750, 400) self.window.set_size_request(750, 400)
self.window.set_transient_for(parent_window)
if win():
self.window.set_transient_for(parent)
apply_button = glade.get_object('apply') apply_button = glade.get_object('apply')
cancel_button = glade.get_object('cancel') cancel_button = glade.get_object('cancel')
@ -1128,10 +1124,13 @@ class UpdateAddons(ManagedWindow):
pos = iter pos = iter
if pos: if pos:
self.list.selection.select_iter(pos) self.list.selection.select_iter(pos)
self.update_dialog.run() self.window.run()
def build_menu_names(self, obj): def close(self, widget):
return (self.title, "") """
Close the dialog.
"""
self.window.destroy()
def select_all_clicked(self, widget): def select_all_clicked(self, widget):
""" """
@ -1151,7 +1150,7 @@ class UpdateAddons(ManagedWindow):
""" """
Process all of the selected addons. Process all of the selected addons.
""" """
self.update_dialog.hide() self.window.hide()
model = self.list.model model = self.list.model
iter = model.get_iter_first() iter = model.get_iter_first()
@ -1212,7 +1211,7 @@ class UpdateAddons(ManagedWindow):
OkDialog(_("Done downloading and installing addons"), OkDialog(_("Done downloading and installing addons"),
_("No addons were installed."), _("No addons were installed."),
self.window) self.window)
self.close() self.window.destroy()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -343,12 +343,7 @@ class ViewManager(CLIManager):
""" """
Called when add-on updates are available. Called when add-on updates are available.
""" """
try: PluginWindows.UpdateAddons(addon_update_list, self.window)
PluginWindows.UpdateAddons(self.uistate, [], addon_update_list,
parent=self.window)
except WindowActiveError:
pass
self.do_reg_plugins(self.dbstate, self.uistate) self.do_reg_plugins(self.dbstate, self.uistate)
def _errordialog(self, title, errormessage): def _errordialog(self, title, errormessage):