本文整理汇总了Python中gi.repository.Gtk.main_iteration_do方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.main_iteration_do方法的具体用法?Python Gtk.main_iteration_do怎么用?Python Gtk.main_iteration_do使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.main_iteration_do方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_running
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [as 别名]
def test_running(self):
"""Check if slideshow runs correctly."""
self.assertEqual(self.vimiv.get_index(), 0)
self.slideshow.toggle()
# Set delay when running
self.run_command("set slideshow_delay 0.5")
self.assertEqual(self._get_delay(), 0.5)
# Paths are updated
refresh_gui(self.vimiv)
self.assertEqual(self.vimiv.get_index(), 1)
refresh_gui(self.vimiv)
self.assertEqual(self.vimiv.get_index(), 0)
# Info message should be displayed for a while
self.check_statusbar("INFO: Back at beginning of slideshow")
while not self.vimiv.get_index():
self.check_statusbar("INFO: Back at beginning of slideshow")
Gtk.main_iteration_do(False)
示例2: destroy
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [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
示例3: ext_wine
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [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,
])
示例4: watch_process
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [as 别名]
def watch_process(self, io, condition, process_name):
if condition is GLib.IO_HUP:
self.progressbar.pulse()
self.n_files_to_copy -= 1
if self.n_files_to_copy == 0:
message_dialog = Gtk.MessageDialog(
self.main_window,
0,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.OK,
_("Done!"),
width_request = 360
)
content_area = message_dialog.get_content_area()
content_area.set_property('margin-left', 10)
content_area.set_property('margin-right', 10)
content_area.set_property('margin-top', 10)
content_area.set_property('margin-bottom', 10)
action_area = message_dialog.get_action_area()
action_area.set_property('spacing', 10)
self.main_window.hide()
message_dialog.run()
message_dialog.destroy()
Gtk.main_quit()
return False
while Gtk.events_pending():
Gtk.main_iteration_do(False)
return True
示例5: set_text
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [as 别名]
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
示例6: load_image
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [as 别名]
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")
示例7: refresh_gui
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [as 别名]
def refresh_gui(vimiv=None):
"""Refresh the GUI as the Gtk.main() loop is not running when testing.
Args:
vimiv: Vimiv class to receive slideshow index.
"""
current_pos = vimiv.get_index()
while current_pos == vimiv.get_index():
Gtk.main_iteration_do(False)
示例8: refresh_gui
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [as 别名]
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)
示例9: disable
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [as 别名]
def disable(self):
self._currently_focused_widget = self.get_focus()
self.preset_list.set_sensitive(False)
self.theme_edit.set_sensitive(False)
Gtk.main_iteration_do(False)
self.spinner.start()
示例10: repairDatabaseNow
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [as 别名]
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)
示例11: repaint
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [as 别名]
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)
示例12: _search_callback
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_iteration_do [as 别名]
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