[Qgis-developer] Adding python bindings for quickprint

Tim Sutton tim at linfiniti.com
Wed Jan 16 13:35:16 EST 2008


Hi

Yes I was thinking the same thing. In c++ 'print ' is not a reserved
word, just in python it seems. Ill just rename the c++ method
printMap() - and thus python bindings too.

Regards

Tim

2008/1/16, Christopher Barker <Chris.Barker at noaa.gov>:
> 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!
>
> -Chris
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> 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
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.qgis.org
> http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
>


-- 
Tim Sutton
QGIS Project Steering Committee Member - Release  Manager
Visit http://qgis.org for a great open source GIS
openModeller Desktop Developer
Visit http://openModeller.sf.net for a great open source ecological
niche modelling tool
Home Page: http://tim.linfiniti.com
Skype: timlinux
Irc: timlinux on #qgis at freenode.net



More information about the Qgis-developer mailing list