From: adv Date: Tue, 10 Sep 2013 06:28:47 +0000 (+0000) Subject: Dump arguments of comser operator to python string representation (base implementation). X-Git-Tag: BR_hydro_v_0_1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fa7f54ee1c5fc278d9710e5aa6edbd3f419019af;p=modules%2Fgui.git Dump arguments of comser operator to python string representation (base implementation). --- diff --git a/src/ImageComposer/ImageComposer_Operator.cxx b/src/ImageComposer/ImageComposer_Operator.cxx index 5e52f22b9..c9cdc7735 100644 --- a/src/ImageComposer/ImageComposer_Operator.cxx +++ b/src/ImageComposer/ImageComposer_Operator.cxx @@ -113,6 +113,31 @@ void ImageComposer_Operator::setBinArgs( const QByteArray& theData ) restoreArgs( aStream ); } +QStringList ImageComposer_Operator::dumpArgsToPython( QString& theArrayName ) const +{ + QStringList aResList; + + if ( theArrayName.isEmpty() ) + theArrayName = "composer_args"; + + QString aStreamName = theArrayName + "_stream"; + + aResList << QString( "%1 = QByteArray();" ).arg( theArrayName ); + aResList << QString( "%1 = QDataStream( %2, QIODevice.WriteOnly );" ) + .arg( aStreamName ).arg( theArrayName ); + + //Dump background color + aResList << QString( "" ); + + aResList << QString( "background_color = QColor( %1, %2, %3, %4 );" ) + .arg( myBackground.red() ).arg( myBackground.green() ) + .arg( myBackground.blue() ).arg( myBackground.alpha() ); + + aResList << QString( "%1 << background_color;" ).arg( aStreamName ); + + return aResList; +} + /** Store the operator's arguments to the stream @param theStream the stream for storing diff --git a/src/ImageComposer/ImageComposer_Operator.h b/src/ImageComposer/ImageComposer_Operator.h index 142a1c6cb..cfece776d 100644 --- a/src/ImageComposer/ImageComposer_Operator.h +++ b/src/ImageComposer/ImageComposer_Operator.h @@ -29,6 +29,13 @@ public: QByteArray getBinArgs() const; void setBinArgs( const QByteArray& ); + /** + Dumps arguments of operator to python script representation + @param theArrayName name of result \c QByteArray array variable + @return list of strings with python representation + **/ + QStringList dumpArgsToPython( QString& theArrayName ) const; + virtual QString name() const; virtual ImageComposer_Image process( const ImageComposer_Image& theImage1, const ImageComposer_Image& theImage2 ) const;