Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SalomePyQt Class Reference

The class provides utility functions which can be used in the Python to operate with the SALOME GUI. More...

#include <SalomePyQt.h>

Static Public Member Functions

static QWidgetgetDesktop ()
 Get the active application's desktop window. More...
 
static QWidgetgetMainFrame ()
 Get current application's main frame widget [obsolete]. More...
 
static QMenuBar * getMainMenuBar ()
 Get current application desktop's main menu. More...
 
static QMenugetPopupMenu (const MenuName)
 Get main menu's child popup submenu by its identifier. More...
 
static QMenugetPopupMenu (const QString &)
 Get main menu's child popup submenu by its name. More...
 
static QTreeViewgetObjectBrowser ()
 Get object browser. More...
 
static void enableSelector ()
 enable PyQt_Selector (on module activation, for instance) More...
 
static void disableSelector ()
 disable PyQt_Selector (on module activation, for instance) More...
 
static SALOME_SelectiongetSelection ()
 Get the selection object for the current study. More...
 
static void setSelection (const QStringList &)
 Send local selection for notification. More...
 
static int getStudyId ()
 Get active study's identifier. More...
 
static void putInfo (const QString &, const int=0)
 Put an information message to the current application's desktop status bar. More...
 
static const QString getActiveComponent ()
 Get the currently active module name (for the current study). More...
 
static PyObject * getActivePythonModule ()
 Access to Python module object currently loaded into SALOME_PYQT_ModuleLight container. More...
 
static bool activateModule (const QString &)
 Activates SALOME module with the given name. More...
 
static void updateObjBrowser (const int=0, bool=true)
 Update an Object Browser of the specified (by identifier) study. More...
 
static bool isModified ()
 
static void setModified (bool)
 
static QString getFileName (QWidget *, const QString &, const QStringList &, const QString &, bool)
 Show 'Open/Save file' dialog box for file selection and return a user's choice (selected file name). More...
 
static QStringList getOpenFileNames (QWidget *, const QString &, const QStringList &, const QString &)
 Show 'Open files' dialog box for multiple files selection and return a user's choice (selected file names list). More...
 
static QString getExistingDirectory (QWidget *, const QString &, const QString &)
 Show 'Get Directory' dialog box for the directory selection and return a user's choice (selected directory name). More...
 
static void createRoot ()
 Initialize root data object. More...
 
static QString createObject (const QString &parent=QString())
 Create empty data object. More...
 
static QString createObject (const QString &, const QString &, const QString &, const QString &=QString())
 Create new data object with specified name, icon and tooltip. More...
 
static void removeObject (const QString &)
 Remove object by entry. More...
 
static void removeChildren (const QString &=QString())
 Remove all child data objects from specified data object. More...
 
static QStringList getChildren (const QString &=QString(), const bool=false)
 Get entries of all child data objects of specified data object. More...
 
static void setName (const QString &, const QString &)
 Set data object name. More...
 
static void setIcon (const QString &, const QString &)
 Set data object icon. More...
 
static void setToolTip (const QString &, const QString &)
 Set data object tooltip. More...
 
static QString getName (const QString &)
 Get data object name. More...
 
static QString getToolTip (const QString &)
 Get data object tooltip. More...
 
static void setVisibilityState (const QString &, VisibilityState)
 Set visibility state for given object. More...
 
static VisibilityState getVisibilityState (const QString &)
 Get visibility state for given object. More...
 
static void setObjectPosition (const QString &, int)
 Set position of given object in the tree. More...
 
static int getObjectPosition (const QString &)
 Get position of given object in the tree. More...
 
static void setColor (const QString &, const QColor &)
 Set data object color. More...
 
static QColor getColor (const QString &)
 Get data object color. More...
 
static void setReference (const QString &, const QString &)
 Set reference to another data object. More...
 
static QString getReference (const QString &)
 
static QIcon loadIcon (const QString &, const QString &)
 Load an icon from the module resources by the specified file name. More...
 
static void helpContext (const QString &, const QString &)
 Open external browser to display context help information. More...
 
static bool dumpView (const QString &, const int=0)
 Dump the contents of the id view window. If id is 0 then current active view is processed. to the image file in the specified format. More...
 
static int defaultMenuGroup ()
 Get detault menu group identifier which can be used when creating menus (insert custom menu commands). More...
 
static int createTool (const QString &, const QString &=QString())
 Create toolbar with specified name. More...
 
static int createTool (const int, const int, const int=-1)
 Insert action with specified id to the toolbar. More...
 
static int createTool (const int, const QString &, const int=-1)
 Insert action with specified id to the toolbar. More...
 
static int createTool (QAction *, const int, const int=-1, const int=-1)
 Insert action to the toolbar. More...
 
static int createTool (QAction *, const QString &, const int=-1, const int=-1)
 Insert action to the toolbar. More...
 
static int createMenu (const QString &, const int=-1, const int=-1, const int=-1, const int=-1)
 Create main menu. More...
 
static int createMenu (const QString &, const QString &=QString(), const int=-1, const int=-1, const int=-1)
 Create main menu. More...
 
static int createMenu (const int, const int=-1, const int=-1, const int=-1)
 Insert action to the main menu. More...
 
static int createMenu (const int, const QString &=QString(), const int=-1, const int=-1)
 Insert action to the main menu. More...
 
static int createMenu (QAction *, const int, const int=-1, const int=-1, const int=-1)
 Insert action to the main menu. More...
 
static int createMenu (QAction *, const QString &, const int=-1, const int=-1, const int=-1)
 Insert action to the main menu. More...
 
static QActioncreateSeparator ()
 Create separator action which can be used in the menu or toolbar. More...
 
static QActioncreateAction (const int, const QString &, const QString &=QString(), const QString &=QString(), const QString &=QString(), const int=0, const bool=false)
 Create an action which can be then used in the menu or toolbar. More...
 
static QtxActionGroupcreateActionGroup (const int, const bool=true)
 Create an action group which can be then used in the menu or toolbar. More...
 
static QActionaction (const int)
 Get action by specified identifier. More...
 
static int actionId (const QAction *)
 Get an action identifier. More...
 
static QString constant (const QString &)
 Get constant's value from application's resource manager. More...
 
static void setConstant (const QString &, const QString &)
 Add constant to the application's resource manager. More...
 
static void addSetting (const QString &, const QString &, const double)
 Add double setting to the application preferences. More...
 
static void addSetting (const QString &, const QString &, const int)
 Add integer setting to the application preferences. More...
 
static void addSetting (const QString &, const QString &, const bool, const int)
 Add boolean setting to the application preferences. More...
 
static void addSetting (const QString &, const QString &, const QString &)
 Add string setting to the application preferences. More...
 
static void addSetting (const QString &, const QString &, const QColor &)
 Add color setting to the application preferences. More...
 
static void addSetting (const QString &, const QString &, const QByteArray &)
 Add byte array setting to the application preferences. More...
 
static int integerSetting (const QString &, const QString &, const int=0)
 Get integer setting from the application preferences. More...
 
static double doubleSetting (const QString &, const QString &, const double=0)
 Get double setting from the application preferences. More...
 
static bool boolSetting (const QString &, const QString &, const bool=0)
 Get boolean setting from the application preferences. More...
 
static QString stringSetting (const QString &, const QString &, const QString &=QString(""), const bool=true)
 Get string setting from the application preferences. More...
 
static QColor colorSetting (const QString &, const QString &, const QColor &=QColor())
 Get color setting from the application preferences. More...
 
static QByteArray byteArraySetting (const QString &, const QString &, const QByteArray &=QByteArray())
 Get byte array setting from the application preferences. More...
 
static void removeSetting (const QString &, const QString &)
 Remove setting from the application preferences. More...
 
static bool hasSetting (const QString &, const QString &)
 Check setting existence in the application preferences. More...
 
static QStringList parameters (const QString &)
 Get names of preference items stored within the given section. More...
 
static QStringList parameters (const QStringList &)
 Get names of preference items stored within the given section. More...
 
static int addGlobalPreference (const QString &)
 Add global (not module-related) preferences group. More...
 
static int addPreference (const QString &)
 Add module-related preferences group. More...
 
static int addPreference (const QString &, const int, const int=PT_Auto, const QString &=QString(), const QString &=QString())
 Add module-related preferences. More...
 
static QVariant preferenceProperty (const int, const QString &)
 Get the preferences property. More...
 
static void setPreferenceProperty (const int, const QString &, const QVariant &)
 Set the preferences property. More...
 
static void addPreferenceProperty (const int, const QString &, const int, const QVariant &)
 Add the property value to the list of values. More...
 
static void message (const QString &, bool=true)
 Put the message to the Log messages output window. More...
 
static void clearMessages ()
 Remove all the messages from the Log messages output window. More...
 
static QList< int > getViews ()
 Get list of integer identifiers of all the currently opened views. More...
 
static int getActiveView ()
 Get integer identifier of the currently active view. More...
 
static QString getViewType (const int)
 Get type of the specified view, e.g. "OCCViewer". More...
 
static bool setViewTitle (const int, const QString &)
 Change view caption. More...
 
static QString getViewTitle (const int)
 Get view caption. More...
 
static bool setViewSize (const int, const int, const int=0)
 Set view size. More...
 
static QList< int > findViews (const QString &)
 Get list of integer identifiers of all the currently opened views of the specified type. More...
 
static bool activateView (const int)
 Activate view. More...
 
static bool activateViewManagerAndView (const int)
 
static QWidgetgetViewWidget (const int)
 
static int createView (const QString &, bool visible=true, const int width=0, const int height=0, bool detached=false)
 
static int createView (const QString &, QWidget *)
 Create new view with custom widget embedded and activate it. More...
 
static bool closeView (const int)
 Close view. More...
 
static int cloneView (const int)
 Clone view (if this operation is supported for specified view type) More...
 
static void setViewVisible (const int id, bool visible=true)
 Set view visibility. More...
 
static bool isViewVisible (const int)
 Check whether view is visible ( i.e. it is on the top of the views stack) More...
 
static void setViewClosable (const int, const bool)
 Set / clear view's "closable" option. By default any view is closable (i.e. can be closed by the user). More...
 
static bool isViewClosable (const int)
 Check whether view is closable (i.e. can be closed by the user) More...
 
static bool groupAllViews ()
 Group all views to the single tab area. More...
 
static bool splitView (const int, const Orientation, const Action)
 Split tab area to which view with identifier belongs to. More...
 
static bool moveView (const int, const int, const bool)
 Move view with the first identifier to the same area which another view with the second identifier belongs to. More...
 
static QList< int > neighbourViews (const int)
 Get list of views identifiers that belongs to the same area as specified view (excluding it) More...
 
static void displayCurve (const int, Plot2d_Curve *)
 Display theCurve in view. More...
 
static void eraseCurve (const int, Plot2d_Curve *)
 Erase theCurve in view. More...
 
static void eraseCurve (Plot2d_Curve *)
 
static void updateCurves (const int)
 updateCurves (repaint) curves in view window. More...
 
static QString getPlot2dTitle (const int, ObjectType=MainTitle)
 Get title of corresponding type. More...
 
static void setPlot2dTitle (const int, const QString &, ObjectType=MainTitle, bool=true)
 Set title of corresponding type. More...
 
static QList< double > getPlot2dFitRangeByCurves (const int)
 Get list of Plot2d view ranges. More...
 
static QList< double > getPlot2dFitRangeCurrent (const int)
 Get list of current Plot2d view ranges. More...
 
static void setPlot2dFitRange (const int, const double XMin, const double XMax, const double YMin, const double YMax)
 Set range of Plot2d view. More...
 
static void processEvents ()
 Process Qt event loop. More...
 
static void addStringSetting (const QString &, const QString &, bool=true)
 Add string setting to the application preferences. More...
 
static void addIntSetting (const QString &, const int, bool=true)
 Add integer setting to the application preferences. More...
 
static void addBoolSetting (const QString &, const bool, bool=true)
 Add boolean setting to the application preferences. More...
 
static void addDoubleSetting (const QString &, const double, bool=true)
 Add double setting to the application preferences. More...
 
static void removeSettings (const QString &)
 Remove setting from the application preferences. More...
 
static QString getSetting (const QString &)
 Get application setting value (as string represenation). More...
 
static void removeChild (const QString &=QString())
 
static void startPyLog (const QString &)
 Start recordind a log of Python commands from embedded console. More...
 
static void stopPyLog ()
 Stop recordind a log of Python commands from embedded console. More...
 

Detailed Description

All the functionality of this class is implemented as static methods, so they can be called with the class name prefixed or via creation of the class instance. For example, next both ways of SalomePyQt class usage are legal:

from SalomePyQt import *
sg = SalomePyQt()
# using SalomePyQt class instance
desktop = sg.getDesktop()
# using SalomePyQt class directly
menubar = SalomePyQt.getMainMenuBar()

Member Function Documentation

QAction * SalomePyQt::action ( const int  id)
static
Returns
action or 0 if action is not registered

References ProcessEvent().

int SalomePyQt::actionId ( const QAction a)
static
Returns
action ID or -1 if action is not registered

References ProcessEvent().

bool SalomePyQt::activateModule ( const QString &  modName)
static
Returns
True if the module has been activated and False otherwise.

References ProcessEvent().

bool SalomePyQt::activateView ( const int  id)
static
Parameters
idwindow identifier
Returns
true if operation is completed successfully and false otherwise

References ProcessEvent().

bool SalomePyQt::activateViewManagerAndView ( const int  id)
static

References ProcessEvent().

void SalomePyQt::addBoolSetting ( const QString &  name,
const bool  value,
bool  autoValue = true 
)
static

The parameter autoValue is obsolete parameter and currently is not used. This parameter will be removed in future, so try to avoid its usage in your code.

This function is obsolete. Use one of addSetting() instead.

Parameters
namesetting name (it should be of kind <section:setting> where section is resources section name and setting is setting name)
valuenew setting value
autoValue(not used)

References myName, ProcessVoidEvent(), SUIT_Session::resourceMgr(), SUIT_Session::session(), and QtxResourceMgr::setValue().

void SalomePyQt::addDoubleSetting ( const QString &  name,
const double  value,
bool  autoValue = true 
)
static

The parameter autoValue is obsolete parameter and currently is not used. This parameter will be removed in future, so try to avoid its usage in your code.

This function is obsolete. Use one of addSetting() instead.

Parameters
namesetting name (it should be of kind <section:setting> where section is resources section name and setting is setting name)
valuenew setting value
autoValue(not used)

References myName, ProcessVoidEvent(), SUIT_Session::resourceMgr(), SUIT_Session::session(), and QtxResourceMgr::setValue().

int SalomePyQt::addGlobalPreference ( const QString &  label)
static
Parameters
labelglobal preferences group name
Returns
preferences group identifier

References ProcessEvent().

void SalomePyQt::addIntSetting ( const QString &  name,
const int  value,
bool  autoValue = true 
)
static

The parameter autoValue is obsolete parameter and currently is not used. This parameter will be removed in future, so try to avoid its usage in your code.

This function is obsolete. Use one of addSetting() instead.

Parameters
namesetting name (it should be of kind <section:setting> where section is resources section name and setting is setting name)
valuenew setting value
autoValue(not used)

References myName, ProcessVoidEvent(), SUIT_Session::resourceMgr(), SUIT_Session::session(), and QtxResourceMgr::setValue().

int SalomePyQt::addPreference ( const QString &  label)
static
Parameters
labelpreferences group name
Returns
preferences group identifier

References ProcessEvent().

int SalomePyQt::addPreference ( const QString &  label,
const int  pId,
const int  type = PT_Auto,
const QString &  section = QString(),
const QString &  param = QString() 
)
static
Parameters
labelpreferences group name
pIdparent preferences group id
typepreferences type
sectionresources file section name
paramresources file setting name
Returns
preferences identifier

References ProcessEvent().

void SalomePyQt::addPreferenceProperty ( const int  id,
const QString &  prop,
const int  idx,
const QVariant &  var 
)
static

This method allows creating properties which are QList<QVariant>

  • there is no way to pass such values directly to QVariant parameter with PyQt.
Parameters
idpreferences identifier
proppreferences property name
idxpreferences property index
varpreferences property value for the index idx

References LightApp_Module::getApp(), SUIT_PreferenceMgr::itemProperty(), LightApp_Application::preferences(), ProcessVoidEvent(), and SUIT_PreferenceMgr::setItemProperty().

void SalomePyQt::addSetting ( const QString &  section,
const QString &  name,
const double  value 
)
static
Parameters
sectionresources file section name
namesetting name
valuenew setting value

References myName, ProcessVoidEvent(), SUIT_Session::resourceMgr(), SUIT_Session::session(), and QtxResourceMgr::setValue().

void SalomePyQt::addSetting ( const QString &  section,
const QString &  name,
const int  value 
)
static
Parameters
sectionresources file section name
namesetting name
valuenew setting value

References myName, ProcessVoidEvent(), SUIT_Session::resourceMgr(), SUIT_Session::session(), and QtxResourceMgr::setValue().

void SalomePyQt::addSetting ( const QString &  section,
const QString &  name,
const bool  value,
const int   
)
static
Parameters
sectionresources file section name
namesetting name
valuenew setting value
dumbthis parameter is used in order to avoid sip compilation error because of conflicting int and bool types

References myName, ProcessVoidEvent(), SUIT_Session::resourceMgr(), SUIT_Session::session(), and QtxResourceMgr::setValue().

void SalomePyQt::addSetting ( const QString &  section,
const QString &  name,
const QString &  value 
)
static
Parameters
sectionresources file section name
namesetting name
valuenew setting value

References myName, ProcessVoidEvent(), SUIT_Session::resourceMgr(), SUIT_Session::session(), and QtxResourceMgr::setValue().

void SalomePyQt::addSetting ( const QString &  section,
const QString &  name,
const QColor &  value 
)
static
Parameters
sectionresources file section name
namesetting name
valuenew setting value

References myName, ProcessVoidEvent(), SUIT_Session::resourceMgr(), SUIT_Session::session(), and QtxResourceMgr::setValue().

void SalomePyQt::addSetting ( const QString &  section,
const QString &  name,
const QByteArray &  value 
)
static
Parameters
sectionresources file section name
namesetting name
valuenew setting value

References myName, ProcessVoidEvent(), SUIT_Session::resourceMgr(), SUIT_Session::session(), and QtxResourceMgr::setValue().

void SalomePyQt::addStringSetting ( const QString &  name,
const QString &  value,
bool  autoValue = true 
)
static

The parameter autoValue is obsolete parameter and currently is not used. This parameter will be removed in future, so try to avoid its usage in your code.

This function is obsolete. Use one of addSetting() instead.

Parameters
namesetting name (it should be of kind <section:setting> where section is resources section name and setting is setting name)
valuenew setting value
autoValue(not used)

References myName, ProcessVoidEvent(), SUIT_Session::resourceMgr(), SUIT_Session::session(), and QtxResourceMgr::setValue().

bool SalomePyQt::boolSetting ( const QString &  section,
const QString &  name,
const bool  def = 0 
)
static
Parameters
sectionresources file section name
namesetting name
defdefault value which is returned if the setting is not found
Returns
setting value

References ProcessEvent().

QByteArray SalomePyQt::byteArraySetting ( const QString &  section,
const QString &  name,
const QByteArray &  def = QByteArray() 
)
static
Parameters
sectionresources file section name
namesetting name
defdefault value which is returned if the setting is not found
Returns
setting value

References ProcessEvent().

void SalomePyQt::clearMessages ( )
static
int SalomePyQt::cloneView ( const int  id)
static
Parameters
idwindow identifier
Returns
integer identifier of the cloned view or -1 or operation could not be performed

References ProcessEvent().

bool SalomePyQt::closeView ( const int  id)
static
Parameters
idwindow identifier
Returns
true if operation is completed successfully and false otherwise

References ProcessEvent().

QColor SalomePyQt::colorSetting ( const QString &  section,
const QString &  name,
const QColor &  def = QColor() 
)
static
Parameters
sectionresources file section name
namesetting name
defdefault value which is returned if the setting is not found
Returns
setting value

References ProcessEvent().

QString SalomePyQt::constant ( const QString &  name)
static
Parameters
namename of the constant
Returns
value of the constant
See Also
setConstant()

References ProcessEvent().

QAction * SalomePyQt::createAction ( const int  id,
const QString &  menuText,
const QString &  tipText = QString(),
const QString &  statusText = QString(),
const QString &  icon = QString(),
const int  key = 0,
const bool  toggle = false 
)
static
Parameters
idthe unique id action to be registered to
menuTextaction text which should appear in menu
tipTexttext which should appear in the tooltip
statusTexttext which should appear in the status bar when action is activated
iconthe name of the icon file (the actual icon file name can be coded in the translation files)
keythe key accelrator for the action
toggleif true the action is checkable

References ProcessEvent().

QtxActionGroup * SalomePyQt::createActionGroup ( const int  id,
const bool  exclusive = true 
)
static
Parameters
id: the unique id action group to be registered to
exclusive: if true the action group does exclusive toggling

References ProcessEvent().

int SalomePyQt::createMenu ( const QString &  subMenu,
const int  menu = -1,
const int  id = -1,
const int  group = -1,
const int  idx = -1 
)
static
Parameters
subMenumenu name
menuparent menu ID
idrequired menu ID
groupmenu group ID
idxrequired index in the menu
Returns
menu ID or -1 if menu could not be added

References ProcessEvent().

int SalomePyQt::createMenu ( const QString &  subMenu,
const QString &  menu = QString(),
const int  id = -1,
const int  group = -1,
const int  idx = -1 
)
static
Parameters
subMenumenu name
menuparent menu name (list of menu names separated by "|")
idrequired menu ID
groupmenu group ID
idxrequired index in the menu
Returns
menu ID or -1 if menu could not be added

References ProcessEvent().

int SalomePyQt::createMenu ( const int  id,
const int  menu = -1,
const int  group = -1,
const int  idx = -1 
)
static
Parameters
idaction ID
menuparent menu ID
groupmenu group ID
idxrequired index in the menu
Returns
action ID or -1 if action could not be added

References ProcessEvent().

int SalomePyQt::createMenu ( const int  id,
const QString &  menu = QString(),
const int  group = -1,
const int  idx = -1 
)
static
Parameters
idaction ID
menuparent menu name (list of menu names separated by "|")
groupmenu group ID
idxrequired index in the menu
Returns
action ID or -1 if action could not be added

References ProcessEvent().

int SalomePyQt::createMenu ( QAction a,
const int  menu,
const int  id = -1,
const int  group = -1,
const int  idx = -1 
)
static
Parameters
aaction
menuparent menu ID
groupmenu group ID
idxrequired index in the menu
Returns
action ID or -1 if action could not be added

References ProcessEvent().

int SalomePyQt::createMenu ( QAction a,
const QString &  menu,
const int  id = -1,
const int  group = -1,
const int  idx = -1 
)
static
Parameters
aaction
menuparent menu name (list of menu names separated by "|")
groupmenu group ID
idxrequired index in the menu
Returns
action ID or -1 if action could not be added

References ProcessEvent().

QString SalomePyQt::createObject ( const QString &  parent = QString())
static
Parameters
parententry of parent data object
Returns
entry of created data object

References ProcessEvent().

QString SalomePyQt::createObject ( const QString &  name,
const QString &  icon,
const QString &  tooltip,
const QString &  parent = QString() 
)
static
Parameters
namedata object name
icondata object icon
toolTipdata object tooltip
parententry of parent data object
Returns
entry of created data object

References ProcessEvent().

void SalomePyQt::createRoot ( )
static

Does nothing if root is already initialized.

References CAM_Module::dataModel(), SALOME_PYQT_DataModelLight::getRoot(), and ProcessVoidEvent().

QAction * SalomePyQt::createSeparator ( )
static
Returns
new separator action

References ProcessEvent().

int SalomePyQt::createTool ( const QString &  tBar,
const QString &  nBar = QString() 
)
static
Parameters
tBartoolbar title (language-dependent)
nBartoolbar name (language-independent) [optional]
Returns
toolbar ID or -1 if toolbar creation is failed

References ProcessEvent().

int SalomePyQt::createTool ( const int  id,
const int  tBar,
const int  idx = -1 
)
static
Parameters
idaction ID
tBartoolbar ID
idxrequired index in the toolbar
Returns
action ID or -1 if action could not be added

References ProcessEvent().

int SalomePyQt::createTool ( const int  id,
const QString &  tBar,
const int  idx = -1 
)
static
Parameters
idaction ID
tBartoolbar name
idxrequired index in the toolbar
Returns
action ID or -1 if action could not be added

References ProcessEvent().

int SalomePyQt::createTool ( QAction a,
const int  tBar,
const int  id = -1,
const int  idx = -1 
)
static
Parameters
aaction
tBartoolbar ID
idrequired action ID
idxrequired index in the toolbar
Returns
action ID or -1 if action could not be added

References ProcessEvent().

int SalomePyQt::createTool ( QAction a,
const QString &  tBar,
const int  id = -1,
const int  idx = -1 
)
static
Parameters
aaction
tBartoolbar name
idrequired action ID
idxrequired index in the toolbar
Returns
action ID or -1 if action could not be added

References ProcessEvent().

int SalomePyQt::createView ( const QString &  type,
bool  visible = true,
const int  width = 0,
const int  height = 0,
bool  detached = false 
)
static

References ProcessEvent().

int SalomePyQt::createView ( const QString &  type,
QWidget w 
)
static
Parameters
typeviewer type
wcustom widget
Returns
integer identifier of created view (or -1 if view could not be created)

References ProcessEvent().

int SalomePyQt::defaultMenuGroup ( )
static
Returns
default menu group ID

References ProcessEvent().

void SalomePyQt::disableSelector ( )
static

References ProcessVoidEvent().

void SalomePyQt::displayCurve ( const int  id,
Plot2d_Curve theCurve 
)
static
Parameters
idwindow identifier
theCurvecurve to display

References ProcessVoidEvent().

double SalomePyQt::doubleSetting ( const QString &  section,
const QString &  name,
const double  def = 0 
)
static
Parameters
sectionresources file section name
namesetting name
defdefault value which is returned if the setting is not found
Returns
setting value

References ProcessEvent().

bool SalomePyQt::dumpView ( const QString &  filename,
const int  id = 0 
)
static

For the current moment JPEG, PNG and BMP images formats are supported. The image format is defined automatically by the file name extension. By default, BMP format is used.

Parameters
filenameimage file name
Returns
operation status (true on success)

References ProcessEvent().

void SalomePyQt::enableSelector ( )
static

References ProcessVoidEvent().

void SalomePyQt::eraseCurve ( const int  id,
Plot2d_Curve theCurve 
)
static
Parameters
idwindow identifier
theCurvecurve to erase

References ProcessVoidEvent().

void SalomePyQt::eraseCurve ( Plot2d_Curve theCurve)
static

References ProcessVoidEvent().

QList< int > SalomePyQt::findViews ( const QString &  type)
static
Parameters
typeviewer type
Returns
list of integer identifiers

References ProcessEvent().

const QString SalomePyQt::getActiveComponent ( )
static
Returns
active module name or empty string if there is no active module

References ProcessEvent().

PyObject * SalomePyQt::getActivePythonModule ( )
static
Returns
Python module object currently loaded into SALOME_PYQT_ModuleLight container

References ProcessEvent().

int SalomePyQt::getActiveView ( )
static
Returns
integer identifier of the currently active view

References ProcessEvent().

QStringList SalomePyQt::getChildren ( const QString &  entry = QString(),
const bool  recursive = false 
)
static
Parameters
entrydata object entry
recursivetrue for recursive processing

References ProcessEvent().

QColor SalomePyQt::getColor ( const QString &  entry)
static
Parameters
entrydata object entry
Returns
data object color

References ProcessEvent().

QWidget * SalomePyQt::getDesktop ( )
static
Returns
desktop window or 0 if there is no any

References ProcessEvent().

QString SalomePyQt::getExistingDirectory ( QWidget parent,
const QString &  initial,
const QString &  caption 
)
static
Parameters
parentparent widget
initialinitial directory the dialog box to be opened in
captiondialog box title
Returns
selected directory name (null string if user cancels operation)

References ProcessEvent().

QString SalomePyQt::getFileName ( QWidget parent,
const QString &  initial,
const QStringList &  filters,
const QString &  caption,
bool  open 
)
static
Parameters
parentparent widget
initialinitial directory the dialog box to be opened in
filterslist of files filters (wildcards)
captiondialog box title
openif true, "Open File" dialog box is shown; otherwise "Save File" dialog box is shown
Returns
selected file name (null string if user cancels operation)

References ProcessEvent().

QWidget * SalomePyQt::getMainFrame ( )
static

Main frame widget is an internal widget of the application desktop window (workspace).

Returns
workspace widget (0 on any error)

References ProcessEvent().

QMenuBar * SalomePyQt::getMainMenuBar ( )
static
Returns
main menu object (0 on any error)

References ProcessEvent().

QString SalomePyQt::getName ( const QString &  entry)
static
Parameters
entrydata object entry
Returns
data object name

References ProcessEvent().

QTreeView * SalomePyQt::getObjectBrowser ( )
static
Returns
object browser for the active study or 0 in case of error

References ProcessEvent().

int SalomePyQt::getObjectPosition ( const QString &  theEntry)
static
Parameters
theEntrystudy ID of the object
Returns
position

References ProcessEvent().

QStringList SalomePyQt::getOpenFileNames ( QWidget parent,
const QString &  initial,
const QStringList &  filters,
const QString &  caption 
)
static
Parameters
parentparent widget
initialinitial directory the dialog box to be opened in
filterslist of files filters (wildcards)
captiondialog box title
Returns
selected file names list (empty list if user cancels operation)

References ProcessEvent().

QList< double > SalomePyQt::getPlot2dFitRangeByCurves ( const int  id)
static
Parameters
idwindow identifier
Returns
list of view ranges (XMin, XMax, YMin, YMax)

References ProcessEvent().

QList< double > SalomePyQt::getPlot2dFitRangeCurrent ( const int  id)
static
Parameters
idwindow identifier
Returns
list of view ranges (XMin, XMax, YMin, YMax)

References ProcessEvent().

QString SalomePyQt::getPlot2dTitle ( const int  id,
ObjectType  type = MainTitle 
)
static
Parameters
idwindow identifier
typeis type of title
Returns
title of corresponding type

References ProcessEvent().

QMenu * SalomePyQt::getPopupMenu ( const MenuName  menu)
static

This function is obsolete. Use QMenu* SalomePyQt::getPopupMenu( const QString& menu ) instead.

Parameters
menumenu identifier
Returns
popup submenu object or 0 if it does not exist

References Edit, File, Help, Preferences, ProcessEvent(), Tools, View, and Window.

QMenu * SalomePyQt::getPopupMenu ( const QString &  menu)
static

The function creates menu if it does not exist.

Parameters
menumenu name
Returns
popup submenu object (0 on any error)

References ProcessEvent().

QString SalomePyQt::getReference ( const QString &  entry)
static

References ProcessEvent().

SALOME_Selection * SalomePyQt::getSelection ( )
static

Creates a Selection object if it has not been created yet.

Returns
selection object (0 on error)

References ProcessEvent().

QString SalomePyQt::getSetting ( const QString &  name)
static

This function is obsolete. Use stringSetting(), integerSetting(), boolSetting(), stringSetting() or colorSetting() instead.

Parameters
namesetting name (it should be of kind <section:setting> where section is resources section name and setting is setting name)
Returns
setting name (empty string if setting name is invalid)

References ProcessEvent().

int SalomePyQt::getStudyId ( )
static
Returns
active study ID or 0 if there is no active study

References ProcessEvent().

QString SalomePyQt::getToolTip ( const QString &  entry)
static
Parameters
entrydata object entry
Returns
data object tooltip

References ProcessEvent().

QList< int > SalomePyQt::getViews ( )
static
Returns
list of integer identifiers of all the currently opened views

References ProcessEvent().

QString SalomePyQt::getViewTitle ( const int  id)
static
Parameters
idwindow identifier
Returns
view caption

References ProcessEvent().

QString SalomePyQt::getViewType ( const int  id)
static
Parameters
idwindow identifier
Returns
view type

References ProcessEvent().

QWidget * SalomePyQt::getViewWidget ( const int  id)
static

References ProcessEvent().

VisibilityState SalomePyQt::getVisibilityState ( const QString &  theEntry)
static
Parameters
theEntrystudy ID of the object
Returns
visibility state

References ProcessEvent().

bool SalomePyQt::groupAllViews ( )
static
Returns
true if operation is completed successfully and false otherwise

References ProcessEvent().

bool SalomePyQt::hasSetting ( const QString &  section,
const QString &  name 
)
static
Parameters
sectionresources file section name
namesetting name
Returns
true if setting exists

References ProcessEvent().

void SalomePyQt::helpContext ( const QString &  source,
const QString &  context 
)
static
Todo:

Current implementation does nothing.

Parameters
sourcedocumentation (HTML) file name
contextcontext (for example, HTML ancor name)

References getApplication(), and ProcessVoidEvent().

int SalomePyQt::integerSetting ( const QString &  section,
const QString &  name,
const int  def = 0 
)
static
Parameters
sectionresources file section name
namesetting name
defdefault value which is returned if the setting is not found
Returns
setting value

References ProcessEvent().

bool SalomePyQt::isModified ( )
static

References ProcessEvent().

bool SalomePyQt::isViewClosable ( const int  id)
static
Parameters
idwindow identifier
Returns
true if view is closable or false otherwise

References ProcessEvent().

bool SalomePyQt::isViewVisible ( const int  id)
static
Parameters
idwindow identifier
Returns
true if view is visible and false otherwise

References ProcessEvent().

QIcon SalomePyQt::loadIcon ( const QString &  module,
const QString &  filename 
)
static
Parameters
fileNameicon file name
Returns
icon object

References ProcessEvent().

void SalomePyQt::message ( const QString &  msg,
bool  addSeparator = true 
)
static
Parameters
msgmessage text (it can be of simple rich text format)
addSeparatorboolean flag which specifies if it is necessary to separate the message with predefined separator

References getApplication(), ProcessVoidEvent(), and LogWindow::putMessage().

bool SalomePyQt::moveView ( const int  id,
const int  id_to,
const bool  before 
)
static
Parameters
idsource window identifier
id_todestination window identifier param before specifies whether the first viewt has to be moved before or after the second view
Returns
true if operation is completed successfully and false otherwise

References ProcessEvent().

QList< int > SalomePyQt::neighbourViews ( const int  id)
static
Parameters
idwindow identifier
Returns
list of views identifiers

References ProcessEvent().

QStringList SalomePyQt::parameters ( const QString &  section)
static
Parameters
sectionresources file section's name
Returns
list of preferences items

References ProcessEvent().

QStringList SalomePyQt::parameters ( const QStringList &  section)
static
Parameters
sectionresources file section's name
Returns
list of preferences items

References ProcessEvent().

QVariant SalomePyQt::preferenceProperty ( const int  id,
const QString &  prop 
)
static
Parameters
idpreferences identifier
proppreferences property name
Returns
preferences property value or null QVariant if property is not set

References ProcessEvent().

void SalomePyQt::processEvents ( )
static
void SalomePyQt::putInfo ( const QString &  msg,
const int  sec = 0 
)
static

Optional second delay parameter (sec) can be used to specify time of the message diplaying in seconds. If this parameter is less or equal to zero, the constant message will be put.

Parameters
msgmessage text
secmessage displaying time in seconds

References ProcessVoidEvent().

void SalomePyQt::removeChild ( const QString &  entry = QString())
static

References removeChildren().

void SalomePyQt::removeChildren ( const QString &  entry = QString())
static
Parameters
entrydata object entry

References ProcessVoidEvent().

void SalomePyQt::removeObject ( const QString &  entry)
static
Parameters
entrydata object entry

References ProcessVoidEvent().

void SalomePyQt::removeSetting ( const QString &  section,
const QString &  name 
)
static
Parameters
sectionresources file section name
namesetting name

References myName, ProcessVoidEvent(), QtxResourceMgr::remove(), SUIT_Session::resourceMgr(), and SUIT_Session::session().

void SalomePyQt::removeSettings ( const QString &  name)
static

This function is obsolete. Use removeSetting() instead.

Parameters
namesetting name (it should be of kind <section:setting> where section is resources section name and setting is setting name)

References myName, ProcessVoidEvent(), QtxResourceMgr::remove(), SUIT_Session::resourceMgr(), and SUIT_Session::session().

void SalomePyQt::setColor ( const QString &  entry,
const QColor &  color 
)
static
Parameters
entrydata object entry
colordata object color

References ProcessVoidEvent().

void SalomePyQt::setConstant ( const QString &  name,
const QString &  value 
)
static

This function is useful to specify programmatically specific variables that are referenced in the resource setting.

For example, some resource value can be set as "$(myroot)/data/files". Then, "mypath" constant can be set programmatically by the application depending on run-time requirements.

Parameters
sectionresources file section name
namename of the constant
valuevalue of the constant
See Also
constant()

References myName, ProcessVoidEvent(), SUIT_Session::resourceMgr(), SUIT_Session::session(), and QtxResourceMgr::setConstant().

void SalomePyQt::setIcon ( const QString &  entry,
const QString &  icon 
)
static
Parameters
entrydata object entry
icondata object icon file name (icon is loaded from module resources)

References ProcessVoidEvent().

void SalomePyQt::setModified ( bool  flag)
static

SalomePyQt::setModified()

Sets the modification status of the data model for the currently active Python module. This method should be used by the Python code in order to enable/disable "Save" operation depending on the module's data state.

Note
This function is supported for "light" Python-based SALOME modules only.
Parameters
Newmodification status of the data model
See Also
isModified()

References CAM_Module::dataModel(), LightApp_Module::getApp(), ProcessVoidEvent(), SALOME_PYQT_DataModelLight::setModified(), and LightApp_Application::updateActions().

void SalomePyQt::setName ( const QString &  entry,
const QString &  name 
)
static
Parameters
entrydata object entry
namedata object name

References ProcessVoidEvent().

void SalomePyQt::setObjectPosition ( const QString &  theEntry,
int  thePos 
)
static
Parameters
theEntrystudy ID of the object
thePosposition

References myEntry, ProcessVoidEvent(), and SALOME_PYQT_ModuleLight::setObjectPosition().

void SalomePyQt::setPlot2dFitRange ( const int  id,
const double  XMin,
const double  XMax,
const double  YMin,
const double  YMax 
)
static
Parameters
idwindow identifier
XMin
XMax
YMin
YMax

References ProcessVoidEvent().

void SalomePyQt::setPlot2dTitle ( const int  id,
const QString &  title,
ObjectType  type = MainTitle,
bool  show = true 
)
static
Parameters
idwindow identifier
title
typeis type of title
show

References ProcessVoidEvent().

void SalomePyQt::setPreferenceProperty ( const int  id,
const QString &  prop,
const QVariant &  var 
)
static
Parameters
idpreferences identifier
proppreferences property name
varpreferences property value

References LightApp_Module::getApp(), LightApp_Application::preferences(), ProcessVoidEvent(), and SUIT_PreferenceMgr::setItemProperty().

void SalomePyQt::setReference ( const QString &  entry,
const QString &  refEntry 
)
static
Parameters
entrydata object entry
refEntryreferenced data object entry

References ProcessVoidEvent().

void SalomePyQt::setSelection ( const QStringList &  entryList)
static

The list of locally selected objects (study entries) is sent for notification of other listening entities (modules, viewers...).

References ProcessVoidEvent().

void SalomePyQt::setToolTip ( const QString &  entry,
const QString &  toolTip 
)
static
Parameters
entrydata object entry
toolTipdata object tooltip

References ProcessVoidEvent().

void SalomePyQt::setViewClosable ( const int  id,
const bool  on 
)
static
Parameters
idwindow identifier
onnew "closable" option's value

References ProcessVoidEvent(), and SUIT_ViewWindow::setClosable().

bool SalomePyQt::setViewSize ( const int  w,
const int  h,
const int  id = 0 
)
static
Parameters
wwindow width
hwindow height
idwindow identifier
Returns
true if operation is completed successfully and false otherwise

References ProcessEvent().

bool SalomePyQt::setViewTitle ( const int  id,
const QString &  title 
)
static
Parameters
idwindow identifier
titlenew window title
Returns
true if operation is completed successfully and false otherwise

References ProcessEvent().

void SalomePyQt::setViewVisible ( const int  id,
bool  visible = true 
)
static
Parameters
idwindow identifier
visiblenew visiblity

References ProcessVoidEvent().

void SalomePyQt::setVisibilityState ( const QString &  theEntry,
VisibilityState  theState 
)
static
Parameters
theEntrystudy ID of the object
theStatevisibility state

References getActiveStudy(), myEntry, ProcessVoidEvent(), and LightApp_Study::setVisibilityState().

bool SalomePyQt::splitView ( const int  id,
const Orientation  ori,
const Action  action 
)
static
Parameters
idwindow identifier
oriorientation of split operation
actionaction to be performed
Returns
true if operation is completed successfully false otherwise

References ProcessEvent().

void SalomePyQt::startPyLog ( const QString &  theFileName)
static
Parameters
theFileNameoutput lof file name

References getApplication(), ProcessVoidEvent(), and LightApp_Application::pythonConsole().

void SalomePyQt::stopPyLog ( )
static
QString SalomePyQt::stringSetting ( const QString &  section,
const QString &  name,
const QString &  def = QString(""),
const bool  subst = true 
)
static
Parameters
sectionresources file section name
namesetting name
defdefault value which is returned if the setting is not found
substtrue to make substitution, false to get "raw" value
Returns
setting value

References ProcessEvent().

void SalomePyQt::updateCurves ( const int  id)
static
void SalomePyQt::updateObjBrowser ( const int  studyId = 0,
bool  updateSelection = true 
)
static

If studyId <= 0 the active study's object browser is updated. The updateSelection parameter is obsolete and currently is not used. This parameter will be removed in future, so try to avoid its usage in your code.

studyId study identifier updateSelection update selection flag (not used)

See Also
getActiveStudy()

References SUIT_Application::activeStudy(), SUIT_Session::applications(), getActiveStudy(), SUIT_Study::id(), ProcessVoidEvent(), SUIT_Session::session(), and LightApp_Application::updateObjectBrowser().


The documentation for this class was generated from the following files: