Python gi.repository.Gtk.main_iteration() Examples
The following are 30
code examples of gi.repository.Gtk.main_iteration().
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: 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 #4
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 #5
Source File: canvas.py From RAFCON with Eclipse Public License 1.0 | 6 votes |
def wait_for_update(self, trigger_update=False): """Update canvas and handle all events in the gtk queue :param bool trigger_update: Whether to call update_now() or not """ if trigger_update: self.update_now() from gi.repository import Gtk from gi.repository import GLib from threading import Event event = Event() # Handle all events from gaphas, but not from gtkmvc3 # Make use of the priority, which is higher for gaphas then for gtkmvc3 def priority_handled(event): event.set() priority = (GLib.PRIORITY_HIGH_IDLE + GLib.PRIORITY_DEFAULT_IDLE) / 2 # idle_add is necessary here, as we do not want to block the user from interacting with the GUI # while gaphas is redrawing GLib.idle_add(priority_handled, event, priority=priority) while not event.is_set(): Gtk.main_iteration()
Example #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
Source File: __init__.py From RAFCON with Eclipse Public License 1.0 | 5 votes |
def wait_for_gui(): from gi.repository import Gtk while Gtk.events_pending(): Gtk.main_iteration()
Example #13
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 #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: __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 #16
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 #17
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 #18
Source File: phpgedviewconnector.py From addons-source with GNU General Public License v2.0 | 5 votes |
def update_progressbar(self,text,step=0,max=0): self.progressbar.set_text(text) if max > 0: self.progressbar.set_fraction( 1.0 * step / max) else: self.progressbar.set_fraction( 0.0) while Gtk.events_pending(): Gtk.main_iteration()
Example #19
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 #20
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 #21
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 #22
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 #23
Source File: backend_gtk3.py From CogAlg with MIT License | 5 votes |
def set_cursor(self, cursor): self.canvas.get_property("window").set_cursor(cursord[cursor]) Gtk.main_iteration()
Example #24
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 #25
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 #26
Source File: launcher_native.py From games_nebula with GNU General Public License v3.0 | 5 votes |
def cb_button_settings(self, button): self.main_window.hide() while Gtk.events_pending(): Gtk.main_iteration() subprocess.call([self.install_dir + '/' + self.game_name + '/settings.sh', \ self.install_dir, nebula_dir]) self.config_save() os.execl(sys.executable, sys.executable, __file__, self.game_name)
Example #27
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
Example #28
Source File: launcher_wine.py From games_nebula with GNU General Public License v3.0 | 5 votes |
def cb_button_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 = '"' + self.install_dir + '/' + self.game_name + '/settings.sh"' full_command = self.win_ver_command + '\n' + \ self.additions_command + '\n' + \ launch_command os.system(full_command) self.config_save() self.exe_path = self.get_new_exe_path() os.execl(sys.executable, sys.executable, __file__, self.game_name, self.exe_path)
Example #29
Source File: launcher_wine.py From games_nebula with GNU General Public License v3.0 | 5 votes |
def launch_game(self, exe_name=None, exe_path=None): self.switch_monitor('ON') self.main_window.hide() while Gtk.events_pending(): Gtk.main_iteration() self.set_environ() self.set_win_ver_command() self.set_mouse_capture_command() self.set_additions_command() if exe_name == None: self.set_launch_command() exe_name, exe_path_no_exe = self.get_exe_path() cd_command = 'cd "' + self.install_dir + '/' + self.game_name + \ '/game/' + exe_path_no_exe + '"' else: self.set_launch_command(exe_name, exe_path) cd_command = 'cd "' + exe_path + '"' full_command = cd_command + '\n' + \ self.win_ver_command + '\n' + \ self.mouse_capture_command + '\n' + \ self.additions_command + '\n' + \ self.launch_command os.system(self.command_before) os.system(full_command) os.system(self.command_after) self.switch_monitor('OFF') sys.exit()
Example #30
Source File: launcher_dosbox.py From games_nebula with GNU General Public License v3.0 | 5 votes |
def cb_button_remap_keys(self, button): self.main_window.hide() while Gtk.events_pending(): Gtk.main_iteration() dosbox_bin = self.set_dosbox_bin() with open('/tmp/gn_tmp_dosbox.conf', 'w') as gn_tmp_dosbox_conf: gn_tmp_dosbox_conf.write('[autoexec]\n') gn_tmp_dosbox_conf.write('exit\n') gn_tmp_dosbox_conf.close() launch_command = [ dosbox_bin, '-conf', '/tmp/gn_tmp_dosbox.conf', '-conf', self.install_dir + '/' + self.game_name + '/dosbox.conf', '-startmapper' ] os.environ['SDL_VIDEO_FULLSCREEN_HEAD'] = '0' subprocess.call(launch_command) if os.path.exists('/tmp/gn_tmp_dosbox.conf'): os.remove('/tmp/gn_tmp_dosbox.conf') self.main_window.show()