spatialthoughts / qgis-tutorials

Source files for sphinx-based website
http://www.qgistutorials.com
Apache License 2.0
62 stars 33 forks source link

Building a Python Plugin (QGIS3) — QGIS Tutorials and Tips #128

Closed utterances-bot closed 8 months ago

utterances-bot commented 8 months ago

Building a Python Plugin (QGIS3) — QGIS Tutorials and Tips

https://www.qgistutorials.com/en/docs/3/building_a_python_plugin.html

David-Soils commented 8 months ago

Hi UJaval, I tried to install the plugin that we created in the tutorial. When I try to install the plugin from zip the error

ModuleNotFoundError: No module named 'save_attribute.save_attributes_dialog' occurs,I copied the code from above do you know if it would have to do with setting the path?

I have been working through the tutorials thank-you for providing this free helpful content.

spatialthoughts commented 8 months ago

This means you do not have a file names save_attributes_dialog.py in the plugin directory. Make sure it is present and there are no typos in the name. Sometimes Windows adds an extra .txt extension at the end if you used regular Notepad to edit the file.

Also Plugin Builder is an overkill for most people and really comes in your way when you are learning. You may learn about the plugin fundamentals much better from my guide at https://courses.spatialthoughts.com/pyqgis-in-a-day.html#writing-plugins which starts from a minimal plugin template.

glapao commented 7 months ago

Excellent guide. Tnks a lot !

cfloutier commented 7 months ago

very good introduction

AnaDK83 commented 6 months ago

Hi.

I can not get txt file. Step 29. Where this txt file should be found? Is it at plugin i QGis pr where. For me step 29. is not clear. When I click on ... button it leads me to plugin directory (QGis/python/plugin/save_attribues) but there is no putput txt file?

Thank you in advance.

spatialthoughts commented 6 months ago

@AnaDK83 The path to the CSV file can be chosen by you. Once you click the ... button, choose any place on your computer where you want the file to be created.

AnaDK83 commented 6 months ago

Thanx, I will try.

mapnerdo commented 6 months ago

Hi Ujaval, I'm on Step #9 and when I type "pb_tool compile" in my Mac terminal I get the following error message in red: "There is no pb_tool.cfg file in the current directory."

I checked my save_attributes folder and pb_tool.cfg is there. Do you know how to correct this?

Thank you,

spatialthoughts commented 6 months ago

@mapnerdo You have to install this on your system using pip install pb_tool as mentioned in the instructions.

I strongly recommend NOT using Plugin Builder for your plugin work. Please build a Processing Plugin if you can where QGIs will take care of all the user interface. https://www.qgistutorials.com/en/docs/3/processing_python_plugin.html

ahonkatu commented 2 months ago

Hi, If I have layers in group, how will I get them in to the plugin comboBox? Thank you :) ~K

spatialthoughts commented 2 months ago

@ahonkatu This should help https://courses.spatialthoughts.com/pyqgis-masterclass.html#get-layers-with-hierarchy