pelord / vscode-osgeo4w-dev-template

Template for developing with OsGeo4W and QGIS-LTR in Visual Studio Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VS Code OsGeo4W Template with QGIS LTR

How to start? Click open_vscode.cmd

...this template is work in progress and not tested seriously.

Requirements / Installation

  • OSGeo4W Network Installer (64 bit) [ Download ]
    • QGIS LTR
  • Visual Studio Code [ Download | Documentation ]
  • QGIS Plugins for plugin-creation and debugging
    • Plugin Builder 3 [ GitHub | QGIS ]
    • debugvs-Plugin [ GitHub | QGIS ]
    • Python debugger package for use Visual Studio Code [ GitHub ]
      --> python3 -m pip install --upgrade ptvsd inside VS Code terminal
    • Plugin Reloader [ GitHub | QGIS ] (flagged as experimental)
  • pb_tools python3 -m pip install --upgrade pb_tool

Important Files


Common Developing Tasks for Plugins

Useful Tools / Informations

Create Plugin

  • 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 or pyrcc5 -o resources.py resources.qrc

Debugging

  1. Define the remoteRoot path-mappings in the debugger-settings .vscode\settings.json
  2. Install and enable debugvs-Plugin and ptvsd
  3. Enable Debug for Visual Studio in QGIS (Button in QGIS)
  4. Start Debugger Python: Remote Attach inside VS Code
  5. Run Plugin-functions from inside QGIS and use breakpoints inside VS Code.

Make and reload Changes

  1. Make changes inside Plugin
  2. run pb_tool deploy --no-confirm and the plugin gets deployed to the qgis plugin-folder
  3. reload it with the Plugin Reloader.
  4. If the order or layout of the toolbars inside QGIS gets messed up, reload it again.
  5. Test the changes.

Known difficulties

pb_tool compile or pyrcc5 throws a pyt4 error -> load environments

rem load neccesary envs
o4w_env
py3_env
qt5_env

About

Template for developing with OsGeo4W and QGIS-LTR in Visual Studio Code


Languages

Language:Batchfile 54.4%Language:Python 45.6%