[GRASS-SVN] r46759 - in grass/branches/develbranch_6/gui: scripts
wxpython/gui_modules wxpython/xml
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jun 23 08:13:24 EDT 2011
Author: martinl
Date: 2011-06-23 05:13:23 -0700 (Thu, 23 Jun 2011)
New Revision: 46759
Modified:
grass/branches/develbranch_6/gui/scripts/g.extension.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/ghelp.py
grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
Log:
wxGUI: various minor changes in install add-ons dialog
minor changes in the menu
g.extension.py: support multiple GRASS_ADDONS_PATH values
(merge r46757 & r46758 rom trunk)
Modified: grass/branches/develbranch_6/gui/scripts/g.extension.py
===================================================================
--- grass/branches/develbranch_6/gui/scripts/g.extension.py 2011-06-23 12:01:08 UTC (rev 46758)
+++ grass/branches/develbranch_6/gui/scripts/g.extension.py 2011-06-23 12:13:23 UTC (rev 46759)
@@ -414,10 +414,17 @@
if options['prefix'] == '$GRASS_ADDON_PATH':
if not os.environ.has_key('GRASS_ADDON_PATH') or \
not os.environ['GRASS_ADDON_PATH']:
- grass.warning(_("GRASS_ADDON_PATH is not defined, installing to ~/.grass7/addons/"))
- options['prefix'] = os.path.join(os.environ['HOME'], '.grass7', 'addons')
+ major_version = int(grass.version()['version'].split('.', 1)[0])
+ grass.warning(_("GRASS_ADDON_PATH is not defined, "
+ "installing to ~/.grass%d/addons/") % major_version)
+ options['prefix'] = os.path.join(os.environ['HOME'], '.grass%d' % major_version, 'addons')
else:
- options['prefix'] = os.environ['GRASS_ADDON_PATH']
+ path_list = os.environ['GRASS_ADDON_PATH'].split(os.pathsep)
+ if len(path_list) < 1:
+ grass.fatal(_("Invalid GRASS_ADDON_PATH value - '%s'") % os.environ['GRASS_ADDON_PATH'])
+ if len(path_list) > 1:
+ grass.warning(_("GRASS_ADDON_PATH has more items, using first defined - '%s'") % path_list[0])
+ options['prefix'] = path_list[0]
# check dirs
check_dirs()
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/ghelp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/ghelp.py 2011-06-23 12:01:08 UTC (rev 46758)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/ghelp.py 2011-06-23 12:13:23 UTC (rev 46759)
@@ -800,8 +800,7 @@
self.treeBox = wx.StaticBox(parent = self.panel, id = wx.ID_ANY,
label = " %s " % _("List of extensions"))
- self.repo = wx.TextCtrl(parent = self.panel, id = wx.ID_ANY,
- value = 'https://svn.osgeo.org/grass/grass-addons')
+ self.repo = wx.TextCtrl(parent = self.panel, id = wx.ID_ANY)
self.fullDesc = wx.CheckBox(parent = self.panel, id = wx.ID_ANY,
label = _("Fetch full info including description and keywords (takes time)"))
self.fullDesc.SetValue(False)
@@ -825,6 +824,8 @@
continue
self.options[name] = wx.CheckBox(parent = self.panel, id = wx.ID_ANY,
label = desc)
+ self.repo.SetValue(task.get_param(value = 'svnurl').get('default',
+ 'https://svn.osgeo.org/grass/grass-addons'))
self.statusbar = self.CreateStatusBar(0)
@@ -836,10 +837,14 @@
label = _("&Install"))
self.btnInstall.SetToolTipString(_("Install selected add-ons GRASS module"))
self.btnInstall.Enable(False)
-
+ self.btnCmd = wx.Button(parent = self.panel, id = wx.ID_ANY,
+ label = _("Command dialog"))
+ self.btnCmd.SetToolTipString(_('Open %s dialog') % 'g.extension')
+
self.btnClose.Bind(wx.EVT_BUTTON, self.OnCloseWindow)
self.btnFetch.Bind(wx.EVT_BUTTON, self.OnFetch)
self.btnInstall.Bind(wx.EVT_BUTTON, self.OnInstall)
+ self.btnCmd.Bind(wx.EVT_BUTTON, self.OnCmdDialog)
self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivated)
self.tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnItemSelected)
self.search.Bind(wx.EVT_TEXT_ENTER, self.OnShowItem)
@@ -873,6 +878,9 @@
optionSizer.Add(item = self.options[key], proportion = 0)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
+ btnSizer.Add(item = self.btnCmd, proportion = 0,
+ flag = wx.RIGHT, border = 5)
+ btnSizer.AddSpacer(10)
btnSizer.Add(item = self.btnClose, proportion = 0,
flag = wx.RIGHT, border = 5)
btnSizer.Add(item = self.btnInstall, proportion = 0)
@@ -893,19 +901,23 @@
self.Layout()
- def _install(self, name):
+ def _getCmd(self):
+ item = self.tree.GetSelected()
+ if not item or not item.IsOk():
+ return ['g.extension.py']
+
+ name = self.tree.GetItemText(item)
if not name:
+ gcmd.GError(_("Extension not defined"), parent = self)
return
- log = self.parent.GetLogWindow()
flags = list()
for key in self.options.keys():
if self.options[key].IsChecked():
flags.append('-%s' % key)
- log.RunCmd(['g.extension.py'] + flags + ['extension=' + name,
- 'svnurl=' + self.repo.GetValue().strip()])
- self.OnCloseWindow(None)
-
+ return ['g.extension.py'] + flags + ['extension=' + name,
+ 'svnurl=' + self.repo.GetValue().strip()]
+
def OnUpdateStatusBar(self, event):
"""!Update statusbar text"""
element = self.search.GetSelection()
@@ -938,15 +950,15 @@
item = event.GetItem()
data = self.tree.GetPyData(item)
if data and 'command' in data:
- self._install(data['command'])
-
+ self.OnInstall(event = None)
+
def OnInstall(self, event):
"""!Install selected extension"""
- item = self.tree.GetSelected()
- if not item.IsOk():
- return
- self._install(self.tree.GetItemText(item))
+ log = self.parent.GetLogWindow()
+ log.RunCmd(self._getCmd())
+ self.OnCloseWindow(None)
+
def OnItemSelected(self, event):
"""!Item selected"""
item = event.GetItem()
@@ -966,6 +978,10 @@
self.btnInstall.Enable()
else:
self.btnInstall.Enable(False)
+
+ def OnCmdDialog(self, event):
+ """!Shows command dialog"""
+ menuform.GUI(parent = self).ParseCommand(cmd = self._getCmd())
class ExtensionTree(ItemTree):
"""!List of available extensions"""
Modified: grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2011-06-23 12:01:08 UTC (rev 46758)
+++ grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2011-06-23 12:13:23 UTC (rev 46759)
@@ -546,14 +546,14 @@
<separator />
<menuitem>
<label>List</label>
- <help>Lists available GRASS data base files of the user-specified data type to standard output.</help>
+ <help>Lists available GRASS data base files of the user-specified data type.</help>
<keywords>general,map management</keywords>
<handler>OnMenuCmd</handler>
<command>g.list</command>
</menuitem>
<menuitem>
<label>List filtered</label>
- <help>Lists available GRASS data base files of the user-specified data type to standard output.</help>
+ <help>Lists available GRASS data base files of the user-specified data type optionally using the search pattern.</help>
<keywords>general,map management</keywords>
<handler>OnMenuCmd</handler>
<command>g.mlist</command>
@@ -843,13 +843,8 @@
<menuitem>
<label>Install extension from add-ons</label>
<help>Install new extension from GRASS AddOns SVN repository.</help>
- <handler>OnInstallExtension</handler>
- </menuitem>
- <menuitem>
- <label>Manage add-ons extensions</label>
- <help>Tool to maintain GRASS extensions in local GRASS installation.</help>
<keywords>general,extensions</keywords>
- <handler>OnMenuCmd</handler>
+ <handler>OnInstallExtension</handler>
<command>g.extension</command>
</menuitem>
<separator />
More information about the grass-commit
mailing list