#6799 Preferences : Clean white-space when using path to python/octave

This commit is contained in:
Magne Sjaastad
2020-11-06 14:37:46 +01:00
parent 784e241eb9
commit ed668be674
2 changed files with 32 additions and 12 deletions

View File

@@ -125,9 +125,9 @@ RiaPreferences::RiaPreferences( void )
CAF_PDM_InitField( &scriptEditorExecutable, "scriptEditorExecutable", defaultTextEditor, "Script Editor", "", "", "" );
scriptEditorExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
CAF_PDM_InitField( &octaveExecutable, "octaveExecutable", QString( "octave" ), "Octave Executable Location", "", "", "" );
octaveExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
octaveExecutable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitField( &m_octaveExecutable, "octaveExecutable", QString( "octave" ), "Octave Executable Location", "", "", "" );
m_octaveExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
m_octaveExecutable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitField( &octaveShowHeaderInfoWhenExecutingScripts,
"octaveShowHeaderInfoWhenExecutingScripts",
@@ -138,9 +138,9 @@ RiaPreferences::RiaPreferences( void )
"" );
octaveShowHeaderInfoWhenExecutingScripts.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &pythonExecutable, "pythonExecutable", QString( "python" ), "Python Executable Location", "", "", "" );
pythonExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
pythonExecutable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitField( &m_pythonExecutable, "pythonExecutable", QString( "python" ), "Python Executable Location", "", "", "" );
m_pythonExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
m_pythonExecutable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitField( &showPythonDebugInfo, "pythonDebugInfo", false, "Show Python Debug Info", "", "", "" );
CAF_PDM_InitField( &ssihubAddress, "ssihubAddress", QString( "http://" ), "SSIHUB Address", "", "", "" );
@@ -555,7 +555,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
else if ( uiConfigName == RiaPreferences::tabNameScripting() )
{
caf::PdmUiGroup* octaveGroup = uiOrdering.addNewGroup( "Octave" );
octaveGroup->add( &octaveExecutable );
octaveGroup->add( &m_octaveExecutable );
octaveGroup->add( &octaveShowHeaderInfoWhenExecutingScripts );
#ifdef ENABLE_GRPC
@@ -563,7 +563,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
pythonGroup->add( &enableGrpcServer );
pythonGroup->add( &showPythonDebugInfo );
pythonGroup->add( &defaultGrpcPortNumber );
pythonGroup->add( &pythonExecutable );
pythonGroup->add( &m_pythonExecutable );
#endif
caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup( "Script files" );
scriptGroup->add( &scriptDirectories );
@@ -1104,6 +1104,22 @@ bool RiaPreferences::showGridBox() const
return m_showGridBox();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences::pythonExecutable() const
{
return m_pythonExecutable().trimmed();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences::octaveExecutable() const
{
return m_octaveExecutable().trimmed();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -130,17 +130,17 @@ public:
bool showInfoBox() const;
bool showGridBox() const;
// Script paths
QString pythonExecutable() const;
QString octaveExecutable() const;
public: // Pdm Fields
caf::PdmField<bool> enableGrpcServer;
caf::PdmField<int> defaultGrpcPortNumber;
caf::PdmField<QString> scriptDirectories;
caf::PdmField<QString> scriptEditorExecutable;
caf::PdmField<QString> octaveExecutable;
caf::PdmField<bool> octaveShowHeaderInfoWhenExecutingScripts;
caf::PdmField<QString> pythonExecutable;
caf::PdmField<bool> showPythonDebugInfo;
caf::PdmField<QString> ssihubAddress;
@@ -228,6 +228,10 @@ private:
caf::PdmField<bool> m_searchPlotTemplateFoldersRecursively;
caf::PdmField<caf::FilePath> m_defaultPlotTemplate;
// Script paths
caf::PdmField<QString> m_octaveExecutable;
caf::PdmField<QString> m_pythonExecutable;
// Surface Import
caf::PdmField<double> m_surfaceImportResamplingDistance;