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))
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()
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))
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")
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))
def set_volume(self, volume): QMetaObject.invokeMethod( self.cast_manager, 'set_media_volume', Qt.AutoConnection, Q_ARG(int, volume) )
def stop_media_playback(self): self.device.media_controller.stop() QMetaObject.invokeMethod( self.cast_server, 'stop_server', Qt.AutoConnection )
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()
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
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
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
def show_splashscreen(self): QMetaObject.invokeMethod( self.cast_manager, 'play_media_path', Qt.AutoConnection, Q_ARG('QString', '/splash.jpg'), Q_ARG('QString', 'image/jpeg') )
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))
def buttonClicked(self): file = str(QFileDialog.getExistingDirectory(self, "Select Directory")) if (file): QMetaObject.invokeMethod( self.view.rootObject(), "clear") #QMetaObject.invokeMethod( # self.view.rootObject(), "showBusyIndicator") self.startProcessing(file)
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 ) )
def keyPressEvent(self, event): super().keyPressEvent(event) if type(event) == QKeyEvent: if event.key() == Qt.Key_Escape and self.isFullScreen(): QMetaObject.invokeMethod(self, 'exit_fullscreen', Qt.AutoConnection) event.accept() else: event.ignore()
def doneCompletion(self): self.timer.stop() self.popup.hide() self.editor.setFocus() item: QTreeWidgetItem = self.popup.currentItem() if item: self.editor.setText(item.text(0)) QMetaObject.invokeMethod(self.editor, "returnPressed")
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
def chart_plot(self): for i in range(self.chart_len): val = self.chart_data[(self.chart_index + i) % self.chart_len] self.chart.setProperty('x_new', i) self.chart.setProperty('y_new', val) QMetaObject.invokeMethod(self.chart, "overwrite_chart", Qt.DirectConnection) self.chart_index = (self.chart_index + 1) % self.chart_len self.chart_data[self.chart_index] = self.val
def init_chart(self): for i in range(100): self.chart.setProperty('x_new', i) self.chart.setProperty('y_new', 0) QMetaObject.invokeMethod(self.chart, "init_chart", Qt.DirectConnection) self.chart_data.append(self.max_tput / 2) self.chart_index = 0 self.chart_len = len(self.chart_data)
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);
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))
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) )
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)
def handle_logout(self, response): self.check_response(response) Service.session = None Service.user_id = None Service.username = None QMetaObject.invokeMethod( self.parent, "logout", Qt.QueuedConnection )
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)
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)
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), )
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
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('错误:无法发送网络数据')))
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))
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)
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);
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)
def processingStateEntered(self): print("processing") QMetaObject.invokeMethod(self.rootObject, "setPathViewIndex",QtCore.Q_ARG("QVariant", 2)) pass
def asyncResetGeneSelector(self): QMetaObject.invokeMethod(self.geneLabel, 'setVisible', Qt.QueuedConnection, Q_ARG(bool, True)) QMetaObject.invokeMethod(self.geneSelector, 'setVisible', Qt.QueuedConnection, Q_ARG(bool, True)) QMetaObject.invokeMethod(self.geneSelector, 'clear', Qt.QueuedConnection) self.asyncAddGeneSelectorItem('All genes')
def _start_core(self): QMetaObject.invokeMethod(self._core, 'start', Qt.QueuedConnection)
def asyncSetProgress(self, progress): QMetaObject.invokeMethod(self.progressBar, 'setValue', Qt.QueuedConnection, Q_ARG(int, progress))
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))
def initStateEntered(self): print("init") QMetaObject.invokeMethod(self.rootObject, "setPathViewIndex", QtCore.Q_ARG("QVariant", 0)) pass
def paintEvent(self, event): option = QStyleOption() option.initFrom(self) contents_rect = self.style().subElementRect(QStyle.SE_FrameContents, option, self) or self.contentsRect() # the SE_FrameContents rect is Null unless the stylesheet defines decorations if self.graphStyle == self.BarStyle: graph_width = self.__dict__['graph_width'] = int(ceil(float(contents_rect.width()) / self.horizontalPixelsPerUnit)) else: graph_width = self.__dict__['graph_width'] = int(ceil(float(contents_rect.width() - 1) / self.horizontalPixelsPerUnit) + 1) max_value = self.__dict__['max_value'] = max(chain([0], *(islice(reversed(graph.data), graph_width) for graph in self.graphs if graph.enabled))) if self.graphHeight == self.AutomaticHeight or self.graphHeight < 0: graph_height = self.__dict__['graph_height'] = max(self.scaler.get_height(max_value), self.minHeight) else: graph_height = self.__dict__['graph_height'] = max(self.graphHeight, self.minHeight) if self.graphStyle == self.BarStyle: height_scaling = float(contents_rect.height()) / graph_height else: height_scaling = float(contents_rect.height() - self.lineThickness) / graph_height painter = QStylePainter(self) painter.drawPrimitive(QStyle.PE_Widget, option) painter.setClipRect(contents_rect) painter.save() painter.translate(contents_rect.x() + contents_rect.width() - 1, contents_rect.y() + contents_rect.height() - 1) painter.scale(-1, -1) painter.setRenderHint(QStylePainter.Antialiasing, self.graphStyle != self.BarStyle) for graph in (graph for graph in self.graphs if graph.enabled and graph.data): if self.boundary is not None and 0 < self.boundary < graph_height: boundary_width = min(5.0/height_scaling, self.boundary-0, graph_height-self.boundary) pen_color = QLinearGradient(0, (self.boundary - boundary_width) * height_scaling, 0, (self.boundary + boundary_width) * height_scaling) pen_color.setColorAt(0, graph.color) pen_color.setColorAt(1, graph.over_boundary_color) brush_color = QLinearGradient(0, (self.boundary - boundary_width) * height_scaling, 0, (self.boundary + boundary_width) * height_scaling) brush_color.setColorAt(0, self.color_with_alpha(graph.color, self.fillTransparency)) brush_color.setColorAt(1, self.color_with_alpha(graph.over_boundary_color, self.fillTransparency)) else: pen_color = graph.color brush_color = self.color_with_alpha(graph.color, self.fillTransparency) dataset = islice(reversed(graph.data), graph_width) if self.graphStyle == self.BarStyle: lines = [QLineF(x*self.horizontalPixelsPerUnit, 0, x*self.horizontalPixelsPerUnit, y*height_scaling) for x, y in enumerate(dataset)] painter.setPen(QPen(pen_color, self.lineThickness)) painter.drawLines(lines) else: painter.translate(0, +self.lineThickness/2 - 1) if self.smoothEnvelope and self.smoothFactor > 0: min_value = 0 max_value = graph_height * height_scaling cx_offset = self.horizontalPixelsPerUnit / 3.0 smoothness = self.smoothFactor last_values = deque(3*[next(dataset) * height_scaling], maxlen=3) # last 3 values: 0 last, 1 previous, 2 previous previous envelope = QPainterPath() envelope.moveTo(0, last_values[0]) for x, y in enumerate(dataset, 1): x = x * self.horizontalPixelsPerUnit y = y * height_scaling * (1 - smoothness) + last_values[0] * smoothness last_values.appendleft(y) c1x = x - cx_offset * 2 c2x = x - cx_offset c1y = limit((1 + smoothness) * last_values[1] - smoothness * last_values[2], min_value, max_value) # same gradient as previous previous value to previous value c2y = limit((1 - smoothness) * last_values[0] + smoothness * last_values[1], min_value, max_value) # same gradient as previous value to last value envelope.cubicTo(c1x, c1y, c2x, c2y, x, y) else: envelope = QPainterPath() envelope.addPolygon(QPolygonF([QPointF(x*self.horizontalPixelsPerUnit, y*height_scaling) for x, y in enumerate(dataset)])) if self.fillEnvelope or graph.fill_envelope: first_element = envelope.elementAt(0) last_element = envelope.elementAt(envelope.elementCount() - 1) fill_path = QPainterPath() fill_path.moveTo(last_element.x, last_element.y) fill_path.lineTo(last_element.x + 1, last_element.y) fill_path.lineTo(last_element.x + 1, -self.lineThickness) fill_path.lineTo(-self.lineThickness, -self.lineThickness) fill_path.lineTo(-self.lineThickness, first_element.y) fill_path.connectPath(envelope) painter.fillPath(fill_path, brush_color) painter.strokePath(envelope, QPen(pen_color, self.lineThickness, join=Qt.RoundJoin)) painter.translate(0, -self.lineThickness/2 + 1) if self.boundary is not None and self.boundaryColor: painter.setRenderHint(QStylePainter.Antialiasing, False) painter.setPen(QPen(self.boundaryColor, 1.0)) painter.drawLine(0, self.boundary*height_scaling, contents_rect.width(), self.boundary*height_scaling) painter.restore() # queue the 'updated' signal to be emitted after returning to the main loop QMetaObject.invokeMethod(self, 'updated', Qt.QueuedConnection)
def asyncSetOwnerSelectorText(self, text): QMetaObject.invokeMethod(self.ownerSelector, 'setCurrentText', Qt.QueuedConnection, Q_ARG(str, text))
def moveEvent(self, event): QMetaObject.invokeMethod(self, "_onWindowGeometryChanged", Qt.QueuedConnection);
def asyncUnlockUi(self, status = ''): QMetaObject.invokeMethod(self, 'setEnabled', Qt.QueuedConnection, Q_ARG(bool, True)) QMetaObject.invokeMethod(self.progressBar, 'setVisible', Qt.QueuedConnection, Q_ARG(bool, False)) self.asyncSetStatus(status)
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))
def asyncSetSummary(self, summary): QMetaObject.invokeMethod(self.summaryLabel, 'setText', Qt.QueuedConnection, Q_ARG(str, summary))
def asyncSetStudyLabelText(self, text): QMetaObject.invokeMethod(self.studyLabel, 'setText', Qt.QueuedConnection, Q_ARG(str, text))
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))
def standbyStateEntered(self): print("standby") QMetaObject.invokeMethod(self.rootObject, "setPathViewIndex", QtCore.Q_ARG("QVariant", 1)) pass
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)
def asyncHideGeneSelector(self): QMetaObject.invokeMethod(self.geneLabel, 'setVisible', Qt.QueuedConnection, Q_ARG(bool, False)) QMetaObject.invokeMethod(self.geneSelector, 'setVisible', Qt.QueuedConnection, Q_ARG(bool, False))
def asyncSetConfirmation(self, confirmation): QMetaObject.invokeMethod(self.confirmationLabel, 'setText', Qt.QueuedConnection, Q_ARG(str, confirmation))
def ping(self, arg): QMetaObject.invokeMethod(QCoreApplication.instance(), 'quit') return "ping(\"%s\") got called" % arg
def use_qml_fun(root_view, fun_parent_name, fun_name, args): parent_view = root_view.findChild(QObject, fun_parent_name) q_arg = QVariant(args) QMetaObject.invokeMethod(parent_view, fun_name, Qt.DirectConnection, Q_ARG(QVariant, q_arg))
def asyncAddStudySelectorItem(self, item): QMetaObject.invokeMethod(self, 'addStudySelectorItem', Qt.QueuedConnection, Q_ARG(str, item))
def asyncSetPage(self, index): QMetaObject.invokeMethod(self.stackedWidget, 'setCurrentIndex', Qt.QueuedConnection, Q_ARG(int, index))
def asyncClearOwnerSelector(self): QMetaObject.invokeMethod(self.ownerSelector, 'clear', Qt.QueuedConnection)
def asyncClearStudySelector(self): QMetaObject.invokeMethod(self.studySelector, 'clear', Qt.QueuedConnection)