当前位置: 首页>>代码示例>>Python>>正文


Python Gtk.events_pending方法代码示例

本文整理汇总了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 
开发者ID:encarsia,项目名称:gpt,代码行数:20,代码来源:modules.py

示例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() 
开发者ID:yancharkin,项目名称:games_nebula,代码行数:25,代码来源:launcher_wine.py

示例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() 
开发者ID:yancharkin,项目名称:games_nebula,代码行数:27,代码来源:launcher_dosbox.py

示例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() 
开发者ID:yancharkin,项目名称:games_nebula,代码行数:25,代码来源:launcher_native.py

示例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) 
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:23,代码来源:set_wifi.py

示例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() 
开发者ID:gerardpuig,项目名称:ubuntu-cleaner,代码行数:23,代码来源:__init__.py

示例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() 
开发者ID:atareao,项目名称:my-weather-indicator,代码行数:24,代码来源:weatherwidget.py

示例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() 
开发者ID:r0x0r,项目名称:pywebview,代码行数:19,代码来源:gtk.py

示例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 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:19,代码来源:mainwindow.py

示例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() 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:12,代码来源:kano_dialog.py

示例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 
开发者ID:encarsia,项目名称:gpt,代码行数:14,代码来源:modules.py

示例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) 
开发者ID:yancharkin,项目名称:games_nebula,代码行数:29,代码来源:launcher_wine.py

示例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() 
开发者ID:yancharkin,项目名称:games_nebula,代码行数:38,代码来源:launcher_wine.py

示例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,
        ]) 
开发者ID:yancharkin,项目名称:games_nebula,代码行数:34,代码来源:extractor.py

示例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() 
开发者ID:yancharkin,项目名称:games_nebula,代码行数:37,代码来源:launcher_dosbox.py


注:本文中的gi.repository.Gtk.events_pending方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。