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


Python QCoreApplication.processEvents方法代码示例

本文整理汇总了Python中PyQt5.QtCore.QCoreApplication.processEvents方法的典型用法代码示例。如果您正苦于以下问题:Python QCoreApplication.processEvents方法的具体用法?Python QCoreApplication.processEvents怎么用?Python QCoreApplication.processEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore.QCoreApplication的用法示例。


在下文中一共展示了QCoreApplication.processEvents方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: upgrade

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def upgrade(self) -> bool:
        """Performs the version upgrades of all configuration files to the most
        recent version.

        The upgrade plug-ins must all be loaded at this point, or no upgrades
        can be performed.

        :return: True if anything was upgraded, or False if it was already up to date.
        """
        start_time = time.time()
        Logger.log("i", "Looking for old configuration files to upgrade.")
        self._upgrade_tasks.extend(self._getUpgradeTasks())     # Get the initial files to upgrade.
        self._upgrade_routes = self._findShortestUpgradeRoutes()  # Pre-compute the upgrade routes.

        upgraded = False  # Did we upgrade something?
        while self._upgrade_tasks:
            upgrade_task = self._upgrade_tasks.popleft()
            self._upgradeFile(upgrade_task.storage_path, upgrade_task.file_name, upgrade_task.configuration_type)  # Upgrade this file.
            QCoreApplication.processEvents()  # Ensure that the GUI does not freeze.
        if upgraded:
            message = UM.Message.Message(text = catalogue.i18nc("@info:version-upgrade", "A configuration from an older version of {0} was imported.", Application.getInstance().getApplicationName()), title = catalogue.i18nc("@info:title", "Version Upgrade"))
            message.show()
        Logger.log("i", "Checking and performing updates took %s", time.time() - start_time)
        return upgraded 
开发者ID:Ultimaker,项目名称:Uranium,代码行数:26,代码来源:VersionUpgradeManager.py

示例2: system

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def system(cmd):
    """
    Wrapper around :py:meth:`os.system`, except that output will be redirected to messages window.

    :param cmd: Command to execute.
    :return: exit status.
    :rtype: int
    """
    process = Popen(cmd, shell=True)

    # call processEvents() to prevent hang
    timeout = 0.01
    while all(thread.is_alive() for thread in process.threads):
        for thread in process.threads:
            thread.join(timeout)
        QCoreApplication.processEvents()

    return process.wait() 
开发者ID:Jinmo,项目名称:idapkg,代码行数:20,代码来源:process.py

示例3: execute

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def execute(self, data):
        logging.info('execute() called at Item {} {}'.format(self.row, self.column))
        self.highlightStart()
        QCoreApplication.processEvents()
        sleep(1)
        self.highlightStop()
        QCoreApplication.processEvents()

        output = ('output from ExecOp')
        target = (self.row, self.column+1)
        return (target, output) 
开发者ID:hANSIc99,项目名称:Pythonic,代码行数:13,代码来源:return.py

示例4: delay

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def delay():
    #QCoreApplication.processEvents(QEventLoop.AllEvents, 1)
    QtWidgets.QApplication.processEvents(QEventLoop.AllEvents, 1)
    #time.sleep(.005)

    """t = QTime.currentTime().addMSecs(1)
    while QTime.currentTime() < t:
        QCoreApplication.processEvents(QEventLoop.AllEvents, 1)""" 
开发者ID:Panda-Lewandowski,项目名称:Computer-graphics,代码行数:10,代码来源:lab6.py

示例5: _compressDataAndNotifyQt

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def _compressDataAndNotifyQt(self, data_to_append: str) -> bytes:
        compressed_data = gzip.compress(data_to_append.encode("utf-8"))
        self._progress_message.setProgress(-1)  # Tickle the message so that it's clear that it's still being used.
        QCoreApplication.processEvents()  # Ensure that the GUI does not freeze.

        # Pretend that this is a response, as zipping might take a bit of time.
        # If we don't do this, the device might trigger a timeout.
        self._last_response_time = time()
        return compressed_data 
开发者ID:Ultimaker,项目名称:Cura,代码行数:11,代码来源:NetworkedPrinterOutputDevice.py

示例6: waitForClose

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def waitForClose(self):
        """Block thread until the dialog is closed."""

        if self._visible:
            if threading.current_thread() != threading.main_thread():
                self._lock.acquire()
                self._lock.release()
            else:
                # If this is not run from a separate thread, we need to ensure that the events are still processed.
                while self._visible:
                    time.sleep(1 / 50)
                    QCoreApplication.processEvents()  # Ensure that the GUI does not freeze. 
开发者ID:Ultimaker,项目名称:Cura,代码行数:14,代码来源:WorkspaceDialog.py

示例7: _cacheAllExtruderSettings

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def _cacheAllExtruderSettings(self):
        global_stack = cast(ContainerStack, CuraApplication.getInstance().getGlobalContainerStack())

        # NB: keys must be strings for the string formatter
        self._all_extruders_settings = {
            "-1": self._buildReplacementTokens(global_stack)
        }
        QCoreApplication.processEvents()  # Ensure that the GUI does not freeze.
        for extruder_stack in ExtruderManager.getInstance().getActiveExtruderStacks():
            extruder_nr = extruder_stack.getProperty("extruder_nr", "value")
            self._all_extruders_settings[str(extruder_nr)] = self._buildReplacementTokens(extruder_stack)
            QCoreApplication.processEvents()  # Ensure that the GUI does not freeze. 
开发者ID:Ultimaker,项目名称:Cura,代码行数:14,代码来源:StartSliceJob.py

示例8: loadPlugins

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def loadPlugins(self, metadata: Optional[Dict[str, Any]] = None) -> None:
        """Load all plugins matching a certain set of metadata

        :param metadata: The meta data that needs to be matched.
        NOTE: This is the method which kicks everything off at app launch.
        """

        start_time = time.time()
        # Get a list of all installed plugins:
        plugin_ids = self._findInstalledPlugins()
        for plugin_id in plugin_ids:
            # Get the plugin metadata:
            try:
                plugin_metadata = self.getMetaData(plugin_id)
            except TrustException:
                Logger.error("Plugin {} was not loaded because it could not be verified.", plugin_id)
                message_text = i18n_catalog.i18nc("@error:untrusted",
                                                  "Plugin {} was not loaded because it could not be verified.", plugin_id)
                Message(text = message_text).show()
                continue

            # Save all metadata to the metadata dictionary:
            self._metadata[plugin_id] = plugin_metadata
            if metadata is None or self._subsetInDict(self._metadata[plugin_id], metadata):
                #
                try:
                    self.loadPlugin(plugin_id)
                    QCoreApplication.processEvents()  # Ensure that the GUI does not freeze.
                    # Add the plugin to the list after actually load the plugin:
                    self._all_plugins.append(plugin_id)
                    self._plugins_installed.append(plugin_id)
                except PluginNotFoundError:
                    pass
        Logger.log("d", "Loading all plugins took %s seconds", time.time() - start_time)

    # Checks if the given plugin API version is compatible with the current version. 
开发者ID:Ultimaker,项目名称:Uranium,代码行数:38,代码来源:PluginRegistry.py

示例9: _on_get_participants_success

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def _on_get_participants_success(self, job):
        participants = job.ret
        while self.scroll_content.layout().count() > 1:
            item = self.scroll_content.layout().takeAt(0)
            w = item.widget()
            self.scroll_content.layout().removeItem(item)
            w.setParent(None)
        QCoreApplication.processEvents()
        for user, (role, revoked_info) in participants.items():
            self.add_participant(
                user, user == self.core.device.user_id, role, is_revoked=revoked_info is not None
            )
        self.line_edit_share.setText("")
        self.button_share.setDisabled(True)
        self.button_apply.setDisabled(True) 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:17,代码来源:workspace_sharing_widget.py

示例10: process_all_gui_events

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def process_all_gui_events():
    QCoreApplication.processEvents()


# ------------------------------------------------------------------------------

# configuration file 
开发者ID:linguistica-uchicago,项目名称:lxa5,代码行数:9,代码来源:util.py

示例11: flatten

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def flatten(self):
        from scipy import optimize as opt
        self.ui.status.setText("Start the flattening...")
        self.level = np.zeros(self.volume.shape[:2])
        self.ui.pb.setMaximum(self.volume.shape[0])
        for y in range(self.volume.shape[0]):
            self.ui.pb.setValue(y)
            self.flatline(y)
            QCoreApplication.processEvents()
            self.ax.clear()
            self.ax.imshow(self.level)
            self.canvas.draw()
        self.ui.pb.setValue(0)
        self.ui.status.setText("Flattening finished")
        np.save(self.path+".level", self.level) 
开发者ID:scholi,项目名称:pySPM,代码行数:17,代码来源:ITAslicer.py

示例12: showMaximized

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def showMaximized(self, skip_dialogs=False):
        super().showMaximized()
        QCoreApplication.processEvents()

        # Used with the --diagnose option
        if skip_dialogs:
            return

        # At the very first launch
        if self.config.gui_first_launch:
            r = ask_question(
                self,
                _("TEXT_ERROR_REPORTING_TITLE"),
                _("TEXT_ERROR_REPORTING_INSTRUCTIONS"),
                [_("ACTION_ERROR_REPORTING_ACCEPT"), _("ACTION_NO")],
            )

            # Acknowledge the changes
            self.event_bus.send(
                CoreEvent.GUI_CONFIG_CHANGED,
                gui_first_launch=False,
                gui_last_version=PARSEC_VERSION,
                telemetry_enabled=r == _("ACTION_ERROR_REPORTING_ACCEPT"),
            )

        # For each parsec update
        if self.config.gui_last_version and self.config.gui_last_version != PARSEC_VERSION:

            # Update from parsec `<1.14` to `>=1.14`
            if LooseVersion(self.config.gui_last_version) < "1.14":

                # Revert the acrobat reader workaround
                if (
                    platform.system() == "Windows"
                    and win_registry.is_acrobat_reader_dc_present()
                    and not win_registry.get_acrobat_app_container_enabled()
                ):
                    win_registry.del_acrobat_app_container_enabled()

            # Acknowledge the changes
            self.event_bus.send(CoreEvent.GUI_CONFIG_CHANGED, gui_last_version=PARSEC_VERSION)

        telemetry.init(self.config)

        devices = list_available_devices(self.config.config_dir)
        if not len(devices):
            r = ask_question(
                self,
                _("TEXT_KICKSTART_PARSEC_WHAT_TO_DO_TITLE"),
                _("TEXT_KICKSTART_PARSEC_WHAT_TO_DO_INSTRUCTIONS"),
                [
                    _("ACTION_NO_DEVICE_CREATE_ORGANIZATION"),
                    _("ACTION_NO_DEVICE_JOIN_ORGANIZATION"),
                ],
                radio_mode=True,
            )
            if r == _("ACTION_NO_DEVICE_JOIN_ORGANIZATION"):
                self._on_join_org_clicked()
            elif r == _("ACTION_NO_DEVICE_CREATE_ORGANIZATION"):
                self._on_create_org_clicked() 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:62,代码来源:main_window.py

示例13: login_update_ui

# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import processEvents [as 别名]
def login_update_ui(self, success, msg, duration):
        """根据登录是否成功更新UI,并保持用户信息"""
        self.show_status(msg, duration)
        if success:
            self.update_lanzoucloud_settings()
            self._work_id = self._config.work_id  # 切换用户后刷新 根目录
            if self._user:
                if len(self._user) <= 6:
                    disk_tab = f"我的蓝奏<{self._user}>"
                else:
                    disk_tab = f"我的蓝奏<{self._user[:4]}..>"
            else:
                disk_tab = "我的蓝奏云"
            self.tabWidget.insertTab(1, self.disk_tab, disk_tab)
            self.tabWidget.insertTab(2, self.rec_tab, "回收站")
            self.disk_tab.setEnabled(True)
            self.rec_tab.setEnabled(True)
            # 更新快捷键与工具栏
            self.toolbar.addAction(self.logout)  # 添加登出工具栏
            self.toolbar.addAction(self.upload)  # 添加上传文件工具栏
            # 菜单栏槽
            self.logout.setEnabled(True)
            self.upload.setEnabled(True)
            self.upload.triggered.connect(self.show_upload_dialog_menus)
            # 设置当前显示 tab
            self.tabWidget.setCurrentIndex(self.tabWidget.indexOf(self.disk_tab))
            QCoreApplication.processEvents()  # 重绘界面
            self._config.update_user()  # 存储用户信息
            # 刷新文件列表
            # self.list_refresher.set_values(self._work_id)
        else:
            self.show_status(msg, duration)
            self.tabWidget.setCurrentIndex(0)
            self.tabWidget.removeTab(2)
            self.tabWidget.removeTab(1)
            self.disk_tab.setEnabled(False)
            self.rec_tab.setEnabled(False)
            # 更新快捷键与工具栏
            self.toolbar.removeAction(self.logout)  # 登出工具栏
            self.toolbar.removeAction(self.upload)  # 上传文件工具栏
            self.logout.setEnabled(False)
            self.upload.setEnabled(False) 
开发者ID:rachpt,项目名称:lanzou-gui,代码行数:44,代码来源:gui.py


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