mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Revert "[processing]fixed bug with wrong characters in output filenames" (caused circular import)
This reverts commit ff5e1ee3a8745ae44db85b1a9511a5f81f6a85fd.
This commit is contained in:
parent
d8b8089e38
commit
4987f4ab4e
@ -16,7 +16,6 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
from processing import interface
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
__copyright__ = '(C) 2012, Victor Olaya'
|
||||
@ -284,7 +283,7 @@ class GeoAlgorithm:
|
||||
if p is not None:
|
||||
self.crs = p.crs()
|
||||
return
|
||||
qgis = interface.iface
|
||||
qgis = dataobjects.iface
|
||||
self.crs = qgis.mapCanvas().mapRenderer().destinationCrs()
|
||||
|
||||
def checkInputCRS(self):
|
||||
@ -369,9 +368,11 @@ class GeoAlgorithm:
|
||||
|
||||
def commandLineName(self):
|
||||
name = self.provider.getName().lower() + ":" + self.name.lower()
|
||||
name = removeInvalidChars(name)
|
||||
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:"
|
||||
name = ''.join(c for c in name if c in validChars)
|
||||
return name
|
||||
|
||||
|
||||
def removeOutputFromName(self, name):
|
||||
for out in self.outputs:
|
||||
if out.name == name:
|
||||
|
@ -16,7 +16,6 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
from processing.tools.general import removeInvalidChars
|
||||
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
@ -229,7 +228,8 @@ class ModelerParameterDefinitionDialog(QtGui.QDialog):
|
||||
QMessageBox.critical(self, "Unable to define parameter", "Invalid parameter name")
|
||||
return
|
||||
if self.param is None:
|
||||
safeName = removeInvalidChars(description)
|
||||
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
safeName = ''.join(c for c in description if c in validChars)
|
||||
name = self.paramType.upper().replace(" ","") + "_" + safeName.upper()
|
||||
else:
|
||||
name = self.param.name
|
||||
|
@ -384,7 +384,8 @@ class SagaAlgorithm(GeoAlgorithm):
|
||||
filename = str(layer.name())
|
||||
else:
|
||||
filename = os.path.basename(source)
|
||||
filename = removeInvalidChars(filename)
|
||||
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:"
|
||||
filename = ''.join(c for c in filename if c in validChars)
|
||||
if len(filename) == 0:
|
||||
filename = "layer"
|
||||
destFilename = getTempFilenameInTempFolder(filename + ".sgrd")
|
||||
|
@ -55,7 +55,8 @@ class SplitRGBBands(GeoAlgorithm):
|
||||
input = self.getParameterValue(SplitRGBBands.INPUT)
|
||||
temp = getTempFilename(None).replace('.','');
|
||||
basename = os.path.basename(temp)
|
||||
safeBasename = removeInvalidChars(basename)
|
||||
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
safeBasename = ''.join(c for c in basename if c in validChars)
|
||||
temp = os.path.join(os.path.dirname(temp), safeBasename)
|
||||
|
||||
r = self.getOutputValue(SplitRGBBands.R)
|
||||
|
@ -219,9 +219,10 @@ def exportVectorLayer(layer):
|
||||
filename = filename[:idx]
|
||||
|
||||
filename = str(layer.name())
|
||||
filename = removeInvalidChars(filename)
|
||||
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:"
|
||||
filename = ''.join(c for c in filename if c in validChars)
|
||||
if len(filename) == 0:
|
||||
filename = "layer"
|
||||
filename = "layer"
|
||||
output = getTempFilenameInTempFolder(filename + ".shp")
|
||||
provider = layer.dataProvider()
|
||||
useSelection = ProcessingConfig.getSetting(ProcessingConfig.USE_SELECTED)
|
||||
|
@ -93,8 +93,5 @@ def extent(layers):
|
||||
else:
|
||||
return str(xmin) + "," + str(xmax) + "," + str(ymin) + "," + str(ymax)
|
||||
|
||||
def removeInvalidChars(string):
|
||||
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:"
|
||||
string = ''.join(c for c in string if c in validChars)
|
||||
return string
|
||||
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
from processing.tools.general import removeInvalidChars
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'March 2013'
|
||||
@ -33,7 +32,8 @@ def createBaseHelpFile(alg, folder):
|
||||
folder = os.path.join(folder, alg.provider.getName().lower())
|
||||
mkdir(folder)
|
||||
cmdLineName = alg.commandLineName()[alg.commandLineName().find(":") + 1:].lower()
|
||||
safeFilename = removeInvalidChars(cmdLineName)
|
||||
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
safeFilename = ''.join(c for c in cmdLineName if c in validChars)
|
||||
filepath = os.path.join(folder, safeFilename + ".rst")
|
||||
file = open(filepath, "w")
|
||||
file.write(alg.name.upper())
|
||||
|
@ -16,7 +16,6 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
from processing.tools.general import removeInvalidChars
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
@ -69,7 +68,6 @@ def getTempFilenameInTempFolder(basename):
|
||||
path = tempFolder()
|
||||
path = os.path.join(path, str(uuid.uuid4()).replace("-",""))
|
||||
mkdir(path)
|
||||
basename = removeInvalidChars(basename)
|
||||
filename = os.path.join(path, basename)
|
||||
return filename
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user