def unmap_cb(self, *junk): GLib.source_remove(self._timer_id) self.app.doc.tdw.disconnect_by_func(self.event_cb) self.app.drawWindow.disconnect_by_func(self.event_cb) logger.info('Event statistics disabled.')
def _cancel_autoreveal_timeout(self): """Cancels any pending auto-reveal""" if not self._autoreveal_timeout: return for timer in self._autoreveal_timeout: GLib.source_remove(timer) self._autoreveal_timeout = []
def stop(self): """Immediately stop processing and clear the queue.""" if self._idle_id: GLib.source_remove(self._idle_id) self._idle_id = None self._queue.clear() assert self._idle_id is None assert len(self._queue) == 0
def _stop_task_queue_runner(self, complete=True): """Halts processing of the task queue, and clears it""" if self._task_queue_runner_id is None: return if complete: for (callback, args, kwargs) in self._task_queue: callback(*args, **kwargs) self._task_queue.clear() GLib.source_remove(self._task_queue_runner_id) self._task_queue_runner_id = None
def _popup_leave_notify_cb(self, widget, event): if not self.active: return # allow to leave the window for a short time if self._outside_popup_timeout_id: GLib.source_remove(self._outside_popup_timeout_id) self._outside_popup_timeout_id = None self._outside_popup_timeout_id = GLib.timeout_add( int(1000 * self.outside_popup_timeout), self._outside_popup_timeout_cb, )
def show_transient_message(self, text, seconds=5): """Display a brief, impermanent status message""" context_id = self._transient_msg_context_id self.statusbar.remove_all(context_id) self.statusbar.push(context_id, unicode(text)) timeout_id = self._transient_msg_remove_timeout_id if timeout_id is not None: GLib.source_remove(timeout_id) timeout_id = GLib.timeout_add_seconds( interval=seconds, function=self._transient_msg_remove_timer_cb, ) self._transient_msg_remove_timeout_id = timeout_id
def _toplevel_configure_cb(self, toplevel, event): """Record the toplevel window's position ("configure-event" callback) """ # Avoid saving fullscreen positions. The timeout is a bit of hack, but # it's necessary because the state change event and the configure event # when fullscreening don't have a sensible order. w, h = event.width, event.height srcid = self._save_toplevel_pos_timeout if srcid: GLib.source_remove(srcid) srcid = GLib.timeout_add( 250, self._save_toplevel_pos_timeout_cb, w, h, ) self._save_toplevel_pos_timeout = srcid
def _in_grab_motion_cb(self, widget, event): assert self._grabbed_pointer_dev is not None if not self._check_event_devices_still_grabbed(event): return True if event.device is not self._grabbed_pointer_dev: return False if not self._grab_button_num: return False # Due to a performance issue, picking can take more time # than we have between two motion events (about 8ms). if self._delayed_picking_update_id: GLib.source_remove(self._delayed_picking_update_id) self._delayed_picking_update_id = GLib.idle_add( self._delayed_picking_update_cb, event.device, event.x_root, event.y_root, ) return True
def _popup_enter_notify_cb(self, widget, event): if not self.active: return if self._outside_popup_timeout_id: GLib.source_remove(self._outside_popup_timeout_id) self._outside_popup_timeout_id = None
def _stop_outside_popup_timeout(self): if not self._outside_popup_timeout_id: return GLib.source_remove(self._outside_popup_timeout_id) self._outside_popup_timeout_id = None
def _stop_autoleave_timeout(self): if not self._autoleave_timeout_id: return GLib.source_remove(self._autoleave_timeout_id) self._autoleave_timeout_id = None
def _cancel_autohide_timeout(self): """Cancels any pending auto-hide""" if not self._autohide_timeout: return GLib.source_remove(self._autohide_timeout) self._autohide_timeout = None
def _stop_hover_expand_timer(self): if self._hover_expand_timer_id is None: return GLib.source_remove(self._hover_expand_timer_id) self._hover_expand_timer_id = None