當前位置: 首頁>>代碼示例>>Python>>正文


Python gobject.IO_OUT屬性代碼示例

本文整理匯總了Python中gobject.IO_OUT屬性的典型用法代碼示例。如果您正苦於以下問題:Python gobject.IO_OUT屬性的具體用法?Python gobject.IO_OUT怎麽用?Python gobject.IO_OUT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在gobject的用法示例。


在下文中一共展示了gobject.IO_OUT屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _install_transport_ready

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import IO_OUT [as 別名]
def _install_transport_ready(self):
        if ('r' in self.access_type):
            io_event = gobject.IO_IN
        else:
            io_event = gobject.IO_OUT

        self.tag = gobject.io_add_watch(self.fd, io_event,
                                        self._transport_ready_handler) 
開發者ID:liamw9534,項目名稱:bt-manager,代碼行數:10,代碼來源:audio.py

示例2: _doReadOrWrite

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import IO_OUT [as 別名]
def _doReadOrWrite(self, source, condition, faildict={
        error.ConnectionDone: failure.Failure(error.ConnectionDone()),
        error.ConnectionLost: failure.Failure(error.ConnectionLost()),
        }):
        why = None
        inRead = False
        if condition & POLL_DISCONNECTED and not (condition & gobject.IO_IN):
            if source in self._reads:
                why = main.CONNECTION_DONE
                inRead = True
            else:
                why = main.CONNECTION_LOST
        else:
            try:
                if condition & gobject.IO_IN:
                    why = source.doRead()
                    inRead = True
                if not why and condition & gobject.IO_OUT:
                    # if doRead caused connectionLost, don't call doWrite
                    # if doRead is doWrite, don't call it again.
                    if not source.disconnected:
                        why = source.doWrite()
            except:
                why = sys.exc_info()[1]
                log.msg('Error In %s' % source)
                log.deferr()

        if why:
            self._disconnectSelectable(source, why, inRead) 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:31,代碼來源:gtk2reactor.py

示例3: _doReadOrWrite

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import IO_OUT [as 別名]
def _doReadOrWrite(self, source, condition, faildict={
        error.ConnectionDone: failure.Failure(error.ConnectionDone()),
        error.ConnectionLost: failure.Failure(error.ConnectionLost()),
        }):
        why = None
        didRead = None
        if condition & POLL_DISCONNECTED and \
               not (condition & gobject.IO_IN):
            why = main.CONNECTION_LOST
        else:
            try:
                if condition & gobject.IO_IN:
                    why = source.doRead()
                    didRead = source.doRead
                if not why and condition & gobject.IO_OUT:
                    # if doRead caused connectionLost, don't call doWrite
                    # if doRead is doWrite, don't call it again.
                    if not source.disconnected and source.doWrite != didRead:
                        why = source.doWrite()
                        didRead = source.doWrite # if failed it was in write
            except:
                why = sys.exc_info()[1]
                log.msg('Error In %s' % source)
                log.deferr()

        if why:
            self._disconnectSelectable(source, why, didRead == source.doRead) 
開發者ID:kenorb-contrib,項目名稱:BitTorrent,代碼行數:29,代碼來源:gtk2reactor.py


注:本文中的gobject.IO_OUT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。