def __show_successful_with_logout_button(self, message): dialog = InfoDialog(message) button = gtk.Button(_('_Logout')) button.connect('clicked', self.on_logout_button_clicked, dialog) dialog.add_option_button(button) dialog.launch()
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_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_action_clicked(self, cell, path): iter = self.model.get_iter_from_string(path) installed = self.model.get_value(iter, COLUMN_ACTION) task = self.model.get_value(iter, COLUMN_TASK) name = self.model.get_value(iter, COLUMN_NAME) self.set_busy() if installed == 'Installed': #TODO install if not complete, and remove options dialog = InfoDialog(_('You\'ve installed the "%s" task.\n' % name)) dialog.launch() else: updateview = UpdateView() updateview.set_headers_visible(False) list = os.popen('tasksel --task-packages %s' % task).read().split('\n') list = [i for i in list if i.strip()] updateview.update_updates(list) dialog = QuestionDialog(_('You are going to install the "%s" task.\nThe following packagers will be installed.' % name), title = _('New packages will be installed')) vbox = dialog.vbox sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) sw.set_size_request(-1, 200) vbox.pack_start(sw, False, False, 0) sw.add(updateview) sw.show_all() res = dialog.run() dialog.destroy() if res == gtk.RESPONSE_YES: package_worker.perform_action(self.get_toplevel(), [task+'~'], []) package_worker.update_apt_cache(True) self.update_model() self.unset_busy()
def on_action_clicked(self, cell, path): iter = self.model.get_iter_from_string(path) installed = self.model.get_value(iter, self.COLUMN_ACTION) task = self.model.get_value(iter, self.COLUMN_TASK) name = self.model.get_value(iter, self.COLUMN_NAME) self.set_busy() updateview = UpdateView() updateview.set_headers_visible(False) if installed == 'Installed': dialog = InfoDialog(_('You\'ve installed the <b>"%s"</b> task.' % name)) dialog.add_button(_('Remove'), gtk.RESPONSE_YES) res = dialog.run() dialog.destroy() if res == gtk.RESPONSE_YES: dialog = WarningDialog(_('It is dangerous to remove a task, it may remove the desktop related packages.\nPlease only continue when you know what you are doing.'), title=_("Dangerous!")) res = dialog.run() dialog.destroy() if res == gtk.RESPONSE_YES: data = os.popen('tasksel -t remove %s' % task).read() pkgs = self.filter_remove_packages(data) updateview.update_updates(pkgs) updateview.select_all_action(True) dialog = self.create_task_dialog(title=_('Packages will be removed'), desc = _('You are going to remove the <b>"%s"</b> task.\nThe following packages will be remove.' % name), updateview=updateview) res = dialog.run() dialog.destroy() if res == gtk.RESPONSE_YES: PACKAGE_WORKER.perform_action(self.get_toplevel(), [], updateview.to_add) PACKAGE_WORKER.update_apt_cache(True) self.update_model() else: list = os.popen('tasksel --task-packages %s' % task).read().split('\n') list = [pkg for pkg in list if pkg.strip() and not PackageInfo(pkg).check_installed()] updateview.update_updates(list) updateview.select_all_action(True) dialog = self.create_task_dialog(title=_('New packages will be installed'), desc = _('You are going to install the <b>"%s"</b> task.\nThe following packager will be installed.' % name), updateview=updateview) res = dialog.run() dialog.destroy() if res == gtk.RESPONSE_YES: PACKAGE_WORKER.perform_action(self.get_toplevel(), updateview.to_add, []) PACKAGE_WORKER.update_apt_cache(True) self.update_model() print self.model.get_value(iter, self.COLUMN_ACTION) self.unset_busy()