[GRASS-SVN] r42171 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 8 15:57:50 EDT 2010


Author: martinl
Date: 2010-05-08 15:57:50 -0400 (Sat, 08 May 2010)
New Revision: 42171

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/help.py
Log:
wxGUI/ext: don't fetch full desc by default
(merge r42169 & r42170 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/help.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/help.py	2010-05-08 19:53:49 UTC (rev 42170)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/help.py	2010-05-08 19:57:50 UTC (rev 42171)
@@ -680,6 +680,9 @@
         
         self.repo = wx.TextCtrl(parent = self.panel, id = wx.ID_ANY,
                                 value = 'https://svn.osgeo.org/grass/grass-addons')
+        self.fullDesc = wx.CheckBox(parent = self.panel, id=wx.ID_ANY,
+                                    label = _("Fetch full description (takes time)"))
+        self.fullDesc.SetValue(False)
         
         self.search = SearchModuleWindow(parent = self.panel, showLabel = False)
         
@@ -709,11 +712,15 @@
     def _layout(self):
         """!Do layout"""
         sizer = wx.BoxSizer(wx.VERTICAL)
-        repoSizer = wx.StaticBoxSizer(self.repoBox, wx.HORIZONTAL)
-        repoSizer.Add(item = self.repo, proportion = 1,
+        repoSizer = wx.StaticBoxSizer(self.repoBox, wx.VERTICAL)
+        repo1Sizer = wx.BoxSizer(wx.HORIZONTAL)
+        repo1Sizer.Add(item = self.repo, proportion = 1,
                       flag = wx.ALL | wx.ALIGN_CENTER_VERTICAL, border = 1)
-        repoSizer.Add(item = self.btnFetch, proportion = 0,
+        repo1Sizer.Add(item = self.btnFetch, proportion = 0,
                       flag = wx.ALL | wx.ALIGN_CENTER_VERTICAL, border = 1)
+        repoSizer.Add(item = repo1Sizer,
+                      flag = wx.EXPAND)
+        repoSizer.Add(item = self.fullDesc)
         
         findSizer = wx.StaticBoxSizer(self.findBox, wx.HORIZONTAL)
         findSizer.Add(item = self.search, proportion = 1)
@@ -771,7 +778,7 @@
     def OnFetch(self, event):
         """!Fetch list of available extensions"""
         self.SetStatusText(_("Fetching list of modules from GRASS-Addons SVN (be patient)..."), 0)
-        self.tree.Load(url = self.repo.GetValue().strip())
+        self.tree.Load(url = self.repo.GetValue().strip(), full = self.fullDesc.IsChecked())
         self.SetStatusText("", 0)
 
     def OnItemActivated(self, event):
@@ -857,29 +864,40 @@
         
         return None
     
-    def Load(self, url):
+    def Load(self, url, full = False):
         """!Load list of extensions"""
         self.DeleteAllItems()
         self.root = self.AddRoot(_("Menu tree"))
         self._initTree()
         
+        if full:
+            flags = 'g'
+        else:
+            flags = 'l'
         ret = gcmd.RunCommand('g.extension', read = True,
                               svnurl = url,
-                              flags = 'g', quiet = True)
+                              flags = flags, quiet = True)
         if not ret:
             return
         
         mdict = dict()
         for line in ret.splitlines():
-            key, value = line.split('=', 1)
-            if key == 'name':
-                prefix, name = value.split('.', 1)
+            if full:
+                key, value = line.split('=', 1)
+                if key == 'name':
+                    prefix, name = value.split('.', 1)
+                    if not mdict.has_key(prefix):
+                        mdict[prefix] = dict()
+                    mdict[prefix][name] = dict()
+                else:
+                    mdict[prefix][name][key] = value
+            else:
+                prefix, name = line.strip().split('.', 1)
                 if not mdict.has_key(prefix):
                     mdict[prefix] = dict()
-                mdict[prefix][name] = dict()
-            else:
-                mdict[prefix][name][key] = value
                 
+                mdict[prefix][name] = { 'command' : prefix + '.' + name }
+        
         for prefix in mdict.keys():
             prefixName = self._expandPrefix(prefix)
             item = self._findItem(prefixName)



More information about the grass-commit mailing list