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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Apr 26 15:20:29 EDT 2010


Author: martinl
Date: 2010-04-26 15:20:29 -0400 (Mon, 26 Apr 2010)
New Revision: 42038

Modified:
   grass/trunk/gui/wxpython/gui_modules/gselect.py
   grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: use GdalSelect in menuform


Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py	2010-04-26 18:43:15 UTC (rev 42037)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py	2010-04-26 19:20:29 UTC (rev 42038)
@@ -34,6 +34,7 @@
 import wx
 import wx.combo
 import wx.lib.filebrowsebutton as filebrowse
+from wx.lib.newevent import NewEvent
 
 import globalvar
 
@@ -45,6 +46,8 @@
 import utils
 from preferences import globalSettings as UserSettings
 
+wxGdalSelect, EVT_GDALSELECT = NewEvent()
+
 class Select(wx.combo.ComboCtrl):
     def __init__(self, parent, id, size = globalvar.DIALOG_GSELECT_SIZE,
                  type = None, multiple = False, mapsets = None, exclude = [],
@@ -1102,25 +1105,8 @@
         path = event.GetString()
         if not path:
             return 
-
+        
         data = list()        
-        # if self.importType == 'dxf':
-        #     ret = gcmd.RunCommand('v.in.dxf',
-        #                           quiet = True,
-        #                           parent = self,
-        #                           read = True,
-        #                           flags = 'l',
-        #                           input = path)
-        #     if not ret:
-        #         self.list.LoadData()
-        #         self.btn_run.Enable(False)
-        #         return
-            
-        #     for line in ret.splitlines():
-        #         layerId = line.split(':')[0].split(' ')[1]
-        #         layerName = line.split(':')[1].strip()
-        #         grassName = utils.GetValidLayerName(layerName)
-        #         data.append((layerId, layerName.strip(), grassName.strip()))
         
         layerId = 1
         if self.format.GetStringSelection() == 'PostgreSQL':
@@ -1159,6 +1145,10 @@
                 data.append((layerId, layerName.strip(), grassName.strip()))
                 layerId += 1
         
+        evt = wxGdalSelect(dsn = dsn)
+        evt.SetId(self.input[self.dsnType][1].GetId())
+        wx.PostEvent(self.parent, evt)
+        
         if self.parent.GetName() == 'MultiImportDialog':
             self.parent.list.LoadData(data)
             if len(data) > 0:
@@ -1166,6 +1156,8 @@
             else:
                 self.parent.btn_run.Enable(False)
         
+        event.Skip()
+        
     def OnSetFormat(self, event):
         """!Format changed"""
         if self.dsnType not in ['file', 'db']:
@@ -1240,9 +1232,10 @@
         
         return self.input[self.dsnType][1].GetValue()
 
-    def SetDsnHandler(self):
-        """!Get DSN"""
-        
+    def GetDsnWin(self):
+        """!Get DSN windows"""
+        return self.input[self.dsnType][1]
+    
     def GetFormatExt(self):
         """!Get format extension"""
         return self.format.GetExtension(self.format.GetStringSelection())

Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-04-26 18:43:15 UTC (rev 42037)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-04-26 19:20:29 UTC (rev 42038)
@@ -706,7 +706,8 @@
             pass
         
         wx.Frame.__init__(self, parent=parent, id=ID, title=title,
-                          pos=wx.DefaultPosition, style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)
+                          pos=wx.DefaultPosition, style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL,
+                          name = "MainFrame")
 
         self.locale = wx.Locale(language = wx.LANGUAGE_DEFAULT)
 
@@ -1035,9 +1036,9 @@
         return self.notebookpanel.createCmd(ignoreErrors=ignoreErrors)
 
 class cmdPanel(wx.Panel):
+    """!A panel containing a notebook dividing in tabs the different
+    guisections of the GRASS cmd.
     """
-    A panel containing a notebook dividing in tabs the different guisections of the GRASS cmd.
-    """
     def __init__( self, parent, task, standalone, mainFrame, *args, **kwargs ):
         wx.Panel.__init__( self, parent, *args, **kwargs )
 
@@ -1421,6 +1422,9 @@
                                                               defSource = 'dir',
                                                               sources = [_("Directory"),
                                                                          _("Database"), _("Protocol")])
+                            self.Bind(gselect.EVT_GDALSELECT, self.OnUpdateSelection)
+                            self.Bind(gselect.EVT_GDALSELECT, self.OnSetValue)
+                            
                             ogrSelection.SetName('OgrSelect')
                             ogrSelection.Hide()
                             
@@ -1428,6 +1432,7 @@
                             
                             p['wxId'].append(rbox.GetId())
                             p['wxId'].append(ogrSelection.GetId())
+                            p['wxId'].append(ogrSelection.GetDsnWin().GetId())
                         else:
                             which_sizer.Add(item=selection, proportion=0,
                                             flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL,
@@ -1872,7 +1877,6 @@
         myId = event.GetId()
         me  = wx.FindWindowById(myId)
         name = me.GetName()
-        
         for porf in self.task.params + self.task.flags:
             if 'wxId' in porf:
                 found = False



More information about the grass-commit mailing list