From b4aaf85ccf2244de991318b19d0fb14af91e2ffe Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 9 Mar 2020 15:13:40 -0500 Subject: [PATCH] [libcalamares] Call Python function if available for status --- src/libcalamares/PythonJob.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp index 37859b349..8165a4c9c 100644 --- a/src/libcalamares/PythonJob.cpp +++ b/src/libcalamares/PythonJob.cpp @@ -168,7 +168,6 @@ namespace Calamares struct PythonJob::Private { bp::object m_prettyStatusMessage; - bp::object m_prettyName; }; PythonJob::PythonJob( const ModuleSystem::InstanceKey& instance, @@ -205,6 +204,21 @@ PythonJob::prettyName() const QString PythonJob::prettyStatusMessage() const { + if ( m_d && !m_d->m_prettyStatusMessage.is_none() ) + { + cDebug() << "Getting dynamic message"; + QString r; + bp::extract< std::string > result( m_d->m_prettyStatusMessage() ); + r = result.check() ? QString::fromStdString( result() ).trimmed() : QString(); + if ( !r.isEmpty() ) + { + return r; + } + } + else + { + cDebug() << "Getting static message"; + } if ( m_description.isEmpty() ) { return tr( "Running %1 operation." ).arg( QDir( m_workingPath ).dirName() );