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


Python gobject.timeout_add方法代碼示例

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


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

示例1: test_timeout_add

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def test_timeout_add(self):
        """
        A
        L{reactor.callLater<twisted.internet.interfaces.IReactorTime.callLater>}
        call scheduled from a C{gobject.timeout_add}
        call is run on time.
        """
        import gobject
        reactor = self.buildReactor()

        result = []
        def gschedule():
            reactor.callLater(0, callback)
            return 0
        def callback():
            result.append(True)
            reactor.stop()

        reactor.callWhenRunning(gobject.timeout_add, 10, gschedule)
        self.runReactor(reactor, 5)
        self.assertEqual(result, [True]) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:23,代碼來源:test_time.py

示例2: StartDownload

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def StartDownload(self,url,dst_dir):
        if is_wifi_connected_now() == False:
            return
        
        if validators.url(url) and os.path.isdir(dst_dir):
            self._URL = url
            self._DST_DIR = dst_dir
        else:
            self._Screen._MsgBox.SetText("Invaid")
            self._Screen._MsgBox.Draw()
            self._Screen.SwapAndShow()            
            print("url or dst dir error")
            return
        
        self._Downloader = Download(url,dst_dir,None)
        self._Downloader.start()
        
        self._DownloaderTimer = gobject.timeout_add(200, self.GObjectUpdateProcessInterval) 
開發者ID:clockworkpi,項目名稱:launcher,代碼行數:20,代碼來源:download_process_page.py

示例3: OnLoadCb

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def OnLoadCb(self):
        self._Scrolled = 0
        self._PosY = 0
        self._DrawOnce = False
        #sync 
        print("OnLoadCb")
        if self._MyStack.Length() == 1:
            self._FootMsg[2] = "Remove"
            self._FootMsg[1] = "Update"
        else:
            self._FootMsg[2] = "Remove"
            self._FootMsg[1] = "Preview"
        
        self._GobjTimer = gobject.timeout_add(500, self.GObjectUpdateProcessInterval)
        
        self.SyncList() 
開發者ID:clockworkpi,項目名稱:launcher,代碼行數:18,代碼來源:__init__.py

示例4: UpdateStatus

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def UpdateStatus(self):
        print("UpdateStatus")
        wireless_connecting = self._Wireless.CheckIfWirelessConnecting()
        fast = not self._Daemon.NeedsExternalCalls()
        
        self._Connecting = wireless_connecting
        
        if self._Connecting:
            gobject.timeout_add(250,self.SetConnectingStatus,fast)
        else:
            if not fast:
                iwconfig = self._Wireless.GetIwconfig()
            else:
                iwconfig = ''

            if self.CheckForWireless(iwconfig,self._Wireless.GetWirelessIP(''),None):
                return True
            else:
                print("Not Connected")
                return True 
開發者ID:clockworkpi,項目名稱:launcher,代碼行數:22,代碼來源:wifi_list.py

示例5: StartDownload

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def StartDownload(self,url,dst_dir):
        if validators.url(url) and os.path.isdir(dst_dir):
            self._URL = url
            self._DST_DIR = dst_dir
        else:
            self._Screen._MsgBox.SetText("Invaid")
            self._Screen._MsgBox.Draw()
            self._Screen.SwapAndShow()            
            return
        
        self._Downloader = Download(url,dst_dir,None)
        if self._MD5 != None:
            if len(self._MD5) == 32:
                self._Downloader.add_hash_verification('md5' ,self._MD5) ## hashlib provide algorithms

        self._Downloader.start()
        
        self._DownloaderTimer = gobject.timeout_add(100, self.GObjectUpdateProcessInterval) 
開發者ID:clockworkpi,項目名稱:launcher,代碼行數:20,代碼來源:__init__.py

示例6: doIteration

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def doIteration(self, delay):
        # flush some pending events, return if there was something to do
        # don't use the usual "while self.context.pending(): self.context.iteration()"
        # idiom because lots of IO (in particular test_tcp's
        # ProperlyCloseFilesTestCase) can keep us from ever exiting.
        log.msg(channel='system', event='iteration', reactor=self)
        if self.__pending():
            self.__iteration(0)
            return
        # nothing to do, must delay
        if delay == 0:
            return # shouldn't delay, so just return
        self.doIterationTimer = gobject.timeout_add(int(delay * 1000),
                                                self.doIterationTimeout)
        # This will either wake up from IO or from a timeout.
        self.__iteration(1) # block
        # note: with the .simulate timer below, delays > 0.1 will always be
        # woken up by the .simulate timer
        if self.doIterationTimer:
            # if woken by IO, need to cancel the timer
            gobject.source_remove(self.doIterationTimer)
            self.doIterationTimer = None 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:24,代碼來源:gtk2reactor.py

示例7: find_word

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def find_word(self, backwards=False):
        pos=-1        
        if backwards:
            lst = range(0, self.search['index'])
            lst.reverse()
            lst.extend(reversed(range(self.search['index'], len(self.search['lines']))))
        else:
            lst = range(self.search['index'], len(self.search['lines']))
            lst.extend(range(0, self.search['index']))
        for i in lst:
            pos = self.search['lines'][i].find(self.search['word'])
            if pos != -1:                
                self.search['index'] = i if backwards else i + 1
                #print 'found at line %d column %d, index=%d' % (i, pos, self.search['index'])
                gobject.timeout_add(0, lambda: self.search['terminal'].get_adjustment().set_value(i))
                self.search['terminal'].queue_draw()
                break
        if pos==-1:
            self.search['index'] = len(self.search['lines']) if backwards else 0 
開發者ID:mjun,項目名稱:gnome-connection-manager,代碼行數:21,代碼來源:gnome_connection_manager.py

示例8: icon_bell

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def icon_bell(self):
        """A bell signal requires we display our bell icon"""
        self.bellicon.show()
        gobject.timeout_add(1000, self.icon_bell_hide) 
開發者ID:OWASP,項目名稱:NINJA-PingU,代碼行數:6,代碼來源:titlebar.py

示例9: watch

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def watch(self, _widget, terminal):
        """Watch a terminal"""
        vte = terminal.get_vte()
        self.watches[terminal] = vte.connect('contents-changed',
                                             self.reset_timer, terminal)
        timeout_id = gobject.timeout_add(5000, self.check_times, terminal)
        self.timers[terminal] = timeout_id
        dbg('timer %s added for %s' %(timeout_id, terminal)) 
開發者ID:OWASP,項目名稱:NINJA-PingU,代碼行數:10,代碼來源:activitywatch.py

示例10: _start_update_timer

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def _start_update_timer(self):
        if self._update_timeout_id is not None:
            gobject.source_remove(self._update_timeout_id)
        #print "start_update_timer"
        self._update_timeout_id = gobject.timeout_add(int(SAMPLE_PERIOD/min(self.speed, 1)*1e3),
                                                      self.update_view_timeout,
                                                      priority=PRIORITY_UPDATE_VIEW) 
開發者ID:ntu-dsi-dcn,項目名稱:ntu-dsi-dcn,代碼行數:9,代碼來源:core.py

示例11: start

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def start(self):
        self.scan_topology()
        self.window.connect("delete-event", self._quit)
        #self._start_update_timer()
        gobject.timeout_add(200, self.autoscale_view)
        self.simulation.start()

        try:
            __IPYTHON__
        except NameError:
            pass
        else:
            self._monkey_patch_ipython()

        gtk.main() 
開發者ID:ntu-dsi-dcn,項目名稱:ntu-dsi-dcn,代碼行數:17,代碼來源:core.py

示例12: _timer_start

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def _timer_start(self):
        # Need to stop it, otherwise we potentially leak a timer id that will
        # never be stopped.
        self._timer_stop()
        self._timer = gobject.timeout_add(self._interval, self._on_timer) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:7,代碼來源:backend_gtk.py

示例13: _on_timer

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def _on_timer(self):
        TimerBase._on_timer(self)

        # Gtk timeout_add() requires that the callback returns True if it
        # is to be called again.
        if len(self.callbacks) > 0 and not self._single:
            return True
        else:
            self._timer = None
            return False 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:12,代碼來源:backend_gtk.py

示例14: _wire_kernel

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import timeout_add [as 別名]
def _wire_kernel(self):
        """Initializes the kernel inside GTK.
        
        This is meant to run only once at startup, so it does its job and
        returns False to ensure it doesn't get run again by GTK.
        """
        self.gtk_main, self.gtk_main_quit = self._hijack_gtk()
        gobject.timeout_add(int(1000*self.kernel._poll_interval),
                            self.iterate_kernel)
        return False 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:12,代碼來源:gtkembed.py


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