[Qgis-developer] Adding python bindings for quickprint

Christopher Barker Chris.Barker at noaa.gov
Wed Jan 16 13:28:33 EST 2008

Martin Dobias wrote:
>> the quick print class *should* work something like this:
>> qp = QgsQuickPrint
>> qp.setMapCanvas ( iface.getMapCanvas() )
>> qp.setOutputPdf ("/tmp/test;pdf")
>> qp.setTitle ("QGIS Rocks")
>> qp.print()
> Besides the parentheses missing in the first command as mentioned
> before, there's a problem with the last statement qp.print() because
> "print" is a python keyword. So it's not possible to call it directly
> and you need to use following workaround to execute it:
> getattr(qp, 'print')()

Wouldn't it make more sense to rename it in the bindings? You don't want 
an API that ugly!

qp.Print() or printMap, or .....

in fact, you can't create a class with a "print" method in python, but 
maybe you can in C -- but it sure seems like a bad idea!


Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov

More information about the Qgis-developer mailing list