本文整理汇总了Python中qgis.PyQt.QtCore.QMetaObject.invokeMethod方法的典型用法代码示例。如果您正苦于以下问题:Python QMetaObject.invokeMethod方法的具体用法?Python QMetaObject.invokeMethod怎么用?Python QMetaObject.invokeMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.PyQt.QtCore.QMetaObject
的用法示例。
在下文中一共展示了QMetaObject.invokeMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write
# 需要导入模块: from qgis.PyQt.QtCore import QMetaObject [as 别名]
# 或者: from qgis.PyQt.QtCore.QMetaObject import invokeMethod [as 别名]
def write(self, m):
# This manage the case when console is called from another thread
if QThread.currentThread() != QCoreApplication.instance().thread():
QMetaObject.invokeMethod(self, "write", Qt.QueuedConnection, Q_ARG(str, m))
return
if self.style == "_traceback":
# Show errors in red
stderrColor = QColor(self.sO.settings.value("pythonConsole/stderrFontColor", QColor(self.ERROR_COLOR)))
self.sO.SendScintilla(QsciScintilla.SCI_STYLESETFORE, 0o01, stderrColor)
self.sO.SendScintilla(QsciScintilla.SCI_STYLESETITALIC, 0o01, True)
self.sO.SendScintilla(QsciScintilla.SCI_STYLESETBOLD, 0o01, True)
pos = self.sO.SendScintilla(QsciScintilla.SCI_GETCURRENTPOS)
self.sO.SendScintilla(QsciScintilla.SCI_STARTSTYLING, pos, 31)
self.sO.append(m)
self.sO.SendScintilla(QsciScintilla.SCI_SETSTYLING, len(m), 0o01)
else:
self.sO.append(m)
if self.out:
self.out.write(m)
self.move_cursor_to_end()
if self.style != "_traceback":
self.sO.repaint()
if self.fire_keyboard_interrupt:
self.fire_keyboard_interrupt = False
raise KeyboardInterrupt
示例2: render
# 需要导入模块: from qgis.PyQt.QtCore import QMetaObject [as 别名]
# 或者: from qgis.PyQt.QtCore.QMetaObject import invokeMethod [as 别名]
def render(self):
""" do the rendering. This function is called in the worker thread """
debug("[WORKER THREAD] Calling request() asynchronously", 3)
QMetaObject.invokeMethod(self.controller, "request")
# setup a timer that checks whether the rendering has not been stopped
# in the meanwhile
timer = QTimer()
timer.setInterval(50)
timer.timeout.connect(self.onTimeout)
timer.start()
debug("[WORKER THREAD] Waiting for the async request to complete", 3)
self.loop = QEventLoop()
self.controller.finished.connect(self.loop.exit)
self.loop.exec_()
debug("[WORKER THREAD] Async request finished", 3)
painter = self.context.painter()
painter.drawImage(0, 0, self.controller.img)
return True