mirror of
https://github.com/qgis/QGIS.git
synced 2025-06-26 00:03:37 -04:00
updated the whole guide to use qgis2to3
parent
d934f3a0f8
commit
ce4eb22a89
@ -7,32 +7,30 @@ In QGIS 3, GeoPackage is much more present. Avoid creating shapefile in your plu
|
|||||||
## Minimal info
|
## Minimal info
|
||||||
|
|
||||||
- `pip install future`
|
- `pip install future`
|
||||||
- [git checkout the source tree](https://htmlpreview.github.io/?https://raw.github.com/qgis/QGIS/master/doc/INSTALL.html#toc9) and run QGIS/scripts/2to3 (https://github.com/qgis/QGIS/blob/master/scripts/2to3) on your plugin
|
- `pip install qgis2to3` (docs [github.com/opengisch/qgis2to3](https://github.com/opengisch/qgis2to3))
|
||||||
- `path/to/QGIS/scripts/2to3 /path/to/your/plugin`
|
- `qgis2to3 /path/to/my/plugin`
|
||||||
- This command will print the diff. If you want to write these changes to files, use `-w`
|
- This command will print the diff. If you want to write these changes to files, use `-w`
|
||||||
- The script will automatically update from Py2 to Py3, from Qt4 to the correct PyQt version. For instance `from PyQt4.QtGui import QMainWindow` will become `from qgis.PyQt.QtWidgets import QMainWindow`.
|
- The script will automatically update from Py2 to Py3, from Qt4 to the correct PyQt version. For instance `from PyQt4.QtGui import QMainWindow` will become `from qgis.PyQt.QtWidgets import QMainWindow`.
|
||||||
- The script will update some QGIS API changes.
|
- The command will update some QGIS API changes.
|
||||||
- have a good look at: https://qgis.org/api/api_break.html
|
- `qgis2apifinder /path/to/my/plugin`
|
||||||
- make sure you do python3 and Qt5 !
|
- This will show you potential api v2 only usages (as listed on https://qgis.org/api/api_break.html)
|
||||||
|
- set `qgisMinimumVersion=3.0` in metadata.txt
|
||||||
|
- make sure you do python3 and Qt5!
|
||||||
- tweak and fix until it works :-)
|
- tweak and fix until it works :-)
|
||||||
|
|
||||||
It was more work then I hoped, but after setting
|
You should see your plugin in QGIS 2.99 and up (*note: if it does not appear, make sure your build is newer than 4.01.2018, as there was an important change 3.01.2018 17:09 UTC: https://github.com/qgis/QGIS/pull/5904*)
|
||||||
|
|
||||||
```
|
You can find Python API documentation at http://python.qgis.org/master/
|
||||||
qgisMinimumVersion=3.0
|
|
||||||
```
|
|
||||||
|
|
||||||
in metadata you should see your plugin in QGIS 2.99 and up (*note: if it does not appear, make sure your build is newer than 4.01.2018, as there was an important change 3.01.2018 17:09 UTC: https://github.com/qgis/QGIS/pull/5904*)
|
|
||||||
|
|
||||||
You can find Python API documentation at http://python.qgis.org/api/ (work in progress).
|
|
||||||
**Please note**: QGIS3 compatibility module (so 3.x plugins will also work on 2.18) has been deprecated.
|
**Please note**: QGIS3 compatibility module (so 3.x plugins will also work on 2.18) has been deprecated.
|
||||||
|
|
||||||
## Python plugin issues
|
## Debugging and finding problems
|
||||||
|
You can use the [qgis2to3](http://www.opengis.ch/2018/04/13/porting-qgis-plugins-to-api-v3-strategy-and-tools/) tools and your IDEs (PyCharm or Eclipse) to step through your code and find and solve incompatibilities.
|
||||||
|
Alternatively, you can install First Aid plugin and use it within QGIS. More info can be found here: https://www.lutraconsulting.co.uk/blog/2016/06/12/introducing-first-aid-plugin/
|
||||||
|
|
||||||
|
## Other possible issues Python plugin issues
|
||||||
QGIS 3 MetaSearch user migration: problems with Python plugins? Clear out your *.pyc files (so QGIS Python can compile via Python 3).
|
QGIS 3 MetaSearch user migration: problems with Python plugins? Clear out your *.pyc files (so QGIS Python can compile via Python 3).
|
||||||
|
|
||||||
## Debugging and finding problems
|
|
||||||
You can use IDEs (PyCharm or Eclipse) to step through your code. Alternatively, you can install First Aid plugin and use it within QGIS. More info can be found here: https://www.lutraconsulting.co.uk/blog/2016/06/12/introducing-first-aid-plugin/
|
|
||||||
|
|
||||||
## More info
|
## More info
|
||||||
* https://gisforthought.com/updating-a-plugin-from-qgis-2-to-qgis-3/
|
* https://gisforthought.com/updating-a-plugin-from-qgis-2-to-qgis-3/
|
||||||
* https://github.com/gc-i/wntOS/wiki/QGIS3Port
|
* https://github.com/gc-i/wntOS/wiki/QGIS3Port
|
||||||
|
* http://www.opengis.ch/2018/04/13/porting-qgis-plugins-to-api-v3-strategy-and-tools/
|
Loading…
x
Reference in New Issue
Block a user