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


Python QMetaObject.invokeMethod方法代码示例

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


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

示例1: _show_backup_decision

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
    def _show_backup_decision(self, error=None):
        text = '<p>{0}</p><p>{1}</p>'.format(
            self.BACKUP_INTRO_TEXT if error is None else error,
            self.BACKUP_PROMPT_TEXT,
        )

        dialog = QMessageBox(
            QMessageBox.Question if error is None else QMessageBox.Critical,
            self.BACKUP_DIALOG_CAPTION if error is None else self.BACKUP_DIALOG_ERROR_CAPTION,
            text,
        )

        revert_button = dialog.addButton(self.REVERT_BACKUP_BUTTON_TEXT, QMessageBox.AcceptRole)
        delete_button = dialog.addButton(self.DELETE_BACKUP_BUTTON_TEXT, QMessageBox.DestructiveRole)
        examine_button = dialog.addButton(self.EXAMINE_BACKUP_BUTTON_TEXT, QMessageBox.ActionRole)
        dialog.addButton(self.QUIT_BUTTON_TEXT, QMessageBox.RejectRole)

        dialog.exec()
        clicked_button = dialog.clickedButton()

        if clicked_button == examine_button:
            QMetaObject.invokeMethod(self, '_examine_backup', Qt.QueuedConnection)
        elif clicked_button == revert_button:
            self._progress_dialog = QProgressDialog(None)
            self._progress_dialog.setLabelText(self.REVERT_BACKUP_PROGRESS_TEXT)
            self._progress_dialog.setCancelButton(None)
            self._progress_dialog.setRange(0, 0)
            self._progress_dialog.forceShow()

            self.request_revert_backup.emit()
        elif clicked_button == delete_button:
            self.request_delete_backup.emit()
        else:
            self.quit()
开发者ID:goc9000,项目名称:baon,代码行数:36,代码来源:BAONQtApplication.py

示例2: Render

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
    def Render(self, frame=None):
        """ Render an images sequence of the current template using Blender 2.62+ and the
        Blender Python API. """

        # Enable the Render button again
        self.disable_interface()

        # Init blender paths
        blend_file_path = os.path.join(info.PATH, "blender", "blend", self.selected_template)
        source_script = os.path.join(info.PATH, "blender", "scripts", self.selected_template.replace(".blend", ".py"))
        target_script = os.path.join(info.BLENDER_PATH, self.unique_folder_name,
                                     self.selected_template.replace(".blend", ".py"))

        # Copy the .py script associated with this template to the temp folder.  This will allow
        # OpenShot to inject the user-entered params into the Python script.
        shutil.copy(source_script, target_script)

        # Open new temp .py file, and inject the user parameters
        self.inject_params(target_script, frame)

        # Create new thread to launch the Blender executable (and read the output)
        if frame:
            # preview mode
            QMetaObject.invokeMethod(self.worker, 'Render', Qt.QueuedConnection,
                                     Q_ARG(str, blend_file_path),
                                     Q_ARG(str, target_script),
                                     Q_ARG(bool, True))
        else:
            # render mode
            # self.my_blender = BlenderCommand(self, blend_file_path, target_script, False)
            QMetaObject.invokeMethod(self.worker, 'Render', Qt.QueuedConnection,
                                     Q_ARG(str, blend_file_path),
                                     Q_ARG(str, target_script),
                                     Q_ARG(bool, False))
开发者ID:ghisvail,项目名称:openshot-qt,代码行数:36,代码来源:blender_treeview.py

示例3: processFrame

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
    def processFrame(self, frame):
        if self.m_isBusy:
            return

        self.m_isBusy = True
        QMetaObject.invokeMethod(self.m_processor, 'processFrame',
                Qt.QueuedConnection, Q_ARG(QVideoFrame, frame),
                Q_ARG(int, self.m_levels))
开发者ID:death-finger,项目名称:Scripts,代码行数:10,代码来源:player.py

示例4: resizeEvent

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
    def resizeEvent(self, event):
        super().resizeEvent(event)

        win_w = event.size().width() * self.devicePixelRatio()
        win_h = event.size().height() * self.devicePixelRatio()

        self._updateViewportGeometry(win_w, win_h)

        QMetaObject.invokeMethod(self, "_onWindowGeometryChanged", Qt.QueuedConnection);
开发者ID:tigertooth4,项目名称:Uranium,代码行数:11,代码来源:MainWindow.py

示例5: resizeEvent

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
    def resizeEvent(self, event):
        super().resizeEvent(event)
        
        w = event.size().width() * self.devicePixelRatio()
        h = event.size().height() * self.devicePixelRatio()
        for camera in self._app.getController().getScene().getAllCameras():
            camera.setViewportSize(w, h)
            proj = Matrix()
            if camera.isPerspective():
                proj.setPerspective(30, w/h, 1, 500)
            else:
                proj.setOrtho(-w / 2, w / 2, -h / 2, h / 2, -500, 500)
            camera.setProjectionMatrix(proj)

        self._app.getRenderer().setViewportSize(w, h)

        QMetaObject.invokeMethod(self, "_onWindowGeometryChanged", Qt.QueuedConnection);
开发者ID:mesut-pehlivan,项目名称:Uranium,代码行数:19,代码来源:MainWindow.py

示例6: wrapper

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
 def wrapper(obj, *args):
     # XXX: support kwargs?
     qargs = [Q_ARG(t, v) for t, v in zip(self.args, args)]
     invoke_args = [obj._instance, self.name]
     invoke_args.append(Qt.DirectConnection)
     rtype = self.returnType
     if rtype:
         invoke_args.append(Q_RETURN_ARG(rtype))
     invoke_args.extend(qargs)
     try:
         result = QMetaObject.invokeMethod(*invoke_args)
         error_msg = str(qApp.property("MIKRO_EXCEPTION").toString())
         if error_msg:
             # clear message
             qApp.setProperty("MIKRO_EXCEPTION", "") # TODO: "" was QVariant(): check that it's correct (ale/20141002)
             raise Exception(error_msg)
     except RuntimeError as e:
         raise TypeError(
             "%s.%s(%r) call failed: %s" % (obj, self.name, args, e))
     return wrap(result)
开发者ID:QuLogic,项目名称:scribus-plugin-scripter,代码行数:22,代码来源:mikro.py

示例7: standbyStateEntered

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
 def standbyStateEntered(self):
     print("standby")
     QMetaObject.invokeMethod(self.rootObject, "setPathViewIndex", QtCore.Q_ARG("QVariant", 1))
     pass
开发者ID:coreanq,项目名称:ultra_sonic,代码行数:6,代码来源:main.py

示例8: ping

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
    def ping(self, arg):
        QMetaObject.invokeMethod(QCoreApplication.instance(), 'quit')

        return "ping(\"%s\") got called" % arg
开发者ID:Axel-Erfurt,项目名称:pyqt5,代码行数:6,代码来源:pong.py

示例9: login_result

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
 def login_result(self, string):
     # print("got result", string)
     obj = self.engine.rootObjects()[0]
     myObj = obj.findChild(QObject, "loginHandle")
     QMetaObject.invokeMethod(myObj, "loginResult", Qt.QueuedConnection, Q_ARG(QVariant, string))
开发者ID:CopyEverything,项目名称:CopyEverything-Desktop,代码行数:7,代码来源:gui.py

示例10: messageHandler

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
def messageHandler(msgType, *args):
    """
    Module function handling messages.
    
    @param msgType type of the message (integer, QtMsgType)
    @param args message handler arguments, for PyQt4 message to be shown
        (bytes), for PyQt5 context information (QMessageLogContext) and
        message to be shown (bytes)
    """
    if len(args) == 2:
        context = args[0]
        message = args[1]
    else:
        message = args[0]
    if __msgHandlerDialog:
        try:
            if msgType == QtDebugMsg:
                messageType = QCoreApplication.translate(
                    "E5ErrorMessage", "Debug Message:")
            elif msgType == QtWarningMsg:
                messageType = QCoreApplication.translate(
                    "E5ErrorMessage", "Warning:")
            elif msgType == QtCriticalMsg:
                messageType = QCoreApplication.translate(
                    "E5ErrorMessage", "Critical:")
            elif msgType == QtFatalMsg:
                messageType = QCoreApplication.translate(
                    "E5ErrorMessage", "Fatal Error:")
            if isinstance(message, bytes):
                message = Utilities.decodeBytes(message)
            message = message.replace("\r\n", "<br/>")\
                             .replace("\n", "<br/>")\
                             .replace("\r", "<br/>")
            if len(args) == 2:
                msg = "<p><b>{0}</b></p><p>{1}</p><p>File: {2}</p>" \
                    "<p>Line: {3}</p><p>Function: {4}</p>".format(
                        messageType, Utilities.html_uencode(message),
                        context.file, context.line, context.function)
            else:
                msg = "<p><b>{0}</b></p><p>{1}</p>".format(
                    messageType, Utilities.html_uencode(message))
            if QThread.currentThread() == qApp.thread():
                __msgHandlerDialog.showMessage(msg)
            else:
                QMetaObject.invokeMethod(
                    __msgHandlerDialog,
                    "showMessage",
                    Qt.QueuedConnection,
                    Q_ARG(str, msg))
            return
        except RuntimeError:
            pass
    elif __origMsgHandler:
        __origMsgHandler(msgType, message)
        return
    
    if msgType == QtDebugMsg:
        messageType = QCoreApplication.translate(
            "E5ErrorMessage", "Debug Message")
    elif msgType == QtWarningMsg:
        messageType = QCoreApplication.translate(
            "E5ErrorMessage", "Warning")
    elif msgType == QtCriticalMsg:
        messageType = QCoreApplication.translate(
            "E5ErrorMessage", "Critical")
    elif msgType == QtFatalMsg:
        messageType = QCoreApplication.translate(
            "E5ErrorMessage", "Fatal Error")
    if isinstance(message, bytes):
        message = message.decode()
    if len(args) == 2:
        print("{0}: {1} in {2} at line {3} ({4})".format(
            messageType, message, context.file, context.line,
            context.function))
    else:
        print("{0}: {1}".format(messageType, message))
开发者ID:testmana2,项目名称:test,代码行数:78,代码来源:E5ErrorMessage.py

示例11: asyncSetSummary

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
 def asyncSetSummary(self, summary):
     QMetaObject.invokeMethod(self.summaryLabel, 'setText', Qt.QueuedConnection, Q_ARG(str, summary))
开发者ID:eilbecklab,项目名称:phenotipsbot,代码行数:4,代码来源:gui.py

示例12: asyncSetStatus

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
 def asyncSetStatus(self, status, maxProgress = 0):
     QMetaObject.invokeMethod(self.statusLabel, 'setText', Qt.QueuedConnection, Q_ARG(str, status))
     QMetaObject.invokeMethod(self.progressBar, 'setMaximum', Qt.QueuedConnection, Q_ARG(int, maxProgress))
开发者ID:eilbecklab,项目名称:phenotipsbot,代码行数:5,代码来源:gui.py

示例13: _handle_frame

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
 def _handle_frame(self, frame):
     self._image = QImage(frame.data, frame.width, frame.height, QImage.Format_ARGB32)
     if self._clock is None:
         QMetaObject.invokeMethod(self, 'update', Qt.QueuedConnection)
开发者ID:AGProjects,项目名称:blink-qt,代码行数:6,代码来源:video.py

示例14: _start_core

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
 def _start_core(self):
     QMetaObject.invokeMethod(self._core, 'start', Qt.QueuedConnection)
开发者ID:goc9000,项目名称:baon,代码行数:4,代码来源:BAONQtApplication.py

示例15: processingStateEntered

# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import invokeMethod [as 别名]
 def processingStateEntered(self):
     print("processing")
     QMetaObject.invokeMethod(self.rootObject, "setPathViewIndex",QtCore.Q_ARG("QVariant", 2))
     pass 
开发者ID:coreanq,项目名称:ultra_sonic,代码行数:6,代码来源:main.py


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