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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 17 12:25:17 EDT 2008


Author: martinl
Date: 2008-03-17 12:25:17 -0400 (Mon, 17 Mar 2008)
New Revision: 30604

Modified:
   grass/trunk/gui/wxpython/gui_modules/menuform.py
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: duplicated properties dialogs are not allowed


Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-03-17 15:28:21 UTC (rev 30603)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-03-17 16:25:17 UTC (rev 30604)
@@ -1394,13 +1394,18 @@
         self.mf = mainFrame(parent=self.parent, ID=wx.ID_ANY,
                             task_description=self.grass_task,
                             get_dcmd=get_dcmd, layer=layer)
-
+        
+        if get_dcmd is not None:
+            # update only propwin reference
+            get_dcmd(dcmd=None, layer=layer, params=None,
+                     propwin=self.mf)
+        
         if show:
             self.mf.Show(show)
             self.mf.MakeModal(modal)
         else:
             self.mf.OnApply(None)
-
+        
         return cmd
 
 class StaticWrapText(wx.StaticText):

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-03-17 15:28:21 UTC (rev 30603)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-03-17 16:25:17 UTC (rev 30604)
@@ -398,6 +398,7 @@
         self.GetPyData(self.layer_selected)[0]['ctrl'] = ctrl.GetId()
         self.layer_selected.SetWindow(ctrl)
 
+        self.RefreshSelected()
         self.Refresh()
         
     def RenameLayer (self, event):
@@ -588,11 +589,17 @@
 
     def PropertiesDialog (self, layer, show=True):
         """Launch the properties dialog"""
-        global gmpath
+
+        if self.GetPyData(layer)[0].has_key('propwin'):
+            # avoid duplicated GUI dialog for given map layer
+            if self.GetPyData(layer)[0]['propwin'].IsShown():
+                self.GetPyData(layer)[0]['propwin'].SetFocus()
+                return
+        
         completed = ''
         params = self.GetPyData(layer)[1]
         ltype  = self.GetPyData(layer)[0]['type']
-
+                
         Debug.msg (3, "LayerTree.PropertiesDialog(): ltype=%s" % \
                    ltype)
 
@@ -972,14 +979,18 @@
         """Process layer data"""
 
         # set layer text to map name
-        mapname = utils.GetLayerNameFromCmd(dcmd)
-        self.SetItemText(layer, mapname)
+        if dcmd:
+            mapname = utils.GetLayerNameFromCmd(dcmd)
+            self.SetItemText(layer, mapname)
 
         # update layer data
-        self.SetPyData(layer, (self.GetPyData(layer)[0], params))
-        self.GetPyData(layer)[0]['cmd'] = dcmd
-        self.GetPyData(layer)[0]['propwin'] = propwin
-
+        if params:
+            self.SetPyData(layer, (self.GetPyData(layer)[0], params))
+        if dcmd:
+            self.GetPyData(layer)[0]['cmd'] = dcmd
+        if propwin:
+            self.GetPyData(layer)[0]['propwin'] = propwin
+        
         # check layer as active
         # self.CheckItem(layer, checked=True)
 



More information about the grass-commit mailing list