diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp index 9be5c7b93..62fa3477d 100644 --- a/src/libcalamares/PythonJob.cpp +++ b/src/libcalamares/PythonJob.cpp @@ -45,7 +45,8 @@ BOOST_PYTHON_MODULE( libcalamares ) bp::class_< CalamaresPython::PythonJobInterface >( "job", bp::init< const Calamares::PythonJob* >() ) .def_readonly( "prettyName", &CalamaresPython::PythonJobInterface::prettyName ) .def_readonly( "workingPath", &CalamaresPython::PythonJobInterface::workingPath ) - .def_readonly( "configuration", &CalamaresPython::PythonJobInterface::configuration ); + .def_readonly( "configuration", &CalamaresPython::PythonJobInterface::configuration ) + .def( "setprogress", &CalamaresPython::PythonJobInterface::setprogress ); bp::class_< Calamares::GlobalStorage >( "GlobalStorage", bp::init<>() ) .def( "contains", &Calamares::GlobalStorage::python_contains ) @@ -148,6 +149,13 @@ PythonJob::exec() } +void +PythonJob::emitProgress( double progressValue ) const +{ + //emit progress( progressValue ); +} + + CalamaresPython::Helper* PythonJob::helper() { diff --git a/src/libcalamares/PythonJob.h b/src/libcalamares/PythonJob.h index 4202746f9..11a572b45 100644 --- a/src/libcalamares/PythonJob.h +++ b/src/libcalamares/PythonJob.h @@ -47,6 +47,8 @@ public: private: friend class CalamaresPython::Helper; friend class CalamaresPython::PythonJobInterface; + void emitProgress( double progressValue ) const; + CalamaresPython::Helper* helper(); QString m_scriptFile; QString m_workingPath; diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp index 7255195dc..0d88a66c0 100644 --- a/src/libcalamares/PythonJobApi.cpp +++ b/src/libcalamares/PythonJobApi.cpp @@ -31,4 +31,12 @@ PythonJobInterface::PythonJobInterface( const Calamares::PythonJob* parent ) configuration = CalamaresPython::variantMapToPyDict( m_parent->m_configurationMap ); } + +void +PythonJobInterface::setprogress( double progress ) +{ + if ( progress >= 0 && progress <= 1 ) + m_parent->emitProgress( progress ); +} + } diff --git a/src/libcalamares/PythonJobApi.h b/src/libcalamares/PythonJobApi.h index cf77709a7..916f475a6 100644 --- a/src/libcalamares/PythonJobApi.h +++ b/src/libcalamares/PythonJobApi.h @@ -39,6 +39,8 @@ public: boost::python::dict configuration; + void setprogress( double progress ); + private: const Calamares::PythonJob* m_parent; };