當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。