[GRASS-SVN] r30984 - in grass/trunk/gui/wxpython: . gui_modules xml
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Apr 14 07:24:25 EDT 2008
Author: martinl
Date: 2008-04-14 07:24:25 -0400 (Mon, 14 Apr 2008)
New Revision: 30984
Modified:
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/workspace.py
grass/trunk/gui/wxpython/wxgui.py
grass/trunk/gui/wxpython/xml/grass-gxw.dtd
Log:
wxGUI: save basic properties of map display window (auto-render, statusbar mode, show computational extent) to workspace file"
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2008-04-14 11:19:39 UTC (rev 30983)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2008-04-14 11:24:25 UTC (rev 30984)
@@ -3411,6 +3411,14 @@
self.PopupMenu(zoommenu)
zoommenu.Destroy()
+ def SetProperties(self, render=False, mode=0, showCompExtent=False):
+ """Set properies of map display window"""
+ self.autoRender.SetValue(render)
+ self.toggleStatus.SetSelection(mode)
+ self.statusText = self.toggleStatus.GetStringSelection()
+ self.StatusbarUpdate()
+ self.showRegion.SetValue(showCompExtent)
+
# end of class MapFrame
class MapApp(wx.App):
Modified: grass/trunk/gui/wxpython/gui_modules/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/workspace.py 2008-04-14 11:19:39 UTC (rev 30983)
+++ grass/trunk/gui/wxpython/gui_modules/workspace.py 2008-04-14 11:24:25 UTC (rev 30984)
@@ -45,8 +45,9 @@
self.inValue = False
self.inGroup = False
self.inDisplay = False
-
+
# list of layers
+ self.displays = []
self.layers = []
self.cmd = []
self.displayIndex = -1 # first display has index '0'
@@ -58,18 +59,22 @@
elif name == 'display':
self.inDisplay = True
self.displayIndex += 1
-
+ self.displays.append({
+ "render" : bool(attrs.get('render', False)),
+ "mode" : int(attrs.get('mode', 0)),
+ "showCompExtent" : bool(attrs.get('showCompExtent', False))})
+
elif name == 'group':
self.groupName = attrs.get('name', None)
self.groupChecked = attrs.get('checked', None)
self.layers.append({
- "type" : 'group',
- "name" : self.groupName,
- "checked" : int(self.groupChecked),
- "opacity" : None,
- "cmd" : None,
- "group" : self.inGroup,
- "display" : self.displayIndex})
+ "type" : 'group',
+ "name" : self.groupName,
+ "checked" : int(self.groupChecked),
+ "opacity" : None,
+ "cmd" : None,
+ "group" : self.inGroup,
+ "display" : self.displayIndex})
self.inGroup = True
elif name == 'layer':
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2008-04-14 11:19:39 UTC (rev 30983)
+++ grass/trunk/gui/wxpython/wxgui.py 2008-04-14 11:24:25 UTC (rev 30984)
@@ -606,9 +606,13 @@
if layer['display'] >= self.disp_idx:
# start new map display if no display is available
self.NewDisplay()
-
+
maptree = self.gm_cb.GetPage(layer['display']).maptree
-
+ mapdisplay = maptree.mapdisplay
+ mapdisplay.SetProperties(render=gxwXml.displays[layer['display']]['render'],
+ mode=gxwXml.displays[layer['display']]['mode'],
+ showCompExtent=gxwXml.displays[layer['display']]['showCompExtent'])
+
if not maptree.mapdisplay.IsShown():
# show map display
maptree.mapdisplay.Show()
@@ -844,9 +848,16 @@
file.write('%s<gxw>\n' % (' ' * self.indent))
# list of displays
for page in range(0, self.gm_cb.GetPageCount()):
+ mapTree = self.gm_cb.GetPage(page).maptree
+
self.indent =+ 4
- file.write('%s<display>\n' % (' ' * self.indent))
- mapTree = self.gm_cb.GetPage(page).maptree
+ file.write('%s<display render="%d" '
+ 'mode="%d" showCompExtent="%d">\n' % (' ' * self.indent,
+ int(mapTree.mapdisplay.autoRender.IsChecked()),
+ mapTree.mapdisplay.toggleStatus.GetSelection(),
+ int(mapTree.mapdisplay.showRegion.IsChecked()),
+ ))
+
# list of layers
item = mapTree.GetFirstChild(mapTree.root)[0]
self.WriteLayersToWorkspaceFile(file, mapTree, item)
Modified: grass/trunk/gui/wxpython/xml/grass-gxw.dtd
===================================================================
--- grass/trunk/gui/wxpython/xml/grass-gxw.dtd 2008-04-14 11:19:39 UTC (rev 30983)
+++ grass/trunk/gui/wxpython/xml/grass-gxw.dtd 2008-04-14 11:24:25 UTC (rev 30984)
@@ -18,8 +18,13 @@
<!-- a display element defines map layer connected to given
map display widnow
+
+ render, mode and showCompExtent (added 2004/08)
-->
-<!ELEMENT display (group*, layer*)>
+<!ELEMENT display ((group|layer)*)>
+<!ATTLIST display render CDATA #IMPLIED>
+<!ATTLIST display mode CDATA #IMPLIED>
+<!ATTLIST display showCompExtent CDATA #IMPLIED>
<!-- group of map layers
-->
@@ -41,7 +46,7 @@
<!ELEMENT task (flag*, parameter*)>
<!ATTLIST task name CDATA #REQUIRED>
-<!-- layer selected
+<!-- layer selected (added 2008/04)
-->
<!ELEMENT selected EMPTY>
More information about the grass-commit
mailing list