[QGIS-Developer] QgsLocator & common python libs
Nyall Dawson
nyall.dawson at gmail.com
Thu Apr 5 16:55:45 PDT 2018
On 5 April 2018 at 05:06, Richard Duivenvoorde <rdmailings at duif.net> wrote:
> So my main point:
> - how to give everybody the possibilty to implement a locator class, BUT
> also share a common base class or use the same QgsNetworkAccessManager
> moduel?
>
> Some options:
> - we create a separate repo for 'common' python classes, and via git
> submodules everybody pulls in it's own copy of those classes
> - we create a common-qgis-python module which would ship with QGIS (with
> filterbaseclass, QgsNetworkAccessManager, and other ideas from the
> Boundless commons lib).
My concern with the second approach is (and always has been) that
these common modules effectively become part of the stable API. We'd
need to carefully decide on things like:
- how are releases of the module handled? Is it bound to QGIS
releases, or on its own release schedule?
- Would the module be versioned (i.e. if it's not tied into QGIS
releases and packaged accordingly, will the code need to work with any
QGIS version from 3.0 up?)
We'd also need to very carefully vet all contributions to this module,
to ensure that they aren't reproducing functionality which is already
present in the core/gui modules. A lot of the code in common python
modules I've seen is just re-implementations of widgets and classes
which are already present in the master codebase, and which should
always be used instead. If Python syntactical sugar is desired for
these existing c++ classes then I'd much prefer to see it implemented
in the core QGIS module, such as is done here:
- https://github.com/qgis/QGIS/blob/master/python/core/__init__.py#L192
- https://github.com/qgis/QGIS/blob/master/src/core/qgsreadwritecontext.h#L84
(Via https://github.com/qgis/QGIS/blob/master/python/core/__init__.py#L216
and
- https://github.com/qgis/QGIS/blob/master/src/core/qgsproject.h#L1316
(via https://github.com/qgis/QGIS/blob/master/python/core/__init__.py#L240)
This is a nice approach to adding standard Python coding patterns into
the QGIS API, with the benefit that it's already tied into the QGIS
releases, packaged accordingly, and are all unit tested on Travis.
Maybe the same approach should be taken for adding the network access
manager.
Just my 2c!
> PS, wannatry? Download
> https://github.com/rduivenvoorde/qgislocator/raw/master/qgislocator_0.1.1.zip
> and use Install from ZIP in the plugin manager. Use '2022zj' to search
> PDOK, or 'eiffel' to search Google. Note that you may need a google key
> to use their geocoder.
Yep, can't wait to give this a spin :)
Nyall
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the QGIS-Developer
mailing list