[GIS] Compile and load QGIS3 plugin

developmentpluginsqgis-3qgis-plugins

Win7 x64, QGIS 3.4 installed through OSGeo4W with 'Advanced Install'

Here's my workflow:

  1. Get the template directory from PluginBuilder3
  2. Navigate to this folder in the OSGeo4W Shell
  3. Use call "C:\OSGeo4W64\bin\qt5_env.bat" otherwise pyrcc5 is unavailable
  4. Use pyrcc5 -o resources.py resources.qrc as suggested in pluginbuilder3 help – note that a resources.qrc file already exists. This steps does not produce an error but does not seem to produce anything either.
  5. Use make – this gives the following message:

    make: Nothing to be done for 'defaults'.

  6. Use make test – this gives the following message:

    chmod: cannot acces 'scripts/compile-strings.sh': No such file or directory
    make: *** [transcompile] Error 1

I try to copy the plugin directory at C:\Users\xxx\AppData\Roaming\QGIS\QIS3\profiles\default\python\plugins but it is not seen by QGIS or Plugin Reloader

UPDATE:
– there is no sub-directory in the plugin folder – isn't a i18n folder expected ?
– at step 4 resources.py is updated but resources.qrc is left unchanged

Best Answer

The compilation is going to be tested with the following example where icon enclosed in the red rectangle (see image), from one test plugin (makingmultiplebuffers), will be changed for one qgis-icon (24x24 pixels) created for this example.

enter image description here

Path to plugin is:

C:\Users\Usuario\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\makingmultiplebuffers

So, old icon name (icon.png) will be modified to qgis-icon.png in metadata.txt, resources.qrc and initGui method of main py file of plugin (in my case making_multiple_buffers.py). Completed all changes, I ran following commands at OSGeo4W shell:

cd C:\Users\Usuario\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\makingmultiplebuffers
call qt5_env.bat 
call py3_env.bat
pyrcc5 -o resources.py resources.qrc

and it can be observed at following image, after using reloading qgis plugin, that icon was efectively changed.

enter image description here

Related Question