be shown to users when using that provider
This can be used to return a translated warning message which should be
shown to users of this provider. It's intended for use in cases such as
a provider which relies on a 3rd-party backend, where the version of the
backend software is not officially supported, or for alerting users to
providers in a "beta" or "untrustworthy" state.
Also exposes this capability to modeler - so that model algorithms
can use data defined parameters within their child algorithms.
TODO:
- tests
- setting the associated vector layer
- Add abstract base class for Processing widget wrappers to c++
- Add wrapper factory interface to c++
- Make QgsProcessingGuiRegistry also register widget wrapper
factories, and be responsible for creation of new c++
processing widget wrapper instances
- Start on private c++ implementation of boolean widget wrapper,
including unit tests
It turns out that an empty QComboBox evaluates to False:
>>> t=QLineEdit()
>>> bool(t)
True
>>> c=QComboBox()
>>> bool(c)
False
Due to that, the 'TABLE' parameter was missing if its (editable) combo box was empty.
Original error - while updating an algorithm's parameters (gdal:importvectorintopostgisdatabaseavailableconnections)
Traceback (most recent call last):
File "/home/martin/qgis/git-master/build-debug/output/python/plugins/processing/algs/gdal/GdalAlgorithmDialog.py", line 121, in parametersHaveChanged
or (not p.checkValueIsAcceptable(parameters[p.name()])):
KeyError: 'TABLE'
Allows algorithms to pre-processes a set of parameters, allowing the
algorithm to clean their values.
This method is automatically called after users enter parameters, e.g.
via the algorithm dialog. This method should NOT be called manually
by algorithms.
Since the underlying issues with the Python bindings are now fixed,
in most cases we can safely default to allowing an algorithm to
run in a background thread!!
So now we make this the default, and require individual algorithms
which are NOT thread safe to declare this. This includes algorithms
which directly manipulate the current project or layers (such as
setting layer styles), alter the selections in layers, or which
rely on 3rd party libraries (for now, SAGA and GRASS algorithms
are marked as not thread safe... TODO - someone more familiar with
these libraries can investigate and remove the flag if appropriate).
Also models are marked as non-thread safe. TODO: only flag an
individual model as thread-unsafe if any of its child algorithms
report this flag.
Ensure that dialogs are always correctly deleted when appropriate.
Also, if an algorithm is running in a background task and hits
an error, we automatically re-show the algorithm dialog and the
associated log for debugging.
Fixes#16858
which cannot run in background tasks
This is not fantastic UX, but we have lots of constraints here:
- The algorithm dialog itself cannot be made modal. There's child
widgets (such as the point and extent parameter widgets) which
interact with the main QGIS window.
- There is no reliable way in Qt to make a dialog modal after
it's shown (e.g. make it modal only when the algorithm is
running). Trust me - I've tried everything, and all approaches
break with some corner case.
- For non-background algorithms, we must have processEvents calls
in order to show the algorithm feedback and progress to users,
and detect cancel button clicks. Yet these processEvents calls
means that users can interact with other parts of QGIS, e.g.
removing layers from a project, and other operations which
could cause the algorithm to crash. So we MUST have some modal
dialog in order to block interactions outside of allowing
the cancel button clicks/progress repainting.
I've tried many approaches, but this is the only one which
works reliably...