[GRASS-SVN] r68486 - grass/trunk/display/d.mon

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 22 07:35:19 PDT 2016


Author: martinl
Date: 2016-05-22 07:35:19 -0700 (Sun, 22 May 2016)
New Revision: 68486

Modified:
   grass/trunk/display/d.mon/render_cmd.py
Log:
d.mon: apply pep8 (autopep8 --in-place --aggressive --recursive --experimental --jobs 4) 


Modified: grass/trunk/display/d.mon/render_cmd.py
===================================================================
--- grass/trunk/display/d.mon/render_cmd.py	2016-05-22 13:26:32 UTC (rev 68485)
+++ grass/trunk/display/d.mon/render_cmd.py	2016-05-22 14:35:19 UTC (rev 68486)
@@ -23,10 +23,10 @@
         if height is None and k == 'GRASS_RENDER_HEIGHT':
             height = int(v)
     fd.close()
-    
+
     if width is None or height is None:
         grass.fatal("Unknown monitor size")
-    
+
     return width, height
 
 # run display command
@@ -46,7 +46,7 @@
                   'd.redraw', 'd.to.rast', 'd.what.rast',
                   'd.what.vect', 'd.where'):
         return
-    
+
     mode = 'w' if cmd[0] == 'd.erase' else 'a'
     # update cmd file
     fd = open(cmd_file, mode)
@@ -61,46 +61,46 @@
         fd.write(' '.join(gtask.cmdtuple_to_list(cmd)))
         fd.write('\n')
     else:
-         fd.write('')
+        fd.write('')
     fd.close()
 
 # adjust region
 def adjust_region(width, height):
     region = grass.region()
-    
-    mapwidth  = abs(region["e"] - region["w"])
+
+    mapwidth = abs(region["e"] - region["w"])
     mapheight = abs(region['n'] - region['s'])
-    
-    region["nsres"] =  mapheight / height
-    region["ewres"] =  mapwidth  / width
-    region['rows']  = int(round(mapheight / region["nsres"]))
-    region['cols']  = int(round(mapwidth / region["ewres"]))
+
+    region["nsres"] = mapheight / height
+    region["ewres"] = mapwidth / width
+    region['rows'] = int(round(mapheight / region["nsres"]))
+    region['cols'] = int(round(mapwidth / region["ewres"]))
     region['cells'] = region['rows'] * region['cols']
-    
-    kwdata = [('proj',      'projection'),
-              ('zone',      'zone'),
-              ('north',     'n'),
-              ('south',     's'),
-              ('east',      'e'),
-              ('west',      'w'),
-              ('cols',      'cols'),
-              ('rows',      'rows'),
+
+    kwdata = [('proj', 'projection'),
+              ('zone', 'zone'),
+              ('north', 'n'),
+              ('south', 's'),
+              ('east', 'e'),
+              ('west', 'w'),
+              ('cols', 'cols'),
+              ('rows', 'rows'),
               ('e-w resol', 'ewres'),
               ('n-s resol', 'nsres')]
-    
+
     grass_region = ''
     for wkey, rkey in kwdata:
         grass_region += '%s: %s;' % (wkey, region[rkey])
-    
+
     os.environ['GRASS_REGION'] = grass_region
-    
+
 if __name__ == "__main__":
     cmd = gtask.cmdstring_to_tuple(sys.argv[1])
     if not cmd[0] or cmd[0] == 'd.mon':
         sys.exit(0)
     path = os.path.dirname(os.path.abspath(__file__))
     mon = os.path.split(path)[-1]
-    
+
     width, height = read_env_file(os.path.join(path, 'env'))
     if mon.startswith('wx'):
         mapfile = tempfile.NamedTemporaryFile(dir=path).name
@@ -111,9 +111,8 @@
     else:
         mapfile = None
         adjust_region(width, height)
-        
 
     render(cmd, mapfile)
     update_cmd_file(os.path.join(path, 'cmd'), cmd, mapfile)
-        
+
     sys.exit(0)



More information about the grass-commit mailing list