mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
parent
ca4d05dec9
commit
709457f7c2
@ -32,3 +32,5 @@
|
||||
#define RESINSIGHT_PATCH_VERSION "@RESINSIGHT_PATCH_VERSION@"
|
||||
|
||||
#define RESINSIGHT_OCTAVE_VERSION "@OCTAVE_VERSION_STRING@"
|
||||
|
||||
#define RESINSIGHT_PYTHON_VERSION "@Python3_VERSION@"
|
||||
|
@ -55,6 +55,12 @@ if(Qt5Core_FOUND)
|
||||
endif(Qt5Charts_FOUND)
|
||||
endif(Qt5Core_FOUND)
|
||||
|
||||
if(RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
|
||||
set(Python3_EXECUTABLE ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE})
|
||||
find_package(Python3)
|
||||
message(STATUS "Using Python Version: ${Python3_VERSION}")
|
||||
endif()
|
||||
|
||||
# NB: The generated file is written to Cmake binary folder to avoid source tree
|
||||
# pollution This folder is added to include_directories
|
||||
configure_file(
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaBaseDefs.h"
|
||||
#include "RiaNetworkTools.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaVersionInfo.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
@ -155,6 +156,19 @@ void RicHelpAboutFeature::onActionTriggered( bool isChecked )
|
||||
dlg.addVersionEntry( " ", QString( " " ) + vendor + " : " + render );
|
||||
}
|
||||
|
||||
QString compiledUsingPythonVersion = RESINSIGHT_PYTHON_VERSION;
|
||||
if ( !compiledUsingPythonVersion.isEmpty() )
|
||||
{
|
||||
auto pythonRuntimePath = RiaPreferences::current()->pythonExecutable();
|
||||
auto pythonRuntimeVersion = RicHelpAboutFeature::getPythonVersion( pythonRuntimePath );
|
||||
|
||||
dlg.addVersionEntry( " ", "" );
|
||||
dlg.addVersionEntry( " ", "Python" );
|
||||
dlg.addVersionEntry( " ", QString( " Compiled with: Python " ) + compiledUsingPythonVersion );
|
||||
dlg.addVersionEntry( " ", QString( " Runtime binary: " ) + pythonRuntimePath );
|
||||
dlg.addVersionEntry( " ", QString( " Runtime version: " ) + pythonRuntimeVersion );
|
||||
}
|
||||
|
||||
dlg.create();
|
||||
dlg.resize( 300, 200 );
|
||||
|
||||
@ -170,6 +184,27 @@ void RicHelpAboutFeature::setupActionLook( QAction* actionToSetup )
|
||||
actionToSetup->setIcon( QIcon( ":/HelpCircle.svg" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicHelpAboutFeature::getPythonVersion( const QString& pathToPythonExecutable )
|
||||
{
|
||||
QStringList arguments;
|
||||
arguments << "--version";
|
||||
|
||||
QProcess process;
|
||||
process.setProgram( pathToPythonExecutable );
|
||||
process.setArguments( arguments );
|
||||
|
||||
process.start();
|
||||
process.waitForFinished();
|
||||
|
||||
QByteArray output = process.readAllStandardOutput();
|
||||
|
||||
QString versionString = QString( output ).trimmed();
|
||||
return versionString;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -27,6 +27,8 @@ class RicHelpAboutFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
static QString getPythonVersion( const QString& pathToPythonExecutable );
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
|
Loading…
Reference in New Issue
Block a user