def __init__(self): TweakModule.__init__(self, 'updatemanager.ui') self.updateview = UpdateView() self.updateview.connect('changed', self.on_update_status_changed) self.updateview.connect('select', self.on_select_action) self.update_list() self.sw1.add(self.updateview) button = GconfCheckButton(label=_('Automatically run System Update Manager'), key='/apps/update-notifier/auto_launch') self.vbox1.pack_start(button, False, False, 0) self.ppa_button = GconfCheckButton( label=_('Temporarily disable third-party PPA sources whilst refreshing'), key='/apps/ubuntu-tweak/disable_ppa') self.vbox1.pack_start(self.ppa_button, False, False, 0) self.reparent(self.main_vbox)
def __init__(self): TweakModule.__init__(self, 'updatemanager.ui') self.updateview = UpdateView() self.updateview.connect('changed', self.on_update_status_changed) self.update_list() self.sw1.add(self.updateview) button = GconfCheckButton(label=_('Enable the auto launch of System Update Manager'), key='/apps/update-notifier/auto_launch') self.vbox1.pack_start(button, False, False, 0) self.reparent(self.main_vbox)
class UpdateManager(TweakModule): __title__ = _('Update Manager') __desc__ = _('A simple and easy-to-use update manager') __icon__ = 'system-software-update' __category__ = 'application' def __init__(self): TweakModule.__init__(self, 'updatemanager.ui') self.updateview = UpdateView() self.updateview.connect('changed', self.on_update_status_changed) self.update_list() self.sw1.add(self.updateview) button = GconfCheckButton(label=_('Enable the auto launch of System Update Manager'), key='/apps/update-notifier/auto_launch') self.vbox1.pack_start(button, False, False, 0) self.reparent(self.main_vbox) def update_list(self): PACKAGE_WORKER.update_apt_cache(init=True) self.updateview.get_model().clear() self.updateview.update_updates(list(PACKAGE_WORKER.get_update_package())) def on_refresh_button_clicked(self, widget): UpdateCacheDialog(widget.get_toplevel()).run() PACKAGE_WORKER.update_apt_cache(True) self.select_button.set_active(False) new_updates = list(PACKAGE_WORKER.get_update_package()) if new_updates: self.emit('call', 'ubuntutweak.modules.sourcecenter', 'update_thirdparty', {}) self.updateview.get_model().clear() self.updateview.update_updates(new_updates) else: dialog = InfoDialog(_("Your system is clean and there's no update yet."), title=_('The software information is up-to-date now')) dialog.launch() def on_select_button_clicked(self, widget): self.updateview.select_all_action(widget.get_active()) def on_update_status_changed(self, widget, i): if i: self.install_button.set_sensitive(True) else: self.install_button.set_sensitive(False) def on_install_button_clicked(self, widget): PACKAGE_WORKER.perform_action(widget.get_toplevel(), self.updateview.to_add, self.updateview.to_rm) PACKAGE_WORKER.update_apt_cache(True) PACKAGE_WORKER.show_installed_status(self.updateview.to_add, self.updateview.to_rm) self.updateview.get_model().clear() self.updateview.update_updates(list(PACKAGE_WORKER.get_update_package())) self.select_button.set_active(False) self.updateview.select_all_action(False)
class UpdateManager(TweakModule): __title__ = _('Update Manager') __desc__ = _('A simple and easy-to-use update manager') __icon__ = 'system-software-update' __category__ = 'application' def __init__(self): TweakModule.__init__(self, 'updatemanager.ui') self.updateview = UpdateView() self.updateview.connect('changed', self.on_update_status_changed) self.updateview.connect('select', self.on_select_action) self.update_list() self.sw1.add(self.updateview) button = GconfCheckButton(label=_('Automatically run System Update Manager'), key='/apps/update-notifier/auto_launch') self.vbox1.pack_start(button, False, False, 0) self.ppa_button = GconfCheckButton( label=_('Temporarily disable third-party PPA sources whilst refreshing'), key='/apps/ubuntu-tweak/disable_ppa') self.vbox1.pack_start(self.ppa_button, False, False, 0) self.reparent(self.main_vbox) def update_list(self): PACKAGE_WORKER.update_apt_cache(init=True) self.updateview.get_model().clear() self.updateview.update_updates(list(PACKAGE_WORKER.get_update_package())) self.install_button.set_sensitive(False) def on_refresh_button_clicked(self, widget): do_ppa_disable = False if self.ppa_button.get_active(): proxy.disable_ppa() do_ppa_disable = True UpdateCacheDialog(widget.get_toplevel()).run() PACKAGE_WORKER.update_apt_cache(True) new_updates = list(PACKAGE_WORKER.get_update_package()) if new_updates: self.updateview.get_model().clear() self.updateview.update_updates(new_updates) else: dialog = InfoDialog(_("Your system is clean and no updates are available."), title=_('Software information is now up-to-date')) dialog.launch() if do_ppa_disable: proxy.enable_ppa() self.emit('call', 'ubuntutweak.modules.sourcecenter', 'update_thirdparty', {}) self.emit('call', 'ubuntutweak.modules.sourceeditor', 'update_source_combo', {}) def on_select_action(self, widget, active): self.updateview.select_all_action(active) def on_update_status_changed(self, widget, count): self.install_button.set_label(ngettext('Install Update', 'Install Updates', count)) if count: self.install_button.set_sensitive(True) else: self.install_button.set_sensitive(False) def on_install_button_clicked(self, widget): PACKAGE_WORKER.perform_action(widget.get_toplevel(), self.updateview.to_add, self.updateview.to_rm) PACKAGE_WORKER.update_apt_cache(True) PACKAGE_WORKER.show_installed_status(self.updateview.to_add, self.updateview.to_rm) self.updateview.get_model().clear() self.updateview.update_updates(list(PACKAGE_WORKER.get_update_package())) self.updateview.select_all_action(False)