1 // Copyright (C) 2007-2023 CEA, EDF, 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();
125 class QtxAction : QWidgetAction
128 #include <QtxAction.h>
131 %ConvertToSubClassCode
132 if ( qobject_cast<QtxAction*>( sipCpp ) )
133 sipType = sipType_QtxAction;
139 explicit QtxAction( QObject* /TransferThis/ = 0, bool = false );
140 QtxAction( const QString&, const QString&, int, QObject* /TransferThis/, bool = false );
141 QtxAction( const QString&, const QIcon&, const QString&, int, QObject* /TransferThis/, bool = false );
142 virtual ~QtxAction();
145 QtxAction( const QtxAction& );
148 class QtxActionSet : QtxAction
151 #include <QtxActionSet.h>
154 %ConvertToSubClassCode
155 if ( qobject_cast<QtxActionSet*>( sipCpp ) )
156 sipType = sipType_QtxActionSet;
162 explicit QtxActionSet( QObject* /TransferThis/ = 0 );
163 virtual ~QtxActionSet();
165 QList<QAction*> actions() const;
166 void setActions( const QList<QAction*>& );
168 void insertActions( const QList<QAction*>&, const int = -1 );
170 int insertAction( QAction*, const int id = -1, const int = -1 );
171 int insertAction( const QString&, const int id = -1, const int = -1 );
172 int insertAction( const QString&, const QIcon&, const int id = -1, const int = -1 );
174 void removeAction( QAction* );
175 void removeAction( const int );
180 void triggered( int );
181 void triggered( QAction* );
184 QtxActionSet( const QtxActionSet& );
187 class QtxActionGroup : QtxActionSet
190 #include <QtxActionGroup.h>
193 %ConvertToSubClassCode
194 if ( qobject_cast<QtxActionGroup*>( sipCpp ) )
195 sipType = sipType_QtxActionGroup;
201 explicit QtxActionGroup( QObject* /TransferThis/ = 0 );
202 QtxActionGroup( QObject* /TransferThis/, const bool );
203 virtual ~QtxActionGroup();
205 bool isExclusive() const;
206 bool usesDropDown() const;
208 void add( QAction* );
211 void setExclusive( const bool );
212 void setUsesDropDown( const bool );
215 void selected( QAction* );
218 QtxActionGroup( const QtxActionGroup& );
221 class QtxTreeView : public QTreeView
224 #include <QtxTreeView.h>
227 %ConvertToSubClassCode
228 if ( qobject_cast<QtxTreeView*>( sipCpp ) )
229 sipType = sipType_QtxTreeView;
235 explicit QtxTreeView( QWidget* /TransferThis/ = 0 );
236 QtxTreeView( const bool, QWidget* /TransferThis/ = 0 );
237 virtual ~QtxTreeView();
240 void sortingEnabled( bool );
241 void selectionChanged();
244 QtxTreeView( const QtxTreeView& );
247 class UserDefinedContent : public QWidget
250 #include <SalomePyQt.h>
253 %ConvertToSubClassCode
254 if ( qobject_cast<UserDefinedContent*>( sipCpp ) )
255 sipType = sipType_UserDefinedContent;
261 explicit UserDefinedContent();
263 virtual void store();
264 virtual void retrieve();
277 #include <SalomePyQt.h>
281 static QString getAppName() /ReleaseGIL/ ;
282 static bool isLightApp() /ReleaseGIL/ ;
284 /* KeepReference is necessary on method getDesktop with SIP >= 4.15.5 to avoid garbage collection of
285 the Python objects added to the desktop. This causes a small memory leak (the wrapper around desktop
286 object is never garbage collected) but since this object contains only references this is not
287 considered a big problem. With versions < 4.15, it seems that this reference was kept implicitly.
288 No proper solution was found for versions between 4.15 and 4.15.4 (included), so those versions
289 should not be used to compile GUI module.
292 static QWidget* getDesktop() /ReleaseGIL,KeepReference/ ;
295 static QWidget* getDesktop() /ReleaseGIL/ ;
298 static QWidget* getMainFrame() /ReleaseGIL/ ;
299 static QMenuBar* getMainMenuBar() /ReleaseGIL/ ;
300 static QMenu* getPopupMenu( const MenuName ) /ReleaseGIL/ ;
301 static QMenu* getPopupMenu( const QString& ) /ReleaseGIL/ ;
302 static QTreeView* getObjectBrowser() /ReleaseGIL/ ;
303 static void enableSelector() /ReleaseGIL/ ;
304 static void disableSelector() /ReleaseGIL/ ;
305 static SALOME_Selection* getSelection() /Factory,ReleaseGIL/ ;
306 static void setSelection( const QStringList& ) /ReleaseGIL/ ;
307 static QStringList getComponents() /ReleaseGIL/ ;
308 static const QString getActiveComponent() /ReleaseGIL/ ;
309 static SIP_PYOBJECT getActivePythonModule() /ReleaseGIL/ ;
310 static bool activateModule( const QString& ) /ReleaseGIL/ ;
311 static void registerModule( const QString& ) /ReleaseGIL/ ;
312 static void updateObjBrowser() /ReleaseGIL/ ;
314 static void infoSetTitle( const QString& ) /ReleaseGIL/ ;
315 static int infoAddLabel( const QString&, const int = -1 ) /ReleaseGIL/ ;
316 static int infoAddLabel( const QString&, Qt::Alignment, const int = -1 ) /ReleaseGIL/ ;
317 static int infoAddAction( QAction*, const int = -1 ) /ReleaseGIL/ ;
318 static int infoAddGroup( const QString&, const int = -1 ) /ReleaseGIL/ ;
320 static void infoRemove( const int ) /ReleaseGIL/ ;
321 static void infoClear( const int = -1 ) /ReleaseGIL/ ;
323 static void infoSetVisible( const int, bool ) /ReleaseGIL/ ;
324 static void infoSetEnabled( const int, bool ) /ReleaseGIL/ ;
326 static void putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ;
327 static int showNotification( const QString&, const QString&, const int = -1 ) /ReleaseGIL/ ;
328 static void hideNotification( const QString& ) /ReleaseGIL/ ;
329 static void hideNotification( const int ) /ReleaseGIL/ ;
331 static bool isModified() /ReleaseGIL/ ;
332 static void setModified( bool ) /ReleaseGIL/ ;
334 static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ;
335 static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ;
336 static QString getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ;
338 static void createRoot() /ReleaseGIL/ ;
339 static QString createObject( const QString& = QString("") ) /ReleaseGIL/ ;
340 static QString createObject( const QString&,
343 const QString& = QString("") ) /ReleaseGIL/ ;
345 static void setName(const QString& ,const QString& ) /ReleaseGIL/ ;
346 static void setIcon(const QString& ,const QString& ) /ReleaseGIL/ ;
347 static void setToolTip(const QString& ,const QString& ) /ReleaseGIL/ ;
348 static QString getName(const QString& ) /ReleaseGIL/ ;
349 static QString getToolTip(const QString& ) /ReleaseGIL/ ;
351 static void setVisibilityState( const QString&, VisibilityState );
352 static VisibilityState getVisibilityState( const QString& );
354 static void setObjectPosition( const QString&, int );
355 static int getObjectPosition( const QString& );
357 static void setColor( const QString&, const QColor& ) /ReleaseGIL/ ;
358 static QColor getColor( const QString& ) /ReleaseGIL/ ;
360 static void setReference( const QString& ,const QString& ) /ReleaseGIL/ ;
361 static QString getReference( const QString& ) /ReleaseGIL/ ;
363 static void removeObject(const QString& ) /ReleaseGIL/ ;
364 static void removeChildren(const QString& = QString("") ) /ReleaseGIL/ ;
365 static void removeChild(const QString& = QString("") ) /ReleaseGIL/ ;
366 static QStringList getChildren(const QString&=QString("") , const bool = false) /ReleaseGIL/ ;
368 static QIcon loadIcon( const QString&, const QString& ) /ReleaseGIL/ ;
369 static void helpContext( const QString&, const QString& ) /ReleaseGIL/ ;
371 static bool dumpView( const QString&, const int = 0 ) /ReleaseGIL/ ;
373 static int defaultMenuGroup() /ReleaseGIL/ ;
375 static int createTool( const QString&, const QString& = QString() ) /ReleaseGIL/ ;
376 static int createTool( const int, const int, const int = -1 ) /ReleaseGIL/ ;
377 static int createTool( const int, const QString&, const int = -1 ) /ReleaseGIL/ ;
378 static int createTool( QAction*, const int, const int = -1, const int = -1 ) /ReleaseGIL/ ;
379 static int createTool( QAction*, const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ;
380 static void clearTool( const QString& ) /ReleaseGIL/ ;
382 static int createMenu( const QString&, const int,
383 const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ;
384 static int createMenu( const QString&, const QString&,
385 const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ;
386 static int createMenu( const int, const int,
387 const int = -1, const int = -1 ) /ReleaseGIL/ ;
388 static int createMenu( const int, const QString&,
389 const int = -1, const int = -1 ) /ReleaseGIL/ ;
390 static int createMenu( QAction*, const int, const int = -1,
391 const int = -1, const int = -1 ) /ReleaseGIL/ ;
392 static int createMenu( QAction*, const QString&, const int = -1,
393 const int = -1, const int = -1 ) /ReleaseGIL/ ;
394 static QAction* createSeparator() /ReleaseGIL/ ;
396 static QAction* createAction( const int, const QString&,
397 const QString& = QString(), const QString& = QString(),
398 const QString& = QString(), const int = 0, const bool = false ) /ReleaseGIL/ ;
400 static QtxActionGroup* createActionGroup( const int, const bool = true ) /ReleaseGIL/ ;
402 static QAction* action( const int ) /ReleaseGIL/ ;
403 static int actionId( const QAction* ) /ReleaseGIL/ ;
405 static QString constant ( const QString& ) /ReleaseGIL/ ;
406 static void setConstant ( const QString&, const QString& ) /ReleaseGIL/ ;
407 static void addSetting ( const QString&, const QString&, const double ) /ReleaseGIL/ ;
408 static void addSetting ( const QString&, const QString&, const int /Constrained/ ) /ReleaseGIL/ ;
409 static void addSetting ( const QString&, const QString&, const bool, const int ) /ReleaseGIL/ ;
410 static void addSetting ( const QString&, const QString&, const QString& ) /ReleaseGIL/ ;
411 static void addSetting ( const QString&, const QString&, const QColor& ) /ReleaseGIL/ ;
412 static void addSetting ( const QString&, const QString&, const QByteArray& ) /ReleaseGIL/ ;
413 static void addSetting ( const QString&, const QString&, const QFont& ) /ReleaseGIL/ ;
414 static int integerSetting( const QString&, const QString&, const int = 0 ) /ReleaseGIL/ ;
415 static double doubleSetting ( const QString&, const QString&, const double = 0 ) /ReleaseGIL/ ;
416 static bool boolSetting ( const QString&, const QString&, const bool = false ) /ReleaseGIL/ ;
417 static QString stringSetting ( const QString&, const QString&, const QString& = QString(""), const bool = true ) /ReleaseGIL/ ;
418 static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() ) /ReleaseGIL/ ;
419 static QByteArray byteArraySetting( const QString&, const QString&, const QByteArray& = QByteArray() ) /ReleaseGIL/ ;
420 static QFont fontSetting( const QString&, const QString&, const QFont& = QFont() ) /ReleaseGIL/ ;
421 static void removeSetting ( const QString&, const QString& ) /ReleaseGIL/ ;
422 static bool hasSetting ( const QString&, const QString& ) /ReleaseGIL/ ;
423 static QStringList parameters ( const QString& ) /ReleaseGIL/ ;
424 static QStringList parameters ( const QStringList& ) /ReleaseGIL/ ;
427 static void addStringSetting( const QString&, const QString&, bool = true ) /ReleaseGIL/ ;
428 static void addIntSetting ( const QString&, const int, bool = true ) /ReleaseGIL/ ;
429 static void addDoubleSetting( const QString&, const double, bool = true ) /ReleaseGIL/ ;
430 static void addBoolSetting ( const QString&, const bool, bool = true ) /ReleaseGIL/ ;
431 static void removeSettings ( const QString& ) /ReleaseGIL/ ;
432 static QString getSetting ( const QString& ) /ReleaseGIL/ ;
434 static int addGlobalPreference( const QString& ) /ReleaseGIL/ ;
435 static int addPreference( const QString& ) /ReleaseGIL/ ;
436 static int addPreference( const QString&,
437 const int, const int = PT_Auto,
438 const QString& = QString(),
439 const QString& = QString() ) /ReleaseGIL/ ;
440 static QVariant preferenceProperty( const int, const QString& ) /ReleaseGIL/ ;
441 static void setPreferenceProperty( const int,
443 const QVariant& ) /ReleaseGIL/ ;
444 static void setPreferencePropertyWg( const int,
446 UserDefinedContent* ) /ReleaseGIL/ ;
447 static void addPreferenceProperty( const int,
450 const QVariant& ) /ReleaseGIL/ ;
452 static void message( const QString&, bool = true ) /ReleaseGIL/ ;
453 static void clearMessages() /ReleaseGIL/ ;
455 static QList<int> getViews() /ReleaseGIL/ ;
456 static int getActiveView() /ReleaseGIL/ ;
457 static QString getViewType( const int ) /ReleaseGIL/ ;
458 static bool setViewTitle( const int, const QString& ) /ReleaseGIL/ ;
459 static QString getViewTitle( const int ) /ReleaseGIL/ ;
460 static bool setViewSize( const int, const int, const int = 0 ) /ReleaseGIL/ ;
461 static bool setViewRotationPoint( const double, const double, const double, const int = 0 ) /ReleaseGIL/ ;
462 static QList<int> findViews( const QString& ) /ReleaseGIL/ ;
463 static bool activateView( const int ) /ReleaseGIL/ ;
464 static bool activateViewManagerAndView( const int ) /ReleaseGIL/ ;
465 static QWidget* getViewWidget( const int ) /ReleaseGIL/ ;
466 static int createView( const QString&, bool visible = true, const int width = 0, const int height = 0, bool detached = false ) /ReleaseGIL/ ;
467 static int createView( const QString&, QWidget* ) /ReleaseGIL/ ;
468 static bool closeView( const int ) /ReleaseGIL/ ;
469 static int cloneView( const int ) /ReleaseGIL/ ;
470 static void setViewVisible( const int id, bool visible = true ) /ReleaseGIL/ ;
471 static bool isViewVisible( const int id ) /ReleaseGIL/ ;
472 static void setViewClosable( const int id, const bool ) /ReleaseGIL/ ;
473 static bool isViewClosable( const int id ) /ReleaseGIL/ ;
475 static bool groupAllViews() /ReleaseGIL/ ;
476 static bool splitView( const int, Orientation, Action ) /ReleaseGIL/ ;
477 static bool moveView( const int, const int, const bool ) /ReleaseGIL/ ;
478 static QList<int> neighbourViews( const int ) /ReleaseGIL/ ;
481 // start Plot2d-related functionality
482 static void displayCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
483 static void eraseCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
484 static void eraseCurve(Plot2d_Curve*) /ReleaseGIL/ ;
485 static void updateCurves( const int ) /ReleaseGIL/ ;
486 static QString getPlot2dTitle(const int, ObjectType = MainTitle) /ReleaseGIL/ ;
487 static void setPlot2dTitle(const int, const QString&, ObjectType = MainTitle, bool = true) /ReleaseGIL/ ;
488 static QList<double> getPlot2dFitRangeByCurves(const int) /ReleaseGIL/ ;
489 static QList<double> getPlot2dFitRangeCurrent(const int) /ReleaseGIL/ ;
490 static void setPlot2dFitRange(const int, const double XMin, const double XMax, const double YMin, const double YMax ) /ReleaseGIL/ ;
491 // end of Plot2d-related functionality
494 static void processEvents();
496 static void startPyLog(const QString&) /ReleaseGIL/ ;
497 static void stopPyLog() /ReleaseGIL/ ;