]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Dump arguments of comser operator to python string representation (base implementation).
authoradv <adv@opencascade.com>
Tue, 10 Sep 2013 06:28:47 +0000 (06:28 +0000)
committeradv <adv@opencascade.com>
Tue, 10 Sep 2013 06:28:47 +0000 (06:28 +0000)
src/ImageComposer/ImageComposer_Operator.cxx
src/ImageComposer/ImageComposer_Operator.h

index 5e52f22b93fbe6a90f5e7c05294110e62b403cfd..c9cdc77358929b5a7d50f91d38aa62680c875d49 100644 (file)
@@ -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
index 142a1c6cba7bafa985b8155c706f8f381c0be656..cfece776de8abfe85bf3bc1e81d46f94ffa7dbb1 100644 (file)
@@ -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;