[GRASS-SVN] r63738 - grass/trunk/gui/wxpython/mapdisp

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 24 09:39:59 PST 2014


Author: martinl
Date: 2014-12-24 09:39:59 -0800 (Wed, 24 Dec 2014)
New Revision: 63738

Modified:
   grass/trunk/gui/wxpython/mapdisp/main.py
Log:
wxGUI: minor changes when starting standalone monitor (decorations)

Modified: grass/trunk/gui/wxpython/mapdisp/main.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/main.py	2014-12-24 17:30:51 UTC (rev 63737)
+++ grass/trunk/gui/wxpython/mapdisp/main.py	2014-12-24 17:39:59 UTC (rev 63738)
@@ -392,27 +392,40 @@
             self.cmdTimeStamp = os.path.getmtime(monFile['cmd'])
             self.Map = DMonMap(giface=self._giface, cmdfile=monFile['cmd'],
                                mapfile = monFile['map'])
+            
+            self.timer = wx.PyTimer(self.watcher)
+            #check each 0.5s
+            global mtime
+            mtime = 500
+            self.timer.Start(mtime)
         else:
             self.Map = None
-
+        
+        return True
+    
+    def CreateMapFrame(self, name, decorations=True):
+        if decorations:
+            toolbars = ['map']
+            statusbar = True
+        else:
+            toolbars = []
+            statusbar = False
+        
         self.mapFrm = DMonFrame(parent = None, id = wx.ID_ANY, Map = self.Map,
-                                giface = self._giface, size = monSize, toolbars = [], statusbar = False)
+                                giface = self._giface, size = monSize,
+                                toolbars = toolbars, statusbar = statusbar)
+        
         # FIXME: hack to solve dependency
         self._giface._mapframe = self.mapFrm
-        # self.SetTopWindow(Map)
+        
         self.mapFrm.GetMapWindow().SetAlwaysRenderEnabled(True)
+        
         self.Map.saveToFile.connect(lambda cmd: self.mapFrm.DOutFile(cmd))
         self.Map.dToRast.connect(lambda cmd: self.mapFrm.DToRast(cmd))
-        self.Map.query.connect(lambda ltype, maps: self.mapFrm.SetQueryLayersAndActivate(ltype=ltype, maps=maps))
-                
-        if __name__ == "__main__":
-            self.timer = wx.PyTimer(self.watcher)
-            #check each 0.5s
-            global mtime
-            mtime = 500
-            self.timer.Start(mtime)
-            
-        return True
+        self.Map.query.connect(lambda ltype, maps: \
+                               self.mapFrm.SetQueryLayersAndActivate(ltype=ltype, maps=maps))
+
+        return self.mapFrm
     
     def OnExit(self):
         if __name__ == "__main__":
@@ -492,11 +505,7 @@
 
     start = time.time()
     gmMap = MapApp(0)
-    mapFrame = gmMap.GetMapFrame()
-    mapFrame.SetTitle(monName)
-    if monDecor:
-        mapFrame._giface.ShowAllToolbars(monDecor)
-        mapFrame._giface.ShowStatusbar(monDecor)
+    mapFrame = gmMap.CreateMapFrame(monName, monDecor)
     mapFrame.Show()
     Debug.msg(1, "WxMonitor started in %.6f sec" % \
                   (time.time() - start))



More information about the grass-commit mailing list