Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5.QtCore import QCoreApplication, QVariant
- from qgis.core import (QgsProcessingUtils,
- QgsProcessing,
- QgsFeatureSink,
- QgsProject,
- QgsLayerTreeLayer,
- QgsFields,
- QgsField,
- QgsWkbTypes,
- QgsFeature,
- QgsGeometry,
- QgsFeatureRequest,
- QgsVectorLayer,
- QgsProcessingException,
- QgsProcessingAlgorithm,
- QgsProcessingParameterFeatureSource,
- QgsProcessingFeatureSourceDefinition,
- QgsProcessingParameterField,
- QgsProcessingParameterNumber,
- QgsProcessingParameterPoint,
- QgsProcessingParameterString,
- QgsProcessingParameterEnum,
- QgsProcessingParameterFeatureSink
- )
- import processing
- import sys
- from qgis.utils import iface
- class crashexample(QgsProcessingAlgorithm):
- ORIG = 'ORIG'
- def createInstance(self):
- return crashexample()
- def tr(self, string):
- """
- Returns a translatable string with the self.tr() function.
- """
- return QCoreApplication.translate('Processing', string)
- def name(self):
- return 'crashexample'
- def displayName(self):
- return self.tr('Crash Example')
- def group(self):
- return self.tr('Debugging Scripts')
- def groupId(self):
- return 'debuggingscripts'
- def shortHelpString(self):
- return self.tr("<p>This script demonstrates a bug with version 3.16 (Hannover) whereby if you run this script manually it will be fine but if you run it using <b>processing.createAlgorithmDialog(\"script:crashexample\",{}).show()</b> via the python console QGIS on Windows 10 will crash. The crash will happen when you click the three dots to select the point on the map canvas. </p><p>Fault code in the Windows Event viewer should be: <br>Faulting application name: qgis-bin-g7.exe, version: 0.0.0.0, time stamp: 0x5f9304c8<br>Faulting module name: KERNELBASE.dll, version: 10.0.18362.1411, time stamp: 0xeb8644a5<br>Exception code: 0xc0000005<br>Fault offset: 0x0000000000043b29")
- def initAlgorithm(self, config=None):
- self.addParameter(QgsProcessingParameterPoint(self.ORIG, 'Origin coordinates',None,True))
- def processAlgorithm(self, parameters, context, feedback):
- originPoint = self.parameterAsPoint(parameters, self.ORIG, context)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement