本文整理汇总了Python中ubuntutweak.common.package.PACKAGE_WORKER.perform_action方法的典型用法代码示例。如果您正苦于以下问题:Python PACKAGE_WORKER.perform_action方法的具体用法?Python PACKAGE_WORKER.perform_action怎么用?Python PACKAGE_WORKER.perform_action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ubuntutweak.common.package.PACKAGE_WORKER
的用法示例。
在下文中一共展示了PACKAGE_WORKER.perform_action方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_action_clicked
# 需要导入模块: from ubuntutweak.common.package import PACKAGE_WORKER [as 别名]
# 或者: from ubuntutweak.common.package.PACKAGE_WORKER import perform_action [as 别名]
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()
示例2: refresh_source
# 需要导入模块: from ubuntutweak.common.package import PACKAGE_WORKER [as 别名]
# 或者: from ubuntutweak.common.package.PACKAGE_WORKER import perform_action [as 别名]
def refresh_source(parent):
dialog = UpdateCacheDialog(parent)
dialog.run()
new_pkg = []
for pkg in PACKAGE_WORKER.get_new_package():
if pkg in APP_PARSER:
new_pkg.append(pkg)
new_updates = list(PACKAGE_WORKER.get_update_package())
if new_pkg or new_updates:
updateview = UpdateView()
if new_pkg:
updateview.update_model(new_pkg)
if new_updates:
updateview.update_updates(new_updates)
dialog = QuestionDialog(_('You can install the new applications by selecting them and choose "Yes".\nOr you can install them at Add/Remove by choose "No".'),
title=_('New applications are available to update'))
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)
select_button = gtk.CheckButton(_('Select All'))
select_button.connect('clicked', on_select_button_clicked, updateview)
vbox.pack_start(select_button, False, False, 0)
vbox.show_all()
res = dialog.run()
dialog.destroy()
to_rm = updateview.to_rm
to_add = updateview.to_add
if res == gtk.RESPONSE_YES and to_add:
PACKAGE_WORKER.perform_action(parent, to_add, to_rm)
PACKAGE_WORKER.update_apt_cache(True)
done = PACKAGE_WORKER.get_install_status(to_add, to_rm)
if done:
InfoDialog(_('Update Successful!')).launch()
else:
ErrorDialog(_('Update Failed!')).launch()
return True
else:
dialog = InfoDialog(_("Your system is clean and there's no update yet."),
title=_('The software information is up-to-date now'))
dialog.launch()
return False
示例3: on_install_button_clicked
# 需要导入模块: from ubuntutweak.common.package import PACKAGE_WORKER [as 别名]
# 或者: from ubuntutweak.common.package.PACKAGE_WORKER import perform_action [as 别名]
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)