[GRASS-SVN] r47201 - in grass/branches/releasebranch_6_4/gui:
scripts wxpython/gui_modules wxpython/xml
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 21 07:52:20 EDT 2011
Author: martinl
Date: 2011-07-21 04:52:20 -0700 (Thu, 21 Jul 2011)
New Revision: 47201
Modified:
grass/branches/releasebranch_6_4/gui/scripts/g.extension.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/ghelp.py
grass/branches/releasebranch_6_4/gui/wxpython/xml/menudata.xml
Log:
wxGUI/extension: sync with grass65
Modified: grass/branches/releasebranch_6_4/gui/scripts/g.extension.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/scripts/g.extension.py 2011-07-21 11:48:31 UTC (rev 47200)
+++ grass/branches/releasebranch_6_4/gui/scripts/g.extension.py 2011-07-21 11:52:20 UTC (rev 47201)
@@ -20,9 +20,7 @@
#%module
#% label: Tool to maintain the extensions in local GRASS installation.
#% description: Downloads, installs extensions from GRASS Addons SVN repository into local GRASS installation or removes installed extensions.
-#% keywords: general
-#% keywords: installation
-#% keywords: extensions
+#% keywords: general, installation, extensions
#%end
#%option
@@ -46,7 +44,7 @@
#% key_desc: url
#% description: SVN Addons repository URL
#% required: yes
-#% answer: https://svn.osgeo.org/grass/grass-addons/grass7
+#% answer: https://svn.osgeo.org/grass/grass-addons
#%end
#%option
#% key: prefix
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/ghelp.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/ghelp.py 2011-07-21 11:48:31 UTC (rev 47200)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/ghelp.py 2011-07-21 11:52:20 UTC (rev 47201)
@@ -802,8 +802,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)
@@ -816,7 +815,7 @@
self.optionBox = wx.StaticBox(parent = self.panel, id = wx.ID_ANY,
label = " %s " % _("Options"))
- task = gtask.parse_interface('g.extension.py')
+ task = gtask.parse_interface('g.extension')
for f in task.get_options()['flags']:
name = f.get('name', '')
@@ -829,6 +828,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(number = 1)
@@ -840,10 +841,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)
@@ -877,6 +882,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)
@@ -897,19 +905,23 @@
self.Layout()
- def _install(self, name):
+ def _getCmd(self):
+ item = self.tree.GetSelected()
+ if not item or not item.IsOk():
+ return ['g.extension']
+
+ 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'] + flags + ['extension=' + name,
+ 'svnurl=' + self.repo.GetValue().strip()]
+
def OnUpdateStatusBar(self, event):
"""!Update statusbar text"""
element = self.search.GetSelection()
@@ -942,15 +954,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()
@@ -970,6 +982,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/releasebranch_6_4/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/xml/menudata.xml 2011-07-21 11:48:31 UTC (rev 47200)
+++ grass/branches/releasebranch_6_4/gui/wxpython/xml/menudata.xml 2011-07-21 11:52:20 UTC (rev 47201)
@@ -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