当前位置: 首页>>代码示例>>Python>>正文


Python AptWorker.install_packages方法代码示例

本文整理汇总了Python中ubuntutweak.utils.package.AptWorker.install_packages方法的典型用法代码示例。如果您正苦于以下问题:Python AptWorker.install_packages方法的具体用法?Python AptWorker.install_packages怎么用?Python AptWorker.install_packages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ubuntutweak.utils.package.AptWorker的用法示例。


在下文中一共展示了AptWorker.install_packages方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_action_for_app

# 需要导入模块: from ubuntutweak.utils.package import AptWorker [as 别名]
# 或者: from ubuntutweak.utils.package.AptWorker import install_packages [as 别名]
    def do_action_for_app(self, pkgname, action_id, *args):
        action_id = int(action_id)

        if action_id == self.INSTALL_ACTION:
            set_busy(self)
            worker = AptWorker(self.get_toplevel(),
                               finish_handler=self.on_package_work_finished,
                               data={'parent': self})
            worker.install_packages([pkgname])

            self.update_action_button(self.INSTALLING_ACTION)
        elif action_id == self.UNINSTALL_ACTION:
            set_busy(self)
            worker = AptWorker(self.get_toplevel(),
                               finish_handler=self.on_package_work_finished,
                               data={'parent': self})
            worker.remove_packages([pkgname])

            self.update_action_button(self.UNINSTALLING_ACTION)
        elif action_id == self.UPDATE_ACTION:
            set_busy(self)
            worker = AptWorker(self.get_toplevel(),
                               finish_handler=self.on_update_work_finished,
                               data={'parent': self})
            worker.update_cache()
            self.update_action_button(self.UPDATING_ACTION)
开发者ID:billy3321,项目名称:ubuntu-tweak,代码行数:28,代码来源:__init__.py

示例2: on_apply_button_clicked

# 需要导入模块: from ubuntutweak.utils.package import AptWorker [as 别名]
# 或者: from ubuntutweak.utils.package.AptWorker import install_packages [as 别名]
    def on_apply_button_clicked(self, widget, data=None):
        @log_func(log)
        def on_install_finished(transaction, status, kwargs):
            to_add, to_rm = kwargs['add_and_rm']
            if to_rm:
                worker = AptWorker(self.get_toplevel(),
                                   finish_handler=self.on_package_work_finished,
                                   data=kwargs)
                worker.remove_packages(to_rm)
            else:
               self.on_package_work_finished(None, None, kwargs)

        to_rm = self.appview.to_rm
        to_add = self.appview.to_add

        log.debug("on_apply_button_clicked: to_rm: %s, to_add: %s" % (to_rm, to_add))

        if to_add or to_rm:
            set_busy(self)

            if to_add:
                worker = AptWorker(self.get_toplevel(),
                                   finish_handler=on_install_finished,
                                   data={'add_and_rm': (to_add, to_rm),
                                         'parent': self})
                worker.install_packages(to_add)
            else:
                on_install_finished(None, None, 
                                   {'add_and_rm': (to_add, to_rm),
                                         'parent': self})
开发者ID:c326277320,项目名称:ubuntu-tweak,代码行数:32,代码来源:appcenter.py

示例3: on_update_work_finished

# 需要导入模块: from ubuntutweak.utils.package import AptWorker [as 别名]
# 或者: from ubuntutweak.utils.package.AptWorker import install_packages [as 别名]
 def on_update_work_finished(self, transaction, status, kwargs):
     parent = kwargs["parent"]
     proxy.update_apt_cache(True)
     if proxy.is_package_upgradable(self.current_app) or (
         not proxy.is_package_installed(self.current_app) and proxy.is_package_avaiable(self.current_app)
     ):
         worker = AptWorker(self.get_toplevel(), finish_handler=self.on_package_work_finished, data={"parent": self})
         worker.install_packages([self.current_app])
     else:
         unset_busy(parent)
         self.reset_install_button()
开发者ID:302sk,项目名称:ubuntu-tweak,代码行数:13,代码来源:__init__.py

示例4: on_apply_button_clicked

# 需要导入模块: from ubuntutweak.utils.package import AptWorker [as 别名]
# 或者: from ubuntutweak.utils.package.AptWorker import install_packages [as 别名]
    def on_apply_button_clicked(self, widget, data = None):
        def on_clean_finished(transaction, status, add_and_rm):
            to_add, to_rm = add_and_rm
            worker = AptWorker(self.get_toplevel(), self.on_package_work_finished, add_and_rm)
            worker.remove_packages(to_rm)

        to_rm = self.appview.to_rm
        to_add = self.appview.to_add

        log.debug("on_apply_button_clicked: to_rm: %s, to_add: %s" % (to_rm, to_add))

        if to_add or to_rm:
            if to_add:
                #TODO if user cancel auth
                if to_rm:
                    worker = AptWorker(self.get_toplevel(), on_clean_finished, (to_add, to_rm))
                else:
                    worker = AptWorker(self.get_toplevel(), self.on_package_work_finished, (to_add, to_rm))
                worker.install_packages(to_add)
            elif to_rm:
                on_clean_finished(None, None, to_rm)
开发者ID:nayanapriyankara,项目名称:ubuntu-tweak,代码行数:23,代码来源:appcenter.py


注:本文中的ubuntutweak.utils.package.AptWorker.install_packages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。