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

Maciej Sieczka tutey at o2.pl
Fri Feb 1 15:41:55 EST 2008


Barry Rowlingson pisze:

>  For example, there's a bunch of 'autoconnected' slots which are 
> connected to GUI objects (buttons and so on) such as:
> 
> // Slot for adding a new connection
> void QgsDbSourceSelect::on_btnNew_clicked()
> {
>   addNewConnection();
> }
> 
>  - so that when the 'New' button is clicked it calls the 
> addNewConnection method. In Python code this would be a method in the 
> Dialog class above, like:
> 
>   def on_btnNew_clicked(self):
>     self.addNewConnection()
> 
>  and then you have to write the addNewConnection method as well.
> 
> Now, I'm not sure if this autoconnected slot business works in Python...

I can't make the "Connect" button call the addNewConnection from Python. 
Can you, or anybody, give a working example of how to do this? My code 
actually looks like in the attachment. It's enough to spawn the main 
plugin GUI, but I can't figure out how to to make it's buttons call the 
existing QGIS C++ functionality, besides that which is already available 
in *.sip files.

For example, it's easy to do:

from qgis.core import QgsContextHelp

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

but how do I call addNewConnection? Or is it impossible, when the given 
C++ functionality is not in *.sip?

Maciek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qgis_postgis_v2.tar.bz2
Type: application/x-bzip
Size: 6281 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/qgis-developer/attachments/20080201/f4b08b84/qgis_postgis_v2.tar.bin


More information about the Qgis-developer mailing list