本文整理汇总了Python中gi.repository.Gtk.events_pending方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.events_pending方法的具体用法?Python Gtk.events_pending怎么用?Python Gtk.events_pending使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.events_pending方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_message
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import events_pending [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 events_pending [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 events_pending [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 events_pending [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 events_pending [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: on_find_object
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import events_pending [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()
示例7: on_expose
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import events_pending [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()
示例8: close_window
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import events_pending [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()
示例9: destroy
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import events_pending [as 别名]
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
示例10: close
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import events_pending [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 events_pending [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 events_pending [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 events_pending [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: ext_wine
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import events_pending [as 别名]
def ext_wine(file_path, dest_dir):
"""Unpack installer using wine"""
wineprefix_path = dest_dir + '/wine_prefix'
os.environ['WINEPREFIX'] = wineprefix_path
os.environ['WINEDEBUG'] = '-all'
os.environ['WINEDLLOVERRIDES'] = 'mshtml,mscoree=d'
if not os.path.exists(wineprefix_path):
os.makedirs(wineprefix_path)
dest_dir = dest_dir + '/game'
proc = subprocess.Popen(['winepath', '-w', dest_dir], stdout=subprocess.PIPE)
dest_dir_win = proc.stdout.readline().decode('utf-8').strip()
subprocess.call([
'wine',
file_path,
'/DIR=' + dest_dir_win,
'/VERYSILENT',
'/SUPPRESSMSGBOXES'
])
if not os.path.exists(dest_dir):
simple_message(
Gtk.MessageType.INFO,
"Info",
"Do not change the installation path!"
)
while Gtk.events_pending():
Gtk.main_iteration_do(False)
subprocess.call([
'wine',
file_path,
'/LANG=english',
'/DIR=' + dest_dir_win,
])
示例15: launch_game
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import events_pending [as 别名]
def launch_game(self):
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_game.conf'
]
os.system(self.command_before)
os.environ['SDL_VIDEO_FULLSCREEN_HEAD'] = '0'
subprocess.call(launch_command)
os.system(self.command_after)
output = self.monitor_primary.split()[0]
os.system('xrandr --output '+ output + ' --primary')
self.config_save()
sys.exit()