1 // Copyright (C) 2007-2014 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)
32 #include <QtxAction.h>
33 #include <QtxActionSet.h>
34 #include <QtxActionGroup.h>
35 #include <SalomePyQt.h>
36 #include <Plot2d_Curve.h>
39 class SALOME_Selection : QObject
42 #include <SalomePyQt.h>
46 void Clear() /ReleaseGIL/ ;
47 void ClearIObjects() /ReleaseGIL/ ;
48 void ClearFilters() /ReleaseGIL/ ;
51 SALOME_Selection( QObject* /TransferThis/ );
54 void currentSelectionChanged();
111 class QtxAction : QWidgetAction
114 #include <QtxAction.h>
117 %ConvertToSubClassCode
118 if ( qobject_cast<QtxAction*>( sipCpp ) )
119 sipClass = sipClass_QtxAction;
125 explicit QtxAction( QObject* /TransferThis/ = 0, bool = false );
126 QtxAction( const QString&, const QString&, int, QObject* /TransferThis/, bool = false );
127 QtxAction( const QString&, const QIcon&, const QString&, int, QObject* /TransferThis/, bool = false );
128 virtual ~QtxAction();
131 QtxAction( const QtxAction& );
134 class QtxActionSet : QtxAction
137 #include <QtxActionSet.h>
140 %ConvertToSubClassCode
141 if ( qobject_cast<QtxActionSet*>( sipCpp ) )
142 sipClass = sipClass_QtxActionSet;
148 explicit QtxActionSet( QObject* /TransferThis/ = 0 );
149 virtual ~QtxActionSet();
151 QList<QAction*> actions() const;
152 void setActions( const QList<QAction*>& );
154 void insertActions( const QList<QAction*>&, const int = -1 );
156 int insertAction( QAction*, const int id = -1, const int = -1 );
157 int insertAction( const QString&, const int id = -1, const int = -1 );
158 int insertAction( const QString&, const QIcon&, const int id = -1, const int = -1 );
160 void removeAction( QAction* );
161 void removeAction( const int );
166 void triggered( int );
167 void triggered( QAction* );
170 QtxActionSet( const QtxActionSet& );
173 class QtxActionGroup : QtxActionSet
176 #include <QtxActionGroup.h>
179 %ConvertToSubClassCode
180 if ( qobject_cast<QtxActionGroup*>( sipCpp ) )
181 sipClass = sipClass_QtxActionGroup;
187 explicit QtxActionGroup( QObject* /TransferThis/ = 0 );
188 QtxActionGroup( QObject* /TransferThis/, const bool );
189 virtual ~QtxActionGroup();
191 bool isExclusive() const;
192 bool usesDropDown() const;
194 void add( QAction* );
197 void setExclusive( const bool );
198 void setUsesDropDown( const bool );
201 void selected( QAction* );
204 QtxActionGroup( const QtxActionGroup& );
221 #include <Plot2d_Curve.h>
224 %ConvertToSubClassCode
225 if ( dynamic_cast<Plot2d_Curve*>( sipCpp ) )
226 sipClass = sipClass_Plot2d_Curve;
233 virtual ~Plot2d_Curve();
234 void setName( const QString& );
235 void addPoint( double, double );
236 void addPoints(SIP_PYLIST X, SIP_PYLIST Y);
238 int nx = PyList_Size(a0);
239 int ny = PyList_Size(a1);
242 PyErr_Format(PyExc_TypeError,"The dimension of x and y should be the same. It is %d and %d currently.", nx, ny);
248 for (i=0; i<nx; i++) {
249 pX = PyList_GET_ITEM(a0,i);
250 pY = PyList_GET_ITEM(a1,i);
251 double aX = PyFloat_AsDouble(pX);
252 double aY = PyFloat_AsDouble(pY);
253 sipCpp->addPoint(aX, aY);
256 void insertPoint( int, double, double );
257 void deletePoint( int );
258 void clearAllPoints();
259 void setXAxis( Axis );
262 sipCpp->setXAxis(QwtPlot::Axis(ax));
264 Axis getXAxis() const;
266 sipRes = Axis(sipCpp->getXAxis());
268 void setYAxis( Axis );
271 sipCpp->setYAxis(QwtPlot::Axis(ay));
273 Axis getYAxis() const;
275 sipRes = Axis(sipCpp->getYAxis());
290 #include <SalomePyQt.h>
294 /* KeepReference is necessary on method getDesktop with SIP >= 4.15.5 to avoid garbage collection of
295 the Python objects added to the desktop. This causes a small memory leak (the wrapper around desktop
296 object is never garbage collected) but since this object contains only references this is not
297 considered a big problem. With versions < 4.15, it seems that this reference was kept implicitly.
298 No proper solution was found for versions between 4.15 and 4.15.4 (included), so those versions
299 should not be used to compile GUI module.
302 static QWidget* getDesktop() /ReleaseGIL,KeepReference/ ;
305 static QWidget* getDesktop() /ReleaseGIL/ ;
308 static QWidget* getMainFrame() /ReleaseGIL/ ;
309 static QMenuBar* getMainMenuBar() /ReleaseGIL/ ;
310 static QMenu* getPopupMenu( const MenuName ) /ReleaseGIL/ ;
311 static QMenu* getPopupMenu( const QString& ) /ReleaseGIL/ ;
312 static QTreeView* getObjectBrowser() /ReleaseGIL/ ;
313 static SALOME_Selection* getSelection() /Factory,ReleaseGIL/ ;
314 static int getStudyId() /ReleaseGIL/ ;
315 static void putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ;
316 static const QString getActiveComponent() /ReleaseGIL/ ;
317 static SIP_PYOBJECT getActivePythonModule() /ReleaseGIL/ ;
318 static bool activateModule( const QString& ) /ReleaseGIL/ ;
319 static void updateObjBrowser( const int = 0, bool = true ) /ReleaseGIL/ ;
321 static bool isModified() /ReleaseGIL/ ;
322 static void setModified( bool ) /ReleaseGIL/ ;
324 static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ;
325 static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ;
326 static QString getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ;
328 static QString createObject( const QString& = QString("") ) /ReleaseGIL/ ;
329 static QString createObject( const QString&,
332 const QString& = QString("") ) /ReleaseGIL/ ;
334 static void setName(const QString& ,const QString& ) /ReleaseGIL/ ;
335 static void setIcon(const QString& ,const QString& ) /ReleaseGIL/ ;
336 static void setToolTip(const QString& ,const QString& ) /ReleaseGIL/ ;
337 static QString getName(const QString& ) /ReleaseGIL/ ;
338 static QString getToolTip(const QString& ) /ReleaseGIL/ ;
340 static void setVisibilityState( const QString&, VisibilityState );
341 static VisibilityState getVisibilityState( const QString& );
343 static void setObjectPosition( const QString&, int );
344 static int getObjectPosition( const QString& );
346 static void setColor( const QString&, const QColor& ) /ReleaseGIL/ ;
347 static QColor getColor( const QString& ) /ReleaseGIL/ ;
349 static void setReference( const QString& ,const QString& ) /ReleaseGIL/ ;
350 static QString getReference( const QString& ) /ReleaseGIL/ ;
352 static void removeObject(const QString& ) /ReleaseGIL/ ;
353 static void removeChildren(const QString& = QString("") ) /ReleaseGIL/ ;
354 static void removeChild(const QString& = QString("") ) /ReleaseGIL/ ;
355 static QStringList getChildren(const QString&=QString("") , const bool = false) /ReleaseGIL/ ;
357 static QIcon loadIcon( const QString&, const QString& ) /ReleaseGIL/ ;
358 static void helpContext( const QString&, const QString& ) /ReleaseGIL/ ;
360 static bool dumpView( const QString&, const int = 0 ) /ReleaseGIL/ ;
362 static int defaultMenuGroup() /ReleaseGIL/ ;
364 static int createTool( const QString& ) /ReleaseGIL/ ;
365 static int createTool( const int, const int, const int = -1 ) /ReleaseGIL/ ;
366 static int createTool( const int, const QString&, const int = -1 ) /ReleaseGIL/ ;
367 static int createTool( QAction*, const int, const int = -1, const int = -1 ) /ReleaseGIL/ ;
368 static int createTool( QAction*, const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ;
370 static int createMenu( const QString&, const int,
371 const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ;
372 static int createMenu( const QString&, const QString&,
373 const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ;
374 static int createMenu( const int, const int,
375 const int = -1, const int = -1 ) /ReleaseGIL/ ;
376 static int createMenu( const int, const QString&,
377 const int = -1, const int = -1 ) /ReleaseGIL/ ;
378 static int createMenu( QAction*, const int, const int = -1,
379 const int = -1, const int = -1 ) /ReleaseGIL/ ;
380 static int createMenu( QAction*, const QString&, const int = -1,
381 const int = -1, const int = -1 ) /ReleaseGIL/ ;
382 static QAction* createSeparator() /ReleaseGIL/ ;
384 static QAction* createAction( const int, const QString&,
385 const QString& = QString(), const QString& = QString(),
386 const QString& = QString(), const int = 0, const bool = false ) /ReleaseGIL/ ;
388 static QtxActionGroup* createActionGroup( const int, const bool = true ) /ReleaseGIL/ ;
390 static QAction* action( const int ) /ReleaseGIL/ ;
391 static int actionId( const QAction* ) /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 int integerSetting( const QString&, const QString&, const int = 0 ) /ReleaseGIL/ ;
399 static double doubleSetting ( const QString&, const QString&, const double = 0 ) /ReleaseGIL/ ;
400 static bool boolSetting ( const QString&, const QString&, const bool = false ) /ReleaseGIL/ ;
401 static QString stringSetting ( const QString&, const QString&, const QString& = QString("") ) /ReleaseGIL/ ;
402 static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() ) /ReleaseGIL/ ;
403 static void removeSetting ( const QString&, const QString& ) /ReleaseGIL/ ;
404 static bool hasSetting ( const QString&, const QString& ) /ReleaseGIL/ ;
407 static void addStringSetting( const QString&, const QString&, bool = true ) /ReleaseGIL/ ;
408 static void addIntSetting ( const QString&, const int, bool = true ) /ReleaseGIL/ ;
409 static void addDoubleSetting( const QString&, const double, bool = true ) /ReleaseGIL/ ;
410 static void addBoolSetting ( const QString&, const bool, bool = true ) /ReleaseGIL/ ;
411 static void removeSettings ( const QString& ) /ReleaseGIL/ ;
412 static QString getSetting ( const QString& ) /ReleaseGIL/ ;
414 static int addGlobalPreference( const QString& ) /ReleaseGIL/ ;
415 static int addPreference( const QString& ) /ReleaseGIL/ ;
416 static int addPreference( const QString&,
417 const int, const int = PT_Auto,
418 const QString& = QString(),
419 const QString& = QString() ) /ReleaseGIL/ ;
420 static QVariant preferenceProperty( const int, const QString& ) /ReleaseGIL/ ;
421 static void setPreferenceProperty( const int,
423 const QVariant& ) /ReleaseGIL/ ;
424 static void addPreferenceProperty( const int,
427 const QVariant& ) /ReleaseGIL/ ;
429 static void message( const QString&, bool = true ) /ReleaseGIL/ ;
430 static void clearMessages() /ReleaseGIL/ ;
432 static QList<int> getViews() /ReleaseGIL/ ;
433 static int getActiveView() /ReleaseGIL/ ;
434 static QString getViewType( const int ) /ReleaseGIL/ ;
435 static bool setViewTitle( const int, const QString& ) /ReleaseGIL/ ;
436 static QString getViewTitle( const int ) /ReleaseGIL/ ;
437 static QList<int> findViews( const QString& ) /ReleaseGIL/ ;
438 static bool activateView( const int ) /ReleaseGIL/ ;
439 static int createView( const QString&, bool visible = true, const int width = 0, const int height = 0 ) /ReleaseGIL/ ;
440 static int createView( const QString&, QWidget* ) /ReleaseGIL/ ;
441 static bool closeView( const int ) /ReleaseGIL/ ;
442 static int cloneView( const int ) /ReleaseGIL/ ;
443 static void setViewVisible( const int id, bool visible = true ) /ReleaseGIL/ ;
444 static bool isViewVisible( const int id ) /ReleaseGIL/ ;
445 static void setViewClosable( const int id, const bool ) /ReleaseGIL/ ;
446 static bool isViewClosable( const int id ) /ReleaseGIL/ ;
448 static bool groupAllViews() /ReleaseGIL/ ;
449 static bool splitView( const int, Orientation, Action ) /ReleaseGIL/ ;
450 static bool moveView( const int, const int, const bool ) /ReleaseGIL/ ;
451 static QList<int> neighbourViews( const int ) /ReleaseGIL/ ;
453 static void displayCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
454 static void eraseCurve(const int, Plot2d_Curve*) /ReleaseGIL/ ;
455 static void eraseCurve(Plot2d_Curve*) /ReleaseGIL/ ;
456 static void updateCurves( const int ) /ReleaseGIL/ ;
457 static QString getPlot2dTitle(const int, ObjectType = MainTitle) /ReleaseGIL/ ;
458 static void setPlot2dTitle(const int, const QString&, ObjectType = MainTitle, bool = true) /ReleaseGIL/ ;
459 static QList<double> getPlot2dFitRangeByCurves(const int) /ReleaseGIL/ ;
460 static QList<double> getPlot2dFitRangeCurrent(const int) /ReleaseGIL/ ;
461 static void setPlot2dFitRange(const int, const double XMin, const double XMax, const double YMin, const double YMax ) /ReleaseGIL/ ;