本文整理汇总了Python中ubuntutweak.common.package.PACKAGE_WORKER类的典型用法代码示例。如果您正苦于以下问题:Python PACKAGE_WORKER类的具体用法?Python PACKAGE_WORKER怎么用?Python PACKAGE_WORKER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PACKAGE_WORKER类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: create_interface
def create_interface(self):
if module_check.has_apt() and PACKAGE_WORKER.get_cache():
self.PACKAGE_WORKER = PACKAGE_WORKER
self.advanced_settings = AptCheckButton(_("Install Advanced Desktop Effects Settings Manager"),
'compizconfig-settings-manager')
self.advanced_settings.connect('toggled', self.colleague_changed)
self.simple_settings = AptCheckButton(_("Install Simple Desktop Effects Settings Manager"),
'simple-ccsm')
self.simple_settings.connect('toggled', self.colleague_changed)
self.screenlets = AptCheckButton(_("Install Screenlets Widget Application"),
'screenlets')
self.screenlets.connect('toggled', self.colleague_changed)
if self.context:
hbox = gtk.HBox(False, 0)
hbox.pack_start(self.create_edge_setting(), True, False, 0)
edge_setting = SinglePack(_(' Workspace Edge Settings'), hbox)
self.add_start(edge_setting, False, False, 0)
self.snap = SnapWindow(_("Enable snapping windows"), self)
self.wobbly_w = WobblyWindow(_("Enable wobbly windows"), self);
box = ListPack(_("Window Effects"), (self.snap, self.wobbly_w))
self.add_start(box, False, False, 0)
button1 = OpacityMenu(_("Enable transparent menus"))
self.wobbly_m = WobblyMenu(_("Enable wobbly menus"), self)
box = ListPack(_("Menu Effects"), (button1, self.wobbly_m))
self.add_start(box, False, False, 0)
if module_check.has_apt() and PACKAGE_WORKER.get_cache():
box = ListPack(_("Useful Extensions"), (
self.simple_settings,
self.screenlets,
))
self.button = gtk.Button(stock = gtk.STOCK_APPLY)
self.button.connect("clicked", self.on_apply_clicked, box)
self.button.set_sensitive(False)
hbox = gtk.HBox(False, 0)
hbox.pack_end(self.button, False, False, 0)
box.vbox.pack_start(hbox, False, False, 0)
self.add_start(box, False, False, 0)
else:
box = ListPack(_("Prerequisite Conditions"), (
self.advanced_settings,
))
self.button = gtk.Button(stock = gtk.STOCK_APPLY)
self.button.connect("clicked", self.on_apply_clicked, box)
self.button.set_sensitive(False)
hbox = gtk.HBox(False, 0)
hbox.pack_end(self.button, False, False, 0)
box.vbox.pack_start(hbox, False, False, 0)
self.add_start(box, False, False, 0)
开发者ID:jonolumb,项目名称:ubuntu-tweak,代码行数:60,代码来源:compiz.py
示例2: test_package
def test_package(self):
self.assertFalse(PACKAGE_WORKER.is_old_kernel_package('gedit'))
self.assertFalse(PACKAGE_WORKER.is_old_kernel_package('ubuntu-tweak'))
self.assertFalse(PACKAGE_WORKER.is_old_kernel_package('linux-firmware'))
self.assertFalse(PACKAGE_WORKER.is_old_kernel_package('linux-generic'))
self.assertFalse(PACKAGE_WORKER.is_old_kernel_package('linux-image-generic'))
self.assertFalse(PACKAGE_WORKER.is_old_kernel_package('linux-headers-2.6.37-020637'))
self.assertFalse(PACKAGE_WORKER.is_old_kernel_package('linux-image-2.6.35-24-generic'))
self.assertFalse(PACKAGE_WORKER.is_old_kernel_package('linux-image-2.6.35-24'))
self.assertTrue(PACKAGE_WORKER.is_old_kernel_package('linux-image-2.6.34-24-generic'))
开发者ID:Adriarson,项目名称:ubuntu-tweak,代码行数:10,代码来源:test_package.py
示例3: on_action_clicked
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()
开发者ID:actiononmail,项目名称:ubuntu-tweak,代码行数:60,代码来源:taskinstall.py
示例4: clean_selected_config
def clean_selected_config(self):
self.set_busy()
model = self.get_model()
dialog = CleanConfigDialog(self.get_toplevel(), self.get_list())
dialog.run()
dialog.destroy()
if dialog.error == True:
self.show_failed_dialog()
else:
self.show_success_dialog()
PACKAGE_WORKER.update_apt_cache(True)
self.update_config_model()
self.emit('cleaned')
self.unset_busy()
开发者ID:jonolumb,项目名称:ubuntu-tweak,代码行数:16,代码来源:cleaner.py
示例5: clean_selected_config
def clean_selected_config(self):
self.set_busy()
model = self.get_model()
dialog = CleanConfigDialog(self.get_toplevel(), self.get_list())
if dialog.run() == gtk.RESPONSE_REJECT:
dialog.destroy()
dialog.user_action = True
self.show_usercancel_dialog()
else:
self.show_success_dialog()
PACKAGE_WORKER.update_apt_cache(True)
self.update_config_model()
self.emit('cleaned')
self.unset_busy()
开发者ID:actiononmail,项目名称:ubuntu-tweak,代码行数:16,代码来源:cleaner.py
示例6: on_refresh_button_clicked
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()
开发者ID:actiononmail,项目名称:ubuntu-tweak,代码行数:16,代码来源:updatemanager.py
示例7: on_apply_clicked
def on_apply_clicked(self, widget, box):
to_add = []
to_rm = []
for widget in box.items:
if widget.get_active():
to_add.append(widget.pkgname)
else:
to_rm.append(widget.pkgname)
self.PACKAGE_WORKER.perform_action(widget.get_toplevel(), to_add, to_rm)
self.PACKAGE_WORKER.update_apt_cache(True)
done = PACKAGE_WORKER.get_install_status(to_add, to_rm)
if done:
self.button.set_sensitive(False)
InfoDialog(_('Update Successful!')).launch()
else:
InfoDialog(_('Update Failed!')).launch()
for widget in box.items:
widget.reset_active()
CompizPlugin.update_context()
self.remove_all_children()
self.create_interface()
self.show_all()
开发者ID:alix67,项目名称:ubuntu-tweak,代码行数:28,代码来源:compiz.py
示例8: clean_selected_package
def clean_selected_package(self):
self.set_busy()
state = self.PACKAGE_WORKER.perform_action(self.get_toplevel(), [],self.__check_list)
if state == 0:
self.show_success_dialog()
else:
self.show_failed_dialog()
PACKAGE_WORKER.update_apt_cache(True)
if self.mode == 'package':
self.update_package_model()
else:
self.update_kernel_model()
self.__check_list = []
self.emit('cleaned')
self.unset_busy()
开发者ID:jonolumb,项目名称:ubuntu-tweak,代码行数:17,代码来源:cleaner.py
示例9: refresh_source
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
开发者ID:ubuntutweak,项目名称:ubuntu-tweak,代码行数:60,代码来源:sourcecenter.py
示例10: update_updates
def update_updates(self, pkgs):
'''apps is a list to iter pkgname,
cates is a dict to find what the category the pkg is
'''
model = self.get_model()
length = len(pkgs)
if pkgs:
model.append((None,
None,
None,
None,
None,
'<span size="large" weight="bold">%s</span>' %
ngettext('Available %d Package Update',
'Available %d Package Updates',
length) % length,
None,
None))
apps = []
updates = []
for pkg in pkgs:
if pkg in APP_PARSER:
apps.append(pkg)
else:
updates.append(pkg)
for pkgname in apps:
pixbuf = self.get_app_logo(APP_PARSER[pkgname]['logo'])
package = PackageInfo(pkgname)
appname = package.get_name()
desc = APP_PARSER.get_summary(pkgname)
self.append_app(False,
pixbuf,
pkgname,
appname,
desc,
0,
'update')
for pkgname in updates:
package = PACKAGE_WORKER.get_cache()[pkgname]
self.append_update(False, package.name, package.summary)
else:
model.append((None,
None,
None,
None,
None,
'<span size="large" weight="bold">%s</span>' %
_('No Available Package Update'),
None,
None))
开发者ID:ubuntutweak,项目名称:ubuntu-tweak,代码行数:57,代码来源:sourcecenter.py
示例11: on_install_button_clicked
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)
开发者ID:jonolumb,项目名称:ubuntu-tweak,代码行数:10,代码来源:updatemanager.py
示例12: update_updates
def update_updates(self, pkgs):
'''apps is a list to iter pkgname,
cates is a dict to find what the category the pkg is
'''
model = self.get_model()
length = len(pkgs)
if pkgs:
iter = model.append()
model.set(iter,
self.COLUMN_DISPLAY,
'<span size="large" weight="bold">%s</span>' %
ngettext('%d Package Update Available',
'%d Package Updates Available',
length) % length)
apps = []
updates = []
for pkg in pkgs:
if pkg in APP_PARSER:
apps.append(pkg)
else:
updates.append(pkg)
for pkgname in apps:
pixbuf = self.get_app_logo(APP_PARSER[pkgname]['logo'])
package = PackageInfo(pkgname)
appname = package.get_name()
desc = APP_PARSER.get_summary(pkgname)
iter = model.append()
model.set(iter,
self.COLUMN_INSTALLED, False,
self.COLUMN_ICON, pixbuf,
self.COLUMN_PKG, pkgname,
self.COLUMN_NAME, appname,
self.COLUMN_DESC, desc,
self.COLUMN_DISPLAY, '<b>%s</b>\n%s' % (appname, desc),
self.COLUMN_TYPE, 'update')
for pkgname in updates:
package = PACKAGE_WORKER.get_cache()[pkgname]
self.append_update(False, package.name, package.summary)
else:
iter = model.append()
model.set(iter,
self.COLUMN_DISPLAY,
'<span size="large" weight="bold">%s</span>' %
_('No Available Package Updates'))
开发者ID:priteshdesai,项目名称:ubuntu-tweak,代码行数:51,代码来源:sourcecenter.py
示例13: on_refresh_button_clicked
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', {})
开发者ID:jonolumb,项目名称:ubuntu-tweak,代码行数:24,代码来源:updatemanager.py
示例14: update_model
def update_model(self, ppas):
model = self.get_model()
model.clear()
pkg_dict = {}
for ppa in ppas:
path = get_ppa_list_name(ppa)
log.debug('Find the PPA path name: %s', path)
if path:
for line in open(path):
if line.startswith('Package:'):
pkg = line.split()[1].strip()
if pkg in pkg_dict:
# Join another ppa info to the pkg dict, so that
# later we can know if more than two ppa provide
# the pkg
pkg_dict[pkg].extend([ppa])
else:
pkg_dict[pkg] = [ppa]
pkg_map = PACKAGE_WORKER.get_downgradeable_pkgs(pkg_dict)
if pkg_map:
log.debug("Start insert pkg_map to model: %s\n" % str(pkg_map))
for pkg, (p_verion, s_verion) in pkg_map.items():
model.append((pkg, p_verion, s_verion))
开发者ID:jonolumb,项目名称:ubuntu-tweak,代码行数:24,代码来源:cleaner.py
示例15: update_list
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)
开发者ID:jonolumb,项目名称:ubuntu-tweak,代码行数:5,代码来源:updatemanager.py
示例16: update_list
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()))
开发者ID:actiononmail,项目名称:ubuntu-tweak,代码行数:4,代码来源:updatemanager.py
示例17: create_interface
def create_interface(self):
if system.has_apt() and PACKAGE_WORKER.get_cache():
self.PACKAGE_WORKER = PACKAGE_WORKER
self.advanced_settings = AptCheckButton(_("Install Advanced Desktop Effects Settings Manager"),
'compizconfig-settings-manager')
self.advanced_settings.connect('toggled', self.colleague_changed)
self.simple_settings = AptCheckButton(_("Install Simple Desktop Effects Settings Manager"),
'simple-ccsm')
self.simple_settings.connect('toggled', self.colleague_changed)
self.screenlets = AptCheckButton(_("Install Screenlets Widget Application"),
'screenlets')
self.screenlets.connect('toggled', self.colleague_changed)
if CompizPlugin.context:
hbox = gtk.HBox(False, 0)
hbox.pack_start(self.create_edge_setting(), True, False, 0)
edge_setting = SinglePack(_(' Workspace Edge Settings'), hbox)
self.add_start(edge_setting, False, False, 0)
self.snap = SnapWindow(_("Enable snapping windows"), self)
self.wobbly_w = WobblyWindow(_("Enable wobbly windows"), self);
self.viewport = ViewpointSwitcher(_('Enable workspace switching with mouse wheel'))
# if system.CODENAME == 'natty':
# self.launcher_autohide = UnityLauncherAutoHide(_('Make the launcher hide automatically after some time inactive'))
# else:
self.launcher_autohide = None
box = ListPack(_("Desktop Effects"), (self.snap,
self.wobbly_w,
self.viewport,
self.launcher_autohide))
self.add_start(box, False, False, 0)
button1 = OpacityMenu(_("Enable transparent menus"))
self.wobbly_m = WobblyMenu(_("Enable wobbly menus"), self)
box = ListPack(_("Menu Effects"), (button1, self.wobbly_m))
self.add_start(box, False, False, 0)
if system.has_apt() and PACKAGE_WORKER.get_cache():
box = ListPack(_("Useful Extensions"), (
self.simple_settings,
self.screenlets,
))
self.button = gtk.Button(stock = gtk.STOCK_APPLY)
self.button.connect("clicked", self.on_apply_clicked, box)
self.button.set_sensitive(False)
hbox = gtk.HBox(False, 0)
hbox.pack_end(self.button, False, False, 0)
box.vbox.pack_start(hbox, False, False, 0)
self.add_start(box, False, False, 0)
elif CompizPlugin.context == None:
box = ListPack(_("Prerequisite Conditions"), (
self.advanced_settings,
))
self.button = gtk.Button(stock = gtk.STOCK_APPLY)
self.button.connect("clicked", self.on_apply_clicked, box)
self.button.set_sensitive(False)
hbox = gtk.HBox(False, 0)
hbox.pack_end(self.button, False, False, 0)
box.vbox.pack_start(hbox, False, False, 0)
self.add_start(box, False, False, 0)
开发者ID:alix67,项目名称:ubuntu-tweak,代码行数:68,代码来源:compiz.py
注:本文中的ubuntutweak.common.package.PACKAGE_WORKER类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论