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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 15 13:44:28 EDT 2008


Author: martinl
Date: 2008-08-15 13:44:28 -0400 (Fri, 15 Aug 2008)
New Revision: 32786

Modified:
   grass/trunk/gui/wxpython/gui_modules/menuform.py
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: fix trac #257, can't really cancel adding layer (merge from devbr6, r32785)


Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-08-15 17:18:34 UTC (rev 32785)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-08-15 17:44:28 UTC (rev 32786)
@@ -570,7 +570,7 @@
         self.get_dcmd = get_dcmd
         self.layer = layer
         self.task = task_description
-        self.parent = parent
+        self.parent = parent # LayerTree | None
 
         # module name + keywords
         title = self.task.name
@@ -842,7 +842,11 @@
         """Cancel button pressed"""
         self.MakeModal(False)
         if self.get_dcmd:
-            self.Hide()
+            if len(self.parent.GetPyData(self.layer)[0]['cmd']) < 1:
+                self.parent.Delete(self.layer)
+                self.Destroy()
+            else:
+                self.Hide()
         else:
             self.Destroy()
 
@@ -1464,7 +1468,10 @@
         try:
             cmd = self.task.getCmd( ignoreErrors=ignoreErrors )
         except ValueError, err:
-            dlg = wx.MessageDialog(self, str(err), _("Error"), wx.OK | wx.ICON_ERROR)
+            dlg = wx.MessageDialog(parent=self,
+                                   message=str(err),
+                                   caption=_("Error in %s") % self.task.name,
+                                   style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
             dlg.ShowModal()
             dlg.Destroy()
             cmd = None

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-08-15 17:18:34 UTC (rev 32785)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-08-15 17:44:28 UTC (rev 32786)
@@ -652,7 +652,7 @@
                                     'ctrl' : ctrlId,
                                     'maplayer' : None,
                                     'nviz' : lnviz,
-                                    'prowin' : None}, 
+                                    'propwin' : None}, 
                                    None))
 
             maplayer = self.Map.AddLayer(type=ltype, command=self.GetPyData(layer)[0]['cmd'], name=name,
@@ -673,7 +673,7 @@
                                     'type' : ltype,
                                     'ctrl' : None,
                                     'maplayer' : None,
-                                    'prowin' : None}, 
+                                    'propwin' : None}, 
                                    None))
 
         # use predefined layer name if given
@@ -1128,7 +1128,6 @@
 
     def GetOptData(self, dcmd, layer, params, propwin):
         """Process layer data"""
-
         # set layer text to map name
         if dcmd:
             mapLayer = self.GetPyData(layer)[0]['maplayer']
@@ -1144,7 +1143,7 @@
                 return
             
             self.SetItemText(layer, mapname + ' (opacity: ' + str(opacity) + '%)')
-
+        
         # update layer data
         if params:
             self.SetPyData(layer, (self.GetPyData(layer)[0], params))



More information about the grass-commit mailing list