Salome HOME
bos #29467 SALOME GUI logger
[modules/gui.git] / src / SALOME_PYQT / SalomePyQt / SalomePyQt.sip
index 4da473a0aa7c4e794b1200fb0cb9f241914046f4..6f6d5fc37c29fc116d09f2bd40499dffcf908d4c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 %Module SalomePyQt
 
 %Feature ENABLE_CORBA
+%Feature ENABLE_PLOT2D
 
-%Import QtGuimod.sip
-%Import QtXmlmod.sip
+%Import QtCore/QtCoremod.sip
+%Import QtGui/QtGuimod.sip
+%If (Qt_5_0_0 -)
+%Import QtWidgets/QtWidgetsmod.sip
+%End
+%Import QtXml/QtXmlmod.sip
+
+%If (ENABLE_PLOT2D)
+%Include SalomePyQt_Plot2d.sip
+%End
 
 %ExportedHeaderCode
 #include <QtxAction.h>
 #include <QtxActionSet.h>
 #include <QtxActionGroup.h>
+#include <QtxTreeView.h>
 #include <SalomePyQt.h>
-#include <Plot2d_Curve.h>
 %End
 
 class SALOME_Selection : QObject
@@ -70,6 +79,7 @@ enum WindowType {
   WT_ObjectBrowser,
   WT_PyConsole,
   WT_LogWindow,
+  WT_InfoPanel,
 %If (ENABLE_CORBA)
   WT_NoteBook,
 %End
@@ -93,6 +103,12 @@ enum PrefType {
   PT_Font, 
   PT_DirList, 
   PT_File, 
+  PT_Slider,
+  PT_Shortcut,
+  PT_ShortcutTree,
+  PT_BiColor,
+  PT_Background,
+  PT_UserDefined
 };
 
 enum Orientation {
@@ -106,13 +122,6 @@ enum Action {
   SplitAt      = 2  
 };
 
-enum Axis {
-  yLeft,
-  yRight,
-  xBottom,
-  xTop,                
-};     
-
 class QtxAction : QWidgetAction
 {
 %TypeHeaderCode
@@ -121,9 +130,9 @@ class QtxAction : QWidgetAction
 
 %ConvertToSubClassCode
     if ( qobject_cast<QtxAction*>( sipCpp ) )
-      sipClass = sipClass_QtxAction;
+      sipType = sipType_QtxAction;
     else
-      sipClass = NULL;
+      sipType = NULL;
 %End
 
 public:
@@ -144,9 +153,9 @@ class QtxActionSet : QtxAction
 
 %ConvertToSubClassCode
     if ( qobject_cast<QtxActionSet*>( sipCpp ) )
-      sipClass = sipClass_QtxActionSet;
+      sipType = sipType_QtxActionSet;
     else
-      sipClass = NULL;
+      sipType = NULL;
 %End
 
 public:
@@ -183,9 +192,9 @@ class QtxActionGroup : QtxActionSet
 
 %ConvertToSubClassCode
     if ( qobject_cast<QtxActionGroup*>( sipCpp ) )
-      sipClass = sipClass_QtxActionGroup;
+      sipType = sipType_QtxActionGroup;
     else
-      sipClass = NULL;
+      sipType = NULL;
 %End
 
 public:
@@ -209,76 +218,50 @@ private:
   QtxActionGroup( const QtxActionGroup& );
 };
 
-enum ObjectType
+class QtxTreeView : public QTreeView
 {
-  MainTitle,
-  XTitle,
-  YTitle,
-  Y2Title,
-  XAxis,
-  YAxis,
-  Y2Axis
+%TypeHeaderCode
+#include <QtxTreeView.h>
+%End
+
+%ConvertToSubClassCode
+    if ( qobject_cast<QtxTreeView*>( sipCpp ) )
+      sipType = sipType_QtxTreeView;
+    else
+      sipType = NULL;
+%End
+
+public:
+  explicit QtxTreeView( QWidget* /TransferThis/ = 0 );
+  QtxTreeView( const bool, QWidget* /TransferThis/ = 0  );
+  virtual ~QtxTreeView();
+
+signals:
+  void     sortingEnabled( bool );
+  void     selectionChanged();
+
+private:
+  QtxTreeView( const QtxTreeView& );
 };
 
-class Plot2d_Curve
+class UserDefinedContent : public QWidget
 {
 %TypeHeaderCode
-#include <Plot2d_Curve.h>
+#include <SalomePyQt.h>
 %End
 
 %ConvertToSubClassCode
-    if ( dynamic_cast<Plot2d_Curve*>( sipCpp ) )
-      sipClass = sipClass_Plot2d_Curve;
+    if ( qobject_cast<UserDefinedContent*>( sipCpp ) )
+      sipType = sipType_UserDefinedContent;
     else
-      sipClass = NULL;
+      sipType = 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
+  explicit UserDefinedContent();
+
+  virtual void store();
+  virtual void retrieve();
 };
 
 enum VisibilityState 
@@ -288,7 +271,6 @@ enum VisibilityState
   UnpresentableState 
 };
 
-
 class SalomePyQt
 {
 %TypeHeaderCode
@@ -296,6 +278,9 @@ class SalomePyQt
 %End
 
 public:
+  static QString           getAppName() /ReleaseGIL/ ;
+  static bool              isLightApp() /ReleaseGIL/ ;
+
 /* 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
@@ -315,14 +300,34 @@ public:
   static QMenu*            getPopupMenu( const MenuName ) /ReleaseGIL/ ;
   static QMenu*            getPopupMenu( const QString& ) /ReleaseGIL/ ;
   static QTreeView*        getObjectBrowser() /ReleaseGIL/ ;
+  static void              enableSelector() /ReleaseGIL/ ;
+  static void              disableSelector() /ReleaseGIL/ ;
   static SALOME_Selection* getSelection() /Factory,ReleaseGIL/ ;
-  static int               getStudyId() /ReleaseGIL/ ;
-  static void              putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ;
+  static void              setSelection( const QStringList& ) /ReleaseGIL/ ;
+  static QStringList       getComponents() /ReleaseGIL/ ;
   static const QString     getActiveComponent() /ReleaseGIL/ ;
   static SIP_PYOBJECT      getActivePythonModule() /ReleaseGIL/ ;
   static bool              activateModule( const QString& ) /ReleaseGIL/ ;
-  static void              updateObjBrowser( const int = 0, bool =  true ) /ReleaseGIL/ ;
-  
+  static void              registerModule( const QString& ) /ReleaseGIL/ ;
+  static void              updateObjBrowser() /ReleaseGIL/ ;
+
+  static void              infoSetTitle( const QString& ) /ReleaseGIL/ ;
+  static int               infoAddLabel( const QString&, const int = -1 ) /ReleaseGIL/ ;
+  static int               infoAddLabel( const QString&, Qt::Alignment, const int = -1 ) /ReleaseGIL/ ;
+  static int               infoAddAction( QAction*, const int = -1 ) /ReleaseGIL/ ;
+  static int               infoAddGroup( const QString&, const int = -1 ) /ReleaseGIL/ ;
+
+  static void              infoRemove( const int ) /ReleaseGIL/ ;
+  static void              infoClear( const int = -1 ) /ReleaseGIL/ ;
+
+  static void              infoSetVisible( const int, bool ) /ReleaseGIL/ ;
+  static void              infoSetEnabled( const int, bool ) /ReleaseGIL/ ;
+
+  static void              putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ;
+  static int               showNotification( const QString&, const QString&, const int = -1 ) /ReleaseGIL/ ;
+  static void              hideNotification( const QString& ) /ReleaseGIL/ ;
+  static void              hideNotification( const int ) /ReleaseGIL/ ;
+
   static bool              isModified() /ReleaseGIL/ ;
   static void              setModified( bool ) /ReleaseGIL/ ;
 
@@ -330,6 +335,7 @@ public:
   static QStringList       getOpenFileNames    ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ;
   static QString           getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ;
                         
+  static void              createRoot() /ReleaseGIL/ ;
   static QString           createObject( const QString& = QString("") )  /ReleaseGIL/ ;
   static QString           createObject( const QString&,
                                         const QString&,
@@ -371,6 +377,7 @@ public:
   static int               createTool( const int,  const QString&, const int = -1 ) /ReleaseGIL/ ;
   static int               createTool( QAction*,   const int,      const int = -1, const int = -1 ) /ReleaseGIL/ ;
   static int               createTool( QAction*,   const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ;
+  static void              clearTool( const QString& ) /ReleaseGIL/ ;
 
   static int               createMenu( const QString&, const int,
                                       const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ;
@@ -395,18 +402,26 @@ public:
   static QAction*          action( const int ) /ReleaseGIL/ ;
   static int               actionId( const QAction* ) /ReleaseGIL/ ;
 
+  static QString           constant      ( const QString& ) /ReleaseGIL/ ;
+  static void              setConstant   ( const QString&, const QString& ) /ReleaseGIL/ ;
   static void              addSetting    ( const QString&, const QString&, const double ) /ReleaseGIL/ ;
   static void              addSetting    ( const QString&, const QString&, const int /Constrained/ ) /ReleaseGIL/ ;
   static void              addSetting    ( const QString&, const QString&, const bool, const int ) /ReleaseGIL/ ;
   static void              addSetting    ( const QString&, const QString&, const QString& ) /ReleaseGIL/ ;
   static void              addSetting    ( const QString&, const QString&, const QColor& ) /ReleaseGIL/ ;
+  static void              addSetting    ( const QString&, const QString&, const QByteArray& ) /ReleaseGIL/ ;
+  static void              addSetting    ( const QString&, const QString&, const QFont& ) /ReleaseGIL/ ;
   static int               integerSetting( const QString&, const QString&, const int = 0 ) /ReleaseGIL/ ;
   static double            doubleSetting ( const QString&, const QString&, const double = 0 ) /ReleaseGIL/ ;
   static bool              boolSetting   ( const QString&, const QString&, const bool = false ) /ReleaseGIL/ ;
-  static QString           stringSetting ( const QString&, const QString&, const QString& = QString("") ) /ReleaseGIL/ ;
+  static QString           stringSetting ( const QString&, const QString&, const QString& = QString(""), const bool = true ) /ReleaseGIL/ ;
   static QColor            colorSetting  ( const QString&, const QString&, const QColor& = QColor() ) /ReleaseGIL/ ;
+  static QByteArray        byteArraySetting( const QString&, const QString&, const QByteArray& = QByteArray() ) /ReleaseGIL/ ;
+  static QFont             fontSetting( const QString&, const QString&, const QFont& = QFont() ) /ReleaseGIL/ ;
   static void              removeSetting ( const QString&, const QString& ) /ReleaseGIL/ ;
   static bool              hasSetting    ( const QString&, const QString& ) /ReleaseGIL/ ;
+  static QStringList       parameters    ( const QString& ) /ReleaseGIL/ ;
+  static QStringList       parameters    ( const QStringList& ) /ReleaseGIL/ ;
 
 // obsolete
   static void              addStringSetting( const QString&, const QString&, bool = true ) /ReleaseGIL/ ;
@@ -426,6 +441,9 @@ public:
   static void              setPreferenceProperty( const int, 
                                                   const QString&,
                                                   const QVariant& ) /ReleaseGIL/ ;
+  static void              setPreferencePropertyWg( const int, 
+                                                    const QString&,    
+                                                    UserDefinedContent* ) /ReleaseGIL/ ;
   static void              addPreferenceProperty( const int, 
                                                   const QString&, 
                                                  const int, 
@@ -439,9 +457,13 @@ public:
   static QString           getViewType( const int ) /ReleaseGIL/ ;
   static bool              setViewTitle( const int, const QString& ) /ReleaseGIL/ ;
   static QString           getViewTitle( const int ) /ReleaseGIL/ ;
+  static bool              setViewSize( const int, const int, const int = 0 ) /ReleaseGIL/ ;
+  static bool              setViewRotationPoint( const double, const double, const double, const int = 0 ) /ReleaseGIL/ ;
   static QList<int>        findViews( const QString& ) /ReleaseGIL/ ;
   static bool              activateView( const int ) /ReleaseGIL/ ;
-  static int               createView( const QString&, bool visible = true, const int width = 0, const int height = 0 ) /ReleaseGIL/ ;
+  static bool              activateViewManagerAndView( const int ) /ReleaseGIL/ ;
+  static QWidget*          getViewWidget( const int ) /ReleaseGIL/ ;
+  static int               createView( const QString&, bool visible = true, const int width = 0, const int height = 0, bool detached = false ) /ReleaseGIL/ ;
   static int               createView( const QString&, QWidget* ) /ReleaseGIL/ ;
   static bool              closeView( const int ) /ReleaseGIL/ ;
   static int               cloneView( const int ) /ReleaseGIL/ ;
@@ -455,6 +477,8 @@ public:
   static bool              moveView( const int, const int, const bool ) /ReleaseGIL/ ;
   static QList<int>        neighbourViews( const int ) /ReleaseGIL/ ;
   
+%If (ENABLE_PLOT2D)
+// start Plot2d-related functionality
   static void              displayCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
   static void              eraseCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
   static void              eraseCurve(Plot2d_Curve*) /ReleaseGIL/ ;
@@ -464,4 +488,14 @@ public:
   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/ ;
+// end of Plot2d-related functionality
+%End
+
+  static void              processEvents();
+
+  static void              startPyLog(const QString&) /ReleaseGIL/ ;
+  static void              stopPyLog() /ReleaseGIL/ ;
+
+  static void              logUserEvent( const QString& ) /ReleaseGIL/ ;
+  static void              logAction( QAction*, const QString& = QString() ) /ReleaseGIL/ ;
 };