Example #1
0
    def initialize():
        icon = QgsApplication.getThemeIcon("/processingAlgorithm.svg")
        ProcessingConfig.settingIcons['General'] = icon
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.KEEP_DIALOG_OPEN,
                ProcessingConfig.tr(
                    'Keep dialog open after running an algorithm'), True))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.USE_FILENAME_AS_LAYER_NAME,
                    ProcessingConfig.tr('Use filename as layer name'), False))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.SHOW_PROVIDERS_TOOLTIP,
                ProcessingConfig.tr(
                    'Show tooltip when there are disabled providers'), True))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.OUTPUT_FOLDER,
                    ProcessingConfig.tr('Output folder'),
                    defaultOutputFolder(),
                    valuetype=Setting.FOLDER))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'), ProcessingConfig.SHOW_CRS_DEF,
                ProcessingConfig.tr(
                    'Show layer CRS definition in selection boxes'), True))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.WARN_UNMATCHING_CRS,
                ProcessingConfig.tr(
                    "Warn before executing if parameter CRS's do not match"),
                True))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.RASTER_STYLE,
                    ProcessingConfig.tr('Style for raster layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.VECTOR_POINT_STYLE,
                    ProcessingConfig.tr('Style for point layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.VECTOR_LINE_STYLE,
                    ProcessingConfig.tr('Style for line layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.VECTOR_POLYGON_STYLE,
                    ProcessingConfig.tr('Style for polygon layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.PRE_EXECUTION_SCRIPT,
                    ProcessingConfig.tr('Pre-execution script'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.POST_EXECUTION_SCRIPT,
                    ProcessingConfig.tr('Post-execution script'),
                    '',
                    valuetype=Setting.FILE))

        invalidFeaturesOptions = [
            ProcessingConfig.tr('Do not filter (better performance)'),
            ProcessingConfig.tr('Ignore features with invalid geometries'),
            ProcessingConfig.tr(
                'Stop algorithm execution when a geometry is invalid')
        ]
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.FILTER_INVALID_GEOMETRIES,
                    ProcessingConfig.tr('Invalid features filtering'),
                    invalidFeaturesOptions[2],
                    valuetype=Setting.SELECTION,
                    options=invalidFeaturesOptions))

        extensions = QgsVectorFileWriter.supportedFormatExtensions()
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.DEFAULT_OUTPUT_VECTOR_LAYER_EXT,
                ProcessingConfig.tr('Default output vector layer extension'),
                extensions[0],
                valuetype=Setting.SELECTION,
                options=extensions))

        extensions = QgsRasterFileWriter.supportedFormatExtensions()
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.DEFAULT_OUTPUT_RASTER_LAYER_EXT,
                ProcessingConfig.tr('Default output raster layer extension'),
                extensions[0],
                valuetype=Setting.SELECTION,
                options=extensions))
Example #2
0
    def initialize():
        icon = QgsApplication.getThemeIcon("/processingAlgorithm.svg")
        ProcessingConfig.settingIcons['General'] = icon
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.SHOW_DEBUG_IN_DIALOG,
                    ProcessingConfig.tr('Show extra info in Log panel'), True))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.KEEP_DIALOG_OPEN,
                ProcessingConfig.tr(
                    'Keep dialog open after running an algorithm'), False))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.USE_SELECTED,
                    ProcessingConfig.tr('Use only selected features'), True))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.USE_FILENAME_AS_LAYER_NAME,
                    ProcessingConfig.tr('Use filename as layer name'), False))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.SHOW_RECENT_ALGORITHMS,
                    ProcessingConfig.tr('Show recently executed algorithms'),
                    True))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.SHOW_PROVIDERS_TOOLTIP,
                ProcessingConfig.tr(
                    'Show tooltip when there are disabled providers'), True))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.OUTPUT_FOLDER,
                    ProcessingConfig.tr('Output folder'),
                    defaultOutputFolder(),
                    valuetype=Setting.FOLDER))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'), ProcessingConfig.SHOW_CRS_DEF,
                ProcessingConfig.tr(
                    'Show layer CRS definition in selection boxes'), True))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.WARN_UNMATCHING_CRS,
                ProcessingConfig.tr(
                    "Warn before executing if layer CRS's do not match"),
                True))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.WARN_UNMATCHING_EXTENT_CRS,
                ProcessingConfig.
                tr("Warn before executing if extent CRS might not match layers CRS"
                   ), True))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.RASTER_STYLE,
                    ProcessingConfig.tr('Style for raster layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.VECTOR_POINT_STYLE,
                    ProcessingConfig.tr('Style for point layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.VECTOR_LINE_STYLE,
                    ProcessingConfig.tr('Style for line layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.VECTOR_POLYGON_STYLE,
                    ProcessingConfig.tr('Style for polygon layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.PRE_EXECUTION_SCRIPT,
                    ProcessingConfig.tr('Pre-execution script'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.POST_EXECUTION_SCRIPT,
                    ProcessingConfig.tr('Post-execution script'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.RECENT_ALGORITHMS,
                    ProcessingConfig.tr('Recent algorithms'),
                    '',
                    hidden=True))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.MODELS_SCRIPTS_REPO,
                ProcessingConfig.tr('Scripts and models repository'),
                'https://raw.githubusercontent.com/qgis/QGIS-Processing/master'
            ))

        invalidFeaturesOptions = [
            ProcessingConfig.tr('Do not filter (better performance)'),
            ProcessingConfig.tr('Ignore features with invalid geometries'),
            ProcessingConfig.tr(
                'Stop algorithm execution when a geometry is invalid')
        ]
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.FILTER_INVALID_GEOMETRIES,
                    ProcessingConfig.tr('Invalid features filtering'),
                    invalidFeaturesOptions[2],
                    valuetype=Setting.SELECTION,
                    options=invalidFeaturesOptions))

        extensions = processing.tools.dataobjects.getSupportedOutputVectorLayerExtensions(
        )
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.DEFAULT_OUTPUT_VECTOR_LAYER_EXT,
                ProcessingConfig.tr('Default output vector layer extension'),
                extensions[0],
                valuetype=Setting.SELECTION,
                options=extensions))

        extensions = processing.tools.dataobjects.getSupportedOutputRasterLayerExtensions(
        )
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.DEFAULT_OUTPUT_RASTER_LAYER_EXT,
                ProcessingConfig.tr('Default output raster layer extension'),
                extensions[0],
                valuetype=Setting.SELECTION,
                options=extensions))
Example #3
0
    def initialize():
        icon = QgsApplication.getThemeIcon("/processingAlgorithm.svg")
        ProcessingConfig.settingIcons['General'] = icon
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.KEEP_DIALOG_OPEN,
            ProcessingConfig.tr('Keep dialog open after running an algorithm'), True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.USE_FILENAME_AS_LAYER_NAME,
            ProcessingConfig.tr('Use filename as layer name'), False))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.SHOW_PROVIDERS_TOOLTIP,
            ProcessingConfig.tr('Show tooltip when there are disabled providers'), True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.OUTPUT_FOLDER,
            ProcessingConfig.tr('Output folder'), defaultOutputFolder(),
            valuetype=Setting.FOLDER))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.SHOW_CRS_DEF,
            ProcessingConfig.tr('Show layer CRS definition in selection boxes'), True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.WARN_UNMATCHING_CRS,
            ProcessingConfig.tr("Warn before executing if parameter CRS's do not match"), True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.RASTER_STYLE,
            ProcessingConfig.tr('Style for raster layers'), '',
            valuetype=Setting.FILE))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.VECTOR_POINT_STYLE,
            ProcessingConfig.tr('Style for point layers'), '',
            valuetype=Setting.FILE))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.VECTOR_LINE_STYLE,
            ProcessingConfig.tr('Style for line layers'), '',
            valuetype=Setting.FILE))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.VECTOR_POLYGON_STYLE,
            ProcessingConfig.tr('Style for polygon layers'), '',
            valuetype=Setting.FILE))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.PRE_EXECUTION_SCRIPT,
            ProcessingConfig.tr('Pre-execution script'), '',
            valuetype=Setting.FILE))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.POST_EXECUTION_SCRIPT,
            ProcessingConfig.tr('Post-execution script'), '',
            valuetype=Setting.FILE))

        invalidFeaturesOptions = [ProcessingConfig.tr('Do not filter (better performance)'),
                                  ProcessingConfig.tr('Skip (ignore) features with invalid geometries'),
                                  ProcessingConfig.tr('Stop algorithm execution when a geometry is invalid')]
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.FILTER_INVALID_GEOMETRIES,
            ProcessingConfig.tr('Invalid features filtering'),
            invalidFeaturesOptions[2],
            valuetype=Setting.SELECTION,
            options=invalidFeaturesOptions))
Example #4
0
    def initialize():
        icon = QgsApplication.getThemeIcon("/processingAlgorithm.svg")
        ProcessingConfig.settingIcons['General'] = icon
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.SHOW_DEBUG_IN_DIALOG,
            ProcessingConfig.tr('Show extra info in Log panel'), True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.KEEP_DIALOG_OPEN,
            ProcessingConfig.tr('Keep dialog open after running an algorithm'), True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.USE_FILENAME_AS_LAYER_NAME,
            ProcessingConfig.tr('Use filename as layer name'), False))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.SHOW_RECENT_ALGORITHMS,
            ProcessingConfig.tr('Show recently executed algorithms'), True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.SHOW_PROVIDERS_TOOLTIP,
            ProcessingConfig.tr('Show tooltip when there are disabled providers'), True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.OUTPUT_FOLDER,
            ProcessingConfig.tr('Output folder'), defaultOutputFolder(),
            valuetype=Setting.FOLDER))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.SHOW_CRS_DEF,
            ProcessingConfig.tr('Show layer CRS definition in selection boxes'), True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.WARN_UNMATCHING_CRS,
            ProcessingConfig.tr("Warn before executing if layer CRS's do not match"), True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.WARN_UNMATCHING_EXTENT_CRS,
            ProcessingConfig.tr("Warn before executing if extent CRS might not match layers CRS"), True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.RASTER_STYLE,
            ProcessingConfig.tr('Style for raster layers'), '',
            valuetype=Setting.FILE))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.VECTOR_POINT_STYLE,
            ProcessingConfig.tr('Style for point layers'), '',
            valuetype=Setting.FILE))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.VECTOR_LINE_STYLE,
            ProcessingConfig.tr('Style for line layers'), '',
            valuetype=Setting.FILE))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.VECTOR_POLYGON_STYLE,
            ProcessingConfig.tr('Style for polygon layers'), '',
            valuetype=Setting.FILE))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.PRE_EXECUTION_SCRIPT,
            ProcessingConfig.tr('Pre-execution script'), '',
            valuetype=Setting.FILE))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.POST_EXECUTION_SCRIPT,
            ProcessingConfig.tr('Post-execution script'), '',
            valuetype=Setting.FILE))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.RECENT_ALGORITHMS,
            ProcessingConfig.tr('Recent algorithms'), '', hidden=True))
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.MODELS_SCRIPTS_REPO,
            ProcessingConfig.tr('Scripts and models repository'),
            'https://raw.githubusercontent.com/qgis/QGIS-Processing/master'))

        invalidFeaturesOptions = [ProcessingConfig.tr('Do not filter (better performance)'),
                                  ProcessingConfig.tr('Ignore features with invalid geometries'),
                                  ProcessingConfig.tr('Stop algorithm execution when a geometry is invalid')]
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.FILTER_INVALID_GEOMETRIES,
            ProcessingConfig.tr('Invalid features filtering'),
            invalidFeaturesOptions[2],
            valuetype=Setting.SELECTION,
            options=invalidFeaturesOptions))

        extensions = QgsVectorFileWriter.supportedFormatExtensions()
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.DEFAULT_OUTPUT_VECTOR_LAYER_EXT,
            ProcessingConfig.tr('Default output vector layer extension'),
            extensions[0],
            valuetype=Setting.SELECTION,
            options=extensions))

        extensions = QgsRasterFileWriter.supportedFormatExtensions()
        ProcessingConfig.addSetting(Setting(
            ProcessingConfig.tr('General'),
            ProcessingConfig.DEFAULT_OUTPUT_RASTER_LAYER_EXT,
            ProcessingConfig.tr('Default output raster layer extension'),
            extensions[0],
            valuetype=Setting.SELECTION,
            options=extensions))
Example #5
0
 def initialize():
     icon = QIcon(os.path.dirname(__file__) + '/../images/alg.png')
     ProcessingConfig.settingIcons['General'] = icon
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.SHOW_DEBUG_IN_DIALOG,
         ProcessingConfig.tr('Show extra info in Log panel'), True))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.KEEP_DIALOG_OPEN,
         ProcessingConfig.tr('Keep dialog open after running an algorithm'), False))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.USE_SELECTED,
         ProcessingConfig.tr('Use only selected features'), True))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.USE_FILENAME_AS_LAYER_NAME,
         ProcessingConfig.tr('Use filename as layer name'), False))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.SHOW_RECENT_ALGORITHMS,
         ProcessingConfig.tr('Show recently executed algorithms'), True))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.SHOW_PROVIDERS_TOOLTIP,
         ProcessingConfig.tr('Show tooltip when there are disabled providers'), True))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.OUTPUT_FOLDER,
         ProcessingConfig.tr('Output folder'), defaultOutputFolder(),
         valuetype=Setting.FOLDER))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.SHOW_CRS_DEF,
         ProcessingConfig.tr('Show layer CRS definition in selection boxes'), True))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.WARN_UNMATCHING_CRS,
         ProcessingConfig.tr("Warn before executing if layer CRS's do not match"), True))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.WARN_UNMATCHING_EXTENT_CRS,
         ProcessingConfig.tr("Warn before executing if extent CRS might not match layers CRS"), True))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.RASTER_STYLE,
         ProcessingConfig.tr('Style for raster layers'), '',
         valuetype=Setting.FILE))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.VECTOR_POINT_STYLE,
         ProcessingConfig.tr('Style for point layers'), '',
         valuetype=Setting.FILE))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.VECTOR_LINE_STYLE,
         ProcessingConfig.tr('Style for line layers'), '',
         valuetype=Setting.FILE))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.VECTOR_POLYGON_STYLE,
         ProcessingConfig.tr('Style for polygon layers'), '',
         valuetype=Setting.FILE))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.PRE_EXECUTION_SCRIPT,
         ProcessingConfig.tr('Pre-execution script'), '',
         valuetype=Setting.FILE))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.POST_EXECUTION_SCRIPT,
         ProcessingConfig.tr('Post-execution script'), '',
         valuetype=Setting.FILE))
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.RECENT_ALGORITHMS,
         ProcessingConfig.tr('Recent algs'), '', hidden=True))
     extensions = processing.tools.dataobjects.getSupportedOutputVectorLayerExtensions()
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.DEFAULT_OUTPUT_VECTOR_LAYER_EXT,
         ProcessingConfig.tr('Default output vector layer extension'), extensions[0],
         valuetype=Setting.SELECTION, options=extensions))
     extensions = processing.tools.dataobjects.getSupportedOutputRasterLayerExtensions()
     ProcessingConfig.addSetting(Setting(
         ProcessingConfig.tr('General'),
         ProcessingConfig.DEFAULT_OUTPUT_RASTER_LAYER_EXT,
         ProcessingConfig.tr('Default output raster layer extension'), extensions[0],
         valuetype=Setting.SELECTION, options=extensions))
Example #6
0
    def initialize():
        icon = QgsApplication.getThemeIcon("/processingAlgorithm.svg")
        ProcessingConfig.settingIcons['General'] = icon
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.KEEP_DIALOG_OPEN,
                ProcessingConfig.tr(
                    'Keep dialog open after running an algorithm'), True))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.PREFER_FILENAME_AS_LAYER_NAME,
                ProcessingConfig.tr('Prefer output filename for layer names'),
                True))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.SHOW_PROVIDERS_TOOLTIP,
                ProcessingConfig.tr(
                    'Show tooltip when there are disabled providers'), True))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.OUTPUT_FOLDER,
                    ProcessingConfig.tr('Output folder'),
                    defaultOutputFolder(),
                    valuetype=Setting.FOLDER))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'), ProcessingConfig.SHOW_CRS_DEF,
                ProcessingConfig.tr(
                    'Show layer CRS definition in selection boxes'), True))
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.WARN_UNMATCHING_CRS,
                ProcessingConfig.tr(
                    "Warn before executing if parameter CRS's do not match"),
                True))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.SHOW_ALGORITHMS_KNOWN_ISSUES,
                    ProcessingConfig.tr("Show algorithms with known issues"),
                    False))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.RASTER_STYLE,
                    ProcessingConfig.tr('Style for raster layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.VECTOR_POINT_STYLE,
                    ProcessingConfig.tr('Style for point layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.VECTOR_LINE_STYLE,
                    ProcessingConfig.tr('Style for line layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.VECTOR_POLYGON_STYLE,
                    ProcessingConfig.tr('Style for polygon layers'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.PRE_EXECUTION_SCRIPT,
                    ProcessingConfig.tr('Pre-execution script'),
                    '',
                    valuetype=Setting.FILE))
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.POST_EXECUTION_SCRIPT,
                    ProcessingConfig.tr('Post-execution script'),
                    '',
                    valuetype=Setting.FILE))

        invalidFeaturesOptions = [
            ProcessingConfig.tr('Do not filter (better performance)'),
            ProcessingConfig.tr(
                'Skip (ignore) features with invalid geometries'),
            ProcessingConfig.tr(
                'Stop algorithm execution when a geometry is invalid')
        ]
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.FILTER_INVALID_GEOMETRIES,
                    ProcessingConfig.tr('Invalid features filtering'),
                    invalidFeaturesOptions[2],
                    valuetype=Setting.SELECTION,
                    options=invalidFeaturesOptions))

        threads = QgsApplication.maxThreads(
        )  # if user specified limit for rendering, lets keep that as default here, otherwise max
        threads = cpu_count(
        ) if threads == -1 else threads  # if unset, maxThreads() returns -1
        ProcessingConfig.addSetting(
            Setting(ProcessingConfig.tr('General'),
                    ProcessingConfig.MAX_THREADS,
                    ProcessingConfig.tr('Max Threads'),
                    threads,
                    valuetype=Setting.INT))

        extensions = QgsVectorFileWriter.supportedFormatExtensions()
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.DEFAULT_OUTPUT_VECTOR_LAYER_EXT,
                ProcessingConfig.tr('Default output vector layer extension'),
                QgsVectorFileWriter.supportedFormatExtensions()[0],
                valuetype=Setting.SELECTION,
                options=extensions))

        extensions = QgsRasterFileWriter.supportedFormatExtensions()
        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.DEFAULT_OUTPUT_RASTER_LAYER_EXT,
                ProcessingConfig.tr('Default output raster layer extension'),
                'tif',
                valuetype=Setting.SELECTION,
                options=extensions))

        ProcessingConfig.addSetting(
            Setting(
                ProcessingConfig.tr('General'),
                ProcessingConfig.TEMP_PATH,
                ProcessingConfig.
                tr('Override temporary output folder path (leave blank for default)'
                   ),
                None,
                valuetype=Setting.FOLDER))
Example #7
0
 def initialize():
     icon = QIcon(os.path.dirname(__file__) + '/../images/alg.png')
     ProcessingConfig.settingIcons['General'] = icon
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.SHOW_DEBUG_IN_DIALOG,
                 ProcessingConfig.tr('Show extra info in Log panel'), True))
     ProcessingConfig.addSetting(
         Setting(
             ProcessingConfig.tr('General'),
             ProcessingConfig.KEEP_DIALOG_OPEN,
             ProcessingConfig.tr(
                 'Keep dialog open after running an algorithm'), False))
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.USE_SELECTED,
                 ProcessingConfig.tr('Use only selected features'), True))
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.USE_FILENAME_AS_LAYER_NAME,
                 ProcessingConfig.tr('Use filename as layer name'), False))
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.SHOW_RECENT_ALGORITHMS,
                 ProcessingConfig.tr('Show recently executed algorithms'),
                 True))
     ProcessingConfig.addSetting(
         Setting(
             ProcessingConfig.tr('General'),
             ProcessingConfig.SHOW_PROVIDERS_TOOLTIP,
             ProcessingConfig.tr(
                 'Show tooltip when there are disabled providers'), True))
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.OUTPUT_FOLDER,
                 ProcessingConfig.tr('Output folder'),
                 defaultOutputFolder(),
                 valuetype=Setting.FOLDER))
     ProcessingConfig.addSetting(
         Setting(
             ProcessingConfig.tr('General'), ProcessingConfig.SHOW_CRS_DEF,
             ProcessingConfig.tr(
                 'Show layer CRS definition in selection boxes'), True))
     ProcessingConfig.addSetting(
         Setting(
             ProcessingConfig.tr('General'),
             ProcessingConfig.WARN_UNMATCHING_CRS,
             ProcessingConfig.tr(
                 "Warn before executing if layer CRS's do not match"),
             True))
     ProcessingConfig.addSetting(
         Setting(
             ProcessingConfig.tr('General'),
             ProcessingConfig.WARN_UNMATCHING_EXTENT_CRS,
             ProcessingConfig.
             tr("Warn before executing if extent CRS might not match layers CRS"
                ), True))
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.RASTER_STYLE,
                 ProcessingConfig.tr('Style for raster layers'),
                 '',
                 valuetype=Setting.FILE))
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.VECTOR_POINT_STYLE,
                 ProcessingConfig.tr('Style for point layers'),
                 '',
                 valuetype=Setting.FILE))
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.VECTOR_LINE_STYLE,
                 ProcessingConfig.tr('Style for line layers'),
                 '',
                 valuetype=Setting.FILE))
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.VECTOR_POLYGON_STYLE,
                 ProcessingConfig.tr('Style for polygon layers'),
                 '',
                 valuetype=Setting.FILE))
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.PRE_EXECUTION_SCRIPT,
                 ProcessingConfig.tr('Pre-execution script'),
                 '',
                 valuetype=Setting.FILE))
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.POST_EXECUTION_SCRIPT,
                 ProcessingConfig.tr('Post-execution script'),
                 '',
                 valuetype=Setting.FILE))
     ProcessingConfig.addSetting(
         Setting(ProcessingConfig.tr('General'),
                 ProcessingConfig.RECENT_ALGORITHMS,
                 ProcessingConfig.tr('Recent algs'),
                 '',
                 hidden=True))
     extensions = processing.tools.dataobjects.getSupportedOutputVectorLayerExtensions(
     )
     ProcessingConfig.addSetting(
         Setting(
             ProcessingConfig.tr('General'),
             ProcessingConfig.DEFAULT_OUTPUT_VECTOR_LAYER_EXT,
             ProcessingConfig.tr('Default output vector layer extension'),
             extensions[0],
             valuetype=Setting.SELECTION,
             options=extensions))
     extensions = processing.tools.dataobjects.getSupportedOutputRasterLayerExtensions(
     )
     ProcessingConfig.addSetting(
         Setting(
             ProcessingConfig.tr('General'),
             ProcessingConfig.DEFAULT_OUTPUT_RASTER_LAYER_EXT,
             ProcessingConfig.tr('Default output raster layer extension'),
             extensions[0],
             valuetype=Setting.SELECTION,
             options=extensions))