[GRASS-SVN] r50055 - in grass/branches/develbranch_6/gui/wxpython: core lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 4 03:38:16 EST 2012


Author: annakrat
Date: 2012-01-04 00:38:16 -0800 (Wed, 04 Jan 2012)
New Revision: 50055

Modified:
   grass/branches/develbranch_6/gui/wxpython/core/workspace.py
   grass/branches/develbranch_6/gui/wxpython/lmgr/frame.py
Log:
wxGUI: save map display names to workspace (merge from trunk, r50054)

Modified: grass/branches/develbranch_6/gui/wxpython/core/workspace.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/workspace.py	2012-01-04 08:33:58 UTC (rev 50054)
+++ grass/branches/develbranch_6/gui/wxpython/core/workspace.py	2012-01-04 08:38:16 UTC (rev 50055)
@@ -132,6 +132,7 @@
                 projection = { 'enabled' : False }
             
             self.displays.append( {
+                    "name"           : display.get('name'),
                     "render"         : bool(int(display.get('render', "0"))),
                     "mode"           : int(display.get('mode', 0)),
                     "showCompExtent" : bool(int(display.get('showCompExtent', "0"))),
@@ -553,6 +554,7 @@
         
         # list of displays
         for page in range(0, self.lmgr.gm_cb.GetPageCount()):
+            dispName = self.lmgr.gm_cb.GetPageText(page)
             mapTree = self.lmgr.gm_cb.GetPage(page).maptree
             region = mapTree.Map.region
             
@@ -563,13 +565,15 @@
             else:
                 viewmode = '2d'
             
-            file.write('%s<display render="%d" '
+            file.write('%s<display '
+                       'name="%s" render="%d" '
                        'mode="%d" showCompExtent="%d" '
                        'alignExtent="%d" '
                        'constrainRes="%d" '
                        'dim="%d,%d,%d,%d" '
                        'extent="%f,%f,%f,%f" '
                        'viewMode="%s" >\n' % (' ' * self.indent,
+                                              dispName.encode('utf8'),
                                               int(mapTree.mapdisplay.GetProperty('render')),
                                               mapTree.mapdisplay.statusbarManager.GetMode(),
                                               int(mapTree.mapdisplay.GetProperty('region')),

Modified: grass/branches/develbranch_6/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/lmgr/frame.py	2012-01-04 08:33:58 UTC (rev 50054)
+++ grass/branches/develbranch_6/gui/wxpython/lmgr/frame.py	2012-01-04 08:38:16 UTC (rev 50055)
@@ -854,7 +854,7 @@
         displayId = 0
         mapdisplay = list()
         for display in gxwXml.displays:
-            mapdisp = self.NewDisplay(show = False)
+            mapdisp = self.NewDisplay(name = display['name'], show = False)
             mapdisplay.append(mapdisp)
             maptree = self.gm_cb.GetPage(displayId).maptree
             
@@ -1376,10 +1376,11 @@
         """!Create new layer tree and map display instance"""
         self.NewDisplay()
 
-    def NewDisplay(self, show = True):
+    def NewDisplay(self, name = None, show = True):
         """!Create new layer tree, which will
         create an associated map display frame
 
+        @param name name of new map display
         @param show show map display window if True
 
         @return reference to mapdisplay intance
@@ -1388,7 +1389,11 @@
         
         # make a new page in the bookcontrol for the layer tree (on page 0 of the notebook)
         self.pg_panel = wx.Panel(self.gm_cb, id = wx.ID_ANY, style = wx.EXPAND)
-        self.gm_cb.AddPage(self.pg_panel, text = "Display "+ str(self.disp_idx + 1), select = True)
+        if name:
+            dispName = name
+        else:
+            dispName = "Display " + str(self.disp_idx + 1)
+        self.gm_cb.AddPage(self.pg_panel, text = dispName, select = True)
         self.curr_page = self.gm_cb.GetCurrentPage()
         
         # create layer tree (tree control for managing GIS layers)  and put on new notebook page



More information about the grass-commit mailing list