コード例 #1
0
    def ExtractAllFrames(self):
        """ Extract All Video Frames Thread """
        if not self.KillAllProcessors():
            return

        options = QFileDialog.DontResolveSymlinks | QFileDialog.ShowDirsOnly
        directory = QFileDialog.getExistingDirectory(
            self,
            QCoreApplication.translate("QgsFmvPlayer", "Save images"),
            '',
            options=options)

        if directory:

            self.VPExtractFrames = ExtractFramesProcessor()
            self.VPTExtractAllFrames = QThread()

            self.VPExtractFrames.moveToThread(self.VPTExtractAllFrames)
            self.VPExtractFrames.finished.connect(self.QThreadFinished)
            self.VPExtractFrames.error.connect(self.QThreadError)
            self.VPExtractFrames.progress.connect(
                self.progressBarProcessor.setValue)
            self.VPTExtractAllFrames.start(QThread.LowPriority)

            QMetaObject.invokeMethod(self.VPExtractFrames,
                                     'ExtractFrames', Qt.QueuedConnection,
                                     Q_ARG(str, directory),
                                     Q_ARG(str, self.fileName))
        return
コード例 #2
0
    def saveInfoToJson(self):
        """ Save video Info to json """
        if not self.KillAllProcessors():
            return
        out_json, _ = QFileDialog.getSaveFileName(self, "Save File", "",
                                                  "Json Files (*.json)")
        if out_json == "":
            return
        try:
            self.VPProbeToJson = Converter()
            self.VPTProbeToJson = QThread()

            self.VPProbeToJson.moveToThread(self.VPTProbeToJson)

            self.VPProbeToJson.finished.connect(self.QThreadFinished)

            self.VPProbeToJson.error.connect(self.QThreadError)

            self.VPProbeToJson.progress.connect(
                self.progressBarProcessor.setValue)

            self.VPTProbeToJson.start(QThread.LowPriority)

            QMetaObject.invokeMethod(self.VPProbeToJson, 'probeToJson',
                                     Qt.QueuedConnection,
                                     Q_ARG(str, self.fileName),
                                     Q_ARG(str, out_json))

        except Exception as e:
            qgsu.showUserAndLogMessage(
                QCoreApplication.translate("QgsFmvPlayer",
                                           "Error saving Json"))
            self.QThreadFinished("probeToJson", "Closing ProbeToJson")
コード例 #3
0
ファイル: test_gui.py プロジェクト: overflw/tribler
def clickItem(tree_view, item, checkable_column):
    state = Qt.Checked if item.checkState(
        checkable_column) == Qt.Unchecked else Qt.Unchecked
    item.setCheckState(checkable_column, state)
    QMetaObject.invokeMethod(tree_view, "itemClicked",
                             Q_ARG(QTreeWidgetItem, item),
                             Q_ARG(int, checkable_column))
コード例 #4
0
    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))
コード例 #5
0
ファイル: chromecast.py プロジェクト: ov1d1u/tv-maxe-ng
 def show_splashscreen(self):
     QMetaObject.invokeMethod(
         self.cast_manager,
         'play_media_path', 
         Qt.AutoConnection,
         Q_ARG('QString', '/splash.jpg'),
         Q_ARG('QString', 'image/jpeg')
     )
コード例 #6
0
ファイル: chromecast.py プロジェクト: ov1d1u/tv-maxe-ng
 def play_url(self, url, content_type='video/mp4'):
     path = '/broadcast?url={0}'.format(quote_plus(url))
     QMetaObject.invokeMethod(
         self.cast_manager,
         'play_media_path', 
         Qt.AutoConnection,
         Q_ARG('QString', path),
         Q_ARG('QString', content_type)
     )
コード例 #7
0
    def invoke(self, method_name, value, value_type=None, connection=Qt.QueuedConnection):
        if value_type is None:
            arg = Q_ARG(type(value), value)
        else:
            arg = Q_ARG(value_type, value)

        try:
            self._methods[method_name].invoke(self._object, connection, arg)
        except KeyError:
            qDebug("no method "+str(method_name)+" found in "+str(self._object))
            qDebug("methods: "+str(self._methods))
コード例 #8
0
 def message(self, message, title=None):
     """
     Displays a message box during experiment
     :param message: message
     :param title: title
     """
     if self.calling_context is not None:
         QMetaObject.invokeMethod(self.calling_context, 'message',
                                  Q_ARG(str, message), Q_ARG(str, title))
         self.calling_context.dialog_open = True
         self.wait_for_dialog()
     else:
         print(message)
コード例 #9
0
    def on_send(self):
        self.progress_bar.show()
        updates = self.updates_table_model.get_selected_updates()

        self.confirm_button.hide()
        self.updates_table.hide()
        self.confirm_button.deleteLater()
        self.updates_table.deleteLater()
        self.adjustSize()

        QMetaObject.invokeMethod(self.worker, 'send_updates',
                                 Qt.QueuedConnection, Q_ARG(list, updates),
                                 Q_ARG(object, self.args))
コード例 #10
0
 def on_ask( self , msg , btns , default ) :
     """Ask the user a question."""
     # NOTE: We are running in a worker thread, so we need to delegate showing the message box
     # to the GUI thread.
     retarg = Q_RETURN_ARG( QMessageBox.StandardButton )
     QMetaObject.invokeMethod(
         StartupWidget._instance , "on_ask" , Qt.BlockingQueuedConnection ,
         retarg ,
         Q_ARG( str , msg ) ,
         Q_ARG( QMessageBox.StandardButtons , btns ) ,
         Q_ARG( QMessageBox.StandardButton , default ) ,
     )
     # FIXME! How do we get the return value?! :-/
     return StartupWidget._on_ask_retval
コード例 #11
0
 def question(self, message, title=None):
     """
     Displays a question dialog during the experiment (yes or no question)
     :param message: question
     :param title: title
     :return: true or false
     """
     if self.calling_context is not None:
         QMetaObject.invokeMethod(self.calling_context, 'question',
                                  Q_ARG(str, message), Q_ARG(str, title))
         self.calling_context.dialog_open = True
         self.wait_for_dialog()
         return self.calling_context.dialog_answer
     else:
         return bool(input(message))
コード例 #12
0
ファイル: eventlet.py プロジェクト: qtpy-app/gitpyman
 def run(self):
     try:
         result = self.func(*(self.args), **(self.kwargs))
     except Exception as e:
         logger.exception("deferToThread caught exception: %r", e)
         QMetaObject.invokeMethod(DeferCallThread.mainThreadStub,
                                  "_slot_errback", Qt.QueuedConnection,
                                  Q_ARG("PyQt_PyObject", self.done),
                                  Q_ARG("PyQt_PyObject", e))
     else:
         QMetaObject.invokeMethod(DeferCallThread.mainThreadStub,
                                  "_slot_callback", Qt.QueuedConnection,
                                  Q_ARG("PyQt_PyObject", self.done),
                                  Q_ARG("PyQt_PyObject", result))
     finally:
         del self.func, self.done, self.args, self.kwargs
コード例 #13
0
ファイル: chromecast.py プロジェクト: ov1d1u/tv-maxe-ng
 def set_volume(self, volume):
     QMetaObject.invokeMethod(
         self.cast_manager,
         'set_media_volume',
         Qt.AutoConnection,
         Q_ARG(int, volume)
     )
コード例 #14
0
ファイル: main.py プロジェクト: alex-tomin/mint-amazon-tagger
 def on_mint_mfa(self):
     mfa_code, ok = QInputDialog().getText(
         self, 'Please enter your Mint Code.',
         'Mint Code:')
     QMetaObject.invokeMethod(
         self.worker, 'mfa_code', Qt.QueuedConnection,
         Q_ARG(int, mfa_code))
コード例 #15
0
ファイル: Form.py プロジェクト: paxcodes/peppsnipp
 def StartProcess(self):
     QMetaObject.invokeMethod(self, "EnableForm", Qt.QueuedConnection,
                              Q_ARG(bool, False))
     self.process = ProcessRunnable(target=self.LoginToPepperplate,
                                    args=(self.email.text(),
                                          self.password.text()))
     self.process.start()
コード例 #16
0
    def showVideoInfo(self):
        ''' Show default probe info '''
        try:

            self.VPProbe = Converter()
            self.VPTProbe = QThread()

            self.VPProbe.moveToThread(self.VPTProbe)

            self.VPProbe.finishedJson.connect(self.QThreadFinished)

            self.VPProbe.error.connect(self.QThreadError)

            self.VPProbe.progress.connect(self.progressBarProcessor.setValue)

            self.VPTProbe.start(QThread.LowPriority)

            QMetaObject.invokeMethod(self.VPProbe, 'probeShow',
                                     Qt.QueuedConnection,
                                     Q_ARG(str, self.fileName))

        except Exception as e:
            qgsu.showUserAndLogMessage(
                QCoreApplication.translate("QgsFmvPlayer", "Error Info Show"))
            self.QThreadFinished("probeShow", "Closing Probe")
        return
コード例 #17
0
 def run(self):
     self.w.queryStatusTag.setText('查询中')
     self.w.queryStatusTag.setStyleSheet("color:black")
     headers = {
         'user-agent':
         'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36',
         'authorization': self.wApiKey,
         'Content-Type': 'application/json'
     }
     r = requests.post(self.mUrl, json=self.mJson, headers=headers)
     QThread.msleep(1000)
     print(r)
     try:
         if len(r.json()['data']['result']) == 0:
             self.w.queryStatusTag.setText('无结果!等待查询')
             self.w.queryStatusTag.setStyleSheet("color:green")
             return
         for solution in r.json()['data']['result']:
             QMetaObject.invokeMethod(self.w, "addSolution",
                                      Qt.QueuedConnection,
                                      Q_ARG(dict, solution))
         self.w.queryStatusTag.setText('等待查询')
         self.w.queryStatusTag.setStyleSheet("color:green")
     except Exception as e:
         self.w.queryStatusTag.setText('查询失败(%s)' % r.json()['code'])
         self.w.queryStatusTag.setStyleSheet("color:red")
         return
コード例 #18
0
 def on_error( self , msg ) :
     """Show the user an error message."""
     # NOTE: We are running in a worker thread, so we need to delegate showing the message box
     # to the GUI thread.
     QMetaObject.invokeMethod(
         StartupWidget._instance , "on_error" , Qt.BlockingQueuedConnection ,
         Q_ARG( str , msg )
     )
コード例 #19
0
def onTimeout(obj):
    global counter
    value = {
        "lesson": str(counter),
        "subject": "PE",
        "day": QDate.longDayName(1 + counter % 7)
    }
    QMetaObject.invokeMethod(obj, "append", Q_ARG(QVariant, value))
    counter += 1
コード例 #20
0
 def downloadScript(self, url):
     """
     Public method to download a GreaseMonkey script.
     
     @param url URL to download script from
     @type QUrl
     """
     QMetaObject.invokeMethod(self, "doDownloadScript", Qt.QueuedConnection,
                              Q_ARG(QUrl, url))
コード例 #21
0
ファイル: chromecast.py プロジェクト: ov1d1u/tv-maxe-ng
 def select_device(self, device):
     QMetaObject.invokeMethod(
         self.cast_manager,
         'connect_to_device', 
         Qt.AutoConnection,
         Q_ARG('PyQt_PyObject', device)
     )
     self.current_device = device
     self.current_device.wait()
     self.current_device.media_controller.register_status_listener(self)
コード例 #22
0
ファイル: Form.py プロジェクト: paxcodes/peppsnipp
 def LoginToPepperplate(self, email, password):
     successful, message = self.crawler.loginToPepperplate(email, password)
     if successful:
         recipeLinks, message = getRecipeLinks(self.crawler)
         self.Log(message)
         self.crawler.ProcessRecipeLinks(recipeLinks, self.exportFormat)
     else:
         QMetaObject.invokeMethod(self, "EnableForm", Qt.QueuedConnection,
                                  Q_ARG(bool, True))
         self.Log(message)
コード例 #23
0
 def _sendCode(self, code):
     code = json.dumps(code)
     if self._socket and self._socket.isReplicaValid():
         # 服务端返回的数据经过zlib压缩
         # 异步调用远程 processMessage 函数
         QMetaObject.invokeMethod(
             self._socket, "processMessage", Qt.QueuedConnection,
             Q_ARG(QByteArray, QByteArray(code.encode())))
     else:
         self.textBrowserApi.append('<font color=red>{0}</font>'.format(
             self.tr('错误:无法发送网络数据')))
コード例 #24
0
ファイル: run.py プロジェクト: notoraptor/pysaurus
 def wrapper():
     try:
         function(*args, **kwargs)
     except Exception as exception:
         self.threads_stop_flag = True
         QMetaObject.invokeMethod(
             self.interface,
             "throw",
             Qt.QueuedConnection,
             Q_ARG(Exception, exception),
         )
コード例 #25
0
 def write(self, message):
     if not hasattr(self, "flag"):
         self.flag = False
     message = message.replace('\r', '').rstrip()
     if message:
         method = "replace_last_line" if self.flag else "appendPlainText"
         QMetaObject.invokeMethod(self, method, Qt.QueuedConnection,
                                  Q_ARG(str, message))
         self.flag = True
     else:
         self.flag = False
コード例 #26
0
    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))
コード例 #27
0
ファイル: camera.py プロジェクト: fbob/dice-dev
    def invoke_xyz(self,
                   method_name,
                   x,
                   y,
                   z,
                   x_type=None,
                   y_type=None,
                   z_type=None,
                   connection=Qt.QueuedConnection):
        if x_type is None:
            arg_x = Q_ARG(type(x), x)
        else:
            arg_x = Q_ARG(x_type, x)
        if x_type is None:
            arg_y = Q_ARG(type(y), y)
        else:
            arg_y = Q_ARG(y_type, y)
        if x_type is None:
            arg_z = Q_ARG(type(z), z)
        else:
            arg_z = Q_ARG(z_type, z)

        try:
            self._methods[method_name].invoke(self._object, connection, arg_x,
                                              arg_y, arg_z)
        except KeyError:
            qDebug("no method " + str(method_name) + " found in " +
                   str(self._object))
            qDebug("methods: " + str(self._methods))
コード例 #28
0
    def change_fixationpoint_ring_thickness(self, thickness):
        if int(thickness.Thickness) < 0:
            return ChangeFixationpointRingThicknessResponse(
                'Failure. Only positive values are allowed.')
        else:
            meta = self.qml_fixationpoint.metaObject()
            res = meta.invokeMethod(self.qml_fixationpoint,
                                    "change_fixationpoint_ring_thickness",
                                    Qt.BlockingQueuedConnection,
                                    Q_RETURN_ARG(QVariant),
                                    Q_ARG(QVariant, thickness.Thickness))

        return ChangeFixationpointRingThicknessResponse('Success.')
コード例 #29
0
    def change_fixationpoint_ring_diameter(self, diameter):
        if int(diameter.Diameter) < 0:
            return ChangeFixationpointDiameterResponse(
                'Failure. Only positive values are allowed.')
        else:
            meta = self.qml_fixationpoint.metaObject()
            res = meta.invokeMethod(self.qml_fixationpoint,
                                    "change_fixationpoint_ring_diameter",
                                    Qt.BlockingQueuedConnection,
                                    Q_RETURN_ARG(QVariant),
                                    Q_ARG(QVariant, diameter.Diameter))

            return ChangeFixationpointDiameterResponse('Success.')
コード例 #30
0
ファイル: Services.py プロジェクト: Kedka/hybrydowe_frontend
 def handle_login(self, data, response):
     print(response.status_code, type(response.status_code))
     if response.status_code == 403:
         print('elo')
         QMetaObject.invokeMethod(
             self.parent,
             "login",
             Qt.QueuedConnection,
             Q_ARG(str, None)
         )
         return
     self.check_response(response)
     response = response.json()
     Service.user_id = response.get('id')
     Service.username = response.get('username')
     self.user_type = response.get('type')
     QMetaObject.invokeMethod(
         self.parent,
         "login",
         Qt.QueuedConnection,
         Q_ARG(str, self.user_type)
     )