[GRASS-SVN] r30238 - in grass/trunk/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 18 11:55:36 EST 2008


Author: martinl
Date: 2008-02-18 11:55:36 -0500 (Mon, 18 Feb 2008)
New Revision: 30238

Modified:
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
   grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: When workspace file is given on start-up (g.gui w=) show Map Display Window after loading is finished

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-02-18 16:38:31 UTC (rev 30237)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-02-18 16:55:36 UTC (rev 30238)
@@ -66,8 +66,8 @@
                  ctstyle=CT.TR_HAS_BUTTONS | CT.TR_HAS_VARIABLE_ROW_HEIGHT |
                  CT.TR_HIDE_ROOT | CT.TR_ROW_LINES | CT.TR_FULL_ROW_HIGHLIGHT|
                  CT.TR_EDIT_LABELS|CT.TR_MULTIPLE,
-                 idx=None, gismgr=None, notebook=None, auimgr=None):
-        CT.CustomTreeCtrl.__init__(self, parent, id, pos, size, style,ctstyle)
+                 idx=None, gismgr=None, notebook=None, auimgr=None, showMapDisplay=True):
+        CT.CustomTreeCtrl.__init__(self, parent, id, pos, size, style, ctstyle)
 
         ### SetAutoLayout() causes that no vertical scrollbar is displayed
         ### when some layers are not visible in layer tree
@@ -103,10 +103,11 @@
                                    str(self.disp_idx) + 
                                    " - Location: " + grassenv.GetGRASSVariable("LOCATION_NAME")))
 
-        #show new display
-        self.mapdisplay.Show()
-        self.mapdisplay.Refresh()
-        self.mapdisplay.Update()
+        # show new display
+        if showMapDisplay is True:
+            self.mapdisplay.Show()
+            self.mapdisplay.Refresh()
+            self.mapdisplay.Update()
 
         self.root = self.AddRoot("Map Layers")
         self.SetPyData(self.root, (None,None))

Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2008-02-18 16:38:31 UTC (rev 30237)
+++ grass/trunk/gui/wxpython/wxgui.py	2008-02-18 16:55:36 UTC (rev 30238)
@@ -150,7 +150,7 @@
         wx.CallAfter(self.notebook.SetSelection, 0)
 
         # start default initial display
-        self.NewDisplay()
+        self.NewDisplay(show=False)
         
         # load workspace file if requested
         if (self.workspaceFile):
@@ -160,6 +160,9 @@
             else:
                 self.workspaceFile = None
 
+        # show map display widnow
+        self.curr_page.maptree.mapdisplay.Show()
+
     def __doLayout(self):
         """Do Layout (unused bacause of aui manager...)"""
         # self.panel = wx.Panel(self,-1, style= wx.EXPAND)
@@ -568,6 +571,11 @@
             # sax
             grcXml = ProcessGrcXml()
             xml.sax.parseString(fileStream, grcXml)
+
+            busy = wx.BusyInfo(message=_("Please wait, loading map layers into layer tree..."),
+                               parent=self)
+            wx.Yield()
+
             for layer in grcXml.layers:
                 if layer['display'] >= self.disp_idx:
                     # create new map display window if needed
@@ -581,6 +589,8 @@
                                            lgroup=layer['group'])
                 maptree.PropertiesDialog(newItem, show=False)
 
+            busy.Destroy()
+            
             # reverse list of map layers
             maptree.Map.ReverseListOfLayers()
 
@@ -902,7 +912,7 @@
 
         return   (
                  ('newdisplay', Icons["newdisplay"].GetBitmap(),
-                  Icons["newdisplay"].GetLabel(), self.NewDisplay),
+                  Icons["newdisplay"].GetLabel(), self.OnNewDisplay),
                  ('', '', '', ''),
                  ('workspaceLoad', Icons["workspaceLoad"].GetBitmap(),
                   Icons["workspaceLoad"].GetLabel(), self.OnWorkspace),
@@ -979,12 +989,14 @@
                                               pointdata=pointdata)
         self.dbmanager.Show()
 
-    def NewDisplay(self, event=None):
-        """
-        Create new layer tree, which will
+    def OnNewDisplay(self, event=None):
+        """Create new layer tree and map display instance"""
+        self.NewDisplay()
+
+    def NewDisplay(self, show=True):
+        """Create new layer tree, which will
         create an associated map display frame
         """
-
         Debug.msg(3, "GMFrame.NewDisplay(): idx=%d" % self.disp_idx)
 
         # make a new page in the bookcontrol for the layer tree (on page 0 of the notebook)
@@ -998,7 +1010,7 @@
                                                        |wx.TR_LINES_AT_ROOT|wx.TR_EDIT_LABELS|wx.TR_HIDE_ROOT
                                                        |wx.TR_DEFAULT_STYLE|wx.NO_BORDER|wx.FULL_REPAINT_ON_RESIZE,
                                                        idx=self.disp_idx, gismgr=self, notebook=self.gm_cb,
-                                                       auimgr=self._auimgr)
+                                                       auimgr=self._auimgr, showMapDisplay=show)
 
         # layout for controls
         cb_boxsizer = wx.BoxSizer(wx.VERTICAL)



More information about the grass-commit mailing list