3

I tried out to create, for Windows, the Where Am I? QGIS 2.99 plugin (similar to Gary Sherman's book) by using Plugin Builder 3. In spite of being created, it was generated an error that it can be visualized in following image:

enter image description here

and this is an extract of produced text:

TypeError: keyPressEvent(self, QKeyEvent): first argument of unbound method must have type 'QDialog'

Traceback (most recent call last):
File "C:/Users/Usuario/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pluginbuilder3\plugin_builder_dialog.py", line 169, in keyPressEvent QDialog.keyPressEvent(event) TypeError: keyPressEvent(self, QKeyEvent): first argument of unbound method must have type 'QDialog'

However, I think that it could be not important because I found out that is was always produced by pressing Shift key.

As I don't have compilation resources in Windows, plugin was compilated (pyqt5-dev-tools) in my Debian GNU/Linux with make (without any error):

pyrcc5 -o resources.py resources.qrc

Afterward, it was newly exported to Windows at folder:

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

When I try to activate plugin, I got that it is not compatible for this version of QGIS; as it can be observed at following image:

enter image description here

When I open folder of each installed plugin (reloader, builder, zoom to Belgium), at top they always have a __pycache__ folder; as it can be observed at following image:

enter image description here

However, created plugin doesn't:

enter image description here

I also corroborated that resources.py was adequately compilated because it has this header:

# -*- coding: utf-8 -*-

# Resource object code
#
# Created: Mon Nov 27 15:50:04 2017
#      by: The Resource Compiler for PyQt (Qt v5.3.2)
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore
.
.
.

and similar structure in all plugins (however my compiler version for PyQt is older; v5.3.2 vs v5.7.1).

My question is why was not adequately produced __pycache__ folder with Plugin Builder 3 or plugins created by user need to be placed in another folder in Windows environment?

Editing Note:

After creating Where Am I? plugin, I edited Qt5 objects in Qt5Designer from Linux and I included required lines to show location of a point click on the map; as it can be observed at following image. Plugin works as expected.

enter image description here

1

Check the metadata.txt file of your plugin to make sure the qgisMinimumVersion is set properly.

Compare the settings in metadata.txt for other working plugins for examples.

  • Thanks a lot for your answer. Yes, there are differences. Other plugins have qgisMinimumVersion=2.99 and qgisMaximumVersion=3.99 and mine only qgisMinimumVersion=3.0 (and it is for 2.99). It will be my turn to start again. I hope to mark as accepted your answer after that. – xunilk Nov 28 '17 at 11:59
  • It worked perfectly but this time I compiled in situ from Linux. Thanks a lot again. – xunilk Nov 28 '17 at 12:26

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.