Add job.setprogress to Python API.

main
Teo Mrnjavac 11 years ago
parent c6c2c67560
commit 2636a1273f

@ -45,7 +45,8 @@ BOOST_PYTHON_MODULE( libcalamares )
bp::class_< CalamaresPython::PythonJobInterface >( "job", bp::init< const Calamares::PythonJob* >() ) bp::class_< CalamaresPython::PythonJobInterface >( "job", bp::init< const Calamares::PythonJob* >() )
.def_readonly( "prettyName", &CalamaresPython::PythonJobInterface::prettyName ) .def_readonly( "prettyName", &CalamaresPython::PythonJobInterface::prettyName )
.def_readonly( "workingPath", &CalamaresPython::PythonJobInterface::workingPath ) .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<>() ) bp::class_< Calamares::GlobalStorage >( "GlobalStorage", bp::init<>() )
.def( "contains", &Calamares::GlobalStorage::python_contains ) .def( "contains", &Calamares::GlobalStorage::python_contains )
@ -148,6 +149,13 @@ PythonJob::exec()
} }
void
PythonJob::emitProgress( double progressValue ) const
{
//emit progress( progressValue );
}
CalamaresPython::Helper* CalamaresPython::Helper*
PythonJob::helper() PythonJob::helper()
{ {

@ -47,6 +47,8 @@ public:
private: private:
friend class CalamaresPython::Helper; friend class CalamaresPython::Helper;
friend class CalamaresPython::PythonJobInterface; friend class CalamaresPython::PythonJobInterface;
void emitProgress( double progressValue ) const;
CalamaresPython::Helper* helper(); CalamaresPython::Helper* helper();
QString m_scriptFile; QString m_scriptFile;
QString m_workingPath; QString m_workingPath;

@ -31,4 +31,12 @@ PythonJobInterface::PythonJobInterface( const Calamares::PythonJob* parent )
configuration = CalamaresPython::variantMapToPyDict( m_parent->m_configurationMap ); configuration = CalamaresPython::variantMapToPyDict( m_parent->m_configurationMap );
} }
void
PythonJobInterface::setprogress( double progress )
{
if ( progress >= 0 && progress <= 1 )
m_parent->emitProgress( progress );
}
} }

@ -39,6 +39,8 @@ public:
boost::python::dict configuration; boost::python::dict configuration;
void setprogress( double progress );
private: private:
const Calamares::PythonJob* m_parent; const Calamares::PythonJob* m_parent;
}; };

Loading…
Cancel
Save