Skip to content
Permalink
Browse files

[processing] Disable runAsBatch/runAsSingle buttons during algorithm …

…execution
  • Loading branch information
gacarrillor committed Mar 7, 2020
1 parent 237f1f7 commit 0153dc805e879fdc5961c485a9b6c150d23c48cd
@@ -254,6 +254,12 @@ Displays an info ``message`` in the dialog's log.
void resetGui();
%Docstring
Resets the dialog's gui, ready for another algorithm execution.
%End

virtual void resetAdditionalGui();
%Docstring
For subclasses to register their own GUI controls to be reset, ready
for another algorithm execution.
%End

void updateRunButtonVisibility();
@@ -265,6 +271,12 @@ Sets visibility for mutually exclusive buttons Run and Change Parameters.
%Docstring
Blocks run and changeParameters buttons and parameters tab while the
algorithm is running.
%End

virtual void blockAdditionalControlsWhileRunning();
%Docstring
For subclasses to register their own GUI controls to be blocked while
the algorithm is running.
%End

QgsMessageBar *messageBar();
@@ -101,6 +101,14 @@ def runAsBatch(self):
dlg.show()
dlg.exec_()

def resetAdditionalGui(self):
if not self.in_place:
self.runAsBatchButton.setEnabled(True)

def blockAdditionalControlsWhileRunning(self):
if not self.in_place:
self.runAsBatchButton.setEnabled(False)

def setParameters(self, parameters):
self.mainWidget().setParameters(parameters)

@@ -87,6 +87,12 @@ def runAsSingle(self):
dlg.show()
dlg.exec_()

def resetAdditionalGui(self):
self.btnRunSingle.setEnabled(True)

def blockAdditionalControlsWhileRunning(self):
self.btnRunSingle.setEnabled(False)

def runAlgorithm(self):
alg_parameters = []

@@ -583,6 +583,7 @@ void QgsProcessingAlgorithmDialogBase::resetGui()
mButtonClose->setEnabled( true );
mTabWidget->setTabEnabled( 0, true ); // Enable Parameters tab
updateRunButtonVisibility();
resetAdditionalGui();
}

void QgsProcessingAlgorithmDialogBase::updateRunButtonVisibility()
@@ -593,11 +594,22 @@ void QgsProcessingAlgorithmDialogBase::updateRunButtonVisibility()
mButtonChangeParameters->setVisible( !runButtonVisible && mExecutedAnyResult );
}

void QgsProcessingAlgorithmDialogBase::resetAdditionalGui()
{

}

void QgsProcessingAlgorithmDialogBase::blockControlsWhileRunning()
{
mButtonRun->setEnabled( false );
mButtonChangeParameters->setEnabled( false );
mTabWidget->setTabEnabled( 0, false ); // Disable Parameters tab
blockAdditionalControlsWhileRunning();
}

void QgsProcessingAlgorithmDialogBase::blockAdditionalControlsWhileRunning()
{

}

QgsMessageBar *QgsProcessingAlgorithmDialogBase::messageBar()
@@ -299,6 +299,12 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
*/
void resetGui();

/**
* For subclasses to register their own GUI controls to be reset, ready
* for another algorithm execution.
*/
virtual void resetAdditionalGui();

/**
* Sets visibility for mutually exclusive buttons Run and Change Parameters.
*/
@@ -310,6 +316,12 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
*/
void blockControlsWhileRunning();

/**
* For subclasses to register their own GUI controls to be blocked while
* the algorithm is running.
*/
virtual void blockAdditionalControlsWhileRunning();

/**
* Returns the dialog's message bar.
*/

0 comments on commit 0153dc8

Please sign in to comment.
You can’t perform that action at this time.