Saturday, 25 March 2017

python - Forcing QgsTask to cancel in QGIS plugin?


I want to force closing Qgis project (QgsTask) in some point




NOTE:
QgsProject.instance().clear() # NOT WORKING


QgsTaskManager().cancelAll() # NOT WORKING


QgsTask.cancel() # NOT WORKING



task.canCancel() # FALSE




project = QgsProject.instance()
project.clear() # NOT WORKING

QgsTaskManager().cancelAll() # NOT WORKING
tasks = QgsApplication.taskManager().activeTasks()
for task in tasks:
print (task.canCancel()) # False
print (task.description()) # Loading “C:/Users/User/Desktop/some_project.qgs”
print (task.flags()) #

task.cancel() # NOT WORKING

Is there any way to force closing project or task or change flag QgsTask.CanCancel to True ?





No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...