42 Commits

Author SHA1 Message Date
Nyall Dawson
d3870937b2 [processing] When exporting a model to a python script, include
helpful comments next to all static enum parameter values used
in child algorithms with the corresponding text.

I.e. instead of

  alg_params = {
    'END_CAP_STYLE': 2,
  }

we now export

  alg_params = {
    'END_CAP_STYLE': 2,  # Flat
  }

Much more readable!
2021-04-09 11:45:53 +10:00
Denis Rouzaud
ba8a445850 run sipify 2021-03-22 21:13:52 +01:00
Nyall Dawson
50b9beaad6 [sipify] Catch more class references and insert :py:class: annotations 2021-01-31 05:41:22 +10:00
Nyall Dawson
81a9db9f57 [sipify] Fix creation of cross references 2020-06-15 13:43:58 +10:00
Nyall Dawson
3b3c7d8012 Hookup model logic for correct skipping of branches which shouldn't be run 2020-04-16 16:02:53 +10:00
Nyall Dawson
e3955df564 Add method to model API to get available dependencies for a child algorithm 2020-04-16 16:02:53 +10:00
Nyall Dawson
b2167594fe Make handling of processing child algorithm dependencies more flexible
Instead of just using child ID strings, use a new dedicated class to
store dependency information
2020-04-16 16:02:53 +10:00
Nyall Dawson
7fd72f3b4e [FEATURE][processing] Allow reordering model inputs
Instead of forcing a quasi-random ordering of inputs for models,
this commit exposes a new "Reorder Model Inputs" option in the model
designer which allows users control over the exact order of
inputs to show users for their model.

No more illogical ordering like showing a field choice before the
layer choice it's based on!

Sponsored by NaturalGIS
2020-04-16 06:03:48 +10:00
Nyall Dawson
b9a99890b4 Add method to validate a whole model 2020-04-14 20:27:21 +10:00
Nyall Dawson
9f7c7fcb35 Add method to validate a child algorithm in a model
Checks that the algorithm has valid values for all inputs
2020-04-14 20:27:21 +10:00
Nyall Dawson
47f96e2466 [FEATURE][processing] Allow copying/cut/paste of model components
This commit allows users to copy and paste model components, both
within the same model and between different models
2020-04-14 14:36:02 +10:00
Nyall Dawson
d20a3bddc0 [FEATURE][processing] Port output parameter wrappers to new c++ API for modeler
This allows a range of new possibilities, including:
- models with static outputs for child algorithms, e.g. always saving
a child algorithm's output to a geopackage or postgres layer
- models with expression based output values for child algorithms, e.g.
generating an automatic file name based on today's date and saving
outputs to that file
2020-04-02 02:29:54 +10:00
Nyall Dawson
f31af07235 Fix windows build 2020-04-01 18:20:09 +10:00
Nyall Dawson
4fa9083cf6 [FEATURE][processing] Allow creation of group boxes in models
These are a visual guide, allowing designers to create logical groups
of algorithms relating to a single task ("eg 'Prepare data')

The title and color of the group boxes can be customized
2020-04-01 18:20:09 +10:00
Nyall Dawson
a7a64d40e0 Add API for storing group boxes in processing models 2020-04-01 18:20:09 +10:00
Nyall Dawson
e788be93fa [processing][FEATURE] Add api for setting model component colors, and expose
the option to set manual colors for individual model comments
2020-04-01 18:20:09 +10:00
Nyall Dawson
e386573c0c [FEATURE][processing] Port multi-layer input parameter widget to new API
Allows
- expression based inputs
- rearrangement of inputs for multi-layer parameters in models, to set
specific layer orders
2020-03-31 01:06:48 +10:00
Nyall Dawson
2a1bf56493 [FEATURE][processing] Remember parameter values between model designer runs
When designing a model, users typically will need to run the model
many times as they tweak its structure.

This change causes the parameters used when running the model from
the designer to be remembered and saved into the model, so that
each time you run the model from the designer you don't have to
re-set all the input parameter values to the desired test ones.

Makes iterative model design SO much easier!

Sponsored by Alta Ehf
2020-03-06 18:22:49 +10:00
Nyall Dawson
64868ce8f2 Bit more Python to c++ porting 2020-03-06 03:49:16 +10:00
Nyall Dawson
13fc85d740 [FEATURE][processsing] Add support for comments attached to components
This allows users to create comments attached to model components (inputs,
algorithms or outputs). Comments are shown linked to the associated component,
and can be freely moved around the model.
2020-03-06 03:49:16 +10:00
Nyall Dawson
d6d1b858c9 Metatype 2020-03-05 18:55:20 +10:00
Nyall Dawson
873ad5f734 Clone should be const 2020-03-05 18:55:20 +10:00
Nyall Dawson
d8111e1025 Make link point collapsing handling more generic 2020-03-03 16:08:23 +10:00
Nyall Dawson
55a582d068 Make size a property of QgsProcessingModelComponent
API only for now, cannot be set by users
2020-03-02 18:53:31 +10:00
Nyall Dawson
d9cc2aedeb Add clone method to QgsProcessingModelComponent 2020-03-02 18:53:31 +10:00
Nyall Dawson
107b48a430 Add NULLPTR macro for use in doxygen comments
For the c++ api dox this expands to "\c nullptr" (the
\c directive indicates a code literal value), and for sipify/Python
it expands to ``None`` (`` is sphinx annotation for literal values)

Makes for nicer dox for both c++ and Python!
2019-02-27 09:41:11 +10:00
Nyall Dawson
b6d66becab Sipify 2019-02-27 09:41:11 +10:00
Nyall Dawson
cdc622ef4c Freackin Amurican sppelling 2019-02-23 05:23:23 +10:00
Nyall Dawson
e31fb920e7 [processing] Add API to allow custom expression variables to be set
for a model
2019-02-23 05:23:23 +10:00
Nyall Dawson
7418c189d0 [processing] Also generate friendly names for outputs when converting models to scripts 2019-02-14 15:36:55 +10:00
Nyall Dawson
d342ce939b [processing] When converting models to Python, use friendlier (more
descriptive) names when storing child algorithm results

Makes for much easier to understand scripts
2019-02-14 15:36:55 +10:00
Nyall Dawson
493aed58fb API tweak 2019-02-13 07:59:30 +10:00
Nyall Dawson
9b2e60130f [processing] Update QgsProcessingModelAlgorithm::asPythonCode for 3.x API 2019-02-01 17:54:28 +11:00
Nyall Dawson
fb519ead46 Update QgsProcessingModelChildAlgorithm::asPythonCode for 3.x API 2019-02-01 17:54:28 +11:00
Nyall Dawson
946687c87b Update QgsProcessingModelChildParameterSource::asPythonCode 2019-02-01 17:54:28 +11:00
Nyall Dawson
95d68e9172 [processing] Default to hiding help button for algorithms
And require that showing help is opt-in. Apart from a handful
of built-in providers, most providers will not have help pages
available within the QGIS documentation (including model and
script algorithms). Accordingly, we should hide the help button
by default and only show it for these selected providers.

Note that 3rd party algorithms can still specify custom helpUrl
urls, in which case the button WILL be shown.
2018-09-26 04:26:49 +10:00
Nyall Dawson
e2082a0935 [processing] Fix modeler help/description generation, allow setting
of model short description text

Fixes #18767
2018-09-26 04:26:49 +10:00
Nyall Dawson
17326541cd [processing] Add method to attempt to reattach model children to linked algorithms
Refs #19857
2018-09-19 05:04:09 +10:00
Nyall Dawson
a717b85e2e [FEATURE][processing] New modeler parameter widget
A new widget which handles parameter values for child algorithms
within a model. Instead of the previous approach of requiring
individual widget wrappers to handle creation of a suitable
model widget, we do all this automatically for them.

This widget uses a stacked widget with a toolbutton to select
the parameter's source, instead of the previous combo box approach
(which didn't scale well for large models). I.e. users select
first whether the value is taken from a static value, a
model input, or an output from a different child algorithm. The
widget then changes appearance and behavior based on this
choice.

Additionally, a new option is present for all parameters
of using a "precalculated expression". This expression is
evaluated once before the child algorithm is executed
and used during the execution of that algorithm.
2018-09-04 19:06:07 +10:00
Nyall Dawson
1fea03fec7 [processing] Make model to/from variant methods public 2018-08-01 07:32:52 +10:00
Nyall Dawson
c9e5a36558 [processing] Avoid generic exceptions
Makes the full Python exception available when running algorithm,
which provides much more useful error messages
2018-05-16 04:35:17 +10:00
Denis Rouzaud
7df2593caf move auto generated sip file in dedicated folder 2018-05-14 10:23:37 -04:00