From 10e90494dcebc5ae9bc38d3b62b488ae783d74d7 Mon Sep 17 00:00:00 2001 From: Leonhard S Date: Tue, 8 Jun 2021 22:06:23 +0200 Subject: [PATCH] Remove monkey-patched core "additions" If someone needs these for their Python - too bad. I do not have time to make sense of them and/or automate their inclusion in the stubs. --- qgis-stubs/core.pyi | 25 +- qgis/core/__init__.py | 724 ------------------ qgis/core/additions/__init__.py | 0 qgis/core/additions/edit.py | 48 -- qgis/core/additions/fromfunction.py | 51 -- qgis/core/additions/metaenum.py | 75 -- qgis/core/additions/processing.py | 33 - qgis/core/additions/projectdirtyblocker.py | 47 -- qgis/core/additions/providermetadata.py | 43 -- qgis/core/additions/qgsfeature.py | 27 - qgis/core/additions/qgsfunction.py | 172 ----- qgis/core/additions/qgsgeometry.py | 29 - qgis/core/additions/qgssettings.py | 123 --- qgis/core/additions/qgssettingsentry.py | 123 --- qgis/core/additions/qgstaskwrapper.py | 58 -- qgis/core/additions/ranges.py | 30 - .../readwritecontextentercategory.py | 46 -- qgis/core/additions/runtimeprofiler.py | 46 -- qgis/core/additions/validitycheck.py | 95 --- qgis/core/contextmanagers.py | 63 -- 20 files changed, 22 insertions(+), 1836 deletions(-) delete mode 100644 qgis/core/__init__.py delete mode 100644 qgis/core/additions/__init__.py delete mode 100644 qgis/core/additions/edit.py delete mode 100644 qgis/core/additions/fromfunction.py delete mode 100644 qgis/core/additions/metaenum.py delete mode 100644 qgis/core/additions/processing.py delete mode 100644 qgis/core/additions/projectdirtyblocker.py delete mode 100644 qgis/core/additions/providermetadata.py delete mode 100644 qgis/core/additions/qgsfeature.py delete mode 100644 qgis/core/additions/qgsfunction.py delete mode 100644 qgis/core/additions/qgsgeometry.py delete mode 100644 qgis/core/additions/qgssettings.py delete mode 100644 qgis/core/additions/qgssettingsentry.py delete mode 100644 qgis/core/additions/qgstaskwrapper.py delete mode 100644 qgis/core/additions/ranges.py delete mode 100644 qgis/core/additions/readwritecontextentercategory.py delete mode 100644 qgis/core/additions/runtimeprofiler.py delete mode 100644 qgis/core/additions/validitycheck.py delete mode 100644 qgis/core/contextmanagers.py diff --git a/qgis-stubs/core.pyi b/qgis-stubs/core.pyi index 6f30475..c003052 100644 --- a/qgis-stubs/core.pyi +++ b/qgis-stubs/core.pyi @@ -1,6 +1,25 @@ -# The PEP 484 type hints stub file for the _core module. -# -# Generated by SIP 4.19.21 +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + __init__.py + --------------------- + Date : May 2014 + Copyright : (C) 2014 by Nathan Woodrow + Email : woodrow dot nathan at gmail dot com +*************************************************************************** +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +*************************************************************************** +""" + +__author__ = 'Nathan Woodrow' +__date__ = 'May 2014' +__copyright__ = '(C) 2014, Nathan Woodrow' import datetime import typing diff --git a/qgis/core/__init__.py b/qgis/core/__init__.py deleted file mode 100644 index e1329c4..0000000 --- a/qgis/core/__init__.py +++ /dev/null @@ -1,724 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - __init__.py - --------------------- - Date : May 2014 - Copyright : (C) 2014 by Nathan Woodrow - Email : woodrow dot nathan at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -__author__ = 'Nathan Woodrow' -__date__ = 'May 2014' -__copyright__ = '(C) 2014, Nathan Woodrow' - -from PyQt5.QtCore import NULL -from qgis._core import * - -from .additions.edit import edit, QgsEditError -from .additions.fromfunction import fromFunction -from .additions.metaenum import metaEnumFromType, metaEnumFromValue -from .additions.processing import processing_output_layer_repr, processing_source_repr -from .additions.projectdirtyblocker import ProjectDirtyBlocker -from .additions.providermetadata import PyProviderMetadata -from .additions.qgsfeature import mapping_feature -from .additions.qgsfunction import register_function, qgsfunction -from .additions.qgsgeometry import _geometryNonZero, mapping_geometry -from .additions.qgssettings import _qgssettings_enum_value, _qgssettings_set_enum_value, _qgssettings_flag_value -from .additions.qgssettingsentry import PyQgsSettingsEntryEnumFlag -from .additions.qgstaskwrapper import QgsTaskWrapper -from .additions.readwritecontextentercategory import ReadWriteContextEnterCategory -from .additions.runtimeprofiler import ScopedRuntimeProfileContextManager -from .additions.validitycheck import check -from .additions.ranges import datetime_range_repr, date_range_repr - -# Injections into classes -QgsFeature.__geo_interface__ = property(mapping_feature) -QgsGeometry.__bool__ = _geometryNonZero -QgsGeometry.__geo_interface__ = property(mapping_geometry) -QgsGeometry.__nonzero__ = _geometryNonZero -QgsProcessingFeatureSourceDefinition.__repr__ = processing_source_repr -QgsProcessingOutputLayerDefinition.__repr__ = processing_output_layer_repr -QgsProject.blockDirtying = ProjectDirtyBlocker -QgsReadWriteContext.enterCategory = ReadWriteContextEnterCategory -QgsRuntimeProfiler.profile = ScopedRuntimeProfileContextManager -QgsSettings.enumValue = _qgssettings_enum_value -QgsSettings.setEnumValue = _qgssettings_set_enum_value -QgsSettings.flagValue = _qgssettings_flag_value -QgsTask.fromFunction = fromFunction -QgsDateTimeRange.__repr__ = datetime_range_repr -QgsDateRange.__repr__ = date_range_repr - -# Classes patched -QgsSettingsEntryEnumFlag = PyQgsSettingsEntryEnumFlag - -# Classes patched using a derived class -QgsProviderMetadata = PyProviderMetadata - -# monkey patch deprecated enum values to maintain API -# TODO - remove for QGIS 4.0 -QgsMarkerLineSymbolLayer.Interval = QgsTemplatedLineSymbolLayerBase.Interval -QgsMarkerLineSymbolLayer.Vertex = QgsTemplatedLineSymbolLayerBase.Vertex -QgsMarkerLineSymbolLayer.LastVertex = QgsTemplatedLineSymbolLayerBase.LastVertex -QgsMarkerLineSymbolLayer.FirstVertex = QgsTemplatedLineSymbolLayerBase.FirstVertex -QgsMarkerLineSymbolLayer.CentralPoint = QgsTemplatedLineSymbolLayerBase.CentralPoint -QgsMarkerLineSymbolLayer.CurvePoint = QgsTemplatedLineSymbolLayerBase.CurvePoint - -# Monkey patch static const "QgsDataProvider.SUBLAYER_SEPARATOR" which was removed for QGIS 3.12 -QgsDataProvider.SUBLAYER_SEPARATOR = QgsDataProvider.sublayerSeparator() - -# Monkey patch Qgis vars -Qgis.QGIS_VERSION = Qgis.version() -Qgis.QGIS_VERSION_INT = Qgis.versionInt() -Qgis.QGIS_RELEASE_NAME = Qgis.releaseName() - -GEOWKT = geoWkt() -PROJECT_SCALES = Qgis.defaultProjectScales() -GEOPROJ4 = geoProj4() -GEO_EPSG_CRS_AUTHID = geoEpsgCrsAuthId() -GEO_NONE = geoNone() -""" -This folder is completed using sipify.pl script -It is not aimed to be manually edited -""" -# The following has been generated automatically from src/core/qgis.h -QgsMapLayer.LayerType = QgsMapLayerType -# monkey patching scoped based enum -QgsMapLayer.VectorLayer = QgsMapLayerType.VectorLayer -QgsMapLayer.VectorLayer.is_monkey_patched = True -QgsMapLayer.VectorLayer.__doc__ = "" -QgsMapLayer.RasterLayer = QgsMapLayerType.RasterLayer -QgsMapLayer.RasterLayer.is_monkey_patched = True -QgsMapLayer.RasterLayer.__doc__ = "" -QgsMapLayer.PluginLayer = QgsMapLayerType.PluginLayer -QgsMapLayer.PluginLayer.is_monkey_patched = True -QgsMapLayer.PluginLayer.__doc__ = "" -QgsMapLayer.MeshLayer = QgsMapLayerType.MeshLayer -QgsMapLayer.MeshLayer.is_monkey_patched = True -QgsMapLayer.MeshLayer.__doc__ = "Added in 3.2" -QgsMapLayer.VectorTileLayer = QgsMapLayerType.VectorTileLayer -QgsMapLayer.VectorTileLayer.is_monkey_patched = True -QgsMapLayer.VectorTileLayer.__doc__ = "Added in 3.14" -QgsMapLayer.AnnotationLayer = QgsMapLayerType.AnnotationLayer -QgsMapLayer.AnnotationLayer.is_monkey_patched = True -QgsMapLayer.AnnotationLayer.__doc__ = "Contains freeform, georeferenced annotations. Added in QGIS 3.16" -QgsMapLayer.PointCloudLayer = QgsMapLayerType.PointCloudLayer -QgsMapLayer.PointCloudLayer.is_monkey_patched = True -QgsMapLayer.PointCloudLayer.__doc__ = "Added in 3.18" -QgsMapLayerType.__doc__ = 'Types of layers that can be added to a map\n\n.. versionadded:: 3.8\n\n' + '* ``VectorLayer``: ' + QgsMapLayerType.VectorLayer.__doc__ + '\n' + '* ``RasterLayer``: ' + QgsMapLayerType.RasterLayer.__doc__ + '\n' + '* ``PluginLayer``: ' + QgsMapLayerType.PluginLayer.__doc__ + '\n' + '* ``MeshLayer``: ' + QgsMapLayerType.MeshLayer.__doc__ + '\n' + '* ``VectorTileLayer``: ' + QgsMapLayerType.VectorTileLayer.__doc__ + '\n' + '* ``AnnotationLayer``: ' + QgsMapLayerType.AnnotationLayer.__doc__ + '\n' + '* ``PointCloudLayer``: ' + QgsMapLayerType.PointCloudLayer.__doc__ -# -- -Qgis.MessageLevel.baseClass = Qgis -# monkey patching scoped based enum -Qgis.UnknownDataType = Qgis.DataType.UnknownDataType -Qgis.UnknownDataType.is_monkey_patched = True -Qgis.UnknownDataType.__doc__ = "Unknown or unspecified type" -Qgis.Byte = Qgis.DataType.Byte -Qgis.Byte.is_monkey_patched = True -Qgis.Byte.__doc__ = "Eight bit unsigned integer (quint8)" -Qgis.UInt16 = Qgis.DataType.UInt16 -Qgis.UInt16.is_monkey_patched = True -Qgis.UInt16.__doc__ = "Sixteen bit unsigned integer (quint16)" -Qgis.Int16 = Qgis.DataType.Int16 -Qgis.Int16.is_monkey_patched = True -Qgis.Int16.__doc__ = "Sixteen bit signed integer (qint16)" -Qgis.UInt32 = Qgis.DataType.UInt32 -Qgis.UInt32.is_monkey_patched = True -Qgis.UInt32.__doc__ = "Thirty two bit unsigned integer (quint32)" -Qgis.Int32 = Qgis.DataType.Int32 -Qgis.Int32.is_monkey_patched = True -Qgis.Int32.__doc__ = "Thirty two bit signed integer (qint32)" -Qgis.Float32 = Qgis.DataType.Float32 -Qgis.Float32.is_monkey_patched = True -Qgis.Float32.__doc__ = "Thirty two bit floating point (float)" -Qgis.Float64 = Qgis.DataType.Float64 -Qgis.Float64.is_monkey_patched = True -Qgis.Float64.__doc__ = "Sixty four bit floating point (double)" -Qgis.CInt16 = Qgis.DataType.CInt16 -Qgis.CInt16.is_monkey_patched = True -Qgis.CInt16.__doc__ = "Complex Int16" -Qgis.CInt32 = Qgis.DataType.CInt32 -Qgis.CInt32.is_monkey_patched = True -Qgis.CInt32.__doc__ = "Complex Int32" -Qgis.CFloat32 = Qgis.DataType.CFloat32 -Qgis.CFloat32.is_monkey_patched = True -Qgis.CFloat32.__doc__ = "Complex Float32" -Qgis.CFloat64 = Qgis.DataType.CFloat64 -Qgis.CFloat64.is_monkey_patched = True -Qgis.CFloat64.__doc__ = "Complex Float64" -Qgis.ARGB32 = Qgis.DataType.ARGB32 -Qgis.ARGB32.is_monkey_patched = True -Qgis.ARGB32.__doc__ = "Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32" -Qgis.ARGB32_Premultiplied = Qgis.DataType.ARGB32_Premultiplied -Qgis.ARGB32_Premultiplied.is_monkey_patched = True -Qgis.ARGB32_Premultiplied.__doc__ = "Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied" -Qgis.DataType.__doc__ = 'Raster data types.\nThis is modified and extended copy of GDALDataType.\n\n' + '* ``UnknownDataType``: ' + Qgis.DataType.UnknownDataType.__doc__ + '\n' + '* ``Byte``: ' + Qgis.DataType.Byte.__doc__ + '\n' + '* ``UInt16``: ' + Qgis.DataType.UInt16.__doc__ + '\n' + '* ``Int16``: ' + Qgis.DataType.Int16.__doc__ + '\n' + '* ``UInt32``: ' + Qgis.DataType.UInt32.__doc__ + '\n' + '* ``Int32``: ' + Qgis.DataType.Int32.__doc__ + '\n' + '* ``Float32``: ' + Qgis.DataType.Float32.__doc__ + '\n' + '* ``Float64``: ' + Qgis.DataType.Float64.__doc__ + '\n' + '* ``CInt16``: ' + Qgis.DataType.CInt16.__doc__ + '\n' + '* ``CInt32``: ' + Qgis.DataType.CInt32.__doc__ + '\n' + '* ``CFloat32``: ' + Qgis.DataType.CFloat32.__doc__ + '\n' + '* ``CFloat64``: ' + Qgis.DataType.CFloat64.__doc__ + '\n' + '* ``ARGB32``: ' + Qgis.DataType.ARGB32.__doc__ + '\n' + '* ``ARGB32_Premultiplied``: ' + Qgis.DataType.ARGB32_Premultiplied.__doc__ -# -- -Qgis.DataType.baseClass = Qgis -# monkey patching scoped based enum -Qgis.Never = Qgis.PythonMacroMode.Never -Qgis.Never.is_monkey_patched = True -Qgis.Never.__doc__ = "Macros are never run" -Qgis.Ask = Qgis.PythonMacroMode.Ask -Qgis.Ask.is_monkey_patched = True -Qgis.Ask.__doc__ = "User is prompt before running" -Qgis.SessionOnly = Qgis.PythonMacroMode.SessionOnly -Qgis.SessionOnly.is_monkey_patched = True -Qgis.SessionOnly.__doc__ = "Only during this session" -Qgis.Always = Qgis.PythonMacroMode.Always -Qgis.Always.is_monkey_patched = True -Qgis.Always.__doc__ = "Macros are always run" -Qgis.NotForThisSession = Qgis.PythonMacroMode.NotForThisSession -Qgis.NotForThisSession.is_monkey_patched = True -Qgis.NotForThisSession.__doc__ = "Macros will not be run for this session" -Qgis.PythonMacroMode.__doc__ = 'Authorisation to run Python Macros\n\n.. versionadded:: 3.10\n\n' + '* ``Never``: ' + Qgis.PythonMacroMode.Never.__doc__ + '\n' + '* ``Ask``: ' + Qgis.PythonMacroMode.Ask.__doc__ + '\n' + '* ``SessionOnly``: ' + Qgis.PythonMacroMode.SessionOnly.__doc__ + '\n' + '* ``Always``: ' + Qgis.PythonMacroMode.Always.__doc__ + '\n' + '* ``NotForThisSession``: ' + Qgis.PythonMacroMode.NotForThisSession.__doc__ -# -- -Qgis.PythonMacroMode.baseClass = Qgis -QgsVectorDataProvider.FeatureCountState = Qgis.FeatureCountState -# monkey patching scoped based enum -QgsVectorDataProvider.Uncounted = Qgis.FeatureCountState.Uncounted -QgsVectorDataProvider.Uncounted.is_monkey_patched = True -QgsVectorDataProvider.Uncounted.__doc__ = "Feature count not yet computed" -QgsVectorDataProvider.UnknownCount = Qgis.FeatureCountState.UnknownCount -QgsVectorDataProvider.UnknownCount.is_monkey_patched = True -QgsVectorDataProvider.UnknownCount.__doc__ = "Provider returned an unknown feature count" -Qgis.FeatureCountState.__doc__ = 'Enumeration of feature count states\n\n.. versionadded:: 3.20\n\n' + '* ``Uncounted``: ' + Qgis.FeatureCountState.Uncounted.__doc__ + '\n' + '* ``UnknownCount``: ' + Qgis.FeatureCountState.UnknownCount.__doc__ -# -- -Qgis.FeatureCountState.baseClass = Qgis -QgsSymbol.SymbolType = Qgis.SymbolType -# monkey patching scoped based enum -QgsSymbol.Marker = Qgis.SymbolType.Marker -QgsSymbol.Marker.is_monkey_patched = True -QgsSymbol.Marker.__doc__ = "Marker symbol" -QgsSymbol.Line = Qgis.SymbolType.Line -QgsSymbol.Line.is_monkey_patched = True -QgsSymbol.Line.__doc__ = "Line symbol" -QgsSymbol.Fill = Qgis.SymbolType.Fill -QgsSymbol.Fill.is_monkey_patched = True -QgsSymbol.Fill.__doc__ = "Fill symbol" -QgsSymbol.Hybrid = Qgis.SymbolType.Hybrid -QgsSymbol.Hybrid.is_monkey_patched = True -QgsSymbol.Hybrid.__doc__ = "Hybrid symbol" -Qgis.SymbolType.__doc__ = 'Symbol types\n\n.. versionadded:: 3.20\n\n' + '* ``Marker``: ' + Qgis.SymbolType.Marker.__doc__ + '\n' + '* ``Line``: ' + Qgis.SymbolType.Line.__doc__ + '\n' + '* ``Fill``: ' + Qgis.SymbolType.Fill.__doc__ + '\n' + '* ``Hybrid``: ' + Qgis.SymbolType.Hybrid.__doc__ -# -- -Qgis.SymbolType.baseClass = Qgis -QgsSymbol.ScaleMethod = Qgis.ScaleMethod -# monkey patching scoped based enum -QgsSymbol.ScaleArea = Qgis.ScaleMethod.ScaleArea -QgsSymbol.ScaleArea.is_monkey_patched = True -QgsSymbol.ScaleArea.__doc__ = "Calculate scale by the area" -QgsSymbol.ScaleDiameter = Qgis.ScaleMethod.ScaleDiameter -QgsSymbol.ScaleDiameter.is_monkey_patched = True -QgsSymbol.ScaleDiameter.__doc__ = "Calculate scale by the diameter" -Qgis.ScaleMethod.__doc__ = 'Scale methods\n\n.. versionadded:: 3.20\n\n' + '* ``ScaleArea``: ' + Qgis.ScaleMethod.ScaleArea.__doc__ + '\n' + '* ``ScaleDiameter``: ' + Qgis.ScaleMethod.ScaleDiameter.__doc__ -# -- -Qgis.ScaleMethod.baseClass = Qgis -QgsSymbol.RenderHint = Qgis.SymbolRenderHint -# monkey patching scoped based enum -QgsSymbol.DynamicRotation = Qgis.SymbolRenderHint.DynamicRotation -QgsSymbol.DynamicRotation.is_monkey_patched = True -QgsSymbol.DynamicRotation.__doc__ = "Rotation of symbol may be changed during rendering and symbol should not be cached" -Qgis.SymbolRenderHint.__doc__ = 'Flags controlling behavior of symbols during rendering\n\n.. versionadded:: 3.20\n\n' + '* ``DynamicRotation``: ' + Qgis.SymbolRenderHint.DynamicRotation.__doc__ -# -- -Qgis.SymbolRenderHint.baseClass = Qgis -# monkey patching scoped based enum -Qgis.SymbolFlag.RendererShouldUseSymbolLevels.__doc__ = "If present, indicates that a QgsFeatureRenderer using the symbol should use symbol levels for best results" -Qgis.SymbolFlag.__doc__ = 'Flags controlling behavior of symbols\n\n.. versionadded:: 3.20\n\n' + '* ``RendererShouldUseSymbolLevels``: ' + Qgis.SymbolFlag.RendererShouldUseSymbolLevels.__doc__ -# -- -Qgis.SymbolFlag.baseClass = Qgis -QgsSymbol.PreviewFlag = Qgis.SymbolPreviewFlag -# monkey patching scoped based enum -QgsSymbol.FlagIncludeCrosshairsForMarkerSymbols = Qgis.SymbolPreviewFlag.FlagIncludeCrosshairsForMarkerSymbols -QgsSymbol.FlagIncludeCrosshairsForMarkerSymbols.is_monkey_patched = True -QgsSymbol.FlagIncludeCrosshairsForMarkerSymbols.__doc__ = "Include a crosshairs reference image in the background of marker symbol previews" -Qgis.SymbolPreviewFlag.__doc__ = 'Flags for controlling how symbol preview images are generated.\n\n.. versionadded:: 3.20\n\n' + '* ``FlagIncludeCrosshairsForMarkerSymbols``: ' + Qgis.SymbolPreviewFlag.FlagIncludeCrosshairsForMarkerSymbols.__doc__ -# -- -Qgis.SymbolPreviewFlag.baseClass = Qgis -QgsDataItem.Type = Qgis.BrowserItemType -# monkey patching scoped based enum -QgsDataItem.Collection = Qgis.BrowserItemType.Collection -QgsDataItem.Collection.is_monkey_patched = True -QgsDataItem.Collection.__doc__ = "A collection of items" -QgsDataItem.Directory = Qgis.BrowserItemType.Directory -QgsDataItem.Directory.is_monkey_patched = True -QgsDataItem.Directory.__doc__ = "Represents a file directory" -QgsDataItem.Layer = Qgis.BrowserItemType.Layer -QgsDataItem.Layer.is_monkey_patched = True -QgsDataItem.Layer.__doc__ = "Represents a map layer" -QgsDataItem.Error = Qgis.BrowserItemType.Error -QgsDataItem.Error.is_monkey_patched = True -QgsDataItem.Error.__doc__ = "Contains an error message" -QgsDataItem.Favorites = Qgis.BrowserItemType.Favorites -QgsDataItem.Favorites.is_monkey_patched = True -QgsDataItem.Favorites.__doc__ = "Represents a favorite item" -QgsDataItem.Project = Qgis.BrowserItemType.Project -QgsDataItem.Project.is_monkey_patched = True -QgsDataItem.Project.__doc__ = "Represents a QGIS project" -QgsDataItem.Custom = Qgis.BrowserItemType.Custom -QgsDataItem.Custom.is_monkey_patched = True -QgsDataItem.Custom.__doc__ = "Custom item type" -QgsDataItem.Fields = Qgis.BrowserItemType.Fields -QgsDataItem.Fields.is_monkey_patched = True -QgsDataItem.Fields.__doc__ = "Collection of fields" -QgsDataItem.Field = Qgis.BrowserItemType.Field -QgsDataItem.Field.is_monkey_patched = True -QgsDataItem.Field.__doc__ = "Vector layer field" -Qgis.BrowserItemType.__doc__ = 'Browser item types.\n\n.. versionadded:: 3.20\n\n' + '* ``Collection``: ' + Qgis.BrowserItemType.Collection.__doc__ + '\n' + '* ``Directory``: ' + Qgis.BrowserItemType.Directory.__doc__ + '\n' + '* ``Layer``: ' + Qgis.BrowserItemType.Layer.__doc__ + '\n' + '* ``Error``: ' + Qgis.BrowserItemType.Error.__doc__ + '\n' + '* ``Favorites``: ' + Qgis.BrowserItemType.Favorites.__doc__ + '\n' + '* ``Project``: ' + Qgis.BrowserItemType.Project.__doc__ + '\n' + '* ``Custom``: ' + Qgis.BrowserItemType.Custom.__doc__ + '\n' + '* ``Fields``: ' + Qgis.BrowserItemType.Fields.__doc__ + '\n' + '* ``Field``: ' + Qgis.BrowserItemType.Field.__doc__ -# -- -Qgis.BrowserItemType.baseClass = Qgis -QgsDataItem.State = Qgis.BrowserItemState -# monkey patching scoped based enum -QgsDataItem.NotPopulated = Qgis.BrowserItemState.NotPopulated -QgsDataItem.NotPopulated.is_monkey_patched = True -QgsDataItem.NotPopulated.__doc__ = "Children not yet created" -QgsDataItem.Populating = Qgis.BrowserItemState.Populating -QgsDataItem.Populating.is_monkey_patched = True -QgsDataItem.Populating.__doc__ = "Creating children in separate thread (populating or refreshing)" -QgsDataItem.Populated = Qgis.BrowserItemState.Populated -QgsDataItem.Populated.is_monkey_patched = True -QgsDataItem.Populated.__doc__ = "Children created" -Qgis.BrowserItemState.__doc__ = 'Browser item states.\n\n.. versionadded:: 3.20\n\n' + '* ``NotPopulated``: ' + Qgis.BrowserItemState.NotPopulated.__doc__ + '\n' + '* ``Populating``: ' + Qgis.BrowserItemState.Populating.__doc__ + '\n' + '* ``Populated``: ' + Qgis.BrowserItemState.Populated.__doc__ -# -- -Qgis.BrowserItemState.baseClass = Qgis -QgsDataItem.Capability = Qgis.BrowserItemCapability -# monkey patching scoped based enum -QgsDataItem.NoCapabilities = Qgis.BrowserItemCapability.NoCapabilities -QgsDataItem.NoCapabilities.is_monkey_patched = True -QgsDataItem.NoCapabilities.__doc__ = "Item has no capabilities" -QgsDataItem.SetCrs = Qgis.BrowserItemCapability.SetCrs -QgsDataItem.SetCrs.is_monkey_patched = True -QgsDataItem.SetCrs.__doc__ = "Can set CRS on layer or group of layers. \deprecated since QGIS 3.6 -- no longer used by QGIS and will be removed in QGIS 4.0" -QgsDataItem.Fertile = Qgis.BrowserItemCapability.Fertile -QgsDataItem.Fertile.is_monkey_patched = True -QgsDataItem.Fertile.__doc__ = "Can create children. Even items without this capability may have children, but cannot create them, it means that children are created by item ancestors." -QgsDataItem.Fast = Qgis.BrowserItemCapability.Fast -QgsDataItem.Fast.is_monkey_patched = True -QgsDataItem.Fast.__doc__ = "CreateChildren() is fast enough to be run in main thread when refreshing items, most root items (wms,wfs,wcs,postgres...) are considered fast because they are reading data only from QgsSettings" -QgsDataItem.Collapse = Qgis.BrowserItemCapability.Collapse -QgsDataItem.Collapse.is_monkey_patched = True -QgsDataItem.Collapse.__doc__ = "The collapse/expand status for this items children should be ignored in order to avoid undesired network connections (wms etc.)" -QgsDataItem.Rename = Qgis.BrowserItemCapability.Rename -QgsDataItem.Rename.is_monkey_patched = True -QgsDataItem.Rename.__doc__ = "Item can be renamed" -QgsDataItem.Delete = Qgis.BrowserItemCapability.Delete -QgsDataItem.Delete.is_monkey_patched = True -QgsDataItem.Delete.__doc__ = "Item can be deleted" -Qgis.BrowserItemCapability.__doc__ = 'Browser item capabilities.\n\n.. versionadded:: 3.20\n\n' + '* ``NoCapabilities``: ' + Qgis.BrowserItemCapability.NoCapabilities.__doc__ + '\n' + '* ``SetCrs``: ' + Qgis.BrowserItemCapability.SetCrs.__doc__ + '\n' + '* ``Fertile``: ' + Qgis.BrowserItemCapability.Fertile.__doc__ + '\n' + '* ``Fast``: ' + Qgis.BrowserItemCapability.Fast.__doc__ + '\n' + '* ``Collapse``: ' + Qgis.BrowserItemCapability.Collapse.__doc__ + '\n' + '* ``Rename``: ' + Qgis.BrowserItemCapability.Rename.__doc__ + '\n' + '* ``Delete``: ' + Qgis.BrowserItemCapability.Delete.__doc__ -# -- -Qgis.BrowserItemCapability.baseClass = Qgis -QgsLayerItem.LayerType = Qgis.BrowserLayerType -# monkey patching scoped based enum -QgsLayerItem.NoType = Qgis.BrowserLayerType.NoType -QgsLayerItem.NoType.is_monkey_patched = True -QgsLayerItem.NoType.__doc__ = "No type" -QgsLayerItem.Vector = Qgis.BrowserLayerType.Vector -QgsLayerItem.Vector.is_monkey_patched = True -QgsLayerItem.Vector.__doc__ = "Generic vector layer" -QgsLayerItem.Raster = Qgis.BrowserLayerType.Raster -QgsLayerItem.Raster.is_monkey_patched = True -QgsLayerItem.Raster.__doc__ = "Raster layer" -QgsLayerItem.Point = Qgis.BrowserLayerType.Point -QgsLayerItem.Point.is_monkey_patched = True -QgsLayerItem.Point.__doc__ = "Vector point layer" -QgsLayerItem.Line = Qgis.BrowserLayerType.Line -QgsLayerItem.Line.is_monkey_patched = True -QgsLayerItem.Line.__doc__ = "Vector line layer" -QgsLayerItem.Polygon = Qgis.BrowserLayerType.Polygon -QgsLayerItem.Polygon.is_monkey_patched = True -QgsLayerItem.Polygon.__doc__ = "Vector polygon layer" -QgsLayerItem.TableLayer = Qgis.BrowserLayerType.TableLayer -QgsLayerItem.TableLayer.is_monkey_patched = True -QgsLayerItem.TableLayer.__doc__ = "Vector non-spatial layer" -QgsLayerItem.Database = Qgis.BrowserLayerType.Database -QgsLayerItem.Database.is_monkey_patched = True -QgsLayerItem.Database.__doc__ = "Database layer" -QgsLayerItem.Table = Qgis.BrowserLayerType.Table -QgsLayerItem.Table.is_monkey_patched = True -QgsLayerItem.Table.__doc__ = "Database table" -QgsLayerItem.Plugin = Qgis.BrowserLayerType.Plugin -QgsLayerItem.Plugin.is_monkey_patched = True -QgsLayerItem.Plugin.__doc__ = "Plugin based layer" -QgsLayerItem.Mesh = Qgis.BrowserLayerType.Mesh -QgsLayerItem.Mesh.is_monkey_patched = True -QgsLayerItem.Mesh.__doc__ = "Mesh layer" -QgsLayerItem.VectorTile = Qgis.BrowserLayerType.VectorTile -QgsLayerItem.VectorTile.is_monkey_patched = True -QgsLayerItem.VectorTile.__doc__ = "Vector tile layer" -QgsLayerItem.PointCloud = Qgis.BrowserLayerType.PointCloud -QgsLayerItem.PointCloud.is_monkey_patched = True -QgsLayerItem.PointCloud.__doc__ = "Point cloud layer" -Qgis.BrowserLayerType.__doc__ = 'Browser item layer types\n\n.. versionadded:: 3.20\n\n' + '* ``NoType``: ' + Qgis.BrowserLayerType.NoType.__doc__ + '\n' + '* ``Vector``: ' + Qgis.BrowserLayerType.Vector.__doc__ + '\n' + '* ``Raster``: ' + Qgis.BrowserLayerType.Raster.__doc__ + '\n' + '* ``Point``: ' + Qgis.BrowserLayerType.Point.__doc__ + '\n' + '* ``Line``: ' + Qgis.BrowserLayerType.Line.__doc__ + '\n' + '* ``Polygon``: ' + Qgis.BrowserLayerType.Polygon.__doc__ + '\n' + '* ``TableLayer``: ' + Qgis.BrowserLayerType.TableLayer.__doc__ + '\n' + '* ``Database``: ' + Qgis.BrowserLayerType.Database.__doc__ + '\n' + '* ``Table``: ' + Qgis.BrowserLayerType.Table.__doc__ + '\n' + '* ``Plugin``: ' + Qgis.BrowserLayerType.Plugin.__doc__ + '\n' + '* ``Mesh``: ' + Qgis.BrowserLayerType.Mesh.__doc__ + '\n' + '* ``VectorTile``: ' + Qgis.BrowserLayerType.VectorTile.__doc__ + '\n' + '* ``PointCloud``: ' + Qgis.BrowserLayerType.PointCloud.__doc__ -# -- -Qgis.BrowserLayerType.baseClass = Qgis -# monkey patching scoped based enum -Qgis.BrowserDirectoryMonitoring.Default.__doc__ = "Use default logic to determine whether directory should be monitored" -Qgis.BrowserDirectoryMonitoring.NeverMonitor.__doc__ = "Never monitor the directory, regardless of the default logic" -Qgis.BrowserDirectoryMonitoring.AlwaysMonitor.__doc__ = "Always monitor the directory, regardless of the default logic" -Qgis.BrowserDirectoryMonitoring.__doc__ = 'Browser directory item monitoring switches.\n\n.. versionadded:: 3.20\n\n' + '* ``Default``: ' + Qgis.BrowserDirectoryMonitoring.Default.__doc__ + '\n' + '* ``NeverMonitor``: ' + Qgis.BrowserDirectoryMonitoring.NeverMonitor.__doc__ + '\n' + '* ``AlwaysMonitor``: ' + Qgis.BrowserDirectoryMonitoring.AlwaysMonitor.__doc__ -# -- -Qgis.BrowserDirectoryMonitoring.baseClass = Qgis -QgsVectorLayerExporter.ExportError = Qgis.VectorExportResult -# monkey patching scoped based enum -QgsVectorLayerExporter.NoError = Qgis.VectorExportResult.Success -QgsVectorLayerExporter.NoError.is_monkey_patched = True -QgsVectorLayerExporter.NoError.__doc__ = "No errors were encountered" -QgsVectorLayerExporter.ErrCreateDataSource = Qgis.VectorExportResult.ErrorCreatingDataSource -QgsVectorLayerExporter.ErrCreateDataSource.is_monkey_patched = True -QgsVectorLayerExporter.ErrCreateDataSource.__doc__ = "Could not create the destination data source" -QgsVectorLayerExporter.ErrCreateLayer = Qgis.VectorExportResult.ErrorCreatingLayer -QgsVectorLayerExporter.ErrCreateLayer.is_monkey_patched = True -QgsVectorLayerExporter.ErrCreateLayer.__doc__ = "Could not create destination layer" -QgsVectorLayerExporter.ErrAttributeTypeUnsupported = Qgis.VectorExportResult.ErrorAttributeTypeUnsupported -QgsVectorLayerExporter.ErrAttributeTypeUnsupported.is_monkey_patched = True -QgsVectorLayerExporter.ErrAttributeTypeUnsupported.__doc__ = "Source layer has an attribute type which could not be handled by destination" -QgsVectorLayerExporter.ErrAttributeCreationFailed = Qgis.VectorExportResult.ErrorAttributeCreationFailed -QgsVectorLayerExporter.ErrAttributeCreationFailed.is_monkey_patched = True -QgsVectorLayerExporter.ErrAttributeCreationFailed.__doc__ = "Destination provider was unable to create an attribute" -QgsVectorLayerExporter.ErrProjection = Qgis.VectorExportResult.ErrorProjectingFeatures -QgsVectorLayerExporter.ErrProjection.is_monkey_patched = True -QgsVectorLayerExporter.ErrProjection.__doc__ = "An error occurred while reprojecting features to destination CRS" -QgsVectorLayerExporter.ErrFeatureWriteFailed = Qgis.VectorExportResult.ErrorFeatureWriteFailed -QgsVectorLayerExporter.ErrFeatureWriteFailed.is_monkey_patched = True -QgsVectorLayerExporter.ErrFeatureWriteFailed.__doc__ = "An error occurred while writing a feature to the destination" -QgsVectorLayerExporter.ErrInvalidLayer = Qgis.VectorExportResult.ErrorInvalidLayer -QgsVectorLayerExporter.ErrInvalidLayer.is_monkey_patched = True -QgsVectorLayerExporter.ErrInvalidLayer.__doc__ = "Could not access newly created destination layer" -QgsVectorLayerExporter.ErrInvalidProvider = Qgis.VectorExportResult.ErrorInvalidProvider -QgsVectorLayerExporter.ErrInvalidProvider.is_monkey_patched = True -QgsVectorLayerExporter.ErrInvalidProvider.__doc__ = "Could not find a matching provider key" -QgsVectorLayerExporter.ErrProviderUnsupportedFeature = Qgis.VectorExportResult.ErrorProviderUnsupportedFeature -QgsVectorLayerExporter.ErrProviderUnsupportedFeature.is_monkey_patched = True -QgsVectorLayerExporter.ErrProviderUnsupportedFeature.__doc__ = "Provider does not support creation of empty layers" -QgsVectorLayerExporter.ErrConnectionFailed = Qgis.VectorExportResult.ErrorConnectionFailed -QgsVectorLayerExporter.ErrConnectionFailed.is_monkey_patched = True -QgsVectorLayerExporter.ErrConnectionFailed.__doc__ = "Could not connect to destination" -QgsVectorLayerExporter.ErrUserCanceled = Qgis.VectorExportResult.UserCanceled -QgsVectorLayerExporter.ErrUserCanceled.is_monkey_patched = True -QgsVectorLayerExporter.ErrUserCanceled.__doc__ = "User canceled the export" -Qgis.VectorExportResult.__doc__ = 'Vector layer export result codes.\n\n.. versionadded:: 3.20\n\n' + '* ``NoError``: ' + Qgis.VectorExportResult.Success.__doc__ + '\n' + '* ``ErrCreateDataSource``: ' + Qgis.VectorExportResult.ErrorCreatingDataSource.__doc__ + '\n' + '* ``ErrCreateLayer``: ' + Qgis.VectorExportResult.ErrorCreatingLayer.__doc__ + '\n' + '* ``ErrAttributeTypeUnsupported``: ' + Qgis.VectorExportResult.ErrorAttributeTypeUnsupported.__doc__ + '\n' + '* ``ErrAttributeCreationFailed``: ' + Qgis.VectorExportResult.ErrorAttributeCreationFailed.__doc__ + '\n' + '* ``ErrProjection``: ' + Qgis.VectorExportResult.ErrorProjectingFeatures.__doc__ + '\n' + '* ``ErrFeatureWriteFailed``: ' + Qgis.VectorExportResult.ErrorFeatureWriteFailed.__doc__ + '\n' + '* ``ErrInvalidLayer``: ' + Qgis.VectorExportResult.ErrorInvalidLayer.__doc__ + '\n' + '* ``ErrInvalidProvider``: ' + Qgis.VectorExportResult.ErrorInvalidProvider.__doc__ + '\n' + '* ``ErrProviderUnsupportedFeature``: ' + Qgis.VectorExportResult.ErrorProviderUnsupportedFeature.__doc__ + '\n' + '* ``ErrConnectionFailed``: ' + Qgis.VectorExportResult.ErrorConnectionFailed.__doc__ + '\n' + '* ``ErrUserCanceled``: ' + Qgis.VectorExportResult.UserCanceled.__doc__ -# -- -Qgis.VectorExportResult.baseClass = Qgis -# monkey patching scoped based enum -Qgis.DriveType.Unknown.__doc__ = "Unknown type" -Qgis.DriveType.Invalid.__doc__ = "Invalid path" -Qgis.DriveType.Removable.__doc__ = "Removable drive" -Qgis.DriveType.Fixed.__doc__ = "Fixed drive" -Qgis.DriveType.Remote.__doc__ = "Remote drive" -Qgis.DriveType.CdRom.__doc__ = "CD-ROM" -Qgis.DriveType.RamDisk.__doc__ = "RAM disk" -Qgis.DriveType.__doc__ = 'Drive types\n\n.. versionadded:: 3.20\n\n' + '* ``Unknown``: ' + Qgis.DriveType.Unknown.__doc__ + '\n' + '* ``Invalid``: ' + Qgis.DriveType.Invalid.__doc__ + '\n' + '* ``Removable``: ' + Qgis.DriveType.Removable.__doc__ + '\n' + '* ``Fixed``: ' + Qgis.DriveType.Fixed.__doc__ + '\n' + '* ``Remote``: ' + Qgis.DriveType.Remote.__doc__ + '\n' + '* ``CdRom``: ' + Qgis.DriveType.CdRom.__doc__ + '\n' + '* ``RamDisk``: ' + Qgis.DriveType.RamDisk.__doc__ -# -- -Qgis.DriveType.baseClass = Qgis -# monkey patching scoped based enum -Qgis.UnplacedLabelVisibility.FollowEngineSetting.__doc__ = "Respect the label engine setting" -Qgis.UnplacedLabelVisibility.NeverShow.__doc__ = "Never show unplaced labels, regardless of the engine setting" -Qgis.UnplacedLabelVisibility.__doc__ = 'Unplaced label visibility.\n\n.. versionadded:: 3.20\n\n' + '* ``FollowEngineSetting``: ' + Qgis.UnplacedLabelVisibility.FollowEngineSetting.__doc__ + '\n' + '* ``NeverShow``: ' + Qgis.UnplacedLabelVisibility.NeverShow.__doc__ -# -- -Qgis.UnplacedLabelVisibility.baseClass = Qgis -# The following has been generated automatically from src/core/providers/qgsabstractdatabaseproviderconnection.h -QgsAbstractDatabaseProviderConnection.TableFlag.baseClass = QgsAbstractDatabaseProviderConnection -QgsAbstractDatabaseProviderConnection.TableFlags.baseClass = QgsAbstractDatabaseProviderConnection -TableFlags = QgsAbstractDatabaseProviderConnection # dirty hack since SIP seems to introduce the flags in module -QgsAbstractDatabaseProviderConnection.Capability.baseClass = QgsAbstractDatabaseProviderConnection -QgsAbstractDatabaseProviderConnection.Capabilities.baseClass = QgsAbstractDatabaseProviderConnection -Capabilities = QgsAbstractDatabaseProviderConnection # dirty hack since SIP seems to introduce the flags in module -QgsAbstractDatabaseProviderConnection.GeometryColumnCapability.baseClass = QgsAbstractDatabaseProviderConnection -QgsAbstractDatabaseProviderConnection.GeometryColumnCapabilities.baseClass = QgsAbstractDatabaseProviderConnection -GeometryColumnCapabilities = QgsAbstractDatabaseProviderConnection # dirty hack since SIP seems to introduce the flags in module -# The following has been generated automatically from src/core/geometry/qgsabstractgeometry.h -QgsAbstractGeometry.SegmentationToleranceType.baseClass = QgsAbstractGeometry -# The following has been generated automatically from src/core/editform/qgsattributeeditorrelation.h -QgsAttributeEditorRelation.Button.baseClass = QgsAttributeEditorRelation -QgsAttributeEditorRelation.Buttons.baseClass = QgsAttributeEditorRelation -Buttons = QgsAttributeEditorRelation # dirty hack since SIP seems to introduce the flags in module -# The following has been generated automatically from src/core/auth/qgsauthmanager.h -QgsAuthManager.MessageLevel.baseClass = QgsAuthManager -# The following has been generated automatically from src/core/qgsdatasourceuri.h -QgsDataSourceUri.SslMode.baseClass = QgsDataSourceUri -# The following has been generated automatically from src/core/qgsdefaultvalue.h -QgsDefaultValue.__bool__ = lambda self: self.isValid() -# The following has been generated automatically from src/core/dxf/qgsdxfexport.h -# monkey patching scoped based enum -QgsDxfExport.ExportResult.Success.__doc__ = "Successful export" -QgsDxfExport.ExportResult.InvalidDeviceError.__doc__ = "Invalid device error" -QgsDxfExport.ExportResult.DeviceNotWritableError.__doc__ = "Device not writable error" -QgsDxfExport.ExportResult.EmptyExtentError.__doc__ = "Empty extent, no extent given and no extent could be derived from layers" -QgsDxfExport.ExportResult.__doc__ = 'The result of an export as dxf operation\n\n.. versionadded:: 3.10.1\n\n' + '* ``Success``: ' + QgsDxfExport.ExportResult.Success.__doc__ + '\n' + '* ``InvalidDeviceError``: ' + QgsDxfExport.ExportResult.InvalidDeviceError.__doc__ + '\n' + '* ``DeviceNotWritableError``: ' + QgsDxfExport.ExportResult.DeviceNotWritableError.__doc__ + '\n' + '* ``EmptyExtentError``: ' + QgsDxfExport.ExportResult.EmptyExtentError.__doc__ -# -- -# monkey patching scoped based enum -QgsDxfExport.VAlign.VBaseLine.__doc__ = "Top (0)" -QgsDxfExport.VAlign.VBottom.__doc__ = "Bottom (1)" -QgsDxfExport.VAlign.VMiddle.__doc__ = "Middle (2)" -QgsDxfExport.VAlign.VTop.__doc__ = "Top (3)" -QgsDxfExport.VAlign.Undefined.__doc__ = "Undefined" -QgsDxfExport.VAlign.__doc__ = 'Vertical alignments.\n\n' + '* ``VBaseLine``: ' + QgsDxfExport.VAlign.VBaseLine.__doc__ + '\n' + '* ``VBottom``: ' + QgsDxfExport.VAlign.VBottom.__doc__ + '\n' + '* ``VMiddle``: ' + QgsDxfExport.VAlign.VMiddle.__doc__ + '\n' + '* ``VTop``: ' + QgsDxfExport.VAlign.VTop.__doc__ + '\n' + '* ``Undefined``: ' + QgsDxfExport.VAlign.Undefined.__doc__ -# -- -# monkey patching scoped based enum -QgsDxfExport.HAlign.HLeft.__doc__ = "Left (0)" -QgsDxfExport.HAlign.HCenter.__doc__ = "Centered (1)" -QgsDxfExport.HAlign.HRight.__doc__ = "Right (2)" -QgsDxfExport.HAlign.HAligned.__doc__ = "Aligned = (3) (if VAlign==0)" -QgsDxfExport.HAlign.HMiddle.__doc__ = "Middle = (4) (if VAlign==0)" -QgsDxfExport.HAlign.HFit.__doc__ = "Fit into point = (5) (if VAlign==0)" -QgsDxfExport.HAlign.Undefined.__doc__ = "Undefined" -QgsDxfExport.HAlign.__doc__ = 'Horizontal alignments.\n\n' + '* ``HLeft``: ' + QgsDxfExport.HAlign.HLeft.__doc__ + '\n' + '* ``HCenter``: ' + QgsDxfExport.HAlign.HCenter.__doc__ + '\n' + '* ``HRight``: ' + QgsDxfExport.HAlign.HRight.__doc__ + '\n' + '* ``HAligned``: ' + QgsDxfExport.HAlign.HAligned.__doc__ + '\n' + '* ``HMiddle``: ' + QgsDxfExport.HAlign.HMiddle.__doc__ + '\n' + '* ``HFit``: ' + QgsDxfExport.HAlign.HFit.__doc__ + '\n' + '* ``Undefined``: ' + QgsDxfExport.HAlign.Undefined.__doc__ -# -- -# The following has been generated automatically from src/core/editform/qgseditformconfig.h -QgsEditFormConfig.EditorLayout.baseClass = QgsEditFormConfig -QgsEditFormConfig.FeatureFormSuppress.baseClass = QgsEditFormConfig -QgsEditFormConfig.PythonInitCodeSource.baseClass = QgsEditFormConfig -# The following has been generated automatically from src/core/qgsfieldproxymodel.h -QgsFieldProxyModel.Filters.baseClass = QgsFieldProxyModel -Filters = QgsFieldProxyModel # dirty hack since SIP seems to introduce the flags in module -# The following has been generated automatically from src/core/geocoding/qgsgeocoder.h -# monkey patching scoped based enum -QgsGeocoderInterface.Flag.GeocodesStrings.__doc__ = "Can geocode string input values" -QgsGeocoderInterface.Flag.GeocodesFeatures.__doc__ = "Can geocode QgsFeature input values" -QgsGeocoderInterface.Flag.__doc__ = 'Capability flags for the geocoder.\n\n' + '* ``GeocodesStrings``: ' + QgsGeocoderInterface.Flag.GeocodesStrings.__doc__ + '\n' + '* ``GeocodesFeatures``: ' + QgsGeocoderInterface.Flag.GeocodesFeatures.__doc__ -# -- -# The following has been generated automatically from src/core/geometry/qgsgeometry.h -QgsGeometry.OperationResult.baseClass = QgsGeometry -QgsGeometry.BufferSide.baseClass = QgsGeometry -QgsGeometry.EndCapStyle.baseClass = QgsGeometry -QgsGeometry.JoinStyle.baseClass = QgsGeometry -# The following has been generated automatically from src/core/geocms/geonode/qgsgeonoderequest.h -# monkey patching scoped based enum -QgsGeoNodeRequest.BackendServer.Unknown.__doc__ = "Unknown backend" -QgsGeoNodeRequest.BackendServer.QgisServer.__doc__ = "QGIS server used as backend" -QgsGeoNodeRequest.BackendServer.Geoserver.__doc__ = "Geoserver used as backend" -QgsGeoNodeRequest.BackendServer.__doc__ = 'GeoNode backend server type.\n\n' + '* ``Unknown``: ' + QgsGeoNodeRequest.BackendServer.Unknown.__doc__ + '\n' + '* ``QgisServer``: ' + QgsGeoNodeRequest.BackendServer.QgisServer.__doc__ + '\n' + '* ``Geoserver``: ' + QgsGeoNodeRequest.BackendServer.Geoserver.__doc__ -# -- -# The following has been generated automatically from src/core/labeling/qgslabellinesettings.h -# monkey patching scoped based enum -QgsLabelLineSettings.DirectionSymbolPlacement.SymbolLeftRight.__doc__ = "Place direction symbols on left/right of label" -QgsLabelLineSettings.DirectionSymbolPlacement.SymbolAbove.__doc__ = "Place direction symbols on above label" -QgsLabelLineSettings.DirectionSymbolPlacement.SymbolBelow.__doc__ = "Place direction symbols on below label" -QgsLabelLineSettings.DirectionSymbolPlacement.__doc__ = 'Placement options for direction symbols.\n\n' + '* ``SymbolLeftRight``: ' + QgsLabelLineSettings.DirectionSymbolPlacement.SymbolLeftRight.__doc__ + '\n' + '* ``SymbolAbove``: ' + QgsLabelLineSettings.DirectionSymbolPlacement.SymbolAbove.__doc__ + '\n' + '* ``SymbolBelow``: ' + QgsLabelLineSettings.DirectionSymbolPlacement.SymbolBelow.__doc__ -# -- -# monkey patching scoped based enum -QgsLabelLineSettings.AnchorType.HintOnly.__doc__ = "Line anchor is a hint for preferred placement only, but other placements close to the hint are permitted" -QgsLabelLineSettings.AnchorType.Strict.__doc__ = "Line anchor is a strict placement, and other placements are not permitted" -QgsLabelLineSettings.AnchorType.__doc__ = 'Line anchor types\n\n' + '* ``HintOnly``: ' + QgsLabelLineSettings.AnchorType.HintOnly.__doc__ + '\n' + '* ``Strict``: ' + QgsLabelLineSettings.AnchorType.Strict.__doc__ -# -- -# monkey patching scoped based enum -QgsLabelLineSettings.AnchorClipping.UseVisiblePartsOfLine.__doc__ = "Only visible parts of lines are considered when calculating the line anchor for labels" -QgsLabelLineSettings.AnchorClipping.UseEntireLine.__doc__ = "Entire original feature line geometry is used when calculating the line anchor for labels" -QgsLabelLineSettings.AnchorClipping.__doc__ = 'Clipping behavior for line anchor calculation.\n\n.. versionadded:: 3.20\n\n' + '* ``UseVisiblePartsOfLine``: ' + QgsLabelLineSettings.AnchorClipping.UseVisiblePartsOfLine.__doc__ + '\n' + '* ``UseEntireLine``: ' + QgsLabelLineSettings.AnchorClipping.UseEntireLine.__doc__ -# -- -# The following has been generated automatically from src/core/layout/qgslayoutmanager.h -QgsLayoutManagerProxyModel.Filters.baseClass = QgsLayoutManagerProxyModel -Filters = QgsLayoutManagerProxyModel # dirty hack since SIP seems to introduce the flags in module -# The following has been generated automatically from src/core/locator/qgslocatorfilter.h -QgsLocatorFilter.Priority.baseClass = QgsLocatorFilter -QgsLocatorFilter.Flags.baseClass = QgsLocatorFilter -Flags = QgsLocatorFilter # dirty hack since SIP seems to introduce the flags in module -# The following has been generated automatically from src/core/qgsmapclippingregion.h -# monkey patching scoped based enum -QgsMapClippingRegion.FeatureClippingType.ClipToIntersection.__doc__ = "Clip the geometry of these features to the region prior to rendering (i.e. feature boundaries will follow the clip region)" -QgsMapClippingRegion.FeatureClippingType.ClipPainterOnly.__doc__ = "Applying clipping on the painter only (i.e. feature boundaries will be unchanged, but may be invisible where the feature falls outside the clipping region)" -QgsMapClippingRegion.FeatureClippingType.NoClipping.__doc__ = "Only render features which intersect the clipping region, but do not clip these features to the region" -QgsMapClippingRegion.FeatureClippingType.__doc__ = 'Feature clipping behavior, which controls how features from vector layers\nwill be clipped.\n\n' + '* ``ClipToIntersection``: ' + QgsMapClippingRegion.FeatureClippingType.ClipToIntersection.__doc__ + '\n' + '* ``ClipPainterOnly``: ' + QgsMapClippingRegion.FeatureClippingType.ClipPainterOnly.__doc__ + '\n' + '* ``NoClipping``: ' + QgsMapClippingRegion.FeatureClippingType.NoClipping.__doc__ -# -- -# The following has been generated automatically from src/core/qgsmaplayer.h -QgsMapLayer.LayerFlag.baseClass = QgsMapLayer -QgsMapLayer.LayerFlags.baseClass = QgsMapLayer -LayerFlags = QgsMapLayer # dirty hack since SIP seems to introduce the flags in module -QgsMapLayer.StyleCategory.baseClass = QgsMapLayer -QgsMapLayer.StyleCategories.baseClass = QgsMapLayer -StyleCategories = QgsMapLayer # dirty hack since SIP seems to introduce the flags in module -# The following has been generated automatically from src/core/qgsmaplayermodel.h -QgsMapLayerModel.ItemDataRole.baseClass = QgsMapLayerModel -# The following has been generated automatically from src/core/qgsmaplayerproxymodel.h -QgsMapLayerProxyModel.Filters.baseClass = QgsMapLayerProxyModel -Filters = QgsMapLayerProxyModel # dirty hack since SIP seems to introduce the flags in module -# The following has been generated automatically from src/core/qgsmapsettingsutils.h -# monkey patching scoped based enum -QgsMapSettingsUtils.EffectsCheckFlag.IgnoreGeoPdfSupportedEffects.__doc__ = "Ignore advanced effects which are supported in GeoPDF exports" -QgsMapSettingsUtils.EffectsCheckFlag.__doc__ = 'Flags for controlling the behavior of :py:func:`~QgsMapSettingsUtils.containsAdvancedEffects`\n\n.. versionadded:: 3.14\n\n' + '* ``IgnoreGeoPdfSupportedEffects``: ' + QgsMapSettingsUtils.EffectsCheckFlag.IgnoreGeoPdfSupportedEffects.__doc__ -# -- -# The following has been generated automatically from src/core/network/qgsnetworkcontentfetcherregistry.h -QgsNetworkContentFetcherRegistry.FetchingMode.baseClass = QgsNetworkContentFetcherRegistry -# The following has been generated automatically from src/core/pointcloud/qgspointcloudattributemodel.h -QgsPointCloudAttributeProxyModel.Filters.baseClass = QgsPointCloudAttributeProxyModel -Filters = QgsPointCloudAttributeProxyModel # dirty hack since SIP seems to introduce the flags in module -# The following has been generated automatically from src/core/processing/qgsprocessingutils.h -# monkey patching scoped based enum -QgsProcessingUtils.UnknownType = QgsProcessingUtils.LayerHint.UnknownType -QgsProcessingUtils.UnknownType.is_monkey_patched = True -QgsProcessingUtils.LayerHint.UnknownType.__doc__ = "Unknown layer type" -QgsProcessingUtils.Vector = QgsProcessingUtils.LayerHint.Vector -QgsProcessingUtils.Vector.is_monkey_patched = True -QgsProcessingUtils.LayerHint.Vector.__doc__ = "Vector layer type" -QgsProcessingUtils.Raster = QgsProcessingUtils.LayerHint.Raster -QgsProcessingUtils.Raster.is_monkey_patched = True -QgsProcessingUtils.LayerHint.Raster.__doc__ = "Raster layer type" -QgsProcessingUtils.Mesh = QgsProcessingUtils.LayerHint.Mesh -QgsProcessingUtils.Mesh.is_monkey_patched = True -QgsProcessingUtils.LayerHint.Mesh.__doc__ = "Mesh layer type, since QGIS 3.6" -QgsProcessingUtils.LayerHint.__doc__ = 'Layer type hints.\n\n.. versionadded:: 3.4\n\n' + '* ``UnknownType``: ' + QgsProcessingUtils.LayerHint.UnknownType.__doc__ + '\n' + '* ``Vector``: ' + QgsProcessingUtils.LayerHint.Vector.__doc__ + '\n' + '* ``Raster``: ' + QgsProcessingUtils.LayerHint.Raster.__doc__ + '\n' + '* ``Mesh``: ' + QgsProcessingUtils.LayerHint.Mesh.__doc__ -# -- -# The following has been generated automatically from src/core/project/qgsproject.h -# monkey patching scoped based enum -QgsProject.FlagDontResolveLayers = QgsProject.ReadFlag.FlagDontResolveLayers -QgsProject.FlagDontResolveLayers.is_monkey_patched = True -QgsProject.ReadFlag.FlagDontResolveLayers.__doc__ = "Don't resolve layer paths (i.e. don't load any layer content). Dramatically improves project read time if the actual data from the layers is not required." -QgsProject.FlagDontLoadLayouts = QgsProject.ReadFlag.FlagDontLoadLayouts -QgsProject.FlagDontLoadLayouts.is_monkey_patched = True -QgsProject.ReadFlag.FlagDontLoadLayouts.__doc__ = "Don't load print layouts. Improves project read time if layouts are not required, and allows projects to be safely read in background threads (since print layouts are not thread safe)." -QgsProject.FlagTrustLayerMetadata = QgsProject.ReadFlag.FlagTrustLayerMetadata -QgsProject.FlagTrustLayerMetadata.is_monkey_patched = True -QgsProject.ReadFlag.FlagTrustLayerMetadata.__doc__ = "Trust layer metadata. Improves project read time. Do not use it if layers' extent is not fixed during the project's use by QGIS and QGIS Server." -QgsProject.FlagDontStoreOriginalStyles = QgsProject.ReadFlag.FlagDontStoreOriginalStyles -QgsProject.FlagDontStoreOriginalStyles.is_monkey_patched = True -QgsProject.ReadFlag.FlagDontStoreOriginalStyles.__doc__ = "Skip the initial XML style storage for layers. Useful for minimising project load times in non-interactive contexts." -QgsProject.ReadFlag.__doc__ = 'Flags which control project read behavior.\n\n.. versionadded:: 3.10\n\n' + '* ``FlagDontResolveLayers``: ' + QgsProject.ReadFlag.FlagDontResolveLayers.__doc__ + '\n' + '* ``FlagDontLoadLayouts``: ' + QgsProject.ReadFlag.FlagDontLoadLayouts.__doc__ + '\n' + '* ``FlagTrustLayerMetadata``: ' + QgsProject.ReadFlag.FlagTrustLayerMetadata.__doc__ + '\n' + '* ``FlagDontStoreOriginalStyles``: ' + QgsProject.ReadFlag.FlagDontStoreOriginalStyles.__doc__ -# -- -# monkey patching scoped based enum -QgsProject.FileFormat.Qgz.__doc__ = "Archive file format, supports auxiliary data" -QgsProject.FileFormat.Qgs.__doc__ = "Project saved in a clear text, does not support auxiliary data" -QgsProject.FileFormat.__doc__ = 'Flags which control project read behavior.\n\n.. versionadded:: 3.12\n\n' + '* ``Qgz``: ' + QgsProject.FileFormat.Qgz.__doc__ + '\n' + '* ``Qgs``: ' + QgsProject.FileFormat.Qgs.__doc__ -# -- -QgsProject.FileFormat.baseClass = QgsProject -# monkey patching scoped based enum -QgsProject.AvoidIntersectionsMode.AllowIntersections.__doc__ = "Overlap with any feature allowed when digitizing new features" -QgsProject.AvoidIntersectionsMode.AvoidIntersectionsCurrentLayer.__doc__ = "Overlap with features from the active layer when digitizing new features not allowed" -QgsProject.AvoidIntersectionsMode.AvoidIntersectionsLayers.__doc__ = "Overlap with features from a specified list of layers when digitizing new features not allowed" -QgsProject.AvoidIntersectionsMode.__doc__ = 'Flags which control how intersections of pre-existing feature are handled when digitizing new features.\n\n.. versionadded:: 3.14\n\n' + '* ``AllowIntersections``: ' + QgsProject.AvoidIntersectionsMode.AllowIntersections.__doc__ + '\n' + '* ``AvoidIntersectionsCurrentLayer``: ' + QgsProject.AvoidIntersectionsMode.AvoidIntersectionsCurrentLayer.__doc__ + '\n' + '* ``AvoidIntersectionsLayers``: ' + QgsProject.AvoidIntersectionsMode.AvoidIntersectionsLayers.__doc__ -# -- -QgsProject.AvoidIntersectionsMode.baseClass = QgsProject -# The following has been generated automatically from src/core/qgsproviderconnectionmodel.h -QgsProviderConnectionModel.Role.baseClass = QgsProviderConnectionModel -# The following has been generated automatically from src/core/providers/qgsprovidermetadata.h -QgsMeshDriverMetadata.MeshDriverCapability.baseClass = QgsMeshDriverMetadata -QgsMeshDriverMetadata.MeshDriverCapabilities.baseClass = QgsMeshDriverMetadata -MeshDriverCapabilities = QgsMeshDriverMetadata # dirty hack since SIP seems to introduce the flags in module -# monkey patching scoped based enum -QgsProviderMetadata.FilterType.FilterVector.__doc__ = "Vector layers" -QgsProviderMetadata.FilterType.FilterRaster.__doc__ = "Raster layers" -QgsProviderMetadata.FilterType.FilterMesh.__doc__ = "Mesh layers" -QgsProviderMetadata.FilterType.FilterMeshDataset.__doc__ = "Mesh datasets" -QgsProviderMetadata.FilterType.FilterPointCloud.__doc__ = "Point clouds (since QGIS 3.18)" -QgsProviderMetadata.FilterType.__doc__ = 'Type of file filters\n\n.. versionadded:: 3.10\n\n' + '* ``FilterVector``: ' + QgsProviderMetadata.FilterType.FilterVector.__doc__ + '\n' + '* ``FilterRaster``: ' + QgsProviderMetadata.FilterType.FilterRaster.__doc__ + '\n' + '* ``FilterMesh``: ' + QgsProviderMetadata.FilterType.FilterMesh.__doc__ + '\n' + '* ``FilterMeshDataset``: ' + QgsProviderMetadata.FilterType.FilterMeshDataset.__doc__ + '\n' + '* ``FilterPointCloud``: ' + QgsProviderMetadata.FilterType.FilterPointCloud.__doc__ -# -- -# The following has been generated automatically from src/core/raster/qgsrasterdataprovider.h -# monkey patching scoped based enum -QgsRasterDataProvider.ResamplingMethod.Nearest.__doc__ = "Nearest-neighbour resampling" -QgsRasterDataProvider.ResamplingMethod.Bilinear.__doc__ = "Bilinear (2x2 kernel) resampling" -QgsRasterDataProvider.ResamplingMethod.Cubic.__doc__ = "Cubic Convolution Approximation (4x4 kernel) resampling" -QgsRasterDataProvider.ResamplingMethod.CubicSpline.__doc__ = "Cubic B-Spline Approximation (4x4 kernel)" -QgsRasterDataProvider.ResamplingMethod.Lanczos.__doc__ = "Lanczos windowed sinc interpolation (6x6 kernel)" -QgsRasterDataProvider.ResamplingMethod.Average.__doc__ = "Average resampling" -QgsRasterDataProvider.ResamplingMethod.Mode.__doc__ = "Mode (selects the value which appears most often of all the sampled points)" -QgsRasterDataProvider.ResamplingMethod.Gauss.__doc__ = "Gauss blurring" -QgsRasterDataProvider.ResamplingMethod.__doc__ = 'Resampling method for provider-level resampling.\n\n.. versionadded:: 3.16\n\n' + '* ``Nearest``: ' + QgsRasterDataProvider.ResamplingMethod.Nearest.__doc__ + '\n' + '* ``Bilinear``: ' + QgsRasterDataProvider.ResamplingMethod.Bilinear.__doc__ + '\n' + '* ``Cubic``: ' + QgsRasterDataProvider.ResamplingMethod.Cubic.__doc__ + '\n' + '* ``CubicSpline``: ' + QgsRasterDataProvider.ResamplingMethod.CubicSpline.__doc__ + '\n' + '* ``Lanczos``: ' + QgsRasterDataProvider.ResamplingMethod.Lanczos.__doc__ + '\n' + '* ``Average``: ' + QgsRasterDataProvider.ResamplingMethod.Average.__doc__ + '\n' + '* ``Mode``: ' + QgsRasterDataProvider.ResamplingMethod.Mode.__doc__ + '\n' + '* ``Gauss``: ' + QgsRasterDataProvider.ResamplingMethod.Gauss.__doc__ -# -- -# The following has been generated automatically from src/core/raster/qgsrasterpipe.h -# monkey patching scoped based enum -QgsRasterPipe.ResamplingStage.ResampleFilter.__doc__ = "" -QgsRasterPipe.ResamplingStage.Provider.__doc__ = "" -QgsRasterPipe.ResamplingStage.__doc__ = 'Stage at which resampling occurs.\n\n.. versionadded:: 3.16\n\n' + '* ``ResampleFilter``: ' + QgsRasterPipe.ResamplingStage.ResampleFilter.__doc__ + '\n' + '* ``Provider``: ' + QgsRasterPipe.ResamplingStage.Provider.__doc__ -# -- -# The following has been generated automatically from src/core/raster/qgsrasterprojector.h -QgsRasterProjector.Precision.baseClass = QgsRasterProjector -# The following has been generated automatically from src/core/qgsrelation.h -QgsRelation.RelationType.baseClass = QgsRelation -QgsRelation.RelationStrength.baseClass = QgsRelation -# The following has been generated automatically from src/core/scalebar/qgsscalebarrenderer.h -# monkey patching scoped based enum -QgsScaleBarRenderer.Flag.FlagUsesLineSymbol.__doc__ = "Renderer utilizes the scalebar line symbol (see QgsScaleBarSettings::lineSymbol() )" -QgsScaleBarRenderer.Flag.FlagUsesFillSymbol.__doc__ = "Renderer utilizes the scalebar fill symbol (see QgsScaleBarSettings::fillSymbol() )" -QgsScaleBarRenderer.Flag.FlagUsesAlternateFillSymbol.__doc__ = "Renderer utilizes the alternate scalebar fill symbol (see QgsScaleBarSettings::alternateFillSymbol() )" -QgsScaleBarRenderer.Flag.FlagRespectsUnits.__doc__ = "Renderer respects the QgsScaleBarSettings::units() setting" -QgsScaleBarRenderer.Flag.FlagRespectsMapUnitsPerScaleBarUnit.__doc__ = "Renderer respects the QgsScaleBarSettings::mapUnitsPerScaleBarUnit() setting" -QgsScaleBarRenderer.Flag.FlagUsesUnitLabel.__doc__ = "Renderer uses the QgsScaleBarSettings::unitLabel() setting" -QgsScaleBarRenderer.Flag.FlagUsesSegments.__doc__ = "Renderer uses the scalebar segments" -QgsScaleBarRenderer.Flag.FlagUsesLabelBarSpace.__doc__ = "Renderer uses the QgsScaleBarSettings::labelBarSpace() setting" -QgsScaleBarRenderer.Flag.FlagUsesLabelVerticalPlacement.__doc__ = "Renderer uses the QgsScaleBarSettings::labelVerticalPlacement() setting" -QgsScaleBarRenderer.Flag.FlagUsesLabelHorizontalPlacement.__doc__ = "Renderer uses the QgsScaleBarSettings::labelHorizontalPlacement() setting" -QgsScaleBarRenderer.Flag.FlagUsesAlignment.__doc__ = "Renderer uses the QgsScaleBarSettings::alignment() setting" -QgsScaleBarRenderer.Flag.FlagUsesSubdivisions.__doc__ = "Renderer uses the scalebar subdivisions (see QgsScaleBarSettings::numberOfSubdivisions() )" -QgsScaleBarRenderer.Flag.FlagUsesDivisionSymbol.__doc__ = "Renderer utilizes the scalebar division symbol (see QgsScaleBarSettings::divisionLineSymbol() )" -QgsScaleBarRenderer.Flag.FlagUsesSubdivisionSymbol.__doc__ = "Renderer utilizes the scalebar subdivision symbol (see QgsScaleBarSettings::subdivisionLineSymbol() )" -QgsScaleBarRenderer.Flag.FlagUsesSubdivisionsHeight.__doc__ = "Renderer uses the scalebar subdivisions height (see QgsScaleBarSettings::subdivisionsHeight() )" -QgsScaleBarRenderer.Flag.__doc__ = 'Flags which control scalebar renderer behavior.\n\n.. versionadded:: 3.14\n\n' + '* ``FlagUsesLineSymbol``: ' + QgsScaleBarRenderer.Flag.FlagUsesLineSymbol.__doc__ + '\n' + '* ``FlagUsesFillSymbol``: ' + QgsScaleBarRenderer.Flag.FlagUsesFillSymbol.__doc__ + '\n' + '* ``FlagUsesAlternateFillSymbol``: ' + QgsScaleBarRenderer.Flag.FlagUsesAlternateFillSymbol.__doc__ + '\n' + '* ``FlagRespectsUnits``: ' + QgsScaleBarRenderer.Flag.FlagRespectsUnits.__doc__ + '\n' + '* ``FlagRespectsMapUnitsPerScaleBarUnit``: ' + QgsScaleBarRenderer.Flag.FlagRespectsMapUnitsPerScaleBarUnit.__doc__ + '\n' + '* ``FlagUsesUnitLabel``: ' + QgsScaleBarRenderer.Flag.FlagUsesUnitLabel.__doc__ + '\n' + '* ``FlagUsesSegments``: ' + QgsScaleBarRenderer.Flag.FlagUsesSegments.__doc__ + '\n' + '* ``FlagUsesLabelBarSpace``: ' + QgsScaleBarRenderer.Flag.FlagUsesLabelBarSpace.__doc__ + '\n' + '* ``FlagUsesLabelVerticalPlacement``: ' + QgsScaleBarRenderer.Flag.FlagUsesLabelVerticalPlacement.__doc__ + '\n' + '* ``FlagUsesLabelHorizontalPlacement``: ' + QgsScaleBarRenderer.Flag.FlagUsesLabelHorizontalPlacement.__doc__ + '\n' + '* ``FlagUsesAlignment``: ' + QgsScaleBarRenderer.Flag.FlagUsesAlignment.__doc__ + '\n' + '* ``FlagUsesSubdivisions``: ' + QgsScaleBarRenderer.Flag.FlagUsesSubdivisions.__doc__ + '\n' + '* ``FlagUsesDivisionSymbol``: ' + QgsScaleBarRenderer.Flag.FlagUsesDivisionSymbol.__doc__ + '\n' + '* ``FlagUsesSubdivisionSymbol``: ' + QgsScaleBarRenderer.Flag.FlagUsesSubdivisionSymbol.__doc__ + '\n' + '* ``FlagUsesSubdivisionsHeight``: ' + QgsScaleBarRenderer.Flag.FlagUsesSubdivisionsHeight.__doc__ -# -- -# The following has been generated automatically from src/core/settings/qgssettingsentry.h -# monkey patching scoped based enum -QgsSettingsEntryBase.SettingsType.Variant.__doc__ = "Generic variant" -QgsSettingsEntryBase.SettingsType.String.__doc__ = "String" -QgsSettingsEntryBase.SettingsType.StringList.__doc__ = "List of strings" -QgsSettingsEntryBase.SettingsType.Bool.__doc__ = "Boolean" -QgsSettingsEntryBase.SettingsType.Integer.__doc__ = "Integer" -QgsSettingsEntryBase.SettingsType.Double.__doc__ = "Double precision numer" -QgsSettingsEntryBase.SettingsType.EnumFlag.__doc__ = "Enum or Flag" -QgsSettingsEntryBase.SettingsType.Color.__doc__ = "Color" -QgsSettingsEntryBase.SettingsType.__doc__ = 'Types of settings entries\n\n' + '* ``Variant``: ' + QgsSettingsEntryBase.SettingsType.Variant.__doc__ + '\n' + '* ``String``: ' + QgsSettingsEntryBase.SettingsType.String.__doc__ + '\n' + '* ``StringList``: ' + QgsSettingsEntryBase.SettingsType.StringList.__doc__ + '\n' + '* ``Bool``: ' + QgsSettingsEntryBase.SettingsType.Bool.__doc__ + '\n' + '* ``Integer``: ' + QgsSettingsEntryBase.SettingsType.Integer.__doc__ + '\n' + '* ``Double``: ' + QgsSettingsEntryBase.SettingsType.Double.__doc__ + '\n' + '* ``EnumFlag``: ' + QgsSettingsEntryBase.SettingsType.EnumFlag.__doc__ + '\n' + '* ``Color``: ' + QgsSettingsEntryBase.SettingsType.Color.__doc__ -# -- -# The following has been generated automatically from src/core/qgssnappingconfig.h -QgsSnappingConfig.SnappingMode.baseClass = QgsSnappingConfig -QgsSnappingConfig.SnappingTypes.baseClass = QgsSnappingConfig -QgsSnappingConfig.SnappingTypeFlag.baseClass = QgsSnappingConfig -SnappingTypeFlag = QgsSnappingConfig # dirty hack since SIP seems to introduce the flags in module -QgsSnappingConfig.ScaleDependencyMode.baseClass = QgsSnappingConfig -# The following has been generated automatically from src/core/symbology/qgsstyle.h -# monkey patching scoped based enum -QgsStyle.TextFormatContext.Labeling.__doc__ = "Text format used in labeling" -QgsStyle.TextFormatContext.__doc__ = 'Text format context.\n\n.. versionadded:: 3.20\n\n' + '* ``Labeling``: ' + QgsStyle.TextFormatContext.Labeling.__doc__ -# -- -# The following has been generated automatically from src/core/symbology/qgsstyleentityvisitor.h -# monkey patching scoped based enum -QgsStyleEntityVisitorInterface.NodeType.Project.__doc__ = "QGIS Project node" -QgsStyleEntityVisitorInterface.NodeType.Layer.__doc__ = "Map layer" -QgsStyleEntityVisitorInterface.NodeType.SymbolRule.__doc__ = "Rule based symbology or label child rule" -QgsStyleEntityVisitorInterface.NodeType.Layouts.__doc__ = "Layout collection" -QgsStyleEntityVisitorInterface.NodeType.PrintLayout.__doc__ = "An individual print layout" -QgsStyleEntityVisitorInterface.NodeType.LayoutItem.__doc__ = "Individual item in a print layout" -QgsStyleEntityVisitorInterface.NodeType.Report.__doc__ = "A QGIS print report" -QgsStyleEntityVisitorInterface.NodeType.ReportHeader.__doc__ = "Report header section" -QgsStyleEntityVisitorInterface.NodeType.ReportFooter.__doc__ = "Report footer section" -QgsStyleEntityVisitorInterface.NodeType.ReportSection.__doc__ = "Report sub section" -QgsStyleEntityVisitorInterface.NodeType.Annotations.__doc__ = "Annotations collection" -QgsStyleEntityVisitorInterface.NodeType.Annotation.__doc__ = "An individual annotation" -QgsStyleEntityVisitorInterface.NodeType.__doc__ = 'Describes the types of nodes which may be visited by the visitor.\n\n' + '* ``Project``: ' + QgsStyleEntityVisitorInterface.NodeType.Project.__doc__ + '\n' + '* ``Layer``: ' + QgsStyleEntityVisitorInterface.NodeType.Layer.__doc__ + '\n' + '* ``SymbolRule``: ' + QgsStyleEntityVisitorInterface.NodeType.SymbolRule.__doc__ + '\n' + '* ``Layouts``: ' + QgsStyleEntityVisitorInterface.NodeType.Layouts.__doc__ + '\n' + '* ``PrintLayout``: ' + QgsStyleEntityVisitorInterface.NodeType.PrintLayout.__doc__ + '\n' + '* ``LayoutItem``: ' + QgsStyleEntityVisitorInterface.NodeType.LayoutItem.__doc__ + '\n' + '* ``Report``: ' + QgsStyleEntityVisitorInterface.NodeType.Report.__doc__ + '\n' + '* ``ReportHeader``: ' + QgsStyleEntityVisitorInterface.NodeType.ReportHeader.__doc__ + '\n' + '* ``ReportFooter``: ' + QgsStyleEntityVisitorInterface.NodeType.ReportFooter.__doc__ + '\n' + '* ``ReportSection``: ' + QgsStyleEntityVisitorInterface.NodeType.ReportSection.__doc__ + '\n' + '* ``Annotations``: ' + QgsStyleEntityVisitorInterface.NodeType.Annotations.__doc__ + '\n' + '* ``Annotation``: ' + QgsStyleEntityVisitorInterface.NodeType.Annotation.__doc__ -# -- -# The following has been generated automatically from src/core/qgstaskmanager.h -QgsTask.TaskStatus.baseClass = QgsTask -# The following has been generated automatically from src/core/textrenderer/qgstextcharacterformat.h -# monkey patching scoped based enum -QgsTextCharacterFormat.BooleanValue.NotSet.__doc__ = "Property is not set" -QgsTextCharacterFormat.BooleanValue.SetTrue.__doc__ = "Property is set and ``True``" -QgsTextCharacterFormat.BooleanValue.SetFalse.__doc__ = "Property is set and ``False``" -QgsTextCharacterFormat.BooleanValue.__doc__ = 'Status values for boolean format properties\n\n' + '* ``NotSet``: ' + QgsTextCharacterFormat.BooleanValue.NotSet.__doc__ + '\n' + '* ``SetTrue``: ' + QgsTextCharacterFormat.BooleanValue.SetTrue.__doc__ + '\n' + '* ``SetFalse``: ' + QgsTextCharacterFormat.BooleanValue.SetFalse.__doc__ -# -- -# The following has been generated automatically from src/core/qgstolerance.h -QgsTolerance.UnitType.baseClass = QgsTolerance -# The following has been generated automatically from src/core/qgsunittypes.h -QgsUnitTypes.SystemOfMeasurement.baseClass = QgsUnitTypes -QgsUnitTypes.DistanceUnit.baseClass = QgsUnitTypes -QgsUnitTypes.AreaUnit.baseClass = QgsUnitTypes -QgsUnitTypes.VolumeUnit.baseClass = QgsUnitTypes -QgsUnitTypes.AngleUnit.baseClass = QgsUnitTypes -QgsUnitTypes.TemporalUnit.baseClass = QgsUnitTypes -QgsUnitTypes.RenderUnit.baseClass = QgsUnitTypes -QgsUnitTypes.LayoutUnit.baseClass = QgsUnitTypes -# The following has been generated automatically from src/core/vector/qgsvectorlayer.h -QgsVectorLayer.EditResult.baseClass = QgsVectorLayer -QgsVectorLayer.SelectBehavior.baseClass = QgsVectorLayer -# The following has been generated automatically from src/core/vector/qgsvectorlayerserverproperties.h -QgsVectorLayerServerProperties.PredefinedWmsDimensionName.baseClass = QgsVectorLayerServerProperties -# The following has been generated automatically from src/core/qgsvectorsimplifymethod.h -QgsVectorSimplifyMethod.SimplifyHint.baseClass = QgsVectorSimplifyMethod -QgsVectorSimplifyMethod.SimplifyHints.baseClass = QgsVectorSimplifyMethod -SimplifyHints = QgsVectorSimplifyMethod # dirty hack since SIP seems to introduce the flags in module -QgsVectorSimplifyMethod.SimplifyAlgorithm.baseClass = QgsVectorSimplifyMethod -# The following has been generated automatically from src/core/geometry/qgswkbtypes.h -QgsWkbTypes.Type.baseClass = QgsWkbTypes -QgsWkbTypes.GeometryType.baseClass = QgsWkbTypes diff --git a/qgis/core/additions/__init__.py b/qgis/core/additions/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/qgis/core/additions/edit.py b/qgis/core/additions/edit.py deleted file mode 100644 index 92756d1..0000000 --- a/qgis/core/additions/edit.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - edit.py - --------------------- - Date : May 2018 - Copyright : (C) 2018 by Denis Rouzaud - Email : denis@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -from builtins import object - - -class QgsEditError(Exception): - - def __init__(self, value): - self.value = value - - def __str__(self): - return repr(self.value) - - -class edit(object): - - def __init__(self, layer): - self.layer = layer - - def __enter__(self): - assert self.layer.startEditing() - return self.layer - - def __exit__(self, ex_type, ex_value, traceback): - if ex_type is None: - if not self.layer.commitChanges(): - raise QgsEditError(self.layer.commitErrors()) - return True - else: - self.layer.rollBack() - return False diff --git a/qgis/core/additions/fromfunction.py b/qgis/core/additions/fromfunction.py deleted file mode 100644 index 79f19d3..0000000 --- a/qgis/core/additions/fromfunction.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - fromfunction.py - --------------------- - Date : May 2018 - Copyright : (C) 2018 by Denis Rouzaud - Email : denis@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -from .qgstaskwrapper import QgsTaskWrapper -from qgis._core import QgsTask - - -@staticmethod -def fromFunction(description, function, *args, on_finished=None, flags=QgsTask.AllFlags, **kwargs): - """ - Creates a new QgsTask task from a python function. - - Example: - - def calculate(task): - # pretend this is some complex maths and stuff we want - # to run in the background - return 5*6 - - def calculation_finished(exception, value=None): - if not exception: - iface.messageBar().pushMessage( - 'the magic number is {}'.format(value)) - else: - iface.messageBar().pushMessage( - str(exception)) - - task = QgsTask.fromFunction('my task', calculate, - on_finished=calculation_finished) - QgsApplication.taskManager().addTask(task) - - """ - - assert function - return QgsTaskWrapper(description, flags, function, on_finished, *args, **kwargs) diff --git a/qgis/core/additions/metaenum.py b/qgis/core/additions/metaenum.py deleted file mode 100644 index 9ffb427..0000000 --- a/qgis/core/additions/metaenum.py +++ /dev/null @@ -1,75 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - metaenum.py - --------------------- - Date : May 2018 - Copyright : (C) 2018 by Denis Rouzaud - Email : denis@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -META_OBJECT_BY_ENUM_CLASS = {} -META_ENUM_BY_ENUM_CLASS = {} - - -def metaEnumFromValue(enumValue, baseClass=None, raiseException=True): - """ - Returns the QMetaEnum for an enum value. - The enum must have declared using the Q_ENUM macro - :param enumValue: the enum value - :param baseClass: the enum base class. If not given, it will try to get it by using `enumValue.__class__.baseClass` - :param raiseException: if False, no exception will be raised and None will be return in case of failure - :return: the QMetaEnum if it succeeds, None otherwise - """ - return metaEnumFromType(enumValue.__class__, baseClass, raiseException) - - -def metaEnumFromType(enumClass, baseClass=None, raiseException=True): - """ - Returns the QMetaEnum for an enum type. - The enum must have declared using the Q_ENUM macro - :param enumClass: the enum class - :param baseClass: the enum base class. If not given, it will try to get it by using `enumValue.__class__.baseClass` - :param raiseException: if False, no exception will be raised and None will be return in case of failure - :return: the QMetaEnum if it succeeds, None otherwise - """ - global META_OBJECT_BY_ENUM_CLASS - global META_ENUM_BY_ENUM_CLASS - if enumClass in META_ENUM_BY_ENUM_CLASS: - return META_ENUM_BY_ENUM_CLASS[enumClass] - - if enumClass == int: - if raiseException: - raise TypeError("enumClass is an int, while it should be an enum") - else: - return None - - if baseClass is None: - try: - baseClass = enumClass.baseClass - return metaEnumFromType(enumClass, baseClass, raiseException) - except AttributeError: - if raiseException: - raise ValueError("Enum type does not implement baseClass method. Provide the base class as argument.") - - try: - meta_object = baseClass.staticMetaObject - META_OBJECT_BY_ENUM_CLASS[enumClass] = meta_object - idx = meta_object.indexOfEnumerator(enumClass.__name__) - meta_enum = meta_object.enumerator(idx) - META_ENUM_BY_ENUM_CLASS[enumClass] = meta_enum - except AttributeError: - if raiseException: - raise TypeError("could not get the metaEnum for {}".format(enumClass.__name__)) - meta_enum = None - - return meta_enum diff --git a/qgis/core/additions/processing.py b/qgis/core/additions/processing.py deleted file mode 100644 index 40e8f62..0000000 --- a/qgis/core/additions/processing.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - processing.py - --------------------- - Date : May 2018 - Copyright : (C) 2018 by Denis Rouzaud - Email : denis@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - - -# add some __repr__ methods to processing classes -def processing_source_repr(self): - if self.featureLimit != -1: - return "".format( - self.source.staticValue(), self.selectedFeaturesOnly, self.featureLimit) - else: - return "".format( - self.source.staticValue(), self.selectedFeaturesOnly) - - -def processing_output_layer_repr(self): - return "".format(self.sink.staticValue(), - self.createOptions) diff --git a/qgis/core/additions/projectdirtyblocker.py b/qgis/core/additions/projectdirtyblocker.py deleted file mode 100644 index 7f06bd0..0000000 --- a/qgis/core/additions/projectdirtyblocker.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - projectdirtyblocker.py - --------------------- - Date : May 2018 - Copyright : (C) 2018 by Denis Rouzaud - Email : denis@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - - -from qgis._core import QgsProjectDirtyBlocker - - -class ProjectDirtyBlocker(): - """ - Context manager used to block project setDirty calls. - - .. code-block:: python - - project = QgsProject.instance() - with QgsProject.blockDirtying(project): - # do something - - .. versionadded:: 3.2 - """ - - def __init__(self, project): - self.project = project - self.blocker = None - - def __enter__(self): - self.blocker = QgsProjectDirtyBlocker(self.project) - return self.project - - def __exit__(self, ex_type, ex_value, traceback): - del self.blocker - return ex_type is None diff --git a/qgis/core/additions/providermetadata.py b/qgis/core/additions/providermetadata.py deleted file mode 100644 index d188f6e..0000000 --- a/qgis/core/additions/providermetadata.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - providermetadata.py - --------------------- - Date : June 2019 - Copyright : (C) 2019 by Martin Dobias - Email : wonder dot sk at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -from qgis._core import QgsProviderMetadata - - -class PyProviderMetadata(QgsProviderMetadata): - """ wrapper around QgsProviderMetadata to keep the existing Python code running which registers - data providers by passing a custom python createProvider() function to QgsProviderMetadata - constructor. The proper new way of doing it is to subclass QgsProviderMetadata and implement - its virtual functions. - - TODO: QGIS 4 - remove this wrapper (only subclassing of QgsProviderMetadata should be used) - """ - - # this is a workaround to keep references to metadata classes - # so they are not removed when the variable gets out of scope - _kept_refs = [] - - def __init__(self, key, description, library_or_create_func=None): - super().__init__(key, description) - if callable(library_or_create_func): - self.createProvider = library_or_create_func - PyProviderMetadata._kept_refs.append(self) - - -PyProviderMetadata.__doc__ = QgsProviderMetadata.__doc__ diff --git a/qgis/core/additions/qgsfeature.py b/qgis/core/additions/qgsfeature.py deleted file mode 100644 index c94d188..0000000 --- a/qgis/core/additions/qgsfeature.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - qgsfeature.py - --------------------- - Date : May 2018 - Copyright : (C) 2018 by Denis Rouzaud - Email : denis@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - - -def mapping_feature(feature): - geom = feature.geometry() - fields = [field.name() for field in feature.fields()] - properties = dict(list(zip(fields, feature.attributes()))) - return {'type': 'Feature', - 'properties': properties, - 'geometry': geom.__geo_interface__} diff --git a/qgis/core/additions/qgsfunction.py b/qgis/core/additions/qgsfunction.py deleted file mode 100644 index caa3479..0000000 --- a/qgis/core/additions/qgsfunction.py +++ /dev/null @@ -1,172 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - qgsfunction.py - --------------------- - Date : May 2018 - Copyright : (C) 2018 by Denis Rouzaud - Email : denis@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - - -import inspect -import string -from builtins import str -from PyQt5.QtCore import QCoreApplication -from qgis._core import QgsExpressionFunction, QgsExpression, QgsMessageLog, QgsFeatureRequest, Qgis - - -def register_function(function, arg_count, group, usesgeometry=False, - referenced_columns=[QgsFeatureRequest.ALL_ATTRIBUTES], handlesnull=False, **kwargs): - """ - Register a Python function to be used as a expression function. - - Functions should take (values, feature, parent) as args: - - Example: - def myfunc(values, feature, parent): - pass - - They can also shortcut naming feature and parent args by using *args - if they are not needed in the function. - - Example: - def myfunc(values, *args): - pass - - Functions should return a value compatible with QVariant - - Eval errors can be raised using parent.setEvalErrorString("Error message") - - :param function: - :param arg_count: - :param group: - :param usesgeometry: - :param handlesnull: Needs to be set to True if this function does not always return NULL if any parameter is NULL. Default False. - :return: - """ - - class QgsPyExpressionFunction(QgsExpressionFunction): - - def __init__(self, func, name, args, group, helptext='', usesGeometry=True, - referencedColumns=QgsFeatureRequest.ALL_ATTRIBUTES, expandargs=False, handlesNull=False): - QgsExpressionFunction.__init__(self, name, args, group, helptext) - self.function = func - self.expandargs = expandargs - self.uses_geometry = usesGeometry - self.referenced_columns = referencedColumns - self.handles_null = handlesNull - - def func(self, values, context, parent, node): - feature = None - if context: - feature = context.feature() - - try: - if self.expandargs: - values.append(feature) - values.append(parent) - if inspect.getfullargspec(self.function).args[-1] == 'context': - values.append(context) - return self.function(*values) - else: - if inspect.getfullargspec(self.function).args[-1] == 'context': - self.function(values, feature, parent, context) - return self.function(values, feature, parent) - except Exception as ex: - parent.setEvalErrorString(str(ex)) - return None - - def usesGeometry(self, node): - return self.uses_geometry - - def referencedColumns(self, node): - return self.referenced_columns - - def handlesNull(self): - return self.handles_null - - helptemplate = string.Template("""

$name function


$doc""") - name = kwargs.get('name', function.__name__) - helptext = kwargs.get('helpText') or function.__doc__ or '' - helptext = helptext.strip() - expandargs = False - - if arg_count == "auto": - # Work out the number of args we need. - # Number of function args - 2. The last two args are always feature, parent. - args = inspect.getfullargspec(function).args - number = len(args) - arg_count = number - 2 - if args[-1] == 'context': - arg_count -= 1 - expandargs = True - - register = kwargs.get('register', True) - if register and QgsExpression.isFunctionName(name): - if not QgsExpression.unregisterFunction(name): - msgtitle = QCoreApplication.translate("UserExpressions", "User expressions") - msg = QCoreApplication.translate("UserExpressions", - "The user expression {0} already exists and could not be unregistered.").format( - name) - QgsMessageLog.logMessage(msg + "\n", msgtitle, Qgis.Warning) - return None - - function.__name__ = name - helptext = helptemplate.safe_substitute(name=name, doc=helptext) - f = QgsPyExpressionFunction(function, name, arg_count, group, helptext, usesgeometry, referenced_columns, - expandargs, handlesnull) - - # This doesn't really make any sense here but does when used from a decorator context - # so it can stay. - if register: - QgsExpression.registerFunction(f) - return f - - -def qgsfunction(args='auto', group='custom', **kwargs): - r""" - Decorator function used to define a user expression function. - - :param args: Number of parameters, set to 'auto' to accept a variable length of parameters. - :param group: The expression group to which this expression should be added. - :param \**kwargs: - See below - - :Keyword Arguments: - * *referenced_columns* (``list``) -- - An array of field names on which this expression works. Can be set to ``[QgsFeatureRequest.ALL_ATTRIBUTES]``. By default empty. - * *usesgeometry* (``bool``) -- - Defines if this expression requires the geometry. By default False. - * *handlesnull* (``bool``) -- - Defines if this expression has custom handling for NULL values. If False, the result will always be NULL as soon as any parameter is NULL. False by default. - - Example: - @qgsfunction(2, 'test'): - def add(values, feature, parent): - pass - - Will create and register a function in QgsExpression called 'add' in the - 'test' group that takes two arguments. - - or not using feature and parent: - - Example: - @qgsfunction(2, 'test'): - def add(values, *args): - pass - """ - - def wrapper(func): - return register_function(func, args, group, **kwargs) - - return wrapper diff --git a/qgis/core/additions/qgsgeometry.py b/qgis/core/additions/qgsgeometry.py deleted file mode 100644 index 59f3dd1..0000000 --- a/qgis/core/additions/qgsgeometry.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - qgsgeometry.py - --------------------- - Date : May 2018 - Copyright : (C) 2018 by Denis Rouzaud - Email : denis@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - - -def _geometryNonZero(self): - return not self.isEmpty() - - -def mapping_geometry(geometry): - geo = geometry.asJson() - # We have to use eval because exportToGeoJSON() gives us - # back a string that looks like a dictionary. - return eval(geo) diff --git a/qgis/core/additions/qgssettings.py b/qgis/core/additions/qgssettings.py deleted file mode 100644 index 570e92f..0000000 --- a/qgis/core/additions/qgssettings.py +++ /dev/null @@ -1,123 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - qgssettings.py - --------------------- - Date : May 2018 - Copyright : (C) 2018 by Denis Rouzaud - Email : denis@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -from .metaenum import metaEnumFromValue -from qgis.core import QgsSettings -import qgis # required to get base class of enums - - -def _qgssettings_enum_value(self, key, enumDefaultValue, section=QgsSettings.NoSection): - """ - Return the setting value for a setting based on an enum. - This forces the output to be a valid and existing entry of the enum. - Hence if the setting value is incorrect, the given default value is returned. - - :param self: the QgsSettings object - :param key: the setting key - :param enumDefaultValue: the default value as an enum value - :param section: optional section - :return: the setting value - - .. note:: The enum needs to be declared with Q_ENUM. - - """ - - meta_enum = metaEnumFromValue(enumDefaultValue) - if meta_enum is None or not meta_enum.isValid(): - # this should not happen - raise ValueError("could not get the meta enum for given enum default value (type: {})" - .format(enumDefaultValue.__class__)) - - str_val = self.value(key, meta_enum.valueToKey(enumDefaultValue), str, section) - # need a new meta enum as QgsSettings.value is making a copy and leads to seg fault (probably a PyQt issue) - meta_enum_2 = metaEnumFromValue(enumDefaultValue) - (enu_val, ok) = meta_enum_2.keyToValue(str_val) - - if not ok: - enu_val = enumDefaultValue - else: - # cast to the enum class - enu_val = enumDefaultValue.__class__(enu_val) - - return enu_val - - -def _qgssettings_set_enum_value(self, key, enumValue, section=QgsSettings.NoSection): - """ - Save the setting value for a setting based on an enum. - This forces the output to be a valid and existing entry of the enum. - The entry is saved as a string. - - :param self: the QgsSettings object - :param key: the setting key - :param enumValue: the value to be saved - :param section: optional section - :return: the setting value - - .. note:: The enum needs to be declared with Q_ENUM. - - """ - meta_enum = metaEnumFromValue(enumValue) - if meta_enum is None or not meta_enum.isValid(): - # this should not happen - raise ValueError("could not get the meta enum for given enum default value (type: {})".format(type(enumValue))) - - self.setValue(key, meta_enum.valueToKey(enumValue), section) - - -def _qgssettings_flag_value(self, key, flagDefaultValue, section=QgsSettings.NoSection): - """ - Return the setting value for a setting based on a flag. - This forces the output to be a valid and existing entry of the enum. - Hence if the setting value is incorrect, the given default value is returned. - - :param self: the QgsSettings object - :param key: the setting key - :param flagDefaultValue: the default value as a flag value - :param section: optional section - :return: the setting value - - .. note:: The flag needs to be declared with Q_FLAG (not Q_FLAGS). - - """ - - # There is an issue in SIP, flags.__class__ does not return the proper class - # (e.g. Filters instead of QgsMapLayerProxyModel.Filters) - # dirty hack to get the parent class - __import__(flagDefaultValue.__module__) - baseClass = None - exec("baseClass={module}.{flag_class}".format(module=flagDefaultValue.__module__.replace('_', ''), - flag_class=flagDefaultValue.__class__.__name__)) - - meta_enum = metaEnumFromValue(flagDefaultValue, baseClass) - if meta_enum is None or not meta_enum.isValid(): - # this should not happen - raise ValueError("could not get the meta enum for given enum default value (type: {})".format(type(flagDefaultValue))) - - str_val = self.value(key, meta_enum.valueToKeys(flagDefaultValue), str, section) - # need a new meta enum as QgsSettings.value is making a copy and leads to seg fault (probably a PyQt issue) - meta_enum_2 = metaEnumFromValue(flagDefaultValue) - (flag_val, ok) = meta_enum_2.keysToValue(str_val) - - if not ok: - flag_val = flagDefaultValue - else: - flag_val = flagDefaultValue.__class__(flag_val) - - return flag_val diff --git a/qgis/core/additions/qgssettingsentry.py b/qgis/core/additions/qgssettingsentry.py deleted file mode 100644 index 2ec8693..0000000 --- a/qgis/core/additions/qgssettingsentry.py +++ /dev/null @@ -1,123 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - qgssettingsentry.py - --------------------- - Date : April 2021 - Copyright : (C) 2021 by Damiano Lombardi - Email : damiano@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -from .metaenum import metaEnumFromValue -from qgis.core import QgsSettings, QgsSettingsEntryBase, QgsLogger -import qgis # required to get base class of enums - - -class PyQgsSettingsEntryEnumFlag(QgsSettingsEntryBase): - """ - class PyQgsSettingsEntryEnumFlag - An enum settings entry. - since QGIS 3.20 - """ - - def __init__(self, key, pluginName, defaultValue, description=str()): - """ - Constructor for PyQgsSettingsEntryEnumFlag. - :param key: argument specifies the final part of the settings key. - :param pluginName: argument is inserted in the key after the section. - :param defaultValue: argument specifies the default value for the settings entry. - :param description: argument specifies a description for the settings entry. - """ - - defaultValueStr = str() - self.__metaEnum = metaEnumFromValue(defaultValue) - if self.__metaEnum is None or not self.__metaEnum.isValid(): - QgsLogger.debug("Invalid metaenum. Enum/Flag probably misses Q_ENUM/Q_FLAG declaration. Settings key: '{0}'".format(self.key())) - else: - if self.__metaEnum.isFlag(): - defaultValueStr = self.__metaEnum.valueToKeys(defaultValue) - else: - defaultValueStr = self.__metaEnum.valueToKey(defaultValue) - self.__enumFlagClass = defaultValue.__class__ - - super().__init__(key, pluginName, defaultValueStr, description) - - def value(self, dynamicKeyPart=None, useDefaultValueOverride=False, defaultValueOverride=None): - """ - Get settings value. - :param dynamicKeyPart: argument specifies the dynamic part of the settings key. - :param useDefaultValueOverride: argument specifies if defaultValueOverride should be used. - :param defaultValueOverride: argument if valid is used instead of the normal default value. - """ - - defaultValue = self.defaultValue() - if useDefaultValueOverride: - defaultValue = defaultValueOverride - - if self.__metaEnum.isFlag(): - return QgsSettings().flagValue(self.key(dynamicKeyPart), - defaultValue, - self.section()) - else: - return QgsSettings().enumValue(self.key(dynamicKeyPart), - defaultValue, - self.section()) - - def defaultValue(self): - """ - Get settings default value. - """ - - if self.__metaEnum is None or not self.__metaEnum.isValid(): - QgsLogger.debug("Invalid metaenum. Enum/Flag probably misses Q_ENUM/Q_FLAG declaration. Settings key: '{0}'".format(self.key())) - return -1 - - defaultValueString = self.defaultValueAsVariant() - if self.__metaEnum.isFlag(): - (defaultValue, ok) = self.__metaEnum.keysToValue(defaultValueString) - else: - (defaultValue, ok) = self.__metaEnum.keyToValue(defaultValueString) - if not ok: - QgsLogger.debug("Invalid enum/flag key/s '{0}'.".format(self.defaultValueAsVariant())) - return -1 - - # cast to the enum class - defaultValue = self.__enumFlagClass(defaultValue) - return defaultValue - - def setValue(self, value, dynamicKeyPart=None): - """ - Set settings value. - :param dynamicKeyPart: argument specifies the dynamic part of the settings key. - """ - - if self.__metaEnum is None or not self.__metaEnum.isValid(): - QgsLogger.debug("Invalid metaenum. Enum/Flag probably misses Q_ENUM/Q_FLAG declaration. Settings key: '{0}'".format(self.key())) - return False - - enumFlagKey = str() - if self.__metaEnum.isFlag(): - enumFlagKey = self.__metaEnum.valueToKeys(value) - else: - enumFlagKey = self.__metaEnum.valueToKey(value) - if not enumFlagKey: - QgsLogger.debug("Invalid enum/flag value '{0}'.".format(value)) - return False - - return super().setVariantValue(enumFlagKey, dynamicKeyPart) - - def settingsType(self): - """ - Get the settings entry type. - """ - - return self.SettingsType.EnumFlag diff --git a/qgis/core/additions/qgstaskwrapper.py b/qgis/core/additions/qgstaskwrapper.py deleted file mode 100644 index 6c2b756..0000000 --- a/qgis/core/additions/qgstaskwrapper.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - qgstaskwrapper.py - --------------------- - Date : May 2018 - Copyright : (C) 2018 by Denis Rouzaud - Email : denis@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - - -from qgis._core import QgsTask - - -class QgsTaskWrapper(QgsTask): - - def __init__(self, description, flags, function, on_finished, *args, **kwargs): - QgsTask.__init__(self, description, flags) - self.args = args - self.kwargs = kwargs - self.function = function - self.on_finished = on_finished - self.returned_values = None - self.exception = None - - def run(self): - try: - self.returned_values = self.function(self, *self.args, **self.kwargs) - except Exception as ex: - # report error - self.exception = ex - return False - - return True - - def finished(self, result): - if not self.on_finished: - return - - if not result and self.exception is None: - self.exception = Exception('Task canceled') - - try: - if self.returned_values: - self.on_finished(self.exception, self.returned_values) - else: - self.on_finished(self.exception) - except Exception as ex: - self.exception = ex diff --git a/qgis/core/additions/ranges.py b/qgis/core/additions/ranges.py deleted file mode 100644 index 53dfa1a..0000000 --- a/qgis/core/additions/ranges.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - ranges.py - --------------------- - Date : Mar 2021 - Copyright : (C) 2021 by Nyall Dawson - Email : nyall dot dawson at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" -from PyQt5.QtCore import Qt - - -# add some __repr__ methods to QGIS range classes. We can't do this via sip because they are template based classes - - -def datetime_range_repr(self): - return f"" - - -def date_range_repr(self): - return f"" diff --git a/qgis/core/additions/readwritecontextentercategory.py b/qgis/core/additions/readwritecontextentercategory.py deleted file mode 100644 index af9c509..0000000 --- a/qgis/core/additions/readwritecontextentercategory.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - readwritecontextentercategory.py - --------------------- - Date : May 2018 - Copyright : (C) 2018 by Denis Rouzaud - Email : denis@opengis.ch -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - - -class ReadWriteContextEnterCategory(): - """ - Push a category to the stack - - .. code-block:: python - - context = QgsReadWriteContext() - with QgsReadWriteContext.enterCategory(context, category, details): - # do something - - .. versionadded:: 3.2 - """ - - def __init__(self, context, category_name, details=None): - self.context = context - self.category_name = category_name - self.details = details - self.popper = None - - def __enter__(self): - self.popper = self.context._enterCategory(self.category_name, self.details) - return self.context - - def __exit__(self, ex_type, ex_value, traceback): - del self.popper - return ex_type is None diff --git a/qgis/core/additions/runtimeprofiler.py b/qgis/core/additions/runtimeprofiler.py deleted file mode 100644 index 2216f56..0000000 --- a/qgis/core/additions/runtimeprofiler.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - runtimeprofiler.py - --------------------- - Date : May 2020 - Copyright : (C) 2020 by Nyall Dawson - Email : nyall dot dawson at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - - -from qgis._core import QgsScopedRuntimeProfile - - -class ScopedRuntimeProfileContextManager(): - """ - Context manager used to profile blocks of code in the QgsApplication.profiler() registry. - - .. code-block:: python - - with QgsRuntimeProfiler.profile('My operation'): - # do something - - .. versionadded:: 3.14 - """ - - def __init__(self, operation): - self.operation = operation - self.profiler = None - - def __enter__(self): - self.profiler = QgsScopedRuntimeProfile(self.operation) - return self.operation - - def __exit__(self, ex_type, ex_value, traceback): - del self.profiler - return ex_type is None diff --git a/qgis/core/additions/validitycheck.py b/qgis/core/additions/validitycheck.py deleted file mode 100644 index 25fdd15..0000000 --- a/qgis/core/additions/validitycheck.py +++ /dev/null @@ -1,95 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - validitycheck.py - --------------------- - Date : January 2019 - Copyright : (C) 2019 by Nyall Dawson - Email : nyall dot dawson at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" -from qgis._core import ( - QgsAbstractValidityCheck, - QgsApplication) - - -class CheckFactory: - """ - Constructs QgsAbstractValidityChecks using a decorator. - - To use, Python based checks should use the decorator syntax: - - .. highlight:: python - .. code-block:: python - @check.register(type=QgsAbstractValidityCheck.TypeLayoutCheck) - def my_layout_check(context, feedback): - results = ... - return results - - """ - - def __init__(self): - # unfortunately /Transfer/ annotation isn't working correct on validityCheckRegistry().addCheck(), - # so we manually need to store a reference to all checks we register - self.checks = [] - - def register(self, type, *args, **kwargs): - """ - Implements a decorator for registering Python based checks. - - :param type: check type, e.g. QgsAbstractValidityCheck.TypeLayoutCheck - """ - - def dec(f): - check = CheckWrapper(check_type=type, check_func=f) - self.checks.append(check) - QgsApplication.validityCheckRegistry().addCheck(check) - - return dec - - -class CheckWrapper(QgsAbstractValidityCheck): - """ - Wrapper object used to create new validity checks from @check. - """ - - def __init__(self, check_type, check_func): - """ - Initializer for CheckWrapper. - - :param check_type: check type, e.g. QgsAbstractValidityCheck.TypeLayoutCheck - :param check_func: test function, should return a list of QgsValidityCheckResult results - """ - super().__init__() - self._check_type = check_type - self._results = [] - self._check_func = check_func - - def create(self): - return CheckWrapper(check_type=self._check_type, check_func=self._check_func) - - def id(self): - return self._check_func.__name__ - - def checkType(self): - return self._check_type - - def prepareCheck(self, context, feedback): - self._results = self._check_func(context, feedback) - if self._results is None: - self._results = [] - return True - - def runCheck(self, context, feedback): - return self._results - - -check = CheckFactory() diff --git a/qgis/core/contextmanagers.py b/qgis/core/contextmanagers.py deleted file mode 100644 index e3d0c18..0000000 --- a/qgis/core/contextmanagers.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - contextmanagers.py - --------------------- - Date : May 2014 - Copyright : (C) 2014 by Nathan Woodrow - Email : woodrow dot nathan at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -__author__ = 'Nathan Woodrow' -__date__ = 'May 2014' -__copyright__ = '(C) 2014, Nathan Woodrow' - -import sys -from contextlib import contextmanager -from qgis.core import QgsApplication - - -@contextmanager -def qgisapp(args=None, guienabled=True, configpath=None, sysexit=True): - """ - Create a new QGIS Qt application. - - You should use this before creating any Qt widgets or QGIS objects for - your custom QGIS based application. - - usage: - from qgis.core.contextmanagers import qgisapp - - def main(app): - # Run your main code block - - with qgisapp(sys.argv) as app: - main(app) - - args - args passed to the underlying QApplication. - guienabled - True by default will create a QApplication with a GUI. Pass - False if you wish to create no GUI based app, e.g a server app. - configpath - Custom config path QGIS will use to load settings. - sysexit - Call sys.exit on app exit. True by default. - """ - if not args: - args = [] - app = QgsApplication(args, guienabled, configpath) - QgsApplication.initQgis() - yield app - if guienabled: - exitcode = app.exec_() - else: - exitcode = 0 - QgsApplication.exitQgis() - if sysexit: - sys.exit(exitcode)