mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Intersection : Add Python support for triangle and result values (#8505)
#8508 Python : Make sure an empty list will be received as empty list in Python Co-authored-by: magnesj <magnesj@users.noreply.github.com>
This commit is contained in:
@@ -282,10 +282,20 @@ QString caf::PdmPythonGenerator::generate( PdmObjectFactory* factory, std::vecto
|
||||
|
||||
QString defaultValue = getDefaultValue( field );
|
||||
|
||||
QString commentOrEnumDescription = field->uiCapability()->uiWhatsThis();
|
||||
|
||||
QStringList enumTexts = scriptability->enumScriptTexts();
|
||||
if ( !enumTexts.empty() )
|
||||
{
|
||||
// Replace the comment text with enum values
|
||||
// The space is limited for the generation of documentation
|
||||
commentOrEnumDescription = "One of [" + enumTexts.join( ", " ) + "]";
|
||||
}
|
||||
|
||||
inputArgumentStrings.push_back( QString( "%1=%2" ).arg( argumentName ).arg( defaultValue ) );
|
||||
outputArgumentStrings.push_back( QString( "%1=%1" ).arg( argumentName ) );
|
||||
argumentComments.push_back(
|
||||
QString( "%1 (%2): %3" ).arg( argumentName ).arg( dataType ).arg( field->uiCapability()->uiWhatsThis() ) );
|
||||
QString( "%1 (%2): %3" ).arg( argumentName ).arg( dataType ).arg( commentOrEnumDescription ) );
|
||||
}
|
||||
QString fullComment = QString( " \"\"\"\n %1\n\n Arguments:\n "
|
||||
"%2\n Returns:\n %3\n \"\"\"" )
|
||||
@@ -468,6 +478,9 @@ QString PdmPythonGenerator::dataTypeString( const PdmFieldHandle* field, bool us
|
||||
{
|
||||
auto xmlObj = field->capability<PdmXmlFieldHandle>();
|
||||
|
||||
auto scriptability = field->capability<PdmAbstractFieldScriptingCapability>();
|
||||
if ( scriptability && !scriptability->enumScriptTexts().empty() ) return "str";
|
||||
|
||||
QString dataType = xmlObj->dataTypeName();
|
||||
|
||||
std::map<QString, QString> builtins = { { QString::fromStdString( typeid( double ).name() ), "float" },
|
||||
|
||||
Reference in New Issue
Block a user