1

I am working on a new QGIS plugin and I am trying to comply with the requirement below. The full requirement is located here.

  • source repository is in good shape:

    • no generated file is left in repository (ui_*.py, resources_rc.py, gen. help files…)

I have a resources.py file.

If I remove resources.py file, no icon will be shown. So how can I achieve the visibility of resources without a resources.py file?

1

Although it may not be good pythonic practice, you don't actually always need a resources.py file. For icons, you can reference them directly in your PyQGIS code. For example, if you have a QToolButton named 'MyToolButton', you can associate a PNG-format icon with via a statement like

MyToolButton.setIcon(QIcon("c:/icons/sample_icon.png"))

  • Thank you. It works! I got the home dir using HOME = expanduser("~") and added '.qgis/python/plugins/[myplugin]' and it works. – wondim Mar 25 '17 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.