Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 3fa10398 authored by PIERSON Julie's avatar PIERSON Julie
Browse files

launching from history ok even when some layers are not loaded

parent 87347d2a
......@@ -149,20 +149,27 @@ class MergeBandTableWidget(BASE, WIDGET):
# when launching alg from history in processing, setting parameters
def setValue(self, value):
QMessageBox.information(None, self.tr('window name'), self.tr('message'))
self.bandClassTree.clear()
# getting raster names
param = value.split(';')
param = [i.split(',') for i in param]
rasterNames = [i[0] for i in param]
QMessageBox.information(None, self.tr('hop'), self.tr(str(param)))
# keeping only loaded layers
rasterNames = [i for i in rasterNames if len(QgsProject.instance().mapLayersByName(i)) != 0]
# checking items in combobox
self.multiLayers.setCheckedItems(rasterNames)
# populating second column in table with band future name
bandNames = [i[1] for i in param]
root = self.bandClassTree.invisibleRootItem()
for i in range(len(bandNames)):
item = item = root.child(i)
item.setText(1, bandNames[i])
# clearing table since rasters may not have been added in right order when checking items
self.bandClassTree.clear()
# for each raster
for r in param:
# if a raster is loaded
if r[0] in rasterNames:
# populate columns in table
item = QTreeWidgetItem()
item.setText(0, r[0])
item.setText(1, r[1])
self.bandClassTree.addTopLevelItem(item)
# return a list each element for a table row
# ['band 1, new name 1', 'band 2, new name 2']
......
......@@ -114,9 +114,6 @@ class MergeAndRenameAlgorithm(QgsProcessingAlgorithm):
input_param = ParameterMergeBandTable.tableValuesAsList(parameters[self.INPUT])
output_raster_path = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
message = 'input_param : ' + str(input_param)
feedback.pushInfo(QCoreApplication.translate('merge and rename', message))
# GETTING USEFUL PARAMETERS
# number of rows in table = number of bands to merge
......@@ -135,9 +132,7 @@ class MergeAndRenameAlgorithm(QgsProcessingAlgorithm):
rasterLayers = [QgsProject.instance().mapLayersByName(i)[0] for i in rasterNames]
rasterPaths = [i.source() for i in rasterLayers]
# MERGING BANDS
merge_param = {
'INPUT' : rasterPaths,
'SEPARATE' : True,
......@@ -159,7 +154,6 @@ class MergeAndRenameAlgorithm(QgsProcessingAlgorithm):
new_name = band_table[band_number][index_oldname]
band.SetDescription(new_name)
# RETURNING RESULTS
# Return the results of the algorithm as a dictionary
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment