mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Remove some unused code
This commit is contained in:
parent
a27c22d9b1
commit
2f28736e8e
@ -585,36 +585,6 @@ class ParameterRaster(ParameterDataObject):
|
||||
def __init__(self, name='', description='', optional=False, showSublayersDialog=True):
|
||||
ParameterDataObject.__init__(self, name, description, None, optional)
|
||||
self.showSublayersDialog = parseBool(showSublayersDialog)
|
||||
self.exported = None
|
||||
|
||||
def getSafeExportedLayer(self):
|
||||
"""Returns not the value entered by the user, but a string with
|
||||
a filename which contains the data of this layer, but saved in
|
||||
a standard format (currently always a geotiff file) so that it
|
||||
can be opened by most external applications.
|
||||
|
||||
Works only if the layer represented by the parameter value is
|
||||
currently loaded in QGIS. Otherwise, it will not perform any
|
||||
export and return the current value string.
|
||||
|
||||
If the current value represents a layer in a suitable format,
|
||||
it does not export at all and returns that value.
|
||||
|
||||
The layer is exported just the first time the method is called.
|
||||
The method can be called several times and it will always
|
||||
return the same file, performing the export only the first
|
||||
time.
|
||||
"""
|
||||
context = dataobjects.createContext()
|
||||
|
||||
if self.exported:
|
||||
return self.exported
|
||||
layer = QgsProcessingUtils.mapLayerFromString(self.value, context, False)
|
||||
if layer:
|
||||
self.exported = dataobjects.exportRasterLayer(layer)
|
||||
else:
|
||||
self.exported = self.value
|
||||
return self.exported
|
||||
|
||||
def getAsScriptCode(self):
|
||||
param_type = ''
|
||||
|
@ -1232,40 +1232,6 @@ class TableFieldWidgetWrapper(WidgetWrapper):
|
||||
return self.comboValue(validator)
|
||||
|
||||
|
||||
def getFileFilter(param):
|
||||
"""
|
||||
Returns a suitable file filter pattern for the specified parameter definition
|
||||
:param param:
|
||||
:return:
|
||||
"""
|
||||
if param.type() == 'multilayer':
|
||||
if param.layerType() == QgsProcessingParameterDefinition.TypeRaster:
|
||||
exts = dataobjects.getSupportedOutputRasterLayerExtensions()
|
||||
elif param.layerType() == QgsProcessingParameterDefinition.TypeFile:
|
||||
return self.tr('All files (*.*)', 'QgsProcessingParameterMultipleLayers')
|
||||
else:
|
||||
exts = QgsVectorFileWriter.supportedFormatExtensions()
|
||||
for i in range(len(exts)):
|
||||
exts[i] = self.tr('{0} files (*.{1})', 'QgsProcessingParameterMultipleLayers').format(exts[i].upper(), exts[i].lower())
|
||||
return ';;'.join(exts)
|
||||
elif param.type() == 'raster':
|
||||
exts = dataobjects.getSupportedOutputRasterLayerExtensions()
|
||||
for i in range(len(exts)):
|
||||
exts[i] = self.tr('{0} files (*.{1})', 'ParameterRaster').format(exts[i].upper(), exts[i].lower())
|
||||
return ';;'.join(exts)
|
||||
elif param.type() == 'table':
|
||||
exts = ['csv', 'dbf']
|
||||
for i in range(len(exts)):
|
||||
exts[i] = self.tr('{0} files (*.{1})', 'ParameterTable').format(exts[i].upper(), exts[i].lower())
|
||||
return ';;'.join(exts)
|
||||
elif param.type() == 'sink':
|
||||
exts = QgsVectorFileWriter.supportedFormatExtensions()
|
||||
for i in range(len(exts)):
|
||||
exts[i] = self.tr('{0} files (*.{1})', 'ParameterVector').format(exts[i].upper(), exts[i].lower())
|
||||
return ';;'.join(exts)
|
||||
return ''
|
||||
|
||||
|
||||
class WidgetWrapperFactory:
|
||||
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user