本文整理汇总了Python中algorithm.Algorithm.deleteLater方法的典型用法代码示例。如果您正苦于以下问题:Python Algorithm.deleteLater方法的具体用法?Python Algorithm.deleteLater怎么用?Python Algorithm.deleteLater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类algorithm.Algorithm
的用法示例。
在下文中一共展示了Algorithm.deleteLater方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OutputTabManager
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import deleteLater [as 别名]
#.........这里部分代码省略.........
return
# run the self.alg
self.thread = QtCore.QThread(self)
self.thread.started.connect(self.alg.run)
self.thread.finished.connect(self.threadCleanup)
self.thread.terminated.connect(self.threadCleanup)
self.alg.moveToThread(self.thread)
self.alg.started.connect(self.manageStarted)
self.alg.progress.connect(self.manageProgress)
self.alg.message.connect(self.manageMessage)
self.alg.error.connect(self.manageError)
self.alg.finished.connect(self.manageFinished)
# set wait cursor and start
QgsApplication.instance().setOverrideCursor(QtCore.Qt.WaitCursor)
self.thread.start()
def checkOutLayerRemoved(self, layerId):
''' check when outLayer has been removed settign semaphore to True
'''
if self.outLayerId == layerId:
QgsMessageLog.logMessage('Completly removed outLayer', 'QTraffic', QgsMessageLog.INFO)
self.outLayerRemoved = True
def threadCleanup(self):
''' cleanup after thread run
'''
# restore cursor
QgsApplication.instance().restoreOverrideCursor()
if self.alg:
self.alg.deleteLater()
self.alg = None
self.thread.wait()
self.thread.deleteLater()
# remove progress bar
if self.progressMessageBarItem:
iface.messageBar().popWidget(self.progressMessageBarItem)
self.progressMessageBarItem = None
def manageStarted(self):
''' Setup GUI env to notify processing progress
'''
message = self.tr('Processing started')
QgsMessageLog.logMessage(message, 'QTraffic', QgsMessageLog.INFO)
# create message bar to show progress
self.progressMessageBarItem = iface.messageBar().createMessage(self.tr('Executing alg'))
self.progress = QtGui.QProgressBar()
self.progress.setMaximum(0)
self.progress.setMinimum(0)
self.progress.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
self.progressMessageBarItem.layout().addWidget(self.progress)
iface.messageBar().pushWidget(self.progressMessageBarItem, QgsMessageBar.INFO)
def manageProgress(self, percentage):
''' Update progress bar basing on alg nofify
'''
self.progress.setValue(percentage)
def manageMessage(self, message, msgType):
''' expose alg thread messages to gui and log
'''