Salome HOME
0022712: [CEA 1300] LightApp_PreferencesDlg - invalid layout / resize policy
[modules/gui.git] / src / SALOME_PYQT / SalomePyQt / SalomePyQt.sip
index b4ff564440a1ab63f584d1aa189c472425d5b87b..6344657816e1e62c498d642b6204e8e49eaaaf68 100644 (file)
@@ -1,23 +1,23 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 // File   : SalomePyQt.sip
 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
@@ -25,6 +25,8 @@
 
 %Module SalomePyQt
 
+%Feature ENABLE_CORBA
+
 %Import QtGuimod.sip
 %Import QtXmlmod.sip
 
@@ -33,6 +35,7 @@
 #include <QtxActionSet.h>
 #include <QtxActionGroup.h>
 #include <SalomePyQt.h>
+#include <Plot2d_Curve.h>
 %End
 
 class SALOME_Selection : QObject
@@ -67,6 +70,9 @@ enum WindowType {
   WT_ObjectBrowser,
   WT_PyConsole,
   WT_LogWindow,
+%If (ENABLE_CORBA)
+  WT_NoteBook,
+%End
   WT_User
 };
 
@@ -100,6 +106,13 @@ enum Action {
   SplitAt      = 2  
 };
 
+enum Axis {
+  yLeft,
+  yRight,
+  xBottom,
+  xTop,                
+};     
+
 class QtxAction : QWidgetAction
 {
 %TypeHeaderCode
@@ -196,6 +209,86 @@ private:
   QtxActionGroup( const QtxActionGroup& );
 };
 
+enum ObjectType
+{
+  MainTitle,
+  XTitle,
+  YTitle,
+  Y2Title,
+  XAxis,
+  YAxis,
+  Y2Axis
+};
+
+class Plot2d_Curve
+{
+%TypeHeaderCode
+#include <Plot2d_Curve.h>
+%End
+
+%ConvertToSubClassCode
+    if ( dynamic_cast<Plot2d_Curve*>( sipCpp ) )
+      sipClass = sipClass_Plot2d_Curve;
+    else
+      sipClass = NULL;
+%End
+
+public:
+  Plot2d_Curve();
+  virtual ~Plot2d_Curve();
+  void setName( const QString& );
+  void addPoint( double, double );
+  void addPoints(SIP_PYLIST X, SIP_PYLIST Y);
+%MethodCode
+  int nx = PyList_Size(a0);
+  int ny = PyList_Size(a1);
+  
+  if( nx != ny ) { 
+    PyErr_Format(PyExc_TypeError,"The dimension of x and y should be the same. It is %d and %d currently.", nx, ny);
+  }
+  
+  int i;
+  PyObject *pX, *pY;
+
+  for (i=0; i<nx; i++) {
+    pX = PyList_GET_ITEM(a0,i);
+    pY = PyList_GET_ITEM(a1,i);
+    double aX = PyFloat_AsDouble(pX);
+    double aY = PyFloat_AsDouble(pY);
+    sipCpp->addPoint(aX, aY);
+  }
+%End
+  void insertPoint( int, double, double );
+  void deletePoint( int );
+  void clearAllPoints();
+  void setXAxis( Axis );
+%MethodCode
+  int ax = int(a0);
+  sipCpp->setXAxis(QwtPlot::Axis(ax));
+%End
+  Axis getXAxis() const;
+%MethodCode
+  sipRes = Axis(sipCpp->getXAxis());
+%End
+  void setYAxis( Axis );
+%MethodCode
+  int ay = int(a0);
+  sipCpp->setYAxis(QwtPlot::Axis(ay));
+%End
+  Axis getYAxis() const;
+%MethodCode
+  sipRes = Axis(sipCpp->getYAxis());
+%End
+};
+
+enum VisibilityState 
+{
+  ShownState,
+  HiddenState,
+  UnpresentableState 
+};
+
+
 class SalomePyQt
 {
 %TypeHeaderCode
@@ -203,28 +296,77 @@ class SalomePyQt
 %End
 
 public:
+/* KeepReference is necessary on method getDesktop with SIP >= 4.15.5 to avoid garbage collection of
+   the Python objects added to the desktop. This causes a small memory leak (the wrapper around desktop
+   object is never garbage collected) but since this object contains only references this is not
+   considered a big problem. With versions < 4.15, it seems that this reference was kept implicitly.
+   No proper solution was found for versions between 4.15 and 4.15.4 (included), so those versions
+   should not be used to compile GUI module.
+*/
+%If (SIP_4_15_5 - )
+  static QWidget*          getDesktop() /ReleaseGIL,KeepReference/ ;
+%End
+%If ( - SIP_4_15_5)
   static QWidget*          getDesktop() /ReleaseGIL/ ;
+%End
+
   static QWidget*          getMainFrame() /ReleaseGIL/ ;
   static QMenuBar*         getMainMenuBar() /ReleaseGIL/ ;
   static QMenu*            getPopupMenu( const MenuName ) /ReleaseGIL/ ;
   static QMenu*            getPopupMenu( const QString& ) /ReleaseGIL/ ;
+  static QTreeView*        getObjectBrowser() /ReleaseGIL/ ;
   static SALOME_Selection* getSelection() /Factory,ReleaseGIL/ ;
   static int               getStudyId() /ReleaseGIL/ ;
   static void              putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ;
   static const QString     getActiveComponent() /ReleaseGIL/ ;
-  static void              updateObjBrowser( const int = 0, bool = true ) /ReleaseGIL/ ;
+  static SIP_PYOBJECT      getActivePythonModule() /ReleaseGIL/ ;
+  static bool              activateModule( const QString& ) /ReleaseGIL/ ;
+  static void              updateObjBrowser( const int = 0, bool =  true ) /ReleaseGIL/ ;
+  
+  static bool              isModified() /ReleaseGIL/ ;
+  static void              setModified( bool ) /ReleaseGIL/ ;
 
   static QString           getFileName         ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ;
   static QStringList       getOpenFileNames    ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ;
   static QString           getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ;
+                        
+  static QString           createObject( const QString& = QString("") )  /ReleaseGIL/ ;
+  static QString           createObject( const QString&,
+                                        const QString&,
+                                        const QString&,
+                                        const QString& = QString("") )  /ReleaseGIL/ ;
+
+  static void              setName(const QString& ,const QString& ) /ReleaseGIL/ ;
+  static void              setIcon(const QString& ,const QString& ) /ReleaseGIL/ ;
+  static void              setToolTip(const QString& ,const QString& ) /ReleaseGIL/ ;
+  static QString           getName(const QString& ) /ReleaseGIL/ ;
+  static QString           getToolTip(const QString& ) /ReleaseGIL/ ;
+
+  static void              setVisibilityState( const QString&, VisibilityState );
+  static VisibilityState   getVisibilityState( const QString& );
+
+  static void              setObjectPosition( const QString&, int );
+  static int               getObjectPosition( const QString& );
+
+  static void              setColor( const QString&, const QColor& ) /ReleaseGIL/ ;
+  static QColor            getColor( const QString& ) /ReleaseGIL/ ;
 
+  static void              setReference( const QString& ,const QString& ) /ReleaseGIL/ ; 
+  static QString           getReference( const QString& ) /ReleaseGIL/ ;
+
+  static void              removeObject(const QString&  )    /ReleaseGIL/ ;
+  static void              removeChildren(const QString& = QString("")  ) /ReleaseGIL/ ;
+  static void              removeChild(const QString& = QString("")  ) /ReleaseGIL/ ;
+  static QStringList       getChildren(const QString&=QString("") , const bool = false) /ReleaseGIL/ ;
+
+  static QIcon             loadIcon( const QString&, const QString& ) /ReleaseGIL/ ;
   static void              helpContext( const QString&, const QString& ) /ReleaseGIL/ ;
 
-  static bool              dumpView( const QString& ) /ReleaseGIL/ ;
+  static bool              dumpView( const QString&, const int = 0 ) /ReleaseGIL/ ;
 
   static int               defaultMenuGroup() /ReleaseGIL/ ;
 
-  static int               createTool( const QString& ) /ReleaseGIL/ ;
+  static int               createTool( const QString&, const QString& = QString() ) /ReleaseGIL/ ;
   static int               createTool( const int,  const int,      const int = -1 ) /ReleaseGIL/ ;
   static int               createTool( const int,  const QString&, const int = -1 ) /ReleaseGIL/ ;
   static int               createTool( QAction*,   const int,      const int = -1, const int = -1 ) /ReleaseGIL/ ;
@@ -299,13 +441,33 @@ public:
   static QString           getViewTitle( const int ) /ReleaseGIL/ ;
   static QList<int>        findViews( const QString& ) /ReleaseGIL/ ;
   static bool              activateView( const int ) /ReleaseGIL/ ;
-  static int               createView( const QString& ) /ReleaseGIL/ ;
+  static int               createView( const QString&, bool visible = true, const int width = 0, const int height = 0 ) /ReleaseGIL/ ;
+  static int               createView( const QString&, QWidget* ) /ReleaseGIL/ ;
   static bool              closeView( const int ) /ReleaseGIL/ ;
   static int               cloneView( const int ) /ReleaseGIL/ ;
+  static void              setViewVisible( const int id, bool visible = true ) /ReleaseGIL/ ;
   static bool              isViewVisible( const int id ) /ReleaseGIL/ ;
+  static void              setViewClosable( const int id, const bool ) /ReleaseGIL/ ;
+  static bool              isViewClosable( const int id ) /ReleaseGIL/ ;
   
   static bool              groupAllViews() /ReleaseGIL/ ;
   static bool              splitView( const int, Orientation, Action ) /ReleaseGIL/ ;
   static bool              moveView( const int, const int, const bool ) /ReleaseGIL/ ;
   static QList<int>        neighbourViews( const int ) /ReleaseGIL/ ;
+  
+  static void              displayCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
+  static void              eraseCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
+  static void              eraseCurve(Plot2d_Curve*) /ReleaseGIL/ ;
+  static void              updateCurves( const int ) /ReleaseGIL/ ;
+  static QString           getPlot2dTitle(const int, ObjectType = MainTitle) /ReleaseGIL/ ;
+  static void              setPlot2dTitle(const int, const QString&, ObjectType = MainTitle, bool = true) /ReleaseGIL/ ;
+  static QList<double>     getPlot2dFitRangeByCurves(const int) /ReleaseGIL/ ;
+  static QList<double>     getPlot2dFitRangeCurrent(const int) /ReleaseGIL/ ;
+  static void              setPlot2dFitRange(const int, const double XMin, const double XMax, const double YMin, const double YMax ) /ReleaseGIL/ ;
+
+  static void              processEvents();
+  
+
+  static void              startPyLog(const QString&) /ReleaseGIL/ ;
+  static void              stopPyLog() /ReleaseGIL/ ;
 };