mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Octave: Change default port number and add custom port number to Preferences
This commit is contained in:
@@ -1076,7 +1076,7 @@ QStringList RiaApplication::octaveArguments() const
|
||||
arguments.append( "--path" );
|
||||
arguments << QApplication::applicationDirPath();
|
||||
|
||||
if ( !m_preferences->octaveShowHeaderInfoWhenExecutingScripts )
|
||||
if ( !m_preferences->octaveShowHeaderInfoWhenExecutingScripts() )
|
||||
{
|
||||
// -q
|
||||
// Don't print the usual greeting and version message at startup.
|
||||
@@ -1119,6 +1119,19 @@ QProcessEnvironment RiaApplication::octaveProcessEnvironment() const
|
||||
penv.insert( "LD_LIBRARY_PATH", ldPath );
|
||||
#endif
|
||||
|
||||
// Set the environment variable for the port number used by Octave plugins
|
||||
// The plugins can access the port number using riOctavePlugin::portNumber()
|
||||
// If the port number is not set in preferences, the plugins will use the default port number
|
||||
const QString key = QString::fromStdString( riOctavePlugin::portNumberKey() );
|
||||
if ( !m_preferences->octavePortNumber().isEmpty() )
|
||||
{
|
||||
penv.insert( key, m_preferences->octavePortNumber() );
|
||||
}
|
||||
else
|
||||
{
|
||||
penv.remove( key );
|
||||
}
|
||||
|
||||
return penv;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,11 +118,14 @@ RiaPreferences::RiaPreferences()
|
||||
m_octaveExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
|
||||
m_octaveExecutable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
|
||||
CAF_PDM_InitField( &octaveShowHeaderInfoWhenExecutingScripts,
|
||||
CAF_PDM_InitField( &m_octaveShowHeaderInfoWhenExecutingScripts,
|
||||
"octaveShowHeaderInfoWhenExecutingScripts",
|
||||
false,
|
||||
"Show Text Header When Executing Scripts" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &octaveShowHeaderInfoWhenExecutingScripts );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_octaveShowHeaderInfoWhenExecutingScripts );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_octavePortNumber, "octavePortNumber", "Octave Port Number" );
|
||||
m_octavePortNumber.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxAndTextEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_pythonExecutable, "pythonExecutable", QString( "python" ), "Python Executable Location" );
|
||||
m_pythonExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
|
||||
@@ -449,7 +452,8 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
{
|
||||
caf::PdmUiGroup* octaveGroup = uiOrdering.addNewGroup( "Octave" );
|
||||
octaveGroup->add( &m_octaveExecutable );
|
||||
octaveGroup->add( &octaveShowHeaderInfoWhenExecutingScripts );
|
||||
octaveGroup->add( &m_octaveShowHeaderInfoWhenExecutingScripts );
|
||||
octaveGroup->add( &m_octavePortNumber );
|
||||
|
||||
#ifdef ENABLE_GRPC
|
||||
caf::PdmUiGroup* pythonGroup = uiOrdering.addNewGroup( "Python" );
|
||||
@@ -1008,6 +1012,24 @@ QString RiaPreferences::octaveExecutable() const
|
||||
return m_octaveExecutable().trimmed();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaPreferences::octaveShowHeaderInfoWhenExecutingScripts() const
|
||||
{
|
||||
return m_octaveShowHeaderInfoWhenExecutingScripts();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferences::octavePortNumber() const
|
||||
{
|
||||
if ( m_octavePortNumber().first ) return m_octavePortNumber().second;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -119,7 +119,11 @@ public:
|
||||
|
||||
// Script paths
|
||||
QString pythonExecutable() const;
|
||||
|
||||
// Octave
|
||||
QString octaveExecutable() const;
|
||||
bool octaveShowHeaderInfoWhenExecutingScripts() const;
|
||||
QString octavePortNumber() const;
|
||||
|
||||
QString loggerFilename() const;
|
||||
int loggerFlushInterval() const;
|
||||
@@ -137,7 +141,6 @@ public:
|
||||
|
||||
caf::PdmField<QString> scriptDirectories;
|
||||
caf::PdmField<QString> scriptEditorExecutable;
|
||||
caf::PdmField<bool> octaveShowHeaderInfoWhenExecutingScripts;
|
||||
caf::PdmField<bool> showPythonDebugInfo;
|
||||
|
||||
caf::PdmField<QString> ssihubAddress;
|
||||
@@ -211,8 +214,12 @@ private:
|
||||
caf::PdmField<caf::FilePath> m_gridCalculationExpressionFolder;
|
||||
caf::PdmField<caf::FilePath> m_summaryCalculationExpressionFolder;
|
||||
|
||||
// Script paths
|
||||
caf::PdmField<QString> m_octaveExecutable;
|
||||
// Octave
|
||||
caf::PdmField<QString> m_octaveExecutable;
|
||||
caf::PdmField<bool> m_octaveShowHeaderInfoWhenExecutingScripts;
|
||||
caf::PdmField<std::pair<bool, QString>> m_octavePortNumber;
|
||||
|
||||
// Python
|
||||
caf::PdmField<QString> m_pythonExecutable;
|
||||
|
||||
// Logging
|
||||
|
||||
Reference in New Issue
Block a user