[Thuban-commits] r2891 - trunk/thuban/Thuban/UI

Bernhard Herzog bernhard.herzog at intevation.de
Thu Jul 14 13:15:14 CEST 2011


On 14.07.2011, scm-commit at wald.intevation.org wrote:
> Author: bricks
> Date: 2011-07-14 12:45:33 +0200 (Thu, 14 Jul 2011)
> New Revision: 2891
8...9
> --- trunk/thuban/Thuban/UI/viewport.py	2009-09-27 20:38:23 UTC (rev 2890)
> +++ trunk/thuban/Thuban/UI/viewport.py	2011-07-14 10:45:33 UTC (rev 2891)
> @@ -377,7 +377,12 @@
>          if scale is None:
>              scale = self.scale
>
> -        llx, lly, urx, ury = bbox = self.map.ProjectedBoundingBox()
> +        bbox = self.map.ProjectedBoundingBox()
> +        if not bbox:
> +            #There are no layers so we have nothing to scale
> +            return scale, scale
> +        else:
> +            llx, lly, urx, ury = bbox

This is better written as 

       if not bbox:
           #There are no layers so we have nothing to scale
           return scale, scale

       llx, lly, urx, ury = bbox

The rest of the method after the if-statement only makes sense if there is a 
bbox, so you'd either need to put the entire rest of the method into the 
else-clause or simply omit the else as above because the early return if 
there's no bbox essentially turns everything after the if statement into an 
else clause anyway.

  Bernhard

-- 
Bernhard Herzog  |  ++49-541-335 08 30  |  http://www.intevation.de/
Intevation GmbH, Neuer Graben 17, 49074 Osnabrück | AG Osnabrück, HR B 18998
Geschäftsführer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)