Browse Source

wxGUI: d.mon: input file has incorrect dimensions (https://trac.osgeo.org/grass/ticket/2680)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65303 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 years ago
parent
commit
97d04fdd7d
1 changed files with 14 additions and 1 deletions
  1. 14 1
      gui/wxpython/mapdisp/main.py

+ 14 - 1
gui/wxpython/mapdisp/main.py

@@ -30,6 +30,7 @@ import os
 import sys
 import time
 import shutil
+import fileinput
 
 from core          import globalvar
 import wx
@@ -387,7 +388,19 @@ class DMonFrame(MapFrame):
         layers = self.MapWindow.GetMap().GetListOfLayers()
         self.MapWindow.ZoomToMap(layers = layers)
         
-
+    def OnSize(self, event):
+        super(DMonFrame, self).OnSize(event)
+
+        # update env file
+        width, height = self.MapWindow.GetClientSize()
+        for line in fileinput.input(monFile['env'], inplace=True):
+            if 'GRASS_RENDER_WIDTH' in line:
+                print 'GRASS_RENDER_WIDTH={}'.format(width)
+            elif 'GRASS_RENDER_HEIGHT' in line:
+                print 'GRASS_RENDER_HEIGHT={}'.format(height)
+            else:
+                print line.rstrip('\n')
+    
 class MapApp(wx.App):
     def OnInit(self):
         if not globalvar.CheckWxVersion([2, 9]):