Python gi.repository.Gtk.events_pending() Examples
The following are 30
code examples of gi.repository.Gtk.events_pending().
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.Gtk
, or try the search function
.
Example #1
Source File: modules.py From gpt with GNU General Public License v3.0 | 6 votes |
def show_message(self, message, log="info"): """Show notifications in terminal window and status bar if possible""" try: app.obj("statusbar").push(1, message) time.sleep(.1) while Gtk.events_pending(): Gtk.main_iteration() except (AttributeError, NameError): self.log.debug(_("Could not write message to statusbar")) self.log.debug(_("Message: {}").format(message)) # print(message) if log in self.loglevels.keys(): lvl = self.loglevels[log] else: lvl = 0 self.log.log(lvl, message) # function exclusively called by cli
Example #2
Source File: launcher_wine.py From games_nebula with GNU General Public License v3.0 | 6 votes |
def cb_button_wine_settings(self, button): self.main_window.hide() while Gtk.events_pending(): Gtk.main_iteration() self.set_wineprefix() self.create_link() self.set_environ() self.set_win_ver_command() self.set_additions_command() launch_command = 'python "' + nebula_dir + '/settings_wine.py"' full_command = self.win_ver_command + '\n' + \ self.additions_command + '\n' + \ launch_command os.system(full_command) self.main_window.show()
Example #3
Source File: mainwindow.py From zim-desktop-wiki with GNU General Public License v2.0 | 6 votes |
def destroy(self): self.pageview.save_changes() if self.page.modified: return # Do not quit if page not saved self.pageview.page.set_ui_object(None) # XXX self._do_close() while Gtk.events_pending(): Gtk.main_iteration_do(False) self.notebook.index.stop_background_check() op = ongoing_operation(self.notebook) if op: op.wait() Window.destroy(self) # gtk destroy & will also emit destroy signal
Example #4
Source File: launcher_native.py From games_nebula with GNU General Public License v3.0 | 6 votes |
def launch_game(self): self.switch_monitor('ON') self.main_window.hide() while Gtk.events_pending(): Gtk.main_iteration() if self.launcher_type == 'gog': launch_command = self.install_dir + '/' + self.game_name + '/start_gog.sh' else: launch_command = self.install_dir + '/' + self.game_name + '/start_gn.sh' os.system(self.command_before) subprocess.call([launch_command]) os.system(self.command_after) self.switch_monitor('OFF') self.config_save() sys.exit()
Example #5
Source File: launcher_dosbox.py From games_nebula with GNU General Public License v3.0 | 6 votes |
def cb_button_dosbox_settings(self, button): self.main_window.hide() while Gtk.events_pending(): Gtk.main_iteration() dosbox_bin = self.set_dosbox_bin() dosbox_version = self.check_dosbox_version(dosbox_bin) self.create_link() subprocess.call([sys.executable, nebula_dir + '/settings_dosbox.py', \ self.install_dir + '/' + self.game_name + '/dosbox.conf', 'local', dosbox_version]) #~ if (dosbox_version == 'stable') or (dosbox_version == 'svn'): #~ os.system('python ' + nebula_dir + '/settings_dosbox.py ' + \ #~ self.install_dir + '/' + self.game_name + '/dosbox.conf local ' + dosbox_version) #~ elif dosbox_version == 'svn_daum': #~ os.system('python ' + nebula_dir + '/settings_dosbox_svn_daum.py ' + \ #~ self.install_dir + '/' + self.game_name + '/dosbox.conf local ' + dosbox_version) self.main_window.show()
Example #6
Source File: weatherwidget.py From my-weather-indicator with MIT License | 6 votes |
def on_expose(self, widget, cr, data): if self.surface is not None: cr.save() cr.set_operator(cairo.OPERATOR_CLEAR) cr.rectangle(0.0, 0.0, *widget.get_size()) cr.fill() cr.restore() while Gtk.events_pending(): Gtk.main_iteration() ''' if self.supports_alpha: pb = take_screenshot(widget) surface = get_surface_from_pixbuf(pb) cr.save() cr.set_source_surface(surface) cr.paint() cr.restore() ''' cr.save() cr.set_source_surface(self.surface) cr.paint() cr.restore()
Example #7
Source File: gtk.py From pywebview with BSD 3-Clause "New" or "Revised" License | 6 votes |
def close_window(self, *data): for res in self.js_results.values(): res['semaphore'].release() while gtk.events_pending(): gtk.main_iteration() self.window.destroy() del BrowserView.instances[self.uid] if self.pywebview_window in windows: windows.remove(self.pywebview_window) self.pywebview_window.closed.set() if BrowserView.instances == {}: gtk.main_quit()
Example #8
Source File: set_wifi.py From kano-settings with GNU General Public License v2.0 | 6 votes |
def configure_wifi(self, widget=None, event=None): # If is a mouse click event or key pressed is ENTER if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: self.kano_button.set_sensitive(True) self.wifi_connection_attempted = True # Blur window self.win.blur() self.win.show_all() # Force blur to be shown while Gtk.events_pending(): Gtk.main_iteration() # Call WiFi config os.system('/usr/bin/kano-wifi-gui') # Refresh window after WiFi Setup self.win.unblur() self.win.clear_win() SetWifi(self.win)
Example #9
Source File: __init__.py From ubuntu-cleaner with GNU General Public License v3.0 | 6 votes |
def on_find_object(self, plugin, cruft, count, iters): while Gtk.events_pending(): Gtk.main_iteration() plugin_iter, result_iter = iters self.result_model.append(result_iter, (False, cruft.get_icon(), cruft.get_name(), cruft.get_name(), cruft.get_size_display(), plugin, cruft)) self.result_view.expand_row(self.result_model.get_path(result_iter), True) # Update the janitor title if count: self.janitor_model[plugin_iter][self.JANITOR_DISPLAY] = "<b>[%d] %s</b>" % (count, plugin.get_title()) else: self.janitor_model[plugin_iter][self.JANITOR_DISPLAY] = "[0] %s" % plugin.get_title()
Example #10
Source File: WebCloner.py From WebTrap with BSD 3-Clause "New" or "Revised" License | 5 votes |
def gtk_sync(): """Wait while all pending GTK events are processed.""" while Gtk.events_pending(): Gtk.main_iteration()
Example #11
Source File: splash_screen.py From RAFCON with Eclipse Public License 1.0 | 5 votes |
def set_text(self, text): logger.info(text) self.label.set_text(text) # include this to give more time to watch # import time # time.sleep(1) while Gtk.events_pending(): Gtk.main_iteration_do(False) return
Example #12
Source File: __init__.py From ubuntu-cleaner with GNU General Public License v3.0 | 5 votes |
def on_plugin_object_cleaned(self, plugin, cruft, count, user_data): while Gtk.events_pending(): Gtk.main_iteration() plugin_iter, cruft_dict = user_data self.result_model.remove(cruft_dict[cruft]) self.janitor_model[plugin_iter][self.JANITOR_DISPLAY] remain = len(cruft_dict) - count if remain: self.janitor_model[plugin_iter][self.JANITOR_DISPLAY] = "<b>[%d] %s</b>" % (remain, plugin.get_title()) else: self.janitor_model[plugin_iter][self.JANITOR_DISPLAY] = "[0] %s" % plugin.get_title()
Example #13
Source File: setting.py From amir with GNU General Public License v3.0 | 5 votes |
def repairDatabaseNow(self, sender): msg = _("Please wait...") self.msgbox = Gtk.MessageDialog( self.window, Gtk.DialogFlags.MODAL, Gtk.MessageType.INFO, Gtk.ButtonsType.NONE, msg) self.msgbox.set_title(_("Repairing database")) self.msgbox.show_all() while Gtk.events_pending(): Gtk.main_iteration_do(False) GObject.timeout_add(1000, self.repairDbFunc)
Example #14
Source File: backend_gtk3.py From ImageFusion with MIT License | 5 votes |
def flush_events(self): Gdk.threads_enter() while Gtk.events_pending(): Gtk.main_iteration(True) Gdk.flush() Gdk.threads_leave()
Example #15
Source File: threading_helper.py From HydraPaper with GNU General Public License v3.0 | 5 votes |
def wait_for_thread(thread): while thread.is_alive(): while Gtk.events_pending(): Gtk.main_iteration() return
Example #16
Source File: vimiv_testcase.py From vimiv with MIT License | 5 votes |
def refresh_gui(delay=0): """Refresh the GUI as the Gtk.main() loop is not running when testing. Args: delay: Time to wait before refreshing. """ time.sleep(delay) while Gtk.events_pending(): Gtk.main_iteration_do(False)
Example #17
Source File: splash_screen.py From RAFCON with Eclipse Public License 1.0 | 5 votes |
def load_image(self, image_path): if image_path: pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(image_path, self.get_size()[0] - 50, self.get_size()[1] - 50) self.image.set_from_pixbuf(pixbuf) while Gtk.events_pending(): Gtk.main_iteration_do(False) else: logger.debug("Splash screen image path is None")
Example #18
Source File: backend_gtk3.py From neural-network-animation with MIT License | 5 votes |
def flush_events(self): Gdk.threads_enter() while Gtk.events_pending(): Gtk.main_iteration(True) Gdk.flush() Gdk.threads_leave()
Example #19
Source File: AppInstaller.py From kano-apps with GNU General Public License v2.0 | 5 votes |
def install(self): if self._win is not None: self._win.blur() self._win.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) if not self._download_app(): return self._end(False) if self._check_if_installed: if not self._installed_check(): return self._end(False) if not self._get_sudo_pw(): return self._end(False) # Prevent the user escaping with the home button os.system('kano-home-button-visible no') # Make sure the dialogs are gone before installing while Gtk.events_pending(): Gtk.main_iteration() rv = self._install() # Should be safe to bail at this point os.system('kano-home-button-visible yes') return self._end(rv)
Example #20
Source File: common.py From bokken with GNU General Public License v2.0 | 5 votes |
def repaint(): '''Easy function to clean up the event queue and force a repaint.''' # I've been unable to find any other way to repaint the interface. :-( while Gtk.events_pending(): # Blocking: True/false Gtk.main_iteration_do(False)
Example #21
Source File: graph.py From my-weather-indicator with MIT License | 5 votes |
def load_changed(self, widget, load_event): print(load_event) if load_event == WebKit2.LoadEvent.FINISHED: self.web_send('title="%s";subtitle="%s";humidity=%s;\ cloudiness=%s;temperature=%s;draw_graph(title,subtitle,temperature,humidity,\ cloudiness);' % (self.title, self.subtitle, self.humidity, self.cloudiness, self.temperature)) while Gtk.events_pending(): Gtk.main_iteration()
Example #22
Source File: whereami.py From my-weather-indicator with MIT License | 5 votes |
def set_wait_cursor(self): Gdk.Screen.get_default().get_root_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) while Gtk.events_pending(): Gtk.main_iteration()
Example #23
Source File: openweathermap.py From my-weather-indicator with MIT License | 5 votes |
def __init__(self, lat=39.36873, lon=-2.417274645879): self.images = {} self.echo = True Gtk.Dialog.__init__(self) self.set_position(Gtk.WindowPosition.CENTER_ALWAYS) self.set_title(comun.APP) self.set_default_size(900, 600) self.set_icon_from_file(comun.ICON) self.connect('destroy', self.close_application) # vbox = Gtk.VBox(spacing=5) self.get_content_area().add(vbox) hbox1 = Gtk.HBox() vbox.pack_start(hbox1, True, True, 0) self.scrolledwindow1 = Gtk.ScrolledWindow() self.scrolledwindow1.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self.scrolledwindow1.set_shadow_type(Gtk.ShadowType.IN) hbox1.pack_start(self.scrolledwindow1, True, True, 0) self.viewer = WebKit2.WebView() self.scrolledwindow1.add(self.viewer) self.scrolledwindow1.set_size_request(900, 600) self.viewer.connect('load-changed', self.load_changed) self.viewer.load_uri('file://' + comun.HTML) self.lat = lat self.lon = lon self.set_focus(self.viewer) self.show_all() while Gtk.events_pending(): Gtk.main_iteration() self.show_all() self.run() self.destroy()
Example #24
Source File: openweathermap.py From my-weather-indicator with MIT License | 5 votes |
def web_send(self, msg): print('send: %s' % (msg)) self.viewer.run_javascript(msg, None, None, None) while Gtk.events_pending(): Gtk.main_iteration()
Example #25
Source File: backend_gtk3.py From CogAlg with MIT License | 5 votes |
def flush_events(self): # docstring inherited Gdk.threads_enter() while Gtk.events_pending(): Gtk.main_iteration() Gdk.flush() Gdk.threads_leave()
Example #26
Source File: main.py From mLauncher with GNU General Public License v3.0 | 5 votes |
def wait(time_lapse): time_start = time.time() time_end = (time_start + time_lapse) while time_end > time.time(): while Gtk.events_pending(): Gtk.main_iteration()
Example #27
Source File: searchdialog.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def _search_callback(self, results, path): # Returning False will cancel the search #~ print('!! CB', path) if results is not None: self._update_results(results) while Gtk.events_pending(): Gtk.main_iteration_do(False) return not self.cancelled
Example #28
Source File: __init__.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def gtk_process_events(*a): '''Method to simulate a few iterations of the gtk main loop''' assert Gtk is not None while Gtk.events_pending(): Gtk.main_iteration() return True # continue
Example #29
Source File: settings_wine.py From games_nebula with GNU General Public License v3.0 | 5 votes |
def cb_button_winetricks(self, button): self.main_window.hide() while Gtk.events_pending(): Gtk.main_iteration() command = 'winetricks --gui' os.system(command) self.main_window.show()
Example #30
Source File: modules.py From gpt with GNU General Public License v3.0 | 5 votes |
def refresh_progressbar(self, c, a): """Refresh progress bar with current status""" fraction = c / a try: self.obj("progressbar").set_fraction(fraction) time.sleep(.1) # see http://faq.pygtk.org/index.py?req=show&file=faq23.020.htp or # http://ubuntuforums.org/showthread.php?t=1056823...it, well, works while Gtk.events_pending(): Gtk.main_iteration() except: raise