1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SalomePyQt.sip
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
29 %Feature ENABLE_PLOT2D
31 %Import QtCore/QtCoremod.sip
32 %Import QtGui/QtGuimod.sip
34 %Import QtWidgets/QtWidgetsmod.sip
36 %Import QtXml/QtXmlmod.sip
39 %Include SalomePyQt_Plot2d.sip
43 #include <QtxAction.h>
44 #include <QtxActionSet.h>
45 #include <QtxActionGroup.h>
46 #include <QtxTreeView.h>
47 #include <SalomePyQt.h>
50 class SALOME_Selection : QObject
53 #include <SalomePyQt.h>
57 void Clear() /ReleaseGIL/ ;
58 void ClearIObjects() /ReleaseGIL/ ;
59 void ClearFilters() /ReleaseGIL/ ;
62 SALOME_Selection( QObject* /TransferThis/ );
65 void currentSelectionChanged();
124 class QtxAction : QWidgetAction
127 #include <QtxAction.h>
130 %ConvertToSubClassCode
131 if ( qobject_cast<QtxAction*>( sipCpp ) )
132 sipClass = sipClass_QtxAction;
138 explicit QtxAction( QObject* /TransferThis/ = 0, bool = false );
139 QtxAction( const QString&, const QString&, int, QObject* /TransferThis/, bool = false );
140 QtxAction( const QString&, const QIcon&, const QString&, int, QObject* /TransferThis/, bool = false );
141 virtual ~QtxAction();
144 QtxAction( const QtxAction& );
147 class QtxActionSet : QtxAction
150 #include <QtxActionSet.h>
153 %ConvertToSubClassCode
154 if ( qobject_cast<QtxActionSet*>( sipCpp ) )
155 sipClass = sipClass_QtxActionSet;
161 explicit QtxActionSet( QObject* /TransferThis/ = 0 );
162 virtual ~QtxActionSet();
164 QList<QAction*> actions() const;
165 void setActions( const QList<QAction*>& );
167 void insertActions( const QList<QAction*>&, const int = -1 );
169 int insertAction( QAction*, const int id = -1, const int = -1 );
170 int insertAction( const QString&, const int id = -1, const int = -1 );
171 int insertAction( const QString&, const QIcon&, const int id = -1, const int = -1 );
173 void removeAction( QAction* );
174 void removeAction( const int );
179 void triggered( int );
180 void triggered( QAction* );
183 QtxActionSet( const QtxActionSet& );
186 class QtxActionGroup : QtxActionSet
189 #include <QtxActionGroup.h>
192 %ConvertToSubClassCode
193 if ( qobject_cast<QtxActionGroup*>( sipCpp ) )
194 sipClass = sipClass_QtxActionGroup;
200 explicit QtxActionGroup( QObject* /TransferThis/ = 0 );
201 QtxActionGroup( QObject* /TransferThis/, const bool );
202 virtual ~QtxActionGroup();
204 bool isExclusive() const;
205 bool usesDropDown() const;
207 void add( QAction* );
210 void setExclusive( const bool );
211 void setUsesDropDown( const bool );
214 void selected( QAction* );
217 QtxActionGroup( const QtxActionGroup& );
220 class QtxTreeView : public QTreeView
223 #include <QtxTreeView.h>
226 %ConvertToSubClassCode
227 if ( qobject_cast<QtxTreeView*>( sipCpp ) )
228 sipClass = sipClass_QtxTreeView;
234 explicit QtxTreeView( QWidget* /TransferThis/ = 0 );
235 QtxTreeView( const bool, QWidget* /TransferThis/ = 0 );
236 virtual ~QtxTreeView();
239 void sortingEnabled( bool );
240 void selectionChanged();
243 QtxTreeView( const QtxTreeView& );
246 class UserDefinedContent : public QWidget
249 #include <SalomePyQt.h>
252 %ConvertToSubClassCode
253 if ( qobject_cast<UserDefinedContent*>( sipCpp ) )
254 sipClass = sipClass_UserDefinedContent;
260 explicit UserDefinedContent();
262 virtual void store();
263 virtual void retrieve();
276 #include <SalomePyQt.h>
280 static QString getAppName() /ReleaseGIL/ ;
281 static bool isLightApp() /ReleaseGIL/ ;
283 /* KeepReference is necessary on method getDesktop with SIP >= 4.15.5 to avoid garbage collection of
284 the Python objects added to the desktop. This causes a small memory leak (the wrapper around desktop
285 object is never garbage collected) but since this object contains only references this is not
286 considered a big problem. With versions < 4.15, it seems that this reference was kept implicitly.
287 No proper solution was found for versions between 4.15 and 4.15.4 (included), so those versions
288 should not be used to compile GUI module.
291 static QWidget* getDesktop() /ReleaseGIL,KeepReference/ ;
294 static QWidget* getDesktop() /ReleaseGIL/ ;
297 static QWidget* getMainFrame() /ReleaseGIL/ ;
298 static QMenuBar* getMainMenuBar() /ReleaseGIL/ ;
299 static QMenu* getPopupMenu( const MenuName ) /ReleaseGIL/ ;
300 static QMenu* getPopupMenu( const QString& ) /ReleaseGIL/ ;
301 static QTreeView* getObjectBrowser() /ReleaseGIL/ ;
302 static void enableSelector() /ReleaseGIL/ ;
303 static void disableSelector() /ReleaseGIL/ ;
304 static SALOME_Selection* getSelection() /Factory,ReleaseGIL/ ;
305 static void setSelection( const QStringList& ) /ReleaseGIL/ ;
306 static QStringList getComponents() /ReleaseGIL/ ;
307 static const QString getActiveComponent() /ReleaseGIL/ ;
308 static SIP_PYOBJECT getActivePythonModule() /ReleaseGIL/ ;
309 static bool activateModule( const QString& ) /ReleaseGIL/ ;
310 static void updateObjBrowser() /ReleaseGIL/ ;
312 static void putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ;
313 static int showNotification( const QString&, const QString&, const int = -1 ) /ReleaseGIL/ ;
314 static void hideNotification( const QString& ) /ReleaseGIL/ ;
315 static void hideNotification( const int ) /ReleaseGIL/ ;
317 static bool isModified() /ReleaseGIL/ ;
318 static void setModified( bool ) /ReleaseGIL/ ;
320 static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ;
321 static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ;
322 static QString getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ;
324 static void createRoot() /ReleaseGIL/ ;
325 static QString createObject( const QString& = QString("") ) /ReleaseGIL/ ;
326 static QString createObject( const QString&,
329 const QString& = QString("") ) /ReleaseGIL/ ;
331 static void setName(const QString& ,const QString& ) /ReleaseGIL/ ;
332 static void setIcon(const QString& ,const QString& ) /ReleaseGIL/ ;
333 static void setToolTip(const QString& ,const QString& ) /ReleaseGIL/ ;
334 static QString getName(const QString& ) /ReleaseGIL/ ;
335 static QString getToolTip(const QString& ) /ReleaseGIL/ ;
337 static void setVisibilityState( const QString&, VisibilityState );
338 static VisibilityState getVisibilityState( const QString& );
340 static void setObjectPosition( const QString&, int );
341 static int getObjectPosition( const QString& );
343 static void setColor( const QString&, const QColor& ) /ReleaseGIL/ ;
344 static QColor getColor( const QString& ) /ReleaseGIL/ ;
346 static void setReference( const QString& ,const QString& ) /ReleaseGIL/ ;
347 static QString getReference( const QString& ) /ReleaseGIL/ ;
349 static void removeObject(const QString& ) /ReleaseGIL/ ;
350 static void removeChildren(const QString& = QString("") ) /ReleaseGIL/ ;
351 static void removeChild(const QString& = QString("") ) /ReleaseGIL/ ;
352 static QStringList getChildren(const QString&=QString("") , const bool = false) /ReleaseGIL/ ;
354 static QIcon loadIcon( const QString&, const QString& ) /ReleaseGIL/ ;
355 static void helpContext( const QString&, const QString& ) /ReleaseGIL/ ;
357 static bool dumpView( const QString&, const int = 0 ) /ReleaseGIL/ ;
359 static int defaultMenuGroup() /ReleaseGIL/ ;
361 static int createTool( const QString&, const QString& = QString() ) /ReleaseGIL/ ;
362 static int createTool( const int, const int, const int = -1 ) /ReleaseGIL/ ;
363 static int createTool( const int, const QString&, const int = -1 ) /ReleaseGIL/ ;
364 static int createTool( QAction*, const int, const int = -1, const int = -1 ) /ReleaseGIL/ ;
365 static int createTool( QAction*, const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ;
366 static void clearTool( const QString& ) /ReleaseGIL/ ;
368 static int createMenu( const QString&, const int,
369 const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ;
370 static int createMenu( const QString&, const QString&,
371 const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ;
372 static int createMenu( const int, const int,
373 const int = -1, const int = -1 ) /ReleaseGIL/ ;
374 static int createMenu( const int, const QString&,
375 const int = -1, const int = -1 ) /ReleaseGIL/ ;
376 static int createMenu( QAction*, const int, const int = -1,
377 const int = -1, const int = -1 ) /ReleaseGIL/ ;
378 static int createMenu( QAction*, const QString&, const int = -1,
379 const int = -1, const int = -1 ) /ReleaseGIL/ ;
380 static QAction* createSeparator() /ReleaseGIL/ ;
382 static QAction* createAction( const int, const QString&,
383 const QString& = QString(), const QString& = QString(),
384 const QString& = QString(), const int = 0, const bool = false ) /ReleaseGIL/ ;
386 static QtxActionGroup* createActionGroup( const int, const bool = true ) /ReleaseGIL/ ;
388 static QAction* action( const int ) /ReleaseGIL/ ;
389 static int actionId( const QAction* ) /ReleaseGIL/ ;
391 static QString constant ( const QString& ) /ReleaseGIL/ ;
392 static void setConstant ( const QString&, const QString& ) /ReleaseGIL/ ;
393 static void addSetting ( const QString&, const QString&, const double ) /ReleaseGIL/ ;
394 static void addSetting ( const QString&, const QString&, const int /Constrained/ ) /ReleaseGIL/ ;
395 static void addSetting ( const QString&, const QString&, const bool, const int ) /ReleaseGIL/ ;
396 static void addSetting ( const QString&, const QString&, const QString& ) /ReleaseGIL/ ;
397 static void addSetting ( const QString&, const QString&, const QColor& ) /ReleaseGIL/ ;
398 static void addSetting ( const QString&, const QString&, const QByteArray& ) /ReleaseGIL/ ;
399 static void addSetting ( const QString&, const QString&, const QFont& ) /ReleaseGIL/ ;
400 static int integerSetting( const QString&, const QString&, const int = 0 ) /ReleaseGIL/ ;
401 static double doubleSetting ( const QString&, const QString&, const double = 0 ) /ReleaseGIL/ ;
402 static bool boolSetting ( const QString&, const QString&, const bool = false ) /ReleaseGIL/ ;
403 static QString stringSetting ( const QString&, const QString&, const QString& = QString(""), const bool = true ) /ReleaseGIL/ ;
404 static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() ) /ReleaseGIL/ ;
405 static QByteArray byteArraySetting( const QString&, const QString&, const QByteArray& = QByteArray() ) /ReleaseGIL/ ;
406 static QFont fontSetting( const QString&, const QString&, const QFont& = QFont() ) /ReleaseGIL/ ;
407 static void removeSetting ( const QString&, const QString& ) /ReleaseGIL/ ;
408 static bool hasSetting ( const QString&, const QString& ) /ReleaseGIL/ ;
409 static QStringList parameters ( const QString& ) /ReleaseGIL/ ;
410 static QStringList parameters ( const QStringList& ) /ReleaseGIL/ ;
413 static void addStringSetting( const QString&, const QString&, bool = true ) /ReleaseGIL/ ;
414 static void addIntSetting ( const QString&, const int, bool = true ) /ReleaseGIL/ ;
415 static void addDoubleSetting( const QString&, const double, bool = true ) /ReleaseGIL/ ;
416 static void addBoolSetting ( const QString&, const bool, bool = true ) /ReleaseGIL/ ;
417 static void removeSettings ( const QString& ) /ReleaseGIL/ ;
418 static QString getSetting ( const QString& ) /ReleaseGIL/ ;
420 static int addGlobalPreference( const QString& ) /ReleaseGIL/ ;
421 static int addPreference( const QString& ) /ReleaseGIL/ ;
422 static int addPreference( const QString&,
423 const int, const int = PT_Auto,
424 const QString& = QString(),
425 const QString& = QString() ) /ReleaseGIL/ ;
426 static QVariant preferenceProperty( const int, const QString& ) /ReleaseGIL/ ;
427 static void setPreferenceProperty( const int,
429 const QVariant& ) /ReleaseGIL/ ;
430 static void setPreferencePropertyWg( const int,
432 UserDefinedContent* ) /ReleaseGIL/ ;
433 static void addPreferenceProperty( const int,
436 const QVariant& ) /ReleaseGIL/ ;
438 static void message( const QString&, bool = true ) /ReleaseGIL/ ;
439 static void clearMessages() /ReleaseGIL/ ;
441 static QList<int> getViews() /ReleaseGIL/ ;
442 static int getActiveView() /ReleaseGIL/ ;
443 static QString getViewType( const int ) /ReleaseGIL/ ;
444 static bool setViewTitle( const int, const QString& ) /ReleaseGIL/ ;
445 static QString getViewTitle( const int ) /ReleaseGIL/ ;
446 static bool setViewSize( const int, const int, const int = 0 ) /ReleaseGIL/ ;
447 static bool setViewRotationPoint( const double, const double, const double, const int = 0 ) /ReleaseGIL/ ;
448 static QList<int> findViews( const QString& ) /ReleaseGIL/ ;
449 static bool activateView( const int ) /ReleaseGIL/ ;
450 static bool activateViewManagerAndView( const int ) /ReleaseGIL/ ;
451 static QWidget* getViewWidget( const int ) /ReleaseGIL/ ;
452 static int createView( const QString&, bool visible = true, const int width = 0, const int height = 0, bool detached = false ) /ReleaseGIL/ ;
453 static int createView( const QString&, QWidget* ) /ReleaseGIL/ ;
454 static bool closeView( const int ) /ReleaseGIL/ ;
455 static int cloneView( const int ) /ReleaseGIL/ ;
456 static void setViewVisible( const int id, bool visible = true ) /ReleaseGIL/ ;
457 static bool isViewVisible( const int id ) /ReleaseGIL/ ;
458 static void setViewClosable( const int id, const bool ) /ReleaseGIL/ ;
459 static bool isViewClosable( const int id ) /ReleaseGIL/ ;
461 static bool groupAllViews() /ReleaseGIL/ ;
462 static bool splitView( const int, Orientation, Action ) /ReleaseGIL/ ;
463 static bool moveView( const int, const int, const bool ) /ReleaseGIL/ ;
464 static QList<int> neighbourViews( const int ) /ReleaseGIL/ ;
467 // start Plot2d-related functionality
468 static void displayCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
469 static void eraseCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
470 static void eraseCurve(Plot2d_Curve*) /ReleaseGIL/ ;
471 static void updateCurves( const int ) /ReleaseGIL/ ;
472 static QString getPlot2dTitle(const int, ObjectType = MainTitle) /ReleaseGIL/ ;
473 static void setPlot2dTitle(const int, const QString&, ObjectType = MainTitle, bool = true) /ReleaseGIL/ ;
474 static QList<double> getPlot2dFitRangeByCurves(const int) /ReleaseGIL/ ;
475 static QList<double> getPlot2dFitRangeCurrent(const int) /ReleaseGIL/ ;
476 static void setPlot2dFitRange(const int, const double XMin, const double XMax, const double YMin, const double YMax ) /ReleaseGIL/ ;
477 // end of Plot2d-related functionality
480 static void processEvents();
482 static void startPyLog(const QString&) /ReleaseGIL/ ;
483 static void stopPyLog() /ReleaseGIL/ ;