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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 1 11:23:49 EDT 2011


Author: martinl
Date: 2011-08-01 08:23:49 -0700 (Mon, 01 Aug 2011)
New Revision: 47337

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm.py
   grass/trunk/gui/wxpython/gui_modules/gdialogs.py
   grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: launch ATM when creating new vector map (cont'ed)


Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py	2011-08-01 15:16:57 UTC (rev 47336)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py	2011-08-01 15:23:49 UTC (rev 47337)
@@ -2063,8 +2063,8 @@
             if not dlg:
                 return
             
-            if dlg.GetName() and dlg.IsChecked('add'):
-                name = dlg.GetName() + '@' + grass.gisenv()['MAPSET']
+            name = dlg.GetName(full = True)
+            if name and dlg.IsChecked('add'):
                 # add layer to map layer tree
                 self.parent.curr_page.maptree.AddLayer(ltype = 'vector',
                                                        lname = name,

Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2011-08-01 15:16:57 UTC (rev 47336)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2011-08-01 15:23:49 UTC (rev 47337)
@@ -275,10 +275,20 @@
         self.panel.SetSizer(self.sizer)
         self.sizer.Fit(self)
 
-    def GetName(self):
-        """!Get name of vector map to be created"""
-        return self.GetElement().split('@', 1)[0]
+    def GetName(self, full = False):
+        """!Get name of vector map to be created
 
+        @param full True to get fully qualified name
+        """
+        name = self.GetElement()
+        if full:
+            if '@' in name:
+                return name
+            else:
+                return name + '@' + grass.gisenv()['MAPSET']
+        
+        return name.split('@', 1)[0]
+
     def IsChecked(self, key):
         """!Get dialog properties
 

Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2011-08-01 15:16:57 UTC (rev 47336)
+++ grass/trunk/gui/wxpython/wxgui.py	2011-08-01 15:23:49 UTC (rev 47337)
@@ -647,18 +647,21 @@
         
     def OnNewVector(self, event):
         """!Create new vector map layer"""
-        name, add = gdialogs.CreateNewVector(self, log = self.goutput,
-                                             cmd = (('v.edit',
-                                                     { 'tool' : 'create' },
-                                                     'map')))
+        dlg = gdialogs.CreateNewVector(self, log = self.goutput,
+                                       cmd = (('v.edit',
+                                               { 'tool' : 'create' },
+                                               'map')))
         
-        if name and add:
+        if not dlg:
+            return
+        
+        name = dlg.GetName(full = True)
+        if name and dlg.IsChecked('add'):
             # add layer to map layer tree
             self.curr_page.maptree.AddLayer(ltype = 'vector',
                                             lname = name,
-                                            lchecked = True,
-                                            lopacity = 1.0,
                                             lcmd = ['d.vect', 'map=%s' % name])
+        dlg.Destroy()
         
     def OnAboutGRASS(self, event):
         """!Display 'About GRASS' dialog"""



More information about the grass-commit mailing list