mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
[GRASS] Rename more references to grass7
This commit is contained in:
parent
c6c13f13a0
commit
a3bb769887
@ -34,11 +34,11 @@ if os.name == 'nt':
|
||||
|
||||
def rliPath():
|
||||
"""Return r.li GRASS user dir"""
|
||||
grass_version = GrassUtils.installedVersion().split('.')[0]
|
||||
if isWindows():
|
||||
homeDir = win32api.GetShortPathName(os.path.expanduser('~'))
|
||||
return os.path.join(homeDir, 'AppData', 'Roaming', 'GRASS7', 'r.li')
|
||||
return os.path.join(homeDir, 'AppData', 'Roaming', f'GRASS{grass_version}', 'r.li')
|
||||
else:
|
||||
grass_version = GrassUtils.installedVersion().split('.')[0]
|
||||
return os.path.join(os.path.expanduser("~"), f'.grass{grass_version}', 'r.li')
|
||||
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ def incorporatePoints(alg, parameters, context, feedback, pointLayerName='points
|
||||
lineLayer = alg.exportedLayers[networkLayerName]
|
||||
else:
|
||||
raise QgsProcessingException(
|
||||
alg.tr('GRASS GIS 7 v.net requires a lines layer!'))
|
||||
alg.tr('GRASS GIS v.net requires a lines layer!'))
|
||||
|
||||
threshold = alg.parameterAsDouble(parameters, 'threshold', context)
|
||||
|
||||
|
||||
@ -276,7 +276,7 @@ class GrassAlgorithm(QgsProcessingAlgorithm):
|
||||
except Exception as e:
|
||||
QgsMessageLog.logMessage(
|
||||
QCoreApplication.translate("GrassAlgorithm",
|
||||
'Could not open GRASS GIS 7 algorithm: {0}').format(
|
||||
'Could not open GRASS GIS algorithm: {0}').format(
|
||||
self._name),
|
||||
QCoreApplication.translate("GrassAlgorithm",
|
||||
'Processing'),
|
||||
@ -309,7 +309,7 @@ class GrassAlgorithm(QgsProcessingAlgorithm):
|
||||
|
||||
param = QgsProcessingParameterExtent(
|
||||
self.GRASS_REGION_EXTENT_PARAMETER,
|
||||
self.tr('GRASS GIS 7 region extent'),
|
||||
self.tr('GRASS GIS region extent'),
|
||||
optional=True
|
||||
)
|
||||
param.setFlags(param.flags() | QgsProcessingParameterDefinition.Flag.FlagAdvanced)
|
||||
@ -319,7 +319,7 @@ class GrassAlgorithm(QgsProcessingAlgorithm):
|
||||
# Add a cellsize parameter
|
||||
param = QgsProcessingParameterNumber(
|
||||
self.GRASS_REGION_CELLSIZE_PARAMETER,
|
||||
self.tr('GRASS GIS 7 region cellsize (leave 0 for default)'),
|
||||
self.tr('GRASS GIS region cellsize (leave 0 for default)'),
|
||||
type=QgsProcessingParameterNumber.Type.Double,
|
||||
minValue=0.0, maxValue=sys.float_info.max + 1, defaultValue=0.0
|
||||
)
|
||||
@ -450,8 +450,8 @@ class GrassAlgorithm(QgsProcessingAlgorithm):
|
||||
path = GrassUtils.grassPath()
|
||||
if path == '':
|
||||
raise QgsProcessingException(
|
||||
self.tr('GRASS GIS 7 folder is not configured. Please '
|
||||
'configure it before running GRASS GIS 7 algorithms.'))
|
||||
self.tr('GRASS GIS folder is not configured. Please '
|
||||
'configure it before running GRASS GIS algorithms.'))
|
||||
|
||||
# make a copy of the original parameters dictionary - it gets modified by grass algorithms
|
||||
parameters = {k: v for k, v in original_parameters.items()}
|
||||
@ -483,7 +483,7 @@ class GrassAlgorithm(QgsProcessingAlgorithm):
|
||||
getattr(self, fullName)(parameters, context, feedback)
|
||||
|
||||
# Run GRASS
|
||||
loglines = [self.tr('GRASS GIS 7 execution commands')]
|
||||
loglines = [self.tr('GRASS GIS execution commands')]
|
||||
for line in self.commands:
|
||||
feedback.pushCommandInfo(line)
|
||||
loglines.append(line)
|
||||
@ -493,7 +493,7 @@ class GrassAlgorithm(QgsProcessingAlgorithm):
|
||||
GrassUtils.executeGrass(self.commands, feedback, self.outputCommands)
|
||||
|
||||
# If the session has been created outside of this algorithm, add
|
||||
# the new GRASS GIS 7 layers to it otherwise finish the session
|
||||
# the new GRASS GIS layers to it otherwise finish the session
|
||||
if existingSession:
|
||||
GrassUtils.addSessionLayers(self.exportedLayers)
|
||||
else:
|
||||
|
||||
@ -102,10 +102,10 @@ class GrassProvider(QgsProcessingProvider):
|
||||
if alg.name().strip() != '':
|
||||
algs.append(alg)
|
||||
else:
|
||||
QgsMessageLog.logMessage(self.tr('Could not open GRASS GIS 7 algorithm: {0}').format(algorithm_json.get('name')), self.tr('Processing'), Qgis.MessageLevel.Critical)
|
||||
QgsMessageLog.logMessage(self.tr('Could not open GRASS GIS algorithm: {0}').format(algorithm_json.get('name')), self.tr('Processing'), Qgis.MessageLevel.Critical)
|
||||
except Exception as e:
|
||||
QgsMessageLog.logMessage(
|
||||
self.tr('Could not open GRASS GIS 7 algorithm: {0}\n{1}').format(algorithm_json.get('name'), e), self.tr('Processing'), Qgis.MessageLevel.Critical)
|
||||
self.tr('Could not open GRASS GIS algorithm: {0}\n{1}').format(algorithm_json.get('name'), e), self.tr('Processing'), Qgis.MessageLevel.Critical)
|
||||
else:
|
||||
# slow approach - pass txt files one by one
|
||||
for descriptionFile in folder.glob('*.txt'):
|
||||
@ -115,10 +115,10 @@ class GrassProvider(QgsProcessingProvider):
|
||||
if alg.name().strip() != '':
|
||||
algs.append(alg)
|
||||
else:
|
||||
QgsMessageLog.logMessage(self.tr('Could not open GRASS GIS 7 algorithm: {0}').format(descriptionFile), self.tr('Processing'), Qgis.MessageLevel.Critical)
|
||||
QgsMessageLog.logMessage(self.tr('Could not open GRASS GIS algorithm: {0}').format(descriptionFile), self.tr('Processing'), Qgis.MessageLevel.Critical)
|
||||
except Exception as e:
|
||||
QgsMessageLog.logMessage(
|
||||
self.tr('Could not open GRASS GIS 7 algorithm: {0}\n{1}').format(descriptionFile, e), self.tr('Processing'), Qgis.MessageLevel.Critical)
|
||||
self.tr('Could not open GRASS GIS algorithm: {0}\n{1}').format(descriptionFile, e), self.tr('Processing'), Qgis.MessageLevel.Critical)
|
||||
return algs
|
||||
|
||||
def loadAlgorithms(self):
|
||||
@ -180,5 +180,5 @@ class GrassProvider(QgsProcessingProvider):
|
||||
|
||||
def tr(self, string, context=''):
|
||||
if context == '':
|
||||
context = 'Grass7AlgorithmProvider'
|
||||
context = 'GrassProvider'
|
||||
return QCoreApplication.translate(context, string)
|
||||
|
||||
@ -354,7 +354,7 @@ class GrassUtils:
|
||||
os.path.join(folder, 'PERMANENT', 'DEFAULT_WIND'))
|
||||
with open(os.path.join(folder, 'PERMANENT', 'MYNAME'), 'w') as outfile:
|
||||
outfile.write(
|
||||
'QGIS GRASS GIS 7 interface: temporary data processing location.\n')
|
||||
'QGIS GRASS GIS interface: temporary data processing location.\n')
|
||||
|
||||
GrassUtils.writeGrassWindow(os.path.join(folder, 'PERMANENT', 'WIND'))
|
||||
mkdir(os.path.join(folder, 'PERMANENT', 'sqlite'))
|
||||
@ -412,7 +412,7 @@ class GrassUtils:
|
||||
|
||||
@staticmethod
|
||||
def executeGrass(commands, feedback, outputCommands=None):
|
||||
loglines = [GrassUtils.tr('GRASS GIS 7 execution console output')]
|
||||
loglines = [GrassUtils.tr('GRASS GIS execution console output')]
|
||||
grassOutDone = False
|
||||
command, grassenv = GrassUtils.prepareGrassExecution(commands)
|
||||
# QgsMessageLog.logMessage('exec: {}'.format(command), 'DEBUG', Qgis.Info)
|
||||
@ -589,20 +589,20 @@ class GrassUtils:
|
||||
'running GRASS algorithms.')
|
||||
if GrassUtils.command is None:
|
||||
return GrassUtils.tr(
|
||||
'GRASS GIS 7 binary {} can\'t be found on this system from a shell. '
|
||||
'GRASS GIS binary {} can\'t be found on this system from a shell. '
|
||||
'Please install it or configure your PATH {} environment variable.'.format(
|
||||
'(grass.bat)' if isWindows() else '(grass.sh)',
|
||||
'or OSGEO4W_ROOT' if isWindows() else ''))
|
||||
# GNU/Linux
|
||||
else:
|
||||
return GrassUtils.tr(
|
||||
'GRASS 7 can\'t be found on this system from a shell. '
|
||||
'GRASS can\'t be found on this system from a shell. '
|
||||
'Please install it or configure your PATH environment variable.')
|
||||
|
||||
@staticmethod
|
||||
def tr(string, context=''):
|
||||
if context == '':
|
||||
context = 'Grass7Utils'
|
||||
context = 'GrassUtils'
|
||||
return QCoreApplication.translate(context, string)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user