python类main_iteration_do()的实例源码

settings.py 文件源码 项目:games_nebula_goglib_scripts 作者: yancharkin 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def watch_process(self, io, condition, process_name):

        if condition is GLib.IO_HUP:

            self.progressbar.pulse()

            self.n_files -= 1

            if self.n_files == 0:
                self.config_save_crop(self.crop)

            return False

        while Gtk.events_pending():
            Gtk.main_iteration_do(False)

        return True
winetricks_cache_backup.py 文件源码 项目:games_nebula 作者: yancharkin 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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
games_nebula.py 文件源码 项目:games_nebula 作者: yancharkin 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def append_queue_tab(self):
        self.notebook.append_page(self.queue_tab_scrolled_window, self.queue_tab)
        self.notebook.set_tab_reorderable(self.queue_tab_scrolled_window, True)
        self.notebook.set_tab_detachable(self.queue_tab_scrolled_window, True)
        self.notebook.show_all()
        while Gtk.events_pending():
            Gtk.main_iteration_do(False)
recogspeech.py 文件源码 项目:Dict-O-nator 作者: theawless 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def update_gui():
        """Updates GUI by completing all tasks in the main event loop"""
        while Gtk.events_pending():
            Gtk.main_iteration_do(True)
mainloop_terminate_ctrl_c.py 文件源码 项目:scarlett_os 作者: bossjones 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def decorate_gtk_mainfunc(function):
    def decorated_function(*args, **kwargs):
        run_mainloop(function, Gtk.main_quit, None, *args, **kwargs)

    return decorated_function

# We could override Gtk.main_iteration and Gtk.main_iteration_do too,
# but that does not seem to be necessary (because they don't dispatch
# our event handler, but instead return; this means that the exception
# is raised anyways).
common.py 文件源码 项目:bokken 作者: thestr4ng3r 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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)
indicator.py 文件源码 项目:sony-av-indicator 作者: aschaeffer 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def run(self):
        while not self.ended:
            gtk.main_iteration_do(False)
settings.py 文件源码 项目:games_nebula_goglib_scripts 作者: yancharkin 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def launch_fsaa_settings(self):

        self.main_window.hide()

        while Gtk.events_pending():
            Gtk.main_iteration_do(False)

        os.system(wineloader + ' ' + game_dir + '/br2fsaaConfig.exe')
        self.main_window.show()
settings.py 文件源码 项目:games_nebula_goglib_scripts 作者: yancharkin 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def cb_button_config(self, button):

        self.main_window.hide()

        while Gtk.events_pending():
            Gtk.main_iteration_do(False)

        os.system(wineloader + ' ' + game_dir + '/bin/Final/Config.exe')
        self.main_window.show()
settings.py 文件源码 项目:games_nebula_goglib_scripts 作者: yancharkin 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def cb_button_patch(self, button):

        if os.path.exists(game_dir + '/' + 'br2fsaaConfig.exe'):
            self.launch_fsaa_settings()
        else:

            patch_path = download_dir + '/_distr/bloodrayne_2/BR2_FSAA_Patch_1.666.rar'

            if not os.path.exists(patch_path):

                message_dialog = Gtk.MessageDialog(
                    self.main_window,
                    0,
                    Gtk.MessageType.ERROR,
                    Gtk.ButtonsType.OK,
                    _("Patch not found in download directory.")
                    )
                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)

                self.main_window.hide()
                message_dialog.run()
                message_dialog.destroy()
                self.main_window.show()

            else:

                self.button_patch.set_sensitive(False)

                while Gtk.events_pending():
                    Gtk.main_iteration_do(False)

                command = ['7z', 'e', '-aoa', '-o' + game_dir, patch_path]

                self.pid, stdin, stdout, stderr = GLib.spawn_async(command,
                                            flags=GLib.SpawnFlags.SEARCH_PATH|GLib.SpawnFlags.DO_NOT_REAP_CHILD,
                                            standard_output=True,
                                            standard_error=True)

                io = GLib.IOChannel(stdout)

                self.source_id_out = io.add_watch(GLib.IO_IN|GLib.IO_HUP,
                                     self.watch_process,
                                     'extracting',
                                     priority=GLib.PRIORITY_HIGH)
settings.py 文件源码 项目:games_nebula_goglib_scripts 作者: yancharkin 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def cb_button_patch(self, button):

        patch_path = download_dir + '/_distr/pathologic/Pathologic_Widescreen_Addon.exe'

        if not os.path.exists(patch_path):

            message_dialog = Gtk.MessageDialog(
                self.main_window,
                0,
                Gtk.MessageType.ERROR,
                Gtk.ButtonsType.OK,
                _("Addon not found in download directory.")
                )
            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)

            self.main_window.hide()
            message_dialog.run()
            message_dialog.destroy()
            self.main_window.show()

        else:

            self.button_config.set_sensitive(False)
            self.button_patch.set_visible(False)
            self.progressbar.set_visible(True)

            while Gtk.events_pending():
                Gtk.main_iteration_do(False)

            command = ['innoextract', patch_path, '-d', game_dir + '/tmp']

            self.pid, stdin, stdout, stderr = GLib.spawn_async(command,
                                        flags=GLib.SpawnFlags.SEARCH_PATH|GLib.SpawnFlags.DO_NOT_REAP_CHILD,
                                        standard_output=True,
                                        standard_error=True)

            io = GLib.IOChannel(stdout)

            self.source_id_out = io.add_watch(GLib.IO_IN|GLib.IO_HUP,
                                 self.watch_process,
                                 'extracting',
                                 priority=GLib.PRIORITY_HIGH)


问题


面经


文章

微信
公众号

扫码关注公众号