本文整理汇总了Python中gi.repository.Gtk.main_iteration方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.main_iteration方法的具体用法?Python Gtk.main_iteration怎么用?Python Gtk.main_iteration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.main_iteration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_message
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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
示例2: cb_button_wine_settings
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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()
示例3: cb_button_dosbox_settings
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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()
示例4: launch_game
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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()
示例5: configure_wifi
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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)
示例6: wait_for_update
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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()
示例7: on_find_object
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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()
示例8: on_expose
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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()
示例9: close_window
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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()
示例10: close
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
def close(self):
'''
Use this method if your app is nesting several Kano Dialogs,
and you need to step through without stacking them up.
'''
self.dialog.destroy()
# Dispatch events so Gtk has a chance to close the dialog
while Gtk.events_pending():
Gtk.main_iteration()
示例11: refresh_progressbar
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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
示例12: cb_button_settings
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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)
示例13: launch_game
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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()
示例14: cb_button_remap_keys
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
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()
示例15: cb_button_settings
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration [as 别名]
def cb_button_settings(self, button):
output = self.combobox_monitor.get_active_text().split()[0]
os.system('xrandr --output '+ output + ' --primary')
self.main_window.hide()
while Gtk.events_pending():
Gtk.main_iteration()
dosbox_bin = self.set_dosbox_bin()
self.create_link()
launch_command = [
dosbox_bin,
'-conf',
os.getenv('HOME') + '/.games_nebula/config/dosbox.conf',
'-conf',
self.install_dir + '/' + self.game_name + '/dosbox.conf',
'-conf',
self.install_dir + '/' + self.game_name + '/dosbox_settings.conf'
]
os.environ['SDL_VIDEO_FULLSCREEN_HEAD'] = '0'
subprocess.call(launch_command)
output = self.monitor_primary.split()[0]
os.system('xrandr --output '+ output + ' --primary')
self.main_window.show()