当前位置: 首页>>代码示例>>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;未经允许,请勿转载。