[Qgis-developer] please help me write a QGIS-PostGIS GUI in Python

Maciej Sieczka tutey at o2.pl
Fri Feb 1 18:34:02 EST 2008


Gary Sherman pisze:

Thanks for the tips. Some "thoughts" below.

> I think you could approach this project differently. For one, you can
> use the connections stored in the user preferences and offer them up
> in your own dialog.

Hmm, still I'd need to write my own schema and table selector. While
it's already there in C++, only I can't use it (I'm lazy, ain't I).

> If you need to create a new connection, you could instruct the user
> to use the other PostGIS dialog,

That would do.

> or you could implement your own using the .ui file for the add new
> connection dialog. Creating a new connection amounts to collecting
> the required parameters, optionally testing to see if you can 
> connect, and storing them in the user's preferences.
> 
> You can save and restore settings using the QSettings object with 
> Python. The "Zoom to Point" plugin does this---see it for an example.
> 
> 
> By now you've realized you have to write your own code to manipulate
>  dialogs and fetch/process user input. I'm working on a tutorial for
> writing a plugin but don't expect it to be done for a while.

Are SIP wrappers for QGIS C++ PostGIS functionality not present for a 
reason? If they were there, could I call PostGIS-related methods easily 
like this:


from qgis.core import QgsContextHelp

   def on_pbnHelp_clicked(self):
     QgsContextHelp.run(32338213)

?

Cheers,
Maciek




More information about the Qgis-developer mailing list