aptd.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:x-mario-center 作者: fossasia 项目源码 文件源码
def _on_lowlevel_transactions_changed(self, watcher, current, pending):
        # cleanup progress signal (to be sure to not leave dbus
        # matchers around)
        if self._progress_signal:
            GObject.source_remove(self._progress_signal)
            self._progress_signal = None
        # attach progress-changed signal for current transaction
        if current:
            try:
                trans = client.get_transaction(current)
                self._progress_signal = trans.connect("progress-changed",
                    self._on_progress_changed)
            except dbus.DBusException:
                pass

        # now update pending transactions
        self.pending_transactions.clear()
        for tid in [current] + pending:
            if not tid:
                continue
            try:
                trans = client.get_transaction(tid,
                    error_handler=lambda x: True)
            except dbus.DBusException:
                continue
            trans_progress = TransactionProgress(trans)
            try:
                self.pending_transactions[trans_progress.pkgname] = \
                    trans_progress
            except KeyError:
                # if its not a transaction from us (sc_pkgname) still
                # add it with the tid as key to get accurate results
                # (the key of pending_transactions is never directly
                #  exposed in the UI)
                self.pending_transactions[trans.tid] = trans_progress
        # emit signal
        self.inject_fake_transactions_and_emit_changed_signal()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号