def on_released(self, widget): if self.timeout: timer.cancel(self.timeout) self.timeout = None self.button_down = self.button_held = False self.queue_redraw() self.emit('released')
def stop_updating(self, id_): self.view.set_volatile(False) if id_ not in self.updating_animations: return self.view.stop_updating_image(self.iter_map[id_]) timer_id = self.updating_animations.pop(id_) timer.cancel(timer_id)
def _setup_info(self, info): """Initialize a newly received ItemInfo.""" download_info = info.download_info if (download_info is not None and not download_info.finished and download_info.state != 'paused' and download_info.downloaded_size > 0 and info.size == -1): # We are downloading an item without a content-length. Take steps # to update the progress throbbers. if info.id not in self._throbber_timeouts: self._schedule_throbber_timeout(info.id) elif info.id in self._throbber_timeouts: timer.cancel(self._throbber_timeouts.pop(info.id))
def _drive_connected(self, volume_monitor, drive): if drive is None: # can happen when a CD is inserted return logging.debug('seen device: %r', drive.get_name()) for id_, info in self._get_device_info(drive): if id_ in self._disconnecting: # Gio sends a disconnect/connect pair when the device is # mounted so we wait a little and check for spurious ones timeout_id = self._disconnecting.pop(id_) timer.cancel(timeout_id) return app.device_manager.device_connected(id_, **info)
def change_non_video_displays(self, display): # If the dc exists, cancel it. If the cancel failed because lost # the race to cancel it, then the display will load and some # some redundant code will be scheduled onto the main thread, but # that's okay, since at the next invocation of the delayed call # we shall get the correct display. We use a miro.timer here # rather than tacking onto the UI loop using call_on_ui_thread() # since we can't cancel it. if self.change_non_video_displays_dc: timer.cancel(self.change_non_video_displays_dc) self.change_non_video_displays_dc = None self.change_non_video_displays_dc = timer.add(0.1, lambda: call_on_ui_thread( lambda: self.do_change_non_video_displays(display)))
def _drive_connected(self, volume_monitor, drive): if drive is None: # can happen when a CD is inserted return try: info = self._get_device_info(drive) except KeyError: logging.debug('unknown device connected: %r' % drive.get_name()) return logging.debug('seen device: %r', drive.get_name()) if info.id in self._disconnecting: # Gio sends a disconnect/connect pair when the device is mounted so # we wait a little and check for spurious ones timeout_id = self._disconnecting.pop(info.id) timer.cancel(timeout_id) return devices.device_connected(info)
def on_clicked(self, widget): if self.timeout: timer.cancel(self.timeout) if not self.button_held: self.emit('clicked')
def on_pressed(self, widget): if self.timeout: timer.cancel(self.timeout) self.button_down = True self.button_held = False self.timeout = timer.add(self.initial_delay, self.on_button_hold)
def cancel_mark_as_watched(self): if self.mark_as_watched_timeout is not None: timer.cancel(self.mark_as_watched_timeout) self.mark_as_watched_timeout = None
def cancel_update_timer(self): if self.update_timeout is not None: timer.cancel(self.update_timeout) self.update_timeout = None