本文整理汇总了Python中gobject.source_remove方法的典型用法代码示例。如果您正苦于以下问题:Python gobject.source_remove方法的具体用法?Python gobject.source_remove怎么用?Python gobject.source_remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gobject
的用法示例。
在下文中一共展示了gobject.source_remove方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: data_ready
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import source_remove [as 别名]
def data_ready(self, sock, condition):
address = self.addresses[sock]
data = sock.recv(1024)
if len(data) == 0:
self.add_text("\nlost connection with %s" % address)
gobject.source_remove(self.sources[address])
del self.sources[address]
del self.peers[address]
del self.addresses[sock]
sock.close()
else:
self.add_text("\n%s - %s" % (address, str(data)))
return True
# --- other stuff
示例2: doIteration
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import source_remove [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
示例3: unwatch
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import source_remove [as 别名]
def unwatch(self, _vte, terminal):
"""Unwatch a terminal"""
vte = terminal.get_vte()
vte.disconnect(self.watches[terminal])
del(self.watches[terminal])
gobject.source_remove(self.timers[terminal])
del(self.timers[terminal])
示例4: _start_update_timer
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import source_remove [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)
示例5: _on_play_button_toggled
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import source_remove [as 别名]
def _on_play_button_toggled(self, button):
if button.get_active():
self._start_update_timer()
else:
if self._update_timeout_id is not None:
gobject.source_remove(self._update_timeout_id)
示例6: _quit
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import source_remove [as 别名]
def _quit(self, *dummy_args):
if self._update_timeout_id is not None:
gobject.source_remove(self._update_timeout_id)
self._update_timeout_id = None
self.simulation.quit = True
self.simulation.go.set()
self.simulation.join()
gtk.main_quit()
示例7: _timer_stop
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import source_remove [as 别名]
def _timer_stop(self):
if self._timer is not None:
gobject.source_remove(self._timer)
self._timer = None
示例8: destroy
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import source_remove [as 别名]
def destroy(self):
#gtk.DrawingArea.destroy(self)
self.close_event()
gobject.source_remove(self._idle_event_id)
if self._idle_draw_id != 0:
gobject.source_remove(self._idle_draw_id)
示例9: stop
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import source_remove [as 别名]
def stop(self):
self.dot_widget.animation = NoAnimation(self.dot_widget)
if self.timeout_id is not None:
gobject.source_remove(self.timeout_id)
self.timeout_id = None