337 Commits

Author SHA1 Message Date
Nyall Dawson
626df694fa Avoid multiple doc strings copies, add comments 2024-08-17 19:59:17 +10:00
Nyall Dawson
532129abf7 Improve processing monkey patching
"forward declare" functions which will be patched when the processing
plugin starts, so that these are known and accessible during the PyQGIS
doc building. Also make these forward declared versions raise
QgsNotSupportedException, so that its clear why they aren't working
when the processing plugin hasn't started

Fixes https://github.com/qgis/pyqgis-api-docs-builder/issues/38
2024-08-17 19:59:17 +10:00
Even Rouault
07067d37b5 python/plugins: turn on GDAL exceptions to avoid deprecation warning
Fixes #57344
2024-05-22 13:34:35 +10:00
Nyall Dawson
ad91789f9e Fix pyqt5_to_pyqt6 double unnesting some enums 2024-02-12 12:19:10 +10:00
Andrea Giudiceandrea
247cadce38 [processing] Don't show hidden parameters in algorithmHelp 2024-02-10 09:24:07 +10:00
Nyall Dawson
8e00d4befa Don't use raw ints as enum values 2024-01-30 19:10:43 +10:00
Nyall Dawson
e42abf7dc5 Update python files 2024-01-22 05:46:15 +10:00
Nyall Dawson
c16a1e2b3d Update enums 2024-01-19 19:44:48 +10:00
Loïc Bartoletti
c298bda614 Update python/plugins/processing/tools/dataobjects.py
Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
2023-07-05 06:06:10 +10:00
Loïc Bartoletti
09ac50fd36 move logic to QgsProcessingUtils and create a convenient method resolveDefaultEncoding() 2023-07-05 06:06:10 +10:00
Loïc Bartoletti
9bd8c1298c Processing: determine and set default encoding from locale
A shapefile can have a .cpg file to determine its encoding.
However, in processing, this file is not created when the
encoding is set to the magic "System" value.

This PR aims to propose to automatically determine the system
encoding using QT's codecForLocale.

So, even when using the magic "System" value, the cpg file
will be created with the true system encoding name.

Fixes #50603
2023-07-05 06:06:10 +10:00
Etienne Trimaille
3cab3c43a2
Python - Run pyupgrade on the processing plugin 2023-04-24 10:03:57 +02:00
Nyall Dawson
30598b9ad9 Pass QgsProcessingContext on to all processing functions which
generate temporary file names
2023-03-21 03:50:08 +10:00
Nyall Dawson
b752d56186 Remove some unused methods 2022-03-30 15:41:23 +10:00
David Marteau
467dd26de0
Fix 'mkdir' in python processing tools 2021-04-28 11:26:39 +02:00
Denis Rouzaud
eddf6feb45 modernize CMakeLists.txt files 2020-11-12 07:14:46 +10:00
Vincent Cloarec
1fbba79a0f
Mesh export processes, first part : infrastructure and export vertices (#39664)
[processing] Infrastructure for QgsMeshLayer to add processing algorithms, dataset group paramater and dataset time parameter to allow the user to easily choose a dataset.
2020-11-03 06:05:28 +01:00
Etienne Trimaille
6076950c68 Add help string for parameters in Processing 2020-09-21 11:05:34 +10:00
Nyall Dawson
4edc7d11d9 Drop postgis GeoDB class from Processing
This class is unused and is a near 1:1 copy of the core connections API
+ db manager classes
2020-03-17 15:10:53 +10:00
Nyall Dawson
3c3efe5f7a Remove unused spatialite python connection class 2020-03-17 15:10:53 +10:00
Nyall Dawson
3b8565115a Also lazy load numpy 2019-11-17 17:08:12 +10:00
Alessandro Pasotti
6c9f01e28d Fix postgis 12 adscr -> adbin consrc -> conbin 2019-11-06 12:53:52 +01:00
Juergen E. Fischer
b81d306047 spelling fixes (closes #32408) 2019-10-26 10:50:30 +10:00
Nyall Dawson
3112332227 Rename variable for clarity 2019-10-09 15:01:51 +10:00
Nyall Dawson
cb06519d16 [api] Add API to indicate that individual layers may be loaded without any
CRS validation, regardless of the user's settings

This avoids hacks put in place in other parts of QGIS code or in plugins
to temporarily deactivate the CRS validation prompt, providing a supported,
stable method to indicate that when loading a particular layer no CRS
validation is required.
2019-10-09 15:01:51 +10:00
Paul Wittle
be25b2e392 Update general.py
Correction of error return type from bool to None (as per comments). This is to resolve unexpected exception messages when algorithm is not found.
2019-09-20 09:27:30 +01:00
Alessandro Pasotti
fd4895b9fb processing postgis connector quote indexes names 2019-05-22 18:28:35 +02:00
Alessandro Pasotti
ad24b87601 Add missing error class and quote identifiers
Fixes #22035 - case sensitive schema
2019-05-22 18:15:19 +02:00
Bas Couwenberg
2628c480c5 Don't include revision in sources.
Prevent changes to files that weren't changed between releases.
This eases review of the changes between releases significantly.
2019-05-17 16:47:47 +02:00
Nyall Dawson
234c1718c4 Mark some Processing methods as deprecated 2019-03-28 11:47:23 +10:00
Nyall Dawson
f758d8b282 Ensure all public, stable API methods for Processing have nice docstrings 2019-03-28 11:47:23 +10:00
Nyall Dawson
7f7c7a9789 [processing][needs-docs] Add friendlier API for running algorithms as sub-steps
of main algorithm

Using code like:

    buffered_layer = processing.run(..., context, feedback)['OUTPUT']
    ...
    return {'OUTPUT': buffered_layer}

can cause issues if done as a sub-step of a larger processing algorithm. This
is because ownership of the generated layer is transferred to the caller
(Python) by processing.run. When the algorithm returns, Processing
attempts to move ownership of the layer from the context to the caller,
resulting in a crash.

(This is by design, because processing.run has been optimised for the
most common use case, which is one-off execution of algorithms as part
of a script, not as part of another processing algorithm. Accordingly
by design it returns layers and ownership to the caller, making things
easier for callers as they do not then have to resolve the layer reference
from the context object and handle ownership themselves)

This commit adds a new "is_child_algorithm" argument to processing.run.
For algorithms which are executed as sub-steps of a larger algorithm
is_child_algorithm should be set to True to avoid any ownership issues
with layers. E.g.

    buffered_layer = processing.run(..., context, feedback, is_child_algorithm=True)['OUTPUT']
    ...
    return {'OUTPUT': buffered_layer}
2019-01-29 18:04:16 +11:00
Víctor Olaya
1b4a9132c2 [processing] avoid exception when listing DB schemas
do not fail if cert file cannot be deleted when creating GeoDB object

fixes #21099
2019-01-29 08:01:20 +11:00
Juergen E. Fischer
196024ccba typo fixes 2019-01-01 21:53:37 +01:00
Nyall Dawson
0e928e8191 [processing] Correctly set parent widgets for algorithm dialogs
to avoid dialogs immediately going out of scope and being garbage
collected
2018-11-23 20:32:16 +11:00
Nyall Dawson
85efc77bb4 Fix inefficient calls to QgsFeature.attributes()[idx]
Replace with just f[idx]. Calling QgsFeature.attributes()
allocates a list of all attributes, which is inefficient
when only a single attribute value is needed.
2018-10-31 08:42:51 +10:00
Nyall Dawson
6e06c32a10 [processing] Fix crash when an algorithm dialog is left open and
processing options are changed

Make sure the algorithm dialogs use their own copy of algorithms,
instead of the copies owned by the processing registry. Opening
processing options triggers a full reload of providers, deleting
all existing algorithm instances from the registry first.
2018-09-25 10:32:20 +10:00
Nyall Dawson
16ac437780 [processing] Fix bar and box plot exception when category field has NULL values 2018-06-20 08:07:23 +10:00
Nyall Dawson
cbbe905fae [processing] Fix missing schemas in postgis destination selection panel 2018-06-06 06:27:03 +10:00
Tom Chadwin
fab563fe71 Processing: avoid deprecated regex
Invalid escape sequence avoided via raw string:

`re.findall("\d+|[a-zA-Z]+", rep[0][0])` > `re.findall(r"\d+|[a-zA-Z]+", rep[0][0])`
2018-06-06 06:24:24 +10:00
Nyall Dawson
612d61dc09 [processing] Tweak algorithHelp formatting 2018-05-31 15:27:34 +10:00
Nyall Dawson
db916bc238 [processing] Show accepted data types for parameters in processing.algorithmHelp 2018-05-31 15:27:34 +10:00
Nyall Dawson
0d21bd0429 [processing] Include description in algorithmHelp output 2018-05-17 08:50:39 +10:00
Nyall Dawson
f4599f13f1 [processing][gdal] Better error messages when invalid parameters are passed 2018-05-06 19:19:45 +10:00
gacarrillor
f07cd2f5b9 [processing] Add comment to make it clear why we need to close the dialog here 2018-05-02 23:46:42 -05:00
gacarrillor
387e724b0f [processing] Refactor Fields algorithm: avoid unnecessary confirmation dialogs 2018-04-30 11:14:36 -05:00
Alexander Bruy
23a5dd3197 [processing] fix file permissions 2018-02-06 19:25:48 +02:00
Nyall Dawson
b8defc113c When processing tasks are clicked in task manager, reopen the
algorithm dialog
2018-01-16 19:45:40 +10:00
Nyall Dawson
5f7aa45aab [needs-docs][processing] Add methods to show algorithm dialog
Adds processing.createAlgorithmDialog and
processing.execAlgorithmDialog. These methods can be used
to create and execute algorithm dialogs for a specified algorithm,
optionally pre-populated with a given set of (non-default) parameter
values.
2017-12-21 11:01:49 +10:00
Alexander Bruy
79d83f2066 [processing] use core methods for raster and vector extensions handling 2017-12-11 09:38:14 +02:00