[GRASS-SVN] r49915 - in grass/trunk/gui/wxpython: gcp iclass lmgr
location_wizard modules vdigit xml
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Dec 26 09:08:21 EST 2011
Author: martinl
Date: 2011-12-26 06:08:21 -0800 (Mon, 26 Dec 2011)
New Revision: 49915
Modified:
grass/trunk/gui/wxpython/gcp/manager.py
grass/trunk/gui/wxpython/iclass/frame.py
grass/trunk/gui/wxpython/lmgr/frame.py
grass/trunk/gui/wxpython/location_wizard/wizard.py
grass/trunk/gui/wxpython/modules/vclean.py
grass/trunk/gui/wxpython/vdigit/wxdigit.py
grass/trunk/gui/wxpython/xml/menudata.xml
Log:
wxGUI: improve OnRunScript - check permission and GRASS_ADDON_PATH
Modified: grass/trunk/gui/wxpython/gcp/manager.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/manager.py 2011-12-26 00:38:34 UTC (rev 49914)
+++ grass/trunk/gui/wxpython/gcp/manager.py 2011-12-26 14:08:21 UTC (rev 49915)
@@ -947,7 +947,7 @@
if self.list.GetItemCount() <= minNumOfItems:
GMessage(parent = self,
- message=_("At least %d GCPs required. Operation cancelled.") % minNumOfItems)
+ message=_("At least %d GCPs required. Operation canceled.") % minNumOfItems)
return
key = self.list.DeleteGCPItem()
@@ -2071,7 +2071,7 @@
if len(values) == 0:
GError(parent = self,
- message=_("Invalid coordinate value. Operation cancelled."))
+ message=_("Invalid coordinate value. Operation canceled."))
else:
for i in range(len(values)):
if values[i] != coords[i]:
Modified: grass/trunk/gui/wxpython/iclass/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/frame.py 2011-12-26 00:38:34 UTC (rev 49914)
+++ grass/trunk/gui/wxpython/iclass/frame.py 2011-12-26 14:08:21 UTC (rev 49915)
@@ -633,7 +633,7 @@
if not group:
GMessage(parent = self,
message = _("No imagery group selected. "
- "Operation cancelled."))
+ "Operation canceled."))
return False
groupLayers = self.GetGroupLayers(group)
@@ -642,7 +642,7 @@
if nLayers <= 1:
GMessage(parent = self,
message = _("Group <%s> does not have enough files "
- "(it has %d files). Operation cancelled.") % (group, nLayers))
+ "(it has %d files). Operation canceled.") % (group, nLayers))
return False
#check if vector has any areas
@@ -652,7 +652,7 @@
if numAreas <= 0:
GMessage(parent = self,
message = _("No areas given. "
- "Operation cancelled."))
+ "Operation canceled."))
return False
# check if vector is inside raster
@@ -664,7 +664,7 @@
vectorInfo['west'] < rasterInfo['west']:
GMessage(parent = self,
message = _("Vector features are outside raster layers. "
- "Operation cancelled."))
+ "Operation canceled."))
return False
return True
Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py 2011-12-26 00:38:34 UTC (rev 49914)
+++ grass/trunk/gui/wxpython/lmgr/frame.py 2011-12-26 14:08:21 UTC (rev 49915)
@@ -21,6 +21,7 @@
import sys
import os
import tempfile
+import stat
try:
import xml.etree.ElementTree as etree
except ImportError:
@@ -579,13 +580,50 @@
if not filename:
return False
-
+
if not os.path.exists(filename):
GError(parent = self,
message = _("Script file '%s' doesn't exist. "
- "Operation cancelled.") % filename)
+ "Operation canceled.") % filename)
return
+
+ # check permission
+ if not os.access(filename, os.X_OK):
+ dlg = wx.MessageDialog(self,
+ message = _("Script <%s> is not executable. "
+ "Do you want to set the permissions "
+ "that allows you to run this script "
+ "(note that you must be the owner of the file)?" % \
+ os.path.basename(filename)),
+ caption = _("Set permission?"),
+ style = wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
+ if dlg.ShowModal() != wx.ID_YES:
+ return
+ dlg.Destroy()
+ try:
+ mode = stat.S_IMODE(os.lstat(filename)[stat.ST_MODE])
+ os.chmod(filename, mode | stat.S_IXUSR)
+ except OSError:
+ GError(_("Unable to set permission. Operation canceled."), parent = self)
+ return
+ # check GRASS_ADDON_PATH
+ addonPath = os.getenv('GRASS_ADDON_PATH', [])
+ if addonPath:
+ addonPath = addonPath.split(os.pathsep)
+ dirName = os.path.dirname(filename)
+ if dirName not in addonPath:
+ addonPath.append(dirName)
+ dlg = wx.MessageDialog(self,
+ message = _("Directory '%s' is not defined in GRASS_ADDON_PATH. "
+ "Do you want add this directory to GRASS_ADDON_PATH?") % \
+ dirName,
+ caption = _("Update Addons path?"),
+ style = wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
+ if dlg.ShowModal() == wx.ID_YES:
+ os.environ['GRASS_ADDON_PATH'] = os.pathsep.join(addonPath)
+ RunCommand('g.gisenv', set = 'ADDON_PATH=%s' % os.environ['GRASS_ADDON_PATH'])
+
self.goutput.WriteCmdLog(_("Launching script '%s'...") % filename)
self.goutput.RunCmd([filename], switchPage = True)
@@ -1645,6 +1683,6 @@
def MsgNoLayerSelected(self):
"""!Show dialog message 'No layer selected'"""
wx.MessageBox(parent = self,
- message = _("No map layer selected. Operation cancelled."),
+ message = _("No map layer selected. Operation canceled."),
caption = _("Message"),
style = wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
Modified: grass/trunk/gui/wxpython/location_wizard/wizard.py
===================================================================
--- grass/trunk/gui/wxpython/location_wizard/wizard.py 2011-12-26 00:38:34 UTC (rev 49914)
+++ grass/trunk/gui/wxpython/location_wizard/wizard.py 2011-12-26 14:08:21 UTC (rev 49915)
@@ -1816,7 +1816,7 @@
"Details: %(err)s") % \
{ 'loc' : self.startpage.location,
'err' : msg })
- else: # -> cancelled
+ else: # -> canceled
self.wizard.Destroy()
GMessage(parent = self.parent,
message = _("Location wizard canceled. "
Modified: grass/trunk/gui/wxpython/modules/vclean.py
===================================================================
--- grass/trunk/gui/wxpython/modules/vclean.py 2011-12-26 00:38:34 UTC (rev 49914)
+++ grass/trunk/gui/wxpython/modules/vclean.py 2011-12-26 14:08:21 UTC (rev 49915)
@@ -461,7 +461,7 @@
err.append(_("'%s' not defined") % name)
if err:
GError(_("Some parameters not defined. Operation "
- "cancelled.\n\n%s") % '\n'.join(err),
+ "canceled.\n\n%s") % '\n'.join(err),
parent = self)
return
Modified: grass/trunk/gui/wxpython/vdigit/wxdigit.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/wxdigit.py 2011-12-26 00:38:34 UTC (rev 49914)
+++ grass/trunk/gui/wxpython/vdigit/wxdigit.py 2011-12-26 14:08:21 UTC (rev 49915)
@@ -55,7 +55,7 @@
message = _('Unable to open vector map <%s>.') % name
else:
message = _('No vector map open for editing.')
- GError(message + ' ' + _('Operation cancelled.'),
+ GError(message + ' ' + _('Operation canceled.'),
parent = self.parent,
caption = self.caption)
@@ -63,7 +63,7 @@
"""!Writing line failed
"""
GError(message = _('Writing new feature failed. '
- 'Operation cancelled.\n\n'
+ 'Operation canceled.\n\n'
'Reason: %s') % GetLastError(),
parent = self.parent,
caption = self.caption)
@@ -72,7 +72,7 @@
"""!Reading line failed
"""
GError(message = _('Reading feature id %d failed. '
- 'Operation cancelled.') % line,
+ 'Operation canceled.') % line,
parent = self.parent,
caption = self.caption)
@@ -80,7 +80,7 @@
"""!No dblink available
"""
GError(message = _('Database link %d not available. '
- 'Operation cancelled.') % dblink,
+ 'Operation canceled.') % dblink,
parent = self.parent,
caption = self.caption)
@@ -88,7 +88,7 @@
"""!Staring driver failed
"""
GError(message = _('Unable to start database driver <%s>. '
- 'Operation cancelled.') % driver,
+ 'Operation canceled.') % driver,
parent = self.parent,
caption = self.caption)
@@ -96,7 +96,7 @@
"""!Opening database failed
"""
GError(message = _('Unable to open database <%(db)s> by driver <%(driver)s>. '
- 'Operation cancelled.') % { 'db' : database, 'driver' : driver},
+ 'Operation canceled.') % { 'db' : database, 'driver' : driver},
parent = self.parent,
caption = self.caption)
@@ -104,7 +104,7 @@
"""!Sql query failed
"""
GError(message = _("Unable to execute SQL query '%s'. "
- "Operation cancelled.") % sql,
+ "Operation canceled.") % sql,
parent = self.parent,
caption = self.caption)
@@ -112,7 +112,7 @@
"""!Dead line
"""
GError(message = _("Feature id %d is marked as dead. "
- "Operation cancelled.") % line,
+ "Operation canceled.") % line,
parent = self.parent,
caption = self.caption)
@@ -120,7 +120,7 @@
"""!Unknown feature type
"""
GError(message = _("Unsupported feature type %d. "
- "Operation cancelled.") % ftype,
+ "Operation canceled.") % ftype,
parent = self.parent,
caption = self.caption)
Modified: grass/trunk/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/trunk/gui/wxpython/xml/menudata.xml 2011-12-26 00:38:34 UTC (rev 49914)
+++ grass/trunk/gui/wxpython/xml/menudata.xml 2011-12-26 14:08:21 UTC (rev 49915)
@@ -895,7 +895,7 @@
<help>Rebuilds all locally installed GRASS Addons extensions.</help>
<keywords>general,installation,extensions</keywords>
<handler>OnMenuCmd</handler>
- <command>g.extension.rebuild.all</command>
+ <command>g.extension.rebuild.all.py</command>
</menuitem>
<menuitem>
<label>Remove extension</label>
More information about the grass-commit
mailing list