Skip to content

Commit

Permalink
Port another member to c++
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 23, 2017
1 parent 3249015 commit a8b364e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions python/core/processing/qgsprocessingmodelalgorithm.sip
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,8 @@ Copies are protected to avoid slicing

virtual bool canExecute( QString *errorMessage /Out/ = 0 ) const;

virtual QString asPythonCommand( const QVariantMap &parameters, QgsProcessingContext &context ) const;


void setName( const QString &name );
%Docstring
Expand Down
6 changes: 0 additions & 6 deletions python/plugins/processing/modeler/ModelerAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,6 @@ def resolveValue(self, value, param):
v = value
return param.evaluateForModeler(v, self)

def asPythonCommand(self, parameters, context):
if self.sourceFilePath():
return QgsProcessingAlgorithm.asPythonCommand(self, parameters, context)
else:
return None

def toPython(self):
s = ['##%s=name' % self.name()]
for param in list(self.parameterComponents().values()):
Expand Down
8 changes: 8 additions & 0 deletions src/core/processing/qgsprocessingmodelalgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,14 @@ bool QgsProcessingModelAlgorithm::canExecute( QString *errorMessage ) const
return true;
}

QString QgsProcessingModelAlgorithm::asPythonCommand( const QVariantMap &parameters, QgsProcessingContext &context ) const
{
if ( mSourceFile.isEmpty() )
return QString(); // temporary model - can't run as python command

return QgsProcessingAlgorithm::asPythonCommand( parameters, context );
}


bool QgsProcessingModelAlgorithm::ChildParameterSource::operator==( const QgsProcessingModelAlgorithm::ChildParameterSource &other ) const
{
Expand Down
1 change: 1 addition & 0 deletions src/core/processing/qgsprocessingmodelalgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ class CORE_EXPORT QgsProcessingModelAlgorithm : public QgsProcessingAlgorithm
QString helpUrl() const override;

bool canExecute( QString *errorMessage SIP_OUT = nullptr ) const override;
QString asPythonCommand( const QVariantMap &parameters, QgsProcessingContext &context ) const override;

/**
* Sets the model \a name.
Expand Down

0 comments on commit a8b364e

Please sign in to comment.