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

This class implements GUI module for "light-weight" (no-CORBA-engine) Python-based SALOME modules.

#include <SALOME_PYQT_ModuleLight.h>

Inheritance diagram for SALOME_PYQT_ModuleLight:
Inheritance graph

Signals

void selectionChanged ()
 
void localSelectionChanged ()
 

Public Member Functions

 SALOME_PYQT_ModuleLight ()
 Constructor. More...
 
 ~SALOME_PYQT_ModuleLight ()
 Destructor. More...
 
void initialize (CAM_Application *)
 Initialization of the module. More...
 
bool activateModule (SUIT_Study *)
 Activation of the module. More...
 
bool deactivateModule (SUIT_Study *)
 Deactivation of the module. More...
 
void onModelClosed ()
 Close of the module. More...
 
void windows (QMap< int, int > &) const
 Get the dockable windows associated with the module. More...
 
void viewManagers (QStringList &) const
 Define the compatible view windows associated with the module. More...
 
void studyActivated ()
 Process study activation. More...
 
void contextMenuPopup (const QString &, QMenu *, QString &)
 Process context popup menu request. More...
 
void createPreferences ()
 Export preferences for the Python module. More...
 
void preferencesChanged (const QString &, const QString &)
 Process module's preferences changing. More...
 
void save (QStringList &, const QString &)
 Save module data. Called when user saves study. More...
 
bool load (const QStringList &, const QString &)
 
void dumpPython (QStringList &)
 Dump module data to the Python script. Called when user activates dump study operation. More...
 
bool isDraggable (const SUIT_DataObject *) const
 Test if object what can be dragged by the user. More...
 
bool isDropAccepted (const SUIT_DataObject *) const
 Test if drop operation can be done on the where object. More...
 
void dropObjects (const DataObjectList &, SUIT_DataObject *, const int, Qt::DropAction)
 Perform drop operation. More...
 
QString createObject (const QString &)
 Create new empty data object. More...
 
QString createObject (const QString &, const QString &, const QString &, const QString &)
 Create new data object with specified name, icon and tooltip. More...
 
void setName (const QString &, const QString &)
 Set data object name. More...
 
QString getName (const QString &) const
 Get data object name. More...
 
void setIcon (const QString &, const QString &)
 Set data object icon. More...
 
void setToolTip (const QString &, const QString &)
 Set data object tooltip. More...
 
QString getToolTip (const QString &) const
 Get data object tooltip. More...
 
void setColor (const QString &, const QColor &)
 Set data object color. More...
 
QColor getColor (const QString &) const
 Get data object color. More...
 
void setReference (const QString &, const QString &)
 Set reference to another data object. More...
 
QString getReference (const QString &) const
 
void removeObject (const QString &)
 Remove object by entry. More...
 
void removeChildren (const QString &)
 Remove all child data objects from specified data object. More...
 
void setObjectPosition (const QString &, int)
 
int getObjectPosition (const QString &)
 
QStringList getChildren (const QString &, const bool=false) const
 Get entries of all child data objects of specified data object. More...
 
void enableSelector ()
 
void disableSelector ()
 
void setLocalSelected (const QStringList &)
 called by Python module to notify a list of study entries locally selected (for selection propagation) More...
 
void getSelected (DataObjectList &) const
 not used yet More...
 
void setSelected (const QStringList &, const bool=false)
 not used yet More...
 
- Public Member Functions inherited from LightApp_Module
 LightApp_Module (const QString &)
 
virtual ~LightApp_Module ()
 
LightApp_ApplicationgetApp () const
 
virtual void update (const int)
 Update something in accordance with update flags. More...
 
virtual void updateObjBrowser (bool=true, SUIT_DataObject *=0)
 
virtual void selectionChanged ()
 
virtual void message (const QString &)
 
virtual LightApp_Displayerdisplayer ()
 
virtual LightApp_SelectioncreateSelection () const
 
virtual bool canCopy () const
 
virtual bool canPaste () const
 
virtual void copy ()
 Copies the current selection into clipboard. More...
 
virtual void paste ()
 Pastes the current data in the clipboard. More...
 
virtual bool renameAllowed (const QString &) const
 Return true if object can be renamed. More...
 
virtual bool renameObject (const QString &, const QString &)
 Return true if rename operation finished successfully, false otherwise. More...
 
virtual void updateModuleVisibilityState ()
 
- Public Member Functions inherited from CAM_Module
 CAM_Module ()
 Default constructor. More...
 
 CAM_Module (const QString &)
 Constructor. More...
 
virtual ~CAM_Module ()
 Destructor. More...
 
QString name () const
 Get module (internal) name. More...
 
QString moduleName () const
 Get module title (user name) More...
 
virtual QPixmap moduleIcon () const
 Get module icon. More...
 
virtual QString iconName () const
 Get module icon's name. More...
 
CAM_DataModeldataModel () const
 Get data model. More...
 
CAM_Applicationapplication () const
 Get application. More...
 
virtual void updateCommandsStatus ()
 Update menu/toolbar actions. More...
 
virtual void putInfo (const QString &, const int=-1)
 Put the text message into the status bar of the application main window. More...
 
bool isActiveModule () const
 Check if the module is active. More...
 
virtual void setMenuShown (const bool)
 Show/hide all module's menus. More...
 
void setMenuShown (QAction *, const bool)
 Show/hide specified menu item. More...
 
void setMenuShown (const int, const bool)
 Show/hide specified menu item. More...
 
virtual void setToolShown (const bool)
 Show/hide all module's toolbars. More...
 
void setToolShown (QAction *, const bool)
 Show/hide specified toolbar item. More...
 
void setToolShown (const int, const bool)
 Show/hide specified toolbar item. More...
 
virtual bool activateOperation (int actionId)
 Activate GUI operation of module by its ID. This method is called from CAM_Application::startOperation(). More...
 
virtual bool activateOperation (const QString &actionId)
 Activate GUI operation of module by its ID. This method is called from CAM_Application::startOperation(). More...
 
virtual bool activateOperation (const QString &actionId, const QString &pluginName)
 Activate GUI operation of module by its ID and pluginName. This method is called from CAM_Application::startOperation(). More...
 
QtxActionMenuMgrmenuMgr () const
 Get menu manager. More...
 
QtxActionToolMgrtoolMgr () const
 Get toolbar manager. More...
 
virtual QActionaction (const int) const
 Get action by specified id. More...
 
virtual int actionId (const QAction *) const
 Get action ID. More...
 
virtual QActioncreateAction (const int, const QString &, const QIcon &, const QString &, const QString &, const int, QObject *=0, const bool=false, QObject *=0, const char *=0, const QString &=QString())
 Create new instance of QtxAction and register action with specified id. More...
 
virtual QActioncreateAction (const int, const QString &, const QIcon &, const QString &, const QString &, const QKeySequence &, QObject *=0, const bool=false, QObject *=0, const char *=0, const QString &=QString())
 Create new instance of QtxAction and register action with specified id. More...
 
QtxActionGroupcreateActionGroup (const int, const bool=true)
 Create new action group. More...
 
int createTool (const QString &, const QString &=QString())
 Create toolbar with speicifed name. More...
 
int createTool (const int, const int, const int=-1)
 Add toolbar item. More...
 
int createTool (const int, const QString &, const int=-1)
 Add toolbar item. More...
 
int createTool (QAction *, const int, const int=-1, const int=-1)
 Add toolbar item. More...
 
int createTool (QAction *, const QString &, const int=-1, const int=-1)
 Add toolbar item. More...
 
int createMenu (const QString &, const int, const int=-1, const int=-1, const int=-1, QMenu *=0)
 Create menu or submenu. More...
 
int createMenu (const QString &, const QString &, const int=-1, const int=-1, const int=-1)
 Create menu or submenu. More...
 
int createMenu (const int, const int, const int=-1, const int=-1)
 Add menu item. More...
 
int createMenu (const int, const QString &, const int=-1, const int=-1)
 Add menu item. More...
 
int createMenu (QAction *, const int, const int=-1, const int=-1, const int=-1)
 Add menu item. More...
 
int createMenu (QAction *, const QString &, const int=-1, const int=-1, const int=-1)
 Add menu item. More...
 

Protected Member Functions

CAM_DataModelcreateDataModel ()
 Create new instance of data model and return it. More...
 
- Protected Member Functions inherited from LightApp_Module
virtual QtxPopupMgrpopupMgr ()
 
LightApp_Preferencespreferences () const
 
virtual bool reusableOperation (const int id)
 
int addPreference (const QString &label)
 
int addPreference (const QString &label, const int pId, const int type=LightApp_Preferences::Auto, const QString &section=QString(), const QString &param=QString())
 
QVariant preferenceProperty (const int, const QString &) const
 
void setPreferenceProperty (const int, const QString &, const QVariant &)
 
void startOperation (const int)
 Starts operation with given identifier. More...
 
virtual LightApp_OperationcreateOperation (const int) const
 Creates operation with given identifier. More...
 
virtual void updateControls ()
 Updates controls. More...
 
virtual bool isSelectionCompatible ()
 If return false, selection will be cleared at module activation. More...
 
LightApp_Operationoperation (const int) const
 Returns instance of operation by its id; if there is no operation corresponding to this id, null pointer is returned. More...
 
- Protected Member Functions inherited from CAM_Module
void setName (const QString &)
 Set module (internal) name. More...
 
virtual void setModuleName (const QString &)
 Set module title (user name) More...
 
int registerAction (const int, QAction *)
 Register action in the internal action map. More...
 
bool unregisterAction (const int)
 Unregister action from the internal action map. More...
 
bool unregisterAction (QAction *)
 Unregister action from the internal action map. More...
 
virtual bool abortAllOperations ()
 

Private Member Functions

SALOME_PYQT_DataObjectLightfindObject (const QString &) const
 Find data object by its entry. More...
 

Private Attributes

PyModuleHelpermyHelper
 
SALOME_PYQT_SelectormySelector
 

Additional Inherited Members

- Public Slots inherited from LightApp_Module
virtual void studyClosed (SUIT_Study *)
 
virtual void onObjectClicked (SUIT_DataObject *, int)
 Virtual public slot. More...
 
void onOBDestroyed ()
 
void MenuItem ()
 
- Static Public Member Functions inherited from CAM_Module
static QActionseparator ()
 Create separator action. More...
 
- Protected Slots inherited from LightApp_Module
virtual void onModelSaved ()
 
virtual void onModelOpened ()
 
virtual void onOperationStopped (SUIT_Operation *)
 Virtual protected slot called when operation stopped. More...
 
virtual void onOperationDestroyed ()
 Virtual protected slot called when operation destroyed. More...
 
virtual void onShowHide ()
 
virtual void onViewManagerAdded (SUIT_ViewManager *)
 
virtual void onViewManagerRemoved (SUIT_ViewManager *)
 
- Protected Attributes inherited from LightApp_Module
int myDisplay
 
int myErase
 
int myDisplayOnly
 
int myEraseAll
 
bool myIsFirstActivate
 

Constructor & Destructor Documentation

SALOME_PYQT_ModuleLight::SALOME_PYQT_ModuleLight ( )

References myHelper.

SALOME_PYQT_ModuleLight::~SALOME_PYQT_ModuleLight ( )

Member Function Documentation

bool SALOME_PYQT_ModuleLight::activateModule ( SUIT_Study study)
virtual
Parameters
studyparent study
Returns
true if activation is successful and false otherwise
See Also
PyModuleHelper::activate()

Reimplemented from LightApp_Module.

References PyModuleHelper::activate(), LightApp_Module::activateModule(), and myHelper.

void SALOME_PYQT_ModuleLight::contextMenuPopup ( const QString &  context,
QMenu menu,
QString &   
)
virtual
Parameters
contextpopup menu context (e.g. "ObjectBrowser")
menupopup menu
titlepopup menu title (not used)
See Also
PyModuleHelper::contextMenu()

Reimplemented from LightApp_Module.

References PyModuleHelper::contextMenu(), and myHelper.

CAM_DataModel * SALOME_PYQT_ModuleLight::createDataModel ( )
protectedvirtual

Reimplemented from LightApp_Module.

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

References CAM_Module::dataModel(), SALOME_PYQT_DataObjectLight::entry(), findObject(), SALOME_PYQT_DataModelLight::getRoot(), and obj.

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

References createObject(), findObject(), obj, SALOME_PYQT_DataObjectLight::setIcon(), SALOME_PYQT_DataObjectLight::setName(), and SALOME_PYQT_DataObjectLight::setToolTip().

void SALOME_PYQT_ModuleLight::createPreferences ( )
virtual
bool SALOME_PYQT_ModuleLight::deactivateModule ( SUIT_Study study)
virtual
Parameters
studyparent study
Returns
true if deactivation is successful and false otherwise
See Also
PyModuleHelper::deactivate()

Reimplemented from LightApp_Module.

References PyModuleHelper::deactivate(), LightApp_Module::deactivateModule(), and myHelper.

void SALOME_PYQT_ModuleLight::disableSelector ( )
void SALOME_PYQT_ModuleLight::dropObjects ( const DataObjectList what,
SUIT_DataObject where,
const int  row,
Qt::DropAction  action 
)
virtual
Parameters
whatlist of data objects being dropped
wheretarget data object for drop operation
rowline (child item index) where drop operation is performed to
actioncurrent drop action (copy or move)
See Also
PyModuleHelper::dropObjects()

Reimplemented from LightApp_Module.

References PyModuleHelper::dropObjects(), and myHelper.

void SALOME_PYQT_ModuleLight::dumpPython ( QStringList &  files)
Parameters
filesoutput list of files where module stores python script
See Also
PyModuleHelper::dumpPython()

References PyModuleHelper::dumpPython(), and myHelper.

void SALOME_PYQT_ModuleLight::enableSelector ( )
SALOME_PYQT_DataObjectLight * SALOME_PYQT_ModuleLight::findObject ( const QString &  entry) const
private
Parameters
entrydata object entry
Returns
data object with given entry or 0 if object isn't found

References SUIT_DataObjectIterator::current(), CAM_Module::dataModel(), SUIT_DataObjectIterator::DepthLeft, SALOME_PYQT_DataObjectLight::entry(), SALOME_PYQT_DataModelLight::getRoot(), and obj.

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

References SUIT_DataObject::children(), CAM_Module::dataModel(), SALOME_PYQT_DataObjectLight::entry(), findObject(), and SALOME_PYQT_DataModelLight::getRoot().

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

References OCCViewer::color(), SALOME_PYQT_DataObjectLight::color(), findObject(), and SUIT_DataObject::Foreground.

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

References findObject(), SALOME_PYQT_DataObjectLight::name(), and CAM_Module::name().

int SALOME_PYQT_ModuleLight::getObjectPosition ( const QString &  theEntry)
QString SALOME_PYQT_ModuleLight::getReference ( const QString &  entry) const
void SALOME_PYQT_ModuleLight::getSelected ( DataObjectList ) const
QString SALOME_PYQT_ModuleLight::getToolTip ( const QString &  entry) const
Parameters
entrydata object entry
Returns
data object tooltip

References findObject(), and SALOME_PYQT_DataObjectLight::toolTip().

void SALOME_PYQT_ModuleLight::initialize ( CAM_Application app)
virtual
bool SALOME_PYQT_ModuleLight::isDraggable ( const SUIT_DataObject what) const
virtual
Parameters
whatdata object being tested
Returns
true if object can be dragged or false otherwise
See Also
PyModuleHelper::isDraggable()

Reimplemented from LightApp_Module.

References PyModuleHelper::isDraggable(), and myHelper.

bool SALOME_PYQT_ModuleLight::isDropAccepted ( const SUIT_DataObject where) const
virtual
Parameters
wheredata object being tested
Returns
true if if drop operation is supported by object or false otherwise
See Also
PyModuleHelper::isDropAccepted()

Reimplemented from LightApp_Module.

References PyModuleHelper::isDropAccepted(), and myHelper.

bool SALOME_PYQT_ModuleLight::load ( const QStringList &  files,
const QString &  url 
)

References PyModuleHelper::load(), and myHelper.

void SALOME_PYQT_ModuleLight::localSelectionChanged ( )
signal
void SALOME_PYQT_ModuleLight::onModelClosed ( )
virtual

This function is usually used in order to close the module's specific menus and toolbars and perform other such actions required when the module is closed.

Reimplemented from LightApp_Module.

References CAM_Module::application(), SALOME_PYQT_Selector::clear(), PyModuleHelper::modelClosed(), myHelper, mySelector, and LightApp_Module::onModelClosed().

void SALOME_PYQT_ModuleLight::preferencesChanged ( const QString &  section,
const QString &  parameter 
)
virtual
Parameters
sectionpreference resources section
parameterpreference resources parameter name
See Also
PyModuleHelper::preferencesChanged()

Reimplemented from LightApp_Module.

References myHelper, and PyModuleHelper::preferencesChanged().

void SALOME_PYQT_ModuleLight::removeChildren ( const QString &  entry)
void SALOME_PYQT_ModuleLight::removeObject ( const QString &  entry)
Parameters
entrydata object entry

References findObject(), SUIT_DataObject::parent(), and SUIT_DataObject::removeChild().

void SALOME_PYQT_ModuleLight::save ( QStringList &  files,
const QString &  url 
)
Parameters
filesoutput list of files where module stores data
urlstudy URL
See Also
PyModuleHelper::save()

References myHelper, and PyModuleHelper::save().

void SALOME_PYQT_ModuleLight::selectionChanged ( )
signal
void SALOME_PYQT_ModuleLight::setColor ( const QString &  entry,
const QColor &  color 
)
Parameters
entrydata object entry
colordata object color

References findObject(), and SALOME_PYQT_DataObjectLight::setColor().

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

References findObject(), and SALOME_PYQT_DataObjectLight::setIcon().

void SALOME_PYQT_ModuleLight::setLocalSelected ( const QStringList &  entries)
void SALOME_PYQT_ModuleLight::setName ( const QString &  entry,
const QString &  name 
)
Parameters
entrydata object entry
namedata object name

References findObject(), and SALOME_PYQT_DataObjectLight::setName().

void SALOME_PYQT_ModuleLight::setObjectPosition ( const QString &  theEntry,
int  thePos 
)
void SALOME_PYQT_ModuleLight::setReference ( const QString &  entry,
const QString &  refEntry 
)
Parameters
entrydata object entry
refEntryreferenced data object entry

References findObject(), and SALOME_PYQT_DataObjectLight::setRefEntry().

void SALOME_PYQT_ModuleLight::setSelected ( const QStringList &  entries,
const bool  isUnused = false 
)

not used yet

Used to notify a Python light module of a modification of selection in study (propagation of a remote selection)

Parameters
listof study entries

References myHelper, and PyModuleHelper::selectionUpdated().

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

References findObject(), and SALOME_PYQT_DataObjectLight::setToolTip().

void SALOME_PYQT_ModuleLight::studyActivated ( )
virtual
void SALOME_PYQT_ModuleLight::viewManagers ( QStringList &  viewList) const
virtual
Parameters
viewListoutput list of view windows types
See Also
PyModuleHelper::viewManagers()

Reimplemented from LightApp_Module.

References myHelper, and PyModuleHelper::viewManagers().

void SALOME_PYQT_ModuleLight::windows ( QMap< int, int > &  winMap) const
virtual
Parameters
winMapoutput map of dockable windows in form { <window_type> : <dock_area> }
See Also
PyModuleHelper::windows()

Reimplemented from LightApp_Module.

References myHelper, and PyModuleHelper::windows().

Member Data Documentation

PyModuleHelper* SALOME_PYQT_ModuleLight::myHelper
private
SALOME_PYQT_Selector* SALOME_PYQT_ModuleLight::mySelector
private

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