Skip to content

Instantly share code, notes, and snippets.

@nick4rivers
Last active April 20, 2022 20:58
Show Gist options
  • Select an option

  • Save nick4rivers/f08bc7c8049061841e7fc164a49a6c9f to your computer and use it in GitHub Desktop.

Select an option

Save nick4rivers/f08bc7c8049061841e7fc164a49a6c9f to your computer and use it in GitHub Desktop.
My notes for Python, Qt, and QGIS plugin development

PYTHON AND QT NOTES FOR QGIS PLUGIN DEVELOPMENT

VIRTUAL ENV:

NEW

python3 -m venv [my_directory]

ACTIVATE

 source my_venv/bin/activate

PIP INSTALL PACKAGES FOR Qt DEVELOPMENT:

pip install PyQt5

  • maybe this one pip install PyQtWebEngine

  • for Q Plugin development pip install pb_tool ##############################################################################

PB_TOOL

  • need to add the path to the plugin folder to pb_tool.cfg plugin_path: /Users/nick/Library/Application Support/QGIS/QGIS3/profiles/test/python/plugins ##############################################################################

LAUNCH QT DESIGNER THAT SHIPS WITH QGIS:

  • FOR LTR /Applications/QGIS-LTR.app/Contents/MacOS/bin/designer
  • FOR NEWEST RELEASE /Applications/QGIS.app/Contents/MacOS/bin/designer ##############################################################################

VSCODE PATH SETTINGS

  • these should be in the .vscode directory, in settings.json { // FROM: https://gist.github.com/NicolaiMogensen/acfd8723720c4761aefef3cdfc2aa55a // I like changing colors for my projects. QGIS projects are usually green. "workbench.colorCustomizations": { "titleBar.activeForeground": "#000000", "titleBar.activeBackground": "#0ff381", }, "terminal.integrated.env.osx": { "PYTHONPATH": "${env:QGIS_PATH}/Contents/Resources/python:${env:QGIS_PATH}/Contents/Resources/python/site-packages:${env:QGIS_PATH}/Contents/Resources/python/site-packages/PyQt5", "PATH": "${env:PATH}:${env:QGIS_PATH}/Contents/MacOS/bin" }, "python.pythonPath": "${env:QGIS_PATH}/Contents/MacOS/bin/python3.8" }

##############################################################################

MANUAL PATH TO QGIS PYTHON INTERPRETER

/Applications/QGIS.app/Contents/MacOS/bin/python3.8 ##############################################################################

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment