Python gi.repository.GObject.source_remove() Examples
The following are 22
code examples of gi.repository.GObject.source_remove().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.GObject
, or try the search function
.
Example #1
Source File: widgets.py From zim-desktop-wiki with GNU General Public License v2.0 | 6 votes |
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)
Example #2
Source File: assemble_dialog.py From bokken with GNU General Public License v2.0 | 5 votes |
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)
Example #3
Source File: main_window.py From rednotebook with GNU General Public License v2.0 | 5 votes |
def count_down(self): self.time_left -= 1 if self.time_left <= 0: GObject.source_remove(self.countdown) self._show_text("", countdown=False) return True
Example #4
Source File: __init__.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def _stop_timer(self): if self._autosave_timer: GObject.source_remove(self._autosave_timer) self._autosave_timer = None
Example #5
Source File: tableeditor.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def on_focus_in(self, treeview, event, toolbar): '''After a table is selected, this function will be triggered''' self._keep_toolbar_open = False if self._timer: GObject.source_remove(self._timer) if self._toolbar_enabled: toolbar.show()
Example #6
Source File: server.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
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)
Example #7
Source File: signals.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def __del__(self): if self.timer_id: GObject.source_remove(self.timer_id)
Example #8
Source File: signals.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
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)
Example #9
Source File: searchable.py From bokken with GNU General Public License v2.0 | 5 votes |
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)
Example #10
Source File: streamserver.py From pulseaudio-dlna with GNU General Public License v3.0 | 5 votes |
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)
Example #11
Source File: audiotsmgtk.py From audiotsm with MIT License | 5 votes |
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)
Example #12
Source File: message_bar.py From hazzy with GNU General Public License v2.0 | 5 votes |
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)
Example #13
Source File: ICLogon.py From pychess with GNU General Public License v3.0 | 5 votes |
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)
Example #14
Source File: timer.py From gtg with GNU General Public License v3.0 | 5 votes |
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)
Example #15
Source File: backend_gtk3.py From matplotlib-4-abaqus with MIT License | 5 votes |
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)
Example #16
Source File: backend_gtk3.py From matplotlib-4-abaqus with MIT License | 5 votes |
def _timer_stop(self): if self._timer is not None: GObject.source_remove(self._timer) self._timer = None
Example #17
Source File: backend_gtk3.py From Computable with MIT License | 5 votes |
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)
Example #18
Source File: backend_gtk3.py From Computable with MIT License | 5 votes |
def _timer_stop(self): if self._timer is not None: GObject.source_remove(self._timer) self._timer = None
Example #19
Source File: daemon.py From pulseaudio-dlna with GNU General Public License v3.0 | 5 votes |
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)
Example #20
Source File: pulseaudio.py From pulseaudio-dlna with GNU General Public License v3.0 | 5 votes |
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)
Example #21
Source File: widgets.py From zim-desktop-wiki with GNU General Public License v2.0 | 4 votes |
def _render(self): # remove timer if any if self._render_timeout: GObject.source_remove(self._render_timeout) self._render_timeout = None # Determine what size we want to render the image allocation = self.get_allocation() wwin, hwin = allocation.width, allocation.height wsrc, hsrc = self._pixbuf.get_width(), self._pixbuf.get_height() #~ print('Allocated', (wwin, hwin),) #~ print('Source', (wsrc, hsrc)) if self.scaling == self.SCALE_STATIC: wimg = self.factor * wsrc himg = self.factor * hsrc elif self.scaling == self.SCALE_FIT: if hsrc <= wwin and hsrc <= hwin: # image fits in the screen - no scaling wimg, himg = wsrc, hsrc elif (float(wwin) / wsrc) < (float(hwin) / hsrc): # Fit by width wimg = wwin himg = int(hsrc * float(wwin) / wsrc) else: # Fit by height wimg = int(wsrc * float(hwin) / hsrc) himg = hwin else: assert False, 'BUG: unknown scaling type' #~ print('Image', (wimg, himg)) # Scale pixbuf to new size wimg = max(wimg, 1) himg = max(himg, 1) if (wimg, himg) == (wsrc, hsrc): pixbuf = self._pixbuf else: pixbuf = self._pixbuf.scale_simple(wimg, himg, GdkPixbuf.InterpType.NEAREST) # And align the image in the layout wvirt = max((wwin, wimg)) hvirt = max((hwin, himg)) #~ print('Virtual', (wvirt, hvirt)) self._image.set_from_pixbuf(pixbuf) self.set_size(wvirt, hvirt) self.move(self._image, (wvirt - wimg) / 2, (hvirt - himg) / 2)
Example #22
Source File: journal.py From zim-desktop-wiki with GNU General Public License v2.0 | 4 votes |
def __init__(self, plugin, notebook, navigation): GObject.GObject.__init__(self) self.plugin = plugin self.notebook = notebook self.navigation = navigation self.model = CalendarWidgetModel(plugin, notebook) self.label_box = Gtk.HBox() self.pack_start(self.label_box, False, True, 0) self.label = Gtk.Label() button = Gtk.Button() button.add(self.label) button.set_relief(Gtk.ReliefStyle.NONE) button.connect('clicked', lambda b: self.go_today()) self.label_box.add(button) self._close_button = None self._refresh_label() self._timer_id = \ GObject.timeout_add(300000, self._refresh_label) # 5 minute = 300_000 ms # Ideally we only need 1 timer per day at 00:00, but not # callback for that self.connect('destroy', lambda o: GObject.source_remove(o._timer_id)) # Clear reference, else we get a new timer for every dialog self.calendar = Calendar() self.calendar.set_display_options( Gtk.CalendarDisplayOptions.SHOW_HEADING | Gtk.CalendarDisplayOptions.SHOW_DAY_NAMES | Gtk.CalendarDisplayOptions.SHOW_WEEK_NUMBERS ) self.calendar.connect('activate', self.on_calendar_activate) self.calendar.connect('month-changed', self.on_month_changed) self.on_month_changed(self.calendar) self.pack_start(self.calendar, False, True, 0) self.treeview = PageTreeView(notebook, navigation) self.pack_start(ScrolledWindow(self.treeview), True, True, 0)