示例#1
0
    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.')
示例#2
0
 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 = []
示例#3
0
 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
示例#4
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
示例#5
0
 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,
     )
示例#6
0
 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
示例#7
0
 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
示例#8
0
 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
示例#9
0
 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
示例#10
0
 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
示例#11
0
 def _stop_autoleave_timeout(self):
     if not self._autoleave_timeout_id:
         return
     GLib.source_remove(self._autoleave_timeout_id)
     self._autoleave_timeout_id = None
示例#12
0
 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
示例#13
0
 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