How to start? Click open_vscode.cmd
...this template is work in progress and not tested seriously.
- OSGeo4W Network Installer (64 bit) [ Download ]
- QGIS LTR
- Visual Studio Code [ Download | Documentation ]
- QGIS Plugins for plugin-creation and debugging
- pb_tools
python3 -m pip install --upgrade pb_tool
- open_vscode.cmd : Opens VS Code in current directory with OsGeo4W and QGIS-LTR environment settings.
- .vscode : Important VS Code and Debugger settings.
- .pylintrc : Settings for pylint (extension-pkg-whitelist=PyQt5,qgis)
- example_python.py : Shows usage of qgis.core and PyQt5
- example_gdal.cmd : Shows usage of gdal
- Create Plugin with Plugin Builder 3 inside this directory.
- Edit the new created
pb_tool.cfg
and define the plugin_path for the deploy (real path whitout %appdata%):%appdata%\QGIS\QGIS3\profiles\default\python\plugins
. It be a good idea to work in a clean qgis-profile. - run
pb_tool compile
orpyrcc5 -o resources.py resources.qrc
- Define the remoteRoot path-mappings in the debugger-settings
.vscode\settings.json
- Install and enable debugvs-Plugin and ptvsd
- Enable Debug for Visual Studio in QGIS (Button in QGIS)
- Start Debugger
Python: Remote Attach
inside VS Code - Run Plugin-functions from inside QGIS and use breakpoints inside VS Code.
- Make changes inside Plugin
- run
pb_tool deploy --no-confirm
and the plugin gets deployed to the qgis plugin-folder - reload it with the Plugin Reloader.
- If the order or layout of the toolbars inside QGIS gets messed up, reload it again.
- Test the changes.
pb_tool compile or pyrcc5 throws a pyt4 error -> load environments
rem load neccesary envs
o4w_env
py3_env
qt5_env