mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
[processing][gdal] Fix gdal command does not automatically update
when destination value is changed
This commit is contained in:
parent
ad1fef9f7c
commit
ff7c70fc87
@ -48,6 +48,7 @@ from processing.gui.AlgorithmDialogBase import AlgorithmDialogBase
|
||||
from processing.gui.ParametersPanel import ParametersPanel
|
||||
from processing.gui.MultipleInputPanel import MultipleInputPanel
|
||||
from processing.gui.NumberInputPanel import NumberInputPanel
|
||||
from processing.gui.DestinationSelectionPanel import DestinationSelectionPanel
|
||||
from processing.tools.dataobjects import createContext
|
||||
|
||||
|
||||
@ -88,6 +89,8 @@ class GdalParametersPanel(ParametersPanel):
|
||||
self.connectWidgetChangedSignals(w)
|
||||
for c in w.findChildren(QWidget):
|
||||
self.connectWidgetChangedSignals(c)
|
||||
for output_widget in self.outputWidgets.values():
|
||||
self.connectWidgetChangedSignals(output_widget)
|
||||
|
||||
def connectWidgetChangedSignals(self, w):
|
||||
if isinstance(w, QLineEdit):
|
||||
@ -102,6 +105,8 @@ class GdalParametersPanel(ParametersPanel):
|
||||
w.selectionChanged.connect(self.parametersHaveChanged)
|
||||
elif isinstance(w, NumberInputPanel):
|
||||
w.hasChanged.connect(self.parametersHaveChanged)
|
||||
elif isinstance(w, DestinationSelectionPanel):
|
||||
w.destinationChanged.connect(self.parametersHaveChanged)
|
||||
|
||||
def parametersHaveChanged(self):
|
||||
context = createContext()
|
||||
|
@ -67,6 +67,7 @@ class DestinationSelectionPanel(BASE, WIDGET):
|
||||
'DestinationSelectionPanel', '[Skip output]')
|
||||
|
||||
skipOutputChanged = pyqtSignal(bool)
|
||||
destinationChanged = pyqtSignal()
|
||||
|
||||
def __init__(self, parameter, alg, default_selection=False):
|
||||
super(DestinationSelectionPanel, self).__init__(None)
|
||||
@ -86,6 +87,7 @@ class DestinationSelectionPanel(BASE, WIDGET):
|
||||
|
||||
def textChanged(self):
|
||||
self.use_temporary = False
|
||||
self.destinationChanged.emit()
|
||||
|
||||
def outputIsSkipped(self):
|
||||
"""
|
||||
@ -98,6 +100,7 @@ signal """
|
||||
self.leText.setText('')
|
||||
self.use_temporary = False
|
||||
self.skipOutputChanged.emit(True)
|
||||
self.destinationChanged.emit()
|
||||
|
||||
def selectOutput(self):
|
||||
if isinstance(self.parameter, QgsProcessingParameterFolderDestination):
|
||||
@ -159,6 +162,7 @@ signal """
|
||||
self.leText.setText('')
|
||||
self.use_temporary = True
|
||||
self.skipOutputChanged.emit(False)
|
||||
self.destinationChanged.emit()
|
||||
|
||||
def saveToPostGIS(self):
|
||||
dlg = PostgisTableSelector(self, self.parameter.name().lower())
|
||||
@ -184,6 +188,7 @@ signal """
|
||||
self.leText.setText("postgis:" + uri.uri())
|
||||
|
||||
self.skipOutputChanged.emit(False)
|
||||
self.destinationChanged.emit()
|
||||
|
||||
def saveToGeopackage(self):
|
||||
file_filter = self.tr('GeoPackage files (*.gpkg);;All files (*.*)', 'OutputFile')
|
||||
@ -215,6 +220,7 @@ signal """
|
||||
self.leText.setText("ogr:" + uri.uri())
|
||||
|
||||
self.skipOutputChanged.emit(False)
|
||||
self.destinationChanged.emit()
|
||||
|
||||
def selectFile(self):
|
||||
file_filter = getFileFilter(self.parameter)
|
||||
@ -257,6 +263,7 @@ signal """
|
||||
settings.setValue(last_ext_path, os.path.splitext(filename)[1].lower())
|
||||
|
||||
self.skipOutputChanged.emit(False)
|
||||
self.destinationChanged.emit()
|
||||
|
||||
def selectEncoding(self):
|
||||
dialog = QgsEncodingSelectionDialog(
|
||||
@ -265,6 +272,7 @@ signal """
|
||||
self.encoding = dialog.encoding()
|
||||
settings = QgsSettings()
|
||||
settings.setValue('/Processing/encoding', self.encoding)
|
||||
self.destinationChanged.emit()
|
||||
dialog.deleteLater()
|
||||
|
||||
def selectDirectory(self):
|
||||
@ -280,6 +288,7 @@ signal """
|
||||
settings.setValue('/Processing/LastOutputPath', dirName)
|
||||
|
||||
self.skipOutputChanged.emit(False)
|
||||
self.destinationChanged.emit()
|
||||
|
||||
def setValue(self, value):
|
||||
if not value:
|
||||
@ -298,11 +307,13 @@ signal """
|
||||
self.leText.setText(value.sink.staticValue())
|
||||
self.use_temporary = False
|
||||
self.skipOutputChanged.emit(False)
|
||||
self.destinationChanged.emit()
|
||||
self.encoding = value.createOptions['fileEncoding']
|
||||
else:
|
||||
self.leText.setText(value)
|
||||
self.use_temporary = False
|
||||
self.skipOutputChanged.emit(False)
|
||||
self.destinationChanged.emit()
|
||||
|
||||
def getValue(self):
|
||||
key = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user