本文整理匯總了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
'''