[GRASS-SVN] r50271 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 18 10:07:59 EST 2012


Author: martinl
Date: 2012-01-18 07:07:59 -0800 (Wed, 18 Jan 2012)
New Revision: 50271

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py
Log:
wxGUI/importer: don't close window
		fix AddLayers on error
		check by default when one layer available


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py	2012-01-18 13:10:56 UTC (rev 50270)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py	2012-01-18 15:07:59 UTC (rev 50271)
@@ -1192,13 +1192,11 @@
     
     def AddLayers(self, returncode, cmd = None):
         """!Add imported/linked layers into layer tree"""
-        self.commandId += 1
-        
         if not self.add.IsChecked() or returncode != 0:
             return
         
+        self.commandId += 1
         maptree = self.parent.curr_page.maptree
-        
         layer, output = self.list.GetLayers()[self.commandId]
         
         if '@' not in output:
@@ -1278,11 +1276,13 @@
 
     def OnRun(self, event):
         """!Import/Link data (each layes as separate vector map)"""
+        self.commandId = -1
         data = self.list.GetLayers()
+        if not data:
+            gcmd.GMessage(parent = self,
+                          message = _("No layers marked for import.\nOperation canceled."))
+            return
         
-        # hide dialog
-        self.Hide()
-        
         dsn = self.dsnInput.GetDsn()
         ext = self.dsnInput.GetFormatExt()
             
@@ -1328,9 +1328,7 @@
             # run in Layer Manager
             self.parent.goutput.RunCmd(cmd, switchPage = True,
                                        onDone = self.AddLayers)
-        
-        self.OnCancel()
-
+            
     def _getCommand(self):
         """!Get command"""
         if self.link:
@@ -1472,9 +1470,10 @@
             index = self.InsertStringItem(sys.maxint, str(id))
             self.SetStringItem(index, 1, "%s" % str(name))
             self.SetStringItem(index, 2, "%s" % str(grassName))
-            # check by default
-            ### self.CheckItem(index, True)
         
+        if len(data) == 1:
+            self.CheckItem(0, True)
+        
         self.SetColumnWidth(col = 0, width = wx.LIST_AUTOSIZE_USEHEADER)
 
     def OnPopupMenu(self, event):



More information about the grass-commit mailing list