[GRASS-SVN] r32451 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 1 12:02:27 EDT 2008


Author: martinl
Date: 2008-08-01 12:02:27 -0400 (Fri, 01 Aug 2008)
New Revision: 32451

Modified:
   grass/trunk/gui/wxpython/gui_modules/gdialogs.py
   grass/trunk/gui/wxpython/gui_modules/goutput.py
Log:
wxGUI: dxf-dialog cosmetics, import only checked layers from the list, optionally add imported layers into layer tree


Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2008-08-01 15:28:45 UTC (rev 32450)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2008-08-01 16:02:27 UTC (rev 32451)
@@ -734,7 +734,11 @@
         #
         self.list = LayersList(self)
         self.list.LoadData()
-        
+
+        self.add = wx.CheckBox(parent=self.panel, id=wx.ID_ANY,
+                               label=_("Add imported layers into layer tree"))
+        self.add.SetValue(True)
+
         #
         # buttons
         #
@@ -789,6 +793,9 @@
         dialogSizer.Add(item=layerSizer, proportion=1,
                         flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5)
 
+        dialogSizer.Add(item=self.add, proportion=0,
+                        flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5)
+
         #
         # buttons
         #
@@ -842,10 +849,23 @@
             # run in Layer Manager
             self.parent.goutput.RunCmd(cmd)
 
+        if self.add.IsChecked():
+            maptree = self.parent.curr_page.maptree
+            for layer, output in data:
+                # add imported layers into layer tree
+                maptree.AddLayer(ltype='vector',
+                                 lname=output,
+                                 lcmd=['d.vect', 'map=%s' % output])
+
+        self.parent.notebook.SetSelection(0)
+        
         self.OnCancel()
         
     def OnAbort(self, event):
-        """Abort running import"""
+        """Abort running import
+
+        @todo not yet implemented
+        """
         pass
         
     def OnSetInput(self, event):
@@ -916,8 +936,9 @@
             item = self.GetNextItem(item)
             if item == -1:
                 break
-            # layer / output name
-            data.append((self.GetItem(item, 1).GetText(),
-                         self.GetItem(item, 2).GetText()))
+            if self.IsChecked(item):
+                # layer / output name
+                data.append((self.GetItem(item, 1).GetText(),
+                             self.GetItem(item, 2).GetText()))
 
         return data

Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2008-08-01 15:28:45 UTC (rev 32450)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2008-08-01 16:02:27 UTC (rev 32451)
@@ -75,11 +75,11 @@
             event = wxCmdRun(cmd=args[0],
                              pid=requestId)
             wx.PostEvent(self.parent, event)
+
+            time.sleep(.1)
             
             self.requestCmd = callable(*args, **kwds)
 
-            time.sleep(.1)
-            
             self.resultQ.put((requestId, self.requestCmd.run()))
 
             event = wxCmdDone(aborted=self.requestCmd.aborted,



More information about the grass-commit mailing list