[Greater-commits] r3616 - trunk/GREAT-ER/Thuban/UI

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Jul 18 17:52:02 CEST 2011


Author: aheinecke
Date: 2011-07-18 17:52:01 +0200 (Mon, 18 Jul 2011)
New Revision: 3616

Modified:
   trunk/GREAT-ER/Thuban/UI/mainwindow.py
Log:
Check if there is a Map before trying to access it's Layers


Modified: trunk/GREAT-ER/Thuban/UI/mainwindow.py
===================================================================
--- trunk/GREAT-ER/Thuban/UI/mainwindow.py	2011-07-18 15:34:33 UTC (rev 3615)
+++ trunk/GREAT-ER/Thuban/UI/mainwindow.py	2011-07-18 15:52:01 UTC (rev 3616)
@@ -422,17 +422,18 @@
         if pos is not None:
             text = "(%10.10g, %10.10g)" % pos
         else:
-            for layer in self.canvas.Map().Layers():
-                bbox = layer.LatLongBoundingBox()
-                if bbox:
-                    left, bottom, right, top = bbox
-                    if not (-180 <= left <= 180 and
-                            -180 <= right <= 180 and
-                            -90 <= top <= 90 and
-                            -90 <= bottom <= 90):
-                        text = _("Select layer '%s' and pick a projection "
-                                 "using Layer/Projection...") % layer.title
-                        break
+            if self.canvas.Map():
+                for layer in self.canvas.Map().Layers():
+                    bbox = layer.LatLongBoundingBox()
+                    if bbox:
+                        left, bottom, right, top = bbox
+                        if not (-180 <= left <= 180 and
+                                -180 <= right <= 180 and
+                                -90 <= top <= 90 and
+                                -90 <= bottom <= 90):
+                            text = _("Select layer '%s' and pick a projection "
+                                     "using Layer/Projection...") % layer.title
+                            break
 
         self.set_position_text(text)
 



More information about the Greater-commits mailing list