Hi Tom,

On Wed, 17. Sep 2014 at 14:43:29 +0000, Tom Chadwin wrote:
> Is that correct? If so (as a QGIS plugin and Python beginner) what is the
> best way to handle the deprecation and maintain backwards compatibility,
> given that QgsMapCanvas.mapRenderer() is only in 2.4+?

You could use:

try:
        crs = c.mapSettings().destinationCrs()
except:
        crs = c.mapRenderer().destinationCrs()

or shorter:

crs = c.mapSettings().destinationCrs() if hasattr(c,"mapSettings") else 
c.mapRenderer().destinationCrs()
        

Jürgen

-- 
Jürgen E. Fischer           norBIT GmbH             Tel. +49-4931-918175-31
Dipl.-Inf. (FH)             Rheinstraße 13          Fax. +49-4931-918175-50
Software Engineer           D-26506 Norden             http://www.norbit.de
QGIS release manager (PSC)  Germany                    IRC: jef on FreeNode     
                    

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to