本文整理汇总了Python中gi.repository.GObject.source_remove方法的典型用法代码示例。如果您正苦于以下问题:Python GObject.source_remove方法的具体用法?Python GObject.source_remove怎么用?Python GObject.source_remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.GObject
的用法示例。
在下文中一共展示了GObject.source_remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_size_allocate
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def on_size_allocate(self, allocation):
# remove timer if any
if self._render_timeout:
GObject.source_remove(self._render_timeout)
self._render_timeout = None
size = (allocation.width, allocation.height)
if size == self._render_size or not self._pixbuf:
pass # no update of rendering needed
else:
def render_on_timeout(size):
self._render_size = size
try:
self._render()
except:
logger.exception('Exception while rendering image')
return False
self._render_timeout = GObject.timeout_add(100, render_on_timeout, size)
示例2: unregister
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def unregister(self, stream):
logger.info('Unregistered stream "{}" ({}) ...'.format(
stream.path, stream.id))
del self.streams[stream.path][stream.id]
if stream.path in self.timeouts:
GObject.source_remove(self.timeouts[stream.path])
self.timeouts[stream.path] = GObject.timeout_add(
2000, self._on_disconnect, stream)
示例3: _delayed_handle_sink_update
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def _delayed_handle_sink_update(self, sink_path):
if self.signal_timers.get(sink_path, None):
GObject.source_remove(self.signal_timers[sink_path])
self.signal_timers[sink_path] = GObject.timeout_add(
1000, self._handle_sink_update, sink_path)
示例4: on_name_owner_changed
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def on_name_owner_changed(self, name, new_owner, old_owner):
if not self.is_checking:
if self.check_id:
GObject.source_remove(self.check_id)
self.check_id = GObject.timeout_add(
3000, self._check_processes)
示例5: _timer_stop
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def _timer_stop(self):
if self._timer is not None:
GObject.source_remove(self._timer)
self._timer = None
示例6: destroy
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.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)
示例7: time_changed
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def time_changed(self):
refresh_time = datetime.datetime.combine(datetime.date.today(),
self.get_configuration())
secs_to_refresh = self.seconds_until(refresh_time)
if self.timeout_source:
GObject.source_remove(self.timeout_source)
self.timeout_source = GObject.timeout_add_seconds(secs_to_refresh,
self.emit_refresh)
示例8: showNormal
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def showNormal(self):
self.widgets["mainbox"].set_sensitive(True)
self.widgets["connectButton"].show()
self.widgets["fics_logon"].set_default(self.widgets["connectButton"])
self.widgets["stopButton"].hide()
self.widgets["progressbarBox"].hide()
self.widgets["progressbar"].set_text("")
GObject.source_remove(self.pulser)
示例9: set_timout
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def set_timout(self, timeout):
if self.time_out_id:
# Remove any active timeout
GObject.source_remove(self.time_out_id)
self.time_out_id = None
if timeout:
self.time_out_id = GObject.timeout_add(timeout * 1000, self.close)
示例10: _on_state_changed
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def _on_state_changed(self, bus, message):
"""Called when the state of an element of the pipeline changes."""
state = message.parse_state_changed()[1]
if message.src != self.playbin:
# Ignore messages that do not come from the playbin
return
if state == Gst.State.READY:
self._speed_set = False
if state == Gst.State.PAUSED:
self._emit_position()
if state == Gst.State.PLAYING:
if not self._speed_set:
self._speed_set = True
self.playbin.seek(
self._speed, Gst.Format.TIME, Gst.SeekFlags.FLUSH,
Gst.SeekType.SET, 0, Gst.SeekType.NONE, -1)
if self.position_timer is None:
self._emit_position()
self.position_timer = (
GObject.timeout_add(100, self._emit_position)
)
else:
if self.position_timer is not None:
GObject.source_remove(self.position_timer)
self.position_timer = None
self.emit('state-changed', state)
示例11: _update
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def _update(self, widget, data=None):
# This loop makes sure that we only call _find every 500 ms .
if self.timer_id:
# We destroy the last event source and create another one.
GObject.source_remove(self.timer_id)
self.timer_id = GObject.timeout_add(500, self._refresh, widget, data)
示例12: _find_cb
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def _find_cb(self, widget, data):
# This loop makes sure that we only call _find every 500 ms .
if self.timer_id:
# We destroy the last event source and create another one.
GObject.source_remove(self.timer_id)
self.timer_id = GObject.timeout_add(500, self._find, widget, data)
示例13: __call__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def __call__(self, *arg, **kwarg):
if self.timer_id:
GObject.source_remove(self.timer_id)
self.timer_id = None
def callback():
self.timer_id = None
self.cb_func(*arg, **kwarg)
return False # destroy timeout
self.timer_id = GObject.timeout_add(self.timeout, callback)
示例14: __del__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def __del__(self):
if self.timer_id:
GObject.source_remove(self.timer_id)
示例15: stop
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import source_remove [as 别名]
def stop(self):
# Stop server
logger.debug('Stop server')
if self._source_id is not None:
GObject.source_remove(self._source_id)
self._source_id = None
if self.httpd:
self.httpd.socket.close()
# There is also a httpd.server_close(), but undocumented (!?)
self.httpd = None
# Update UI
self.status_label.set_markup('<i>' + _('Server stopped') + '</i>')
# T: Status in web server gui
if self.link_button:
self.link_button.set_sensitive(False)
self.notebookcombobox.set_sensitive(True)
self.portentry.set_sensitive(True)
self.public_checkbox.set_sensitive(True)
self.templatecombobox.set_sensitive(True)
self.open_button.set_sensitive(True)
self.stop_button.set_sensitive(False)
self.start_button.set_sensitive(True)
self.auth_checkbox.set_sensitive(True)
self.username_input.set_sensitive(True)
self.password_input.set_sensitive(True)