Hi Tara, the link for pscyopg I sent you were apparently linux builds (I had this already installed). Psycopg and psycopg2 are actually Python libraries for connecting to Postgresql/postgis databases via python. So IF you ever want to let your python plugin do something against postgresql, you will need it anyway :-) I found windows builds here: http://www.stickpeople.com/projects/python/win-psycopg/index.html
The raster plugin is a nice example for taking of with a simple plugin, when you need some 'config interface', you can use martin's copyright plugin (http://blog.qgis.org/?q=node/59) as a starting point. Have fun. Richard Duivenvoorde Tara Athan wrote: > I do not have psycopg, but otherwise following your advice I got the > plugin to the point where it would attempt to compile and produce the > "no psycopg" error. Since psycopg is not included with the QGIS windows > build, perhaps a plugin example that doesn't depend on this would be > better for the manual. I downloaded the psycopg library, but their > website is down and there is no installation notes so I wasn't sure how > to incorporate it. Its not that important as I was just trying to > follow the example, but it could definitely throw off a novice trying to > follow the manual. I did get the raster info plugin working, so I guess > I'm ready to dive into the qgis API and build something new! > > Thanks for your help. > > Tara > > Richard Duivenvoorde wrote: >> Hi Tara, >> the good news: you (almost) succeeded. Here is your stuff back (I >> upgraded it to version 0.11 :-) >> >> 1) don't put python plugins in the directory: >> C:\Program Files\Quantum GIS_091\share\qgis\python\plugins\ >> You are right, that's where the plugin installer is (which is I would >> say still beta (aka not yet working the way it is supposed to yet). >> But put your files in a directory new_layer here: >> C:\Program Files\Quantum GIS_091\python\plugins\new_layer >> There (after some fixes...) it works!! >> >> 2) python is very picky with whitespaces! you will see error messages >> when you put your old plugin code in the right place ;-) >> I removed them, or changed them (see new zip) >> >> 3) remove the linenumbers in your newlayer.py >> >> 4) you're including the python library pscopg (needed for python to >> interact with Postgresql. Do you have that lib installed in your >> python installation? I did'nt, and got errormessages, so I changed the >> version to psycopg2 (a library I do have). You should use/have one of >> those installed. >> >> 5) your button did't show up in the buttonbar, but the plugin shows up >> in the pluginmanager! This is because the name you define in the >> resources.qrc should match the name you use for it in your code: >> /plugins/new_layer/new_layer_icon.png >> in the qrc file should match the name you use in your code: >> self.action = QAction(QIcon(":/plugins/new_layer/new_layer_icon.png"), >> >> After fixing this, it's loading. >> So I would say, congrat with your first plugin! >> >> Read something about python's whitespaces here: >> http://www.python.org/doc/essays/styleguide.html >> here http://docs.python.org/ or http://docs.python.org/tut/tut.html >> >> psycopg or psycopg2 can be downloaded here: >> http://www.initd.org/pub/software/psycopg/ >> >> If you need an even easier plugin to start with, start with this one >> here: >> http://blog.qgis.org/?q=node/104 >> >> Good luck >> >> Richard Duivenvoorde >> >> attached some screendumps to prove your plugin is loaded (0.9.1 on >> WinXP), and the code cleaned up a little and 'loadable' (all in the zip) >> >> >> Tara Athan wrote: >>> answers embedded. Thanks for the help - Tara >>> Richard Duivenvoorde wrote: >>>> >>>> Hi Tara, >>>> >>>> where did you put you plugin stuff? >>> C:\Program Files\Quantum GIS_091\share\qgis\python\plugins\new_layer >>> This is the same folder that contains the plugin plugin_installer, >>> which does appear in my Plugin Manager >>> (and works when installed, except there is an error when I tried to >>> download something- concerning permissions. >>> Perhaps there is something wrong with the permissions of the folder >>> new_layer? >>> Another Windows system thing I am not very familiar with.) >>>> which files did you put there? >>> __init__.py >>> new_layer_icon.png >>> newlayer.py >>> resources.py >>> resources.qrc >>> >>> I copied the names from Explorer to make sure these are the exact names >>>> Can you reply to this mail with the exact paths you are put your files? >>>> >>>> As an example, my plugin is here (I installed qgis in >>>> C:\programs\QGIS091): >>>> C:\programs\QGIS091\python\plugins\imagemap_plugin >>>> >>>> Maybe you can also sent me the files? I can look into them if you want. >>> files attached in zip >>>> >>>> Didn't you see an error-message dialog? >>> No, no error message. >>>> >>>> Regards Richard Duivenvoorde >>>> >>>> Tara Athan wrote: >>>>> I have now made it through all the steps in the manual (Section >>>>> 11, subsection 7) for Using the Python Plugin. >>>>> However the NewLayer plugin does not appear in the PlugIn Manager. >>>>> I see a similar post on the Plugin forum (Developer>Plugins August, >>>>> 2007) but there were no replies. >>>>> >>>>> Version 0.9.0, 0.9.1 (I tried it in both) >>>>> Platform WIndows XP SP2 >>>>> >>>>> Thanks, Tara > > _______________________________________________ Qgis-user mailing list [email protected] http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user
