Emit job progress from Python jobs.

This commit is contained in:
Teo Mrnjavac 2014-07-23 12:54:53 +02:00
parent 89fd6a950b
commit 78de11a412
4 changed files with 9 additions and 9 deletions

View File

@ -42,7 +42,7 @@ BOOST_PYTHON_MODULE( libcalamares )
bp::scope().attr( "version" ) = CALAMARES_VERSION;
bp::scope().attr( "shortVersion" ) = CALAMARES_VERSION_SHORT;
bp::class_< CalamaresPython::PythonJobInterface >( "job", bp::init< const Calamares::PythonJob* >() )
bp::class_< CalamaresPython::PythonJobInterface >( "job", bp::init< Calamares::PythonJob* >() )
.def_readonly( "prettyName", &CalamaresPython::PythonJobInterface::prettyName )
.def_readonly( "workingPath", &CalamaresPython::PythonJobInterface::workingPath )
.def_readonly( "configuration", &CalamaresPython::PythonJobInterface::configuration )
@ -150,9 +150,9 @@ PythonJob::exec()
void
PythonJob::emitProgress( double progressValue ) const
PythonJob::emitProgress( qreal progressValue )
{
//emit progress( progressValue );
emit progress( progressValue );
}

View File

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

View File

@ -23,7 +23,7 @@
namespace CalamaresPython
{
PythonJobInterface::PythonJobInterface( const Calamares::PythonJob* parent )
PythonJobInterface::PythonJobInterface( Calamares::PythonJob* parent )
: m_parent( parent )
{
prettyName = m_parent->prettyName().toStdString();
@ -33,7 +33,7 @@ PythonJobInterface::PythonJobInterface( const Calamares::PythonJob* parent )
void
PythonJobInterface::setprogress( double progress )
PythonJobInterface::setprogress( qreal progress )
{
if ( progress >= 0 && progress <= 1 )
m_parent->emitProgress( progress );

View File

@ -32,17 +32,17 @@ namespace CalamaresPython
class PythonJobInterface
{
public:
explicit PythonJobInterface( const Calamares::PythonJob* parent );
explicit PythonJobInterface( Calamares::PythonJob* parent );
std::string prettyName;
std::string workingPath;
boost::python::dict configuration;
void setprogress( double progress );
void setprogress( qreal progress );
private:
const Calamares::PythonJob* m_parent;
Calamares::PythonJob* m_parent;
};
}