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

Commit 2818dc08 authored by PIERSON Julie's avatar PIERSON Julie
Browse files

removing unused code

parent 1800ad10
...@@ -23,25 +23,17 @@ __date__ = '2021-09-14' ...@@ -23,25 +23,17 @@ __date__ = '2021-09-14'
__copyright__ = '(C) 2021 by J. Pierson, UMR 6554 LETG, CNRS' __copyright__ = '(C) 2021 by J. Pierson, UMR 6554 LETG, CNRS'
import os import os
import codecs
from qgis.PyQt import uic from qgis.PyQt import uic
from qgis.PyQt.QtCore import pyqtSlot, QDir from qgis.PyQt.QtCore import pyqtSlot
from qgis.PyQt.QtWidgets import (QTreeWidgetItem, from qgis.PyQt.QtWidgets import (QTreeWidgetItem,
QFileDialog,
QMessageBox, QMessageBox,
QInputDialog, QInputDialog,
QColorDialog
) )
from qgis.PyQt.QtXml import QDomDocument
from qgis.core import (QgsApplication, from qgis.core import (QgsApplication,
QgsMapLayer, QgsMapLayer,
QgsMapLayerProxyModel) QgsMapLayerProxyModel)
from qgis.analysis import QgsRelief
from processing.gui.wrappers import WidgetWrapper from processing.gui.wrappers import WidgetWrapper
from processing.tools import system
from osgeo import gdal from osgeo import gdal
pluginPath = os.path.dirname(__file__) pluginPath = os.path.dirname(__file__)
...@@ -91,13 +83,15 @@ class BandTableWidget(BASE, WIDGET): ...@@ -91,13 +83,15 @@ class BandTableWidget(BASE, WIDGET):
def _removeBandData(self,): def _removeBandData(self,):
self.bandClassTree.clear() self.bandClassTree.clear()
# remove selected line in table when remove button is clicked
@pyqtSlot() @pyqtSlot()
def on_btnRemove_clicked(self): def on_btnRemove_clicked(self):
selectedItems = self.bandClassTree.selectedItems() selectedItems = self.bandClassTree.selectedItems()
for item in selectedItems: for item in selectedItems:
self.bandClassTree.invisibleRootItem().removeChild(item) self.bandClassTree.invisibleRootItem().removeChild(item)
item = None item = None
# move down selected line in table when down button is clicked
@pyqtSlot() @pyqtSlot()
def on_btnDown_clicked(self): def on_btnDown_clicked(self):
selectedItems = self.bandClassTree.selectedItems() selectedItems = self.bandClassTree.selectedItems()
...@@ -107,7 +101,8 @@ class BandTableWidget(BASE, WIDGET): ...@@ -107,7 +101,8 @@ class BandTableWidget(BASE, WIDGET):
self.bandClassTree.takeTopLevelItem(currentIndex) self.bandClassTree.takeTopLevelItem(currentIndex)
self.bandClassTree.insertTopLevelItem(currentIndex + 1, item) self.bandClassTree.insertTopLevelItem(currentIndex + 1, item)
self.bandClassTree.setCurrentItem(item) self.bandClassTree.setCurrentItem(item)
# move up selected line in table when up button is clicked
@pyqtSlot() @pyqtSlot()
def on_btnUp_clicked(self): def on_btnUp_clicked(self):
selectedItems = self.bandClassTree.selectedItems() selectedItems = self.bandClassTree.selectedItems()
...@@ -118,6 +113,7 @@ class BandTableWidget(BASE, WIDGET): ...@@ -118,6 +113,7 @@ class BandTableWidget(BASE, WIDGET):
self.bandClassTree.insertTopLevelItem(currentIndex - 1, item) self.bandClassTree.insertTopLevelItem(currentIndex - 1, item)
self.bandClassTree.setCurrentItem(item) self.bandClassTree.setCurrentItem(item)
# when a cell in 3rd column is clicked, open dialog box for entering value
@pyqtSlot(QTreeWidgetItem, int) @pyqtSlot(QTreeWidgetItem, int)
def on_bandClassTree_itemDoubleClicked(self, item, column): def on_bandClassTree_itemDoubleClicked(self, item, column):
if not item: if not item:
...@@ -131,6 +127,8 @@ class BandTableWidget(BASE, WIDGET): ...@@ -131,6 +127,8 @@ class BandTableWidget(BASE, WIDGET):
if ok: if ok:
item.setText(2, str(d)) item.setText(2, str(d))
# return table values in a list, one element for each row
# [['band 1', 'old name 1', 'new name 1'], ['band 2', 'old name 2', 'new name 2']]
def bandNames(self): def bandNames(self):
band_names = [] band_names = []
for i in range(self.bandClassTree.topLevelItemCount()): for i in range(self.bandClassTree.topLevelItemCount()):
...@@ -139,9 +137,6 @@ class BandTableWidget(BASE, WIDGET): ...@@ -139,9 +137,6 @@ class BandTableWidget(BASE, WIDGET):
row = [item.text(0), item.text(1), item.text(2)] row = [item.text(0), item.text(1), item.text(2)]
band_names.append(row) band_names.append(row)
return band_names return band_names
def layerName(self):
pass
def setLayer(self, layer): def setLayer(self, layer):
QMessageBox.information(None, self.tr('tralala'), self.tr('coucou')) QMessageBox.information(None, self.tr('tralala'), self.tr('coucou'))
......
...@@ -31,18 +31,12 @@ __copyright__ = '(C) 2021 by J. Pierson, UMR 6554 LETG, CNRS' ...@@ -31,18 +31,12 @@ __copyright__ = '(C) 2021 by J. Pierson, UMR 6554 LETG, CNRS'
__revision__ = '$Format:%H$' __revision__ = '$Format:%H$'
from qgis.PyQt.QtCore import QCoreApplication from qgis.PyQt.QtCore import QCoreApplication
from qgis.PyQt.QtGui import QIcon, QColor
from qgis.core import (QgsProcessing, from qgis.core import (QgsProcessing,
QgsProcessingAlgorithm, QgsProcessingAlgorithm,
QgsProcessingParameterRasterLayer, QgsProcessingParameterRasterLayer,
QgsProcessingParameterMatrix,
QgsProcessingParameterDefinition, QgsProcessingParameterDefinition,
QgsProcessingParameterString, QgsProcessingParameterString,
QgsProcessingParameterRasterDestination) QgsProcessingParameterRasterDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.gui.wrappers import WidgetWrapper
#import BandTableWidget
from qgis.PyQt.QtWidgets import QTableWidget
from osgeo import gdal from osgeo import gdal
# custom band table widget # custom band table widget
...@@ -72,32 +66,6 @@ class ParameterBandTable(QgsProcessingParameterDefinition): ...@@ -72,32 +66,6 @@ class ParameterBandTable(QgsProcessingParameterDefinition):
else: else:
return value.split(';') return value.split(';')
class TableWidget(WidgetWrapper):
"""
QTable widget
"""
def createWidget(self):
self._combo = QTableWidget()
# row count
self._combo.setRowCount(1)
# column count
self._combo.setColumnCount(2)
# column headers
self._combo.setHorizontalHeaderLabels(["Name", "Future name"])
return self._combo
def value(self):
# retrieve table values [["name 1", "future name 1"], ["name 2", "future name 2"], ...]
table = []
nrow = self._combo.rowCount()
#ncol = self._combo.columnCount()
for i in range(nrow):
table.append([self._combo.cellWidget(i, 0), self._combo.cellWidget(i, 1)])
return table
class MergeAndRenameAlgorithm(QgsProcessingAlgorithm): class MergeAndRenameAlgorithm(QgsProcessingAlgorithm):
...@@ -143,8 +111,6 @@ class MergeAndRenameAlgorithm(QgsProcessingAlgorithm): ...@@ -143,8 +111,6 @@ class MergeAndRenameAlgorithm(QgsProcessingAlgorithm):
""" """
# RETRIEVE INPUTS AND OUTPUT # RETRIEVE INPUTS AND OUTPUT
#input_param = self.parameterAsRasterLayer(parameters, self.INPUT, context)
#bandData = ParameterBandTable.parseValue(parameters[self.INPUT])
band_data = ParameterBandTable.tableValuesAsList(parameters[self.INPUT]) band_data = ParameterBandTable.tableValuesAsList(parameters[self.INPUT])
output_raster_path = self.parameterAsOutputLayer(parameters, self.OUTPUT, context) output_raster_path = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
......
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