Version: 6.3.1
Data Structures | Public Slots | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends

SALOME_PYQT_ModuleLight Class Reference

This class implements module API for all the Python-based SALOME modules.

#include <SALOME_PYQT_ModuleLight.h>

Inheritance diagram for SALOME_PYQT_ModuleLight:
Inheritance graph

Data Structures

class  XmlHandler

Public Slots

virtual bool activateModule (SUIT_Study *)
 Activation of the module.
virtual bool deactivateModule (SUIT_Study *)
 Deactivation of the module.
void preferenceChanged (const QString &, const QString &, const QString &)
void onGUIEvent ()
 Process GUI action (from main menu, toolbar or context popup menu action).
void onActiveViewChanged (SUIT_ViewWindow *)
 Signal handler windowActivated(SUIT_ViewWindow*) of SUIT_Desktop.
void onViewTryClose (SUIT_ViewWindow *)
 Signal handler tryClose(SUIT_ViewWindow*) of a view.
void onViewClosed (SUIT_ViewWindow *)
 Signal handler closing(SUIT_ViewWindow*) of a view.
void onViewCloned (SUIT_ViewWindow *)
 Signal handler cloneView() of OCCViewer_ViewWindow.
void MenuItem ()
virtual void connectToStudy (CAM_Study *)
 Connect data model of the module to the active study.
virtual void studyClosed (SUIT_Study *)
 Called when study is closed.
virtual void studyChanged (SUIT_Study *, SUIT_Study *)
 Called when study is changed (obsolete).
virtual void onApplicationClosed (SUIT_Application *)
 Called when application is closed.

Public Member Functions

 SALOME_PYQT_ModuleLight ()
 Constructor.
 ~SALOME_PYQT_ModuleLight ()
 Destructor.
void initialize (CAM_Application *)
 Initialization of the module.
void windows (QMap< int, int > &) const
 Define the dockable windows associated with the module.
void viewManagers (QStringList &) const
 Define the compatible view windows associated with the module.
void contextMenuPopup (const QString &, QMenu *, QString &)
 Process context popup menu request.
void createPreferences ()
 Export preferences for the Python module.
void studyActivated ()
 Process study activation.
void preferencesChanged (const QString &, const QString &)
 Process module's preferences changing.
int createTool (const QString &)
 Create toolbar with specified name.
int createTool (const int, const int, const int=-1)
 Insert action with specified id to the toolbar.
int createTool (const int, const QString &, const int=-1)
 Insert action with specified id to the toolbar.
int createTool (QAction *, const int, const int=-1, const int=-1)
 Insert action to the toolbar.
int createTool (QAction *, const QString &, const int=-1, const int=-1)
 Insert action to the toolbar.
int createMenu (const QString &, const int, const int=-1, const int=-1, const int=-1)
 Create main menu.
int createMenu (const QString &, const QString &, const int=-1, const int=-1, const int=-1)
 Create main menu.
int createMenu (const int, const int, const int=-1, const int=-1)
 Insert action to the main menu.
int createMenu (const int, const QString &, const int=-1, const int=-1)
 Insert action to the main menu.
int createMenu (QAction *, const int, const int=-1, const int=-1, const int=-1)
 Insert action to the main menu.
int createMenu (QAction *, const QString &, const int=-1, const int=-1, const int=-1)
 Insert action to the main menu.
QActionseparator ()
 Create separator action which can be used in the menu or toolbar.
QActionaction (const int) const
 Get action by specified id.
int actionId (const QAction *) const
 Get action identifier.
QActioncreateAction (const int, const QString &, const QString &, const QString &, const QString &, const int, const bool=false, QObject *=0)
 Create new action.
QtxActionGroupcreateActionGroup (const int, const bool)
 Create new action group.
QIcon loadIcon (const QString &fileName)
 Load icon from resource file.
int addGlobalPreference (const QString &)
 Add global application preference (for example, application specific section).
int addPreference (const QString &)
 Add preference.
int addPreference (const QString &, const int, const int=LightApp_Preferences::Auto, const QString &=QString(), const QString &=QString())
 Add preference.
QVariant preferenceProperty (const int, const QString &) const
 Get the preference property.
void setPreferenceProperty (const int, const QString &, const QVariant &)
 Set the preference property.
void save (QStringList &theListOfFiles)
bool open (QStringList theListOfFiles)
QString createObject (const QString &parent)
QString createObject (const QString &name, const QString &iconname, const QString &tooltip, const QString &parent)
void setName (const QString &obj, const QString &iconname)
void setIcon (const QString &obj, const QString &name)
void setToolTip (const QString &obj, const QString &name)
QString getName (const QString &obj)
QString getToolTip (const QString &obj)
void removeObject (const QString &obj)
void removeChild (const QString &obj)
QStringList getChildren (const QString &obj, const bool rec)
LightApp_ApplicationgetApp () const
virtual void update (const int)
 Update something in accordance with update flags.
virtual void updateObjBrowser (bool=true, SUIT_DataObject *=0)
virtual void selectionChanged ()
virtual LightApp_Displayerdisplayer ()
virtual LightApp_SelectioncreateSelection () const
virtual bool canCopy () const
virtual bool canPaste () const
virtual void copy ()
 Copies the current selection into clipboard.
virtual void paste ()
 Pastes the current data in the clipboard.
virtual bool renameAllowed (const QString &) const
 Return true if object can be renamed.
virtual bool renameObject (const QString &, const QString &)
 Return true if rename operation finished successfully, false otherwise.
QString name () const
 Get module (internal) name.
QString moduleName () const
 Get module title (user name)
virtual QPixmap moduleIcon () const
 Get module icon.
virtual QString iconName () const
 Get module icon's name.
CAM_DataModeldataModel () const
 Get data model.
CAM_Applicationapplication () const
 Get application.
virtual void updateCommandsStatus ()
 Update menu/toolbar actions.
virtual void putInfo (const QString &, const int=-1)
 Put the text message into the status bar of the application main window.
bool isActiveModule () const
 Check if the module is active.
virtual void setMenuShown (const bool)
 Show/hide all module's menus.
void setMenuShown (QAction *, const bool)
 Show/hide specified menu item.
void setMenuShown (const int, const bool)
 Show/hide specified menu item.
virtual void setToolShown (const bool)
 Show/hide all module's toolbars.
void setToolShown (QAction *, const bool)
 Show/hide specified toolbar item.
void setToolShown (const int, const bool)
 Show/hide specified toolbar item.

Static Public Member Functions

static SALOME_PYQT_ModuleLightgetInitModule ()
 Get the module being initialized.
static int defaultMenuGroup ()
 Get default menu group identifier.

Protected Slots

virtual void onModelSaved ()
virtual void onModelOpened ()
virtual void onModelClosed ()
virtual void onOperationStopped (SUIT_Operation *)
 Virtual protected slot called when operation stopped.
virtual void onOperationDestroyed ()
 Virtual protected slot called when operation destroyed.
virtual void onShowHide ()
virtual void onViewManagerAdded (SUIT_ViewManager *)
virtual void onViewManagerRemoved (SUIT_ViewManager *)

Protected Member Functions

virtual CAM_DataModelcreateDataModel ()
virtual bool activateModuleInternal (SUIT_Study *)
 Perform internal activation of the module.
virtual QtxPopupMgrpopupMgr ()
LightApp_Preferencespreferences () const
virtual bool reusableOperation (const int id)
void startOperation (const int)
 Starts operation with given identifier.
virtual LightApp_OperationcreateOperation (const int) const
 Creates operation with given identifier.
virtual void updateControls ()
 Updates controls.
virtual bool isSelectionCompatible ()
 If return false, selection will be cleared at module activation.
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.
void setName (const QString &)
 Set module (internal) name.
virtual void setModuleName (const QString &)
 Set module title (user name)
QtxActionMenuMgrmenuMgr () const
 Get menu manager.
QtxActionToolMgrtoolMgr () const
 Get toolbar manager.
int registerAction (const int, QAction *)
 Register action in the internal action map.
bool unregisterAction (const int)
 Unregister action from the internal action map.
bool unregisterAction (QAction *)
 Unregister action from the internal action map.
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.

Protected Attributes

PyObject * myModule
 Python GUI module.
PyInterp_InterpmyInterp
 current Python subinterpreter
int myDisplay
int myErase
int myDisplayOnly
int myEraseAll

Static Protected Attributes

static InterpMap myInterpMap
 study to Python subinterpreter map

Private Types

typedef QMap< int,
PyInterp_Interp * > 
InterpMap
 study to Python subinterpreter map

Private Member Functions

void init (CAM_Application *)
 Internal module initialization:
void activate (SUIT_Study *)
 Internal activation:
void deactivate (SUIT_Study *)
 Internal deactivation:
bool lastActivationStatus () const
 Get last activation status.
void customize (SUIT_Study *)
 Additional customization after module is activated:
void studyChanged (SUIT_Study *)
 Perform internal actions when active study is changed.
void contextMenu (const QString &, QMenu *)
 Process (internally) context popup menu request.
void guiEvent (const int)
 Internal GUI event handling.
void initPreferences ()
 Initialize (internally) preferences for the module.
void prefChanged (const QString &, const QString &)
 Preference changing callback function (internal).
virtual void initInterp (int)
 Initialize python subinterpreter (one per study).
void importModule ()
 Import Python GUI module and remember the reference to the module.
void setWorkSpace ()
 Set study workspace to the Python module.
void activeViewChanged (const SUIT_ViewWindow *)
 Processes the view changing, calls Python module's activeViewChanged() method.
void viewTryClose (const SUIT_ViewWindow *)
 Processes the view closing attempt, calls Python module's viewTryClose() method.
void viewClosed (const SUIT_ViewWindow *)
 Processes the view closing, calls Python module's viewClosed() method.
void viewCloned (const SUIT_ViewWindow *)
 Processes the view cloning, calls Python module's activeViewCloned() method.
void connectView (const SUIT_ViewWindow *)
 Connects or disconnects signals about activating and cloning view on the module slots.
void saveEvent (QStringList &theListOfFiles)
void openEvent (QStringList theListOfFiles, bool &opened)
SALOME_PYQT_DataObjectLightfindObject (const QString &entry)

Private Attributes

XmlHandlermyXmlHandler
 XML resource file parser.
QMap< int, int > myWindowsMap
 windows map
QStringList myViewMgrList
 compatible view managers list
bool myLastActivateStatus
 latest module activation status

Static Private Attributes

static SALOME_PYQT_ModuleLightmyInitModule = 0
 Python GUI being initialized (not zero only during the initialization)

Friends

class XmlHandler

Member Typedef Documentation

typedef QMap<int, PyInterp_Interp*> SALOME_PYQT_ModuleLight.InterpMap [private]

Constructor & Destructor Documentation

SALOME_PYQT_ModuleLight::SALOME_PYQT_ModuleLight ( )
SALOME_PYQT_ModuleLight::~SALOME_PYQT_ModuleLight ( )

Member Function Documentation

SALOME_PYQT_ModuleLight * SALOME_PYQT_ModuleLight::getInitModule ( ) [static]

This is a little trick :) needed to provide an access from Python (SalomePyQt) to the module being currently activated. The problem that during the process of module initialization (initialize() function) it is not yet available via application->activeModule() call.

This method returns valid pointer only if called in scope of initialize() function.

Returns:
the module being currently initialized

References myInitModule.

void SALOME_PYQT_ModuleLight::initialize ( CAM_Application app) [virtual]

This method can be used for creation of the menus, toolbars and other such staff.

There are two ways to do this:

  • for obsolete modules this method first tries to read <module>_<language>.xml resource file which contains a menu, toolbars and popup menus description;
  • new modules can create menus by direct calling of the corresponding methods of SalomePyQt Python API in the Python module's initialize() method which is called from here.

NOTE: SALOME supports two modes of modules loading:

  • immediate (all the modules are created and initialized immediately when the application object is created;
  • postponed modules loading (used currently); in this mode the module is loaded only be request. If postponed modules loading is not used, the active study might be not yet defined at this stage, so initialize() method should not perform any study-based initialization.
Parameters:
appparent application object

Reimplemented from LightApp_Module.

References SALOME_PYQT_ModuleLight.XmlHandler.createActions(), PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), LightApp_Module.getApp(), CAM_Module.myApp, myXmlHandler, CAM_Module.name(), QtxResourceMgr.path(), SUIT_Application.resourceMgr(), and QtxResourceMgr.stringValue().

void SALOME_PYQT_ModuleLight::windows ( QMap< int, int > &  mappa) const [virtual]

To fill the list of windows the correspondind Python module's windows() method is called from SALOME_PYQT_ModuleLight.init() method.

By default, ObjectBrowser, PythonConsole and LogWindow windows are associated to the module.

Allowed dockable windows:

Dock area is defined by Qt.DockWidgetArea enumeration:

  • Qt.TopDockWidgetArea : top dock area
  • Qt.BottomDockWidgetArea : bottom dock area
  • Qt.LeftDockWidgetArea : left dock area
  • Qt.RightDockWidgetArea : right dock area
Parameters:
mappamap of dockable windows: { <window_type> : <dock_area> }

Reimplemented from LightApp_Module.

References myWindowsMap.

void SALOME_PYQT_ModuleLight::viewManagers ( QStringList &  lst) const [virtual]

The associated view windows are opened automatically when the module is activated.

To fill the list of views the correspondind Python module's views() method is called from SALOME_PYQT_ModuleLight.init() method. By default, the list is empty.

Parameters:
listiklist of view windows types

Reimplemented from LightApp_Module.

References myViewMgrList.

void SALOME_PYQT_ModuleLight::contextMenuPopup ( const QString &  theContext,
QMenu thePopupMenu,
QString &   
) [virtual]

Called when user activates popup menu in some window (view, object browser, etc).

Parameters:
theContextpopup menu context (e.g. "ObjectBrowser")
thePopupMenupopup menu
titlepopup menu title (not used)

Reimplemented from LightApp_Module.

References PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), FuncMsg.message(), and myInterp.

void SALOME_PYQT_ModuleLight::createPreferences ( ) [virtual]

Called only once when the first instance of the module is created.

Reimplemented from LightApp_Module.

References PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), and myInterp.

void SALOME_PYQT_ModuleLight::studyActivated ( ) [virtual]

Called when study desktop is activated. Used for notifying the Python module about changing of the active study.

Reimplemented from LightApp_Module.

References CAM_Module.application(), PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), and PyInterp.myStudy.

void SALOME_PYQT_ModuleLight::preferencesChanged ( const QString &  section,
const QString &  setting 
) [virtual]

Called when the module's preferences are changed.

Parameters:
sectionsetting section
settingsetting name

Reimplemented from LightApp_Module.

References PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), and myInterp.

int SALOME_PYQT_ModuleLight::defaultMenuGroup ( ) [static]
Returns:
menu group ID (40 by default)

References DEFAULT_GROUP.

int SALOME_PYQT_ModuleLight::createTool ( const QString &  name)
Parameters:
nametoolbar name
Returns:
toolbar ID or -1 if toolbar creation is failed

Reimplemented from CAM_Module.

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

Reimplemented from CAM_Module.

References createTool().

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

Reimplemented from CAM_Module.

References createTool().

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

Reimplemented from CAM_Module.

References createTool().

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

Reimplemented from CAM_Module.

References createTool().

int SALOME_PYQT_ModuleLight::createMenu ( const QString &  subMenu,
const int  menu,
const int  id = -1,
const int  group = -1,
const int  idx = -1 
)
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

Reimplemented from LightApp_Module.

int SALOME_PYQT_ModuleLight::createMenu ( const QString &  subMenu,
const QString &  menu,
const int  id = -1,
const int  group = -1,
const int  idx = -1 
)
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

Reimplemented from LightApp_Module.

References createMenu().

int SALOME_PYQT_ModuleLight::createMenu ( const int  id,
const int  menu,
const int  group = -1,
const int  idx = -1 
)
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

Reimplemented from LightApp_Module.

References createMenu().

int SALOME_PYQT_ModuleLight::createMenu ( const int  id,
const QString &  menu,
const int  group = -1,
const int  idx = -1 
)
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

Reimplemented from LightApp_Module.

References createMenu().

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

Reimplemented from LightApp_Module.

References createMenu().

int SALOME_PYQT_ModuleLight::createMenu ( QAction a,
const QString &  menu,
const int  id = -1,
const int  group = -1,
const int  idx = -1 
)
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

Reimplemented from LightApp_Module.

References createMenu().

QAction * SALOME_PYQT_ModuleLight::separator ( )
Returns:
new separator action

Reimplemented from CAM_Module.

QAction * SALOME_PYQT_ModuleLight::action ( const int  id) const
Returns:
action or 0 if it is not found

Reimplemented from CAM_Module.

References test_table.a, QtxActionMenuMgr.findMenu(), and CAM_Module.menuMgr().

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

Reimplemented from CAM_Module.

QAction * SALOME_PYQT_ModuleLight::createAction ( const int  id,
const QString &  text,
const QString &  icon,
const QString &  menu,
const QString &  tip,
const int  key,
const bool  toggle = false,
QObject parent = 0 
)

If the action with specified identifier already registered it is not created, but its attributes are only modified.

Parameters:
idaction ID
texttooltip text
iconicon
menumenu text
tipstatus tip
keykeyboard shortcut
toggletrue for checkable action
Returns:
created action

References test_table.a, action(), loadIcon(), and onGUIEvent().

QtxActionGroup * SALOME_PYQT_ModuleLight::createActionGroup ( const int  id,
const bool  exclusive 
)

If the action with specified identifier already registered it is not created, but its attributes are only modified.

Parameters:
idaction ID
texttooltip text
iconicon
menumenu text
tipstatus tip
keykeyboard shortcut
toggletrue for checkable action
Returns:
created action

References test_table.a, action(), CAM_Module.registerAction(), and QtxActionGroup.setExclusive().

QIcon SALOME_PYQT_ModuleLight::loadIcon ( const QString &  fileName)
Parameters:
fileNameicon file name
Returns:
icon (null icon if loading failed)

References LightApp_Module.getApp(), QtxResourceMgr.loadPixmap(), CAM_Module.name(), and SUIT_Application.resourceMgr().

int SALOME_PYQT_ModuleLight::addGlobalPreference ( const QString &  label)
Parameters:
labelpreference name
Returns:
preference ID

References LightApp_Preferences.addPreference(), and LightApp_Module.preferences().

int SALOME_PYQT_ModuleLight::addPreference ( const QString &  label)
Parameters:
labelpreference name
Returns:
preference ID

Reimplemented from LightApp_Module.

int SALOME_PYQT_ModuleLight::addPreference ( const QString &  label,
const int  pId,
const int  type = LightApp_Preferences::Auto,
const QString &  section = QString(),
const QString &  param = QString() 
)
Parameters:
labelpreference name
pIdparent preference ID
typepreference type
sectionresource file section name
paramresource file setting name
Returns:
preference ID

Reimplemented from LightApp_Module.

References addPreference().

QVariant SALOME_PYQT_ModuleLight::preferenceProperty ( const int  id,
const QString &  prop 
) const
Parameters:
idpreference ID
propproperty name
Returns:
property value (invalid QVariant() if property is not found)

Reimplemented from LightApp_Module.

void SALOME_PYQT_ModuleLight::setPreferenceProperty ( const int  id,
const QString &  prop,
const QVariant &  var 
)
Parameters:
idpreference ID
propproperty name
varproperty value

Reimplemented from LightApp_Module.

void SALOME_PYQT_ModuleLight::save ( QStringList &  theListOfFiles)
bool SALOME_PYQT_ModuleLight::open ( QStringList  theListOfFiles)
QString SALOME_PYQT_ModuleLight::createObject ( const QString &  parent)
QString SALOME_PYQT_ModuleLight::createObject ( const QString &  name,
const QString &  iconname,
const QString &  tooltip,
const QString &  parent 
)
void SALOME_PYQT_ModuleLight::setName ( const QString &  obj,
const QString &  iconname 
)
void SALOME_PYQT_ModuleLight::setIcon ( const QString &  obj,
const QString &  name 
)
void SALOME_PYQT_ModuleLight::setToolTip ( const QString &  obj,
const QString &  name 
)
QString SALOME_PYQT_ModuleLight::getName ( const QString &  obj)
QString SALOME_PYQT_ModuleLight::getToolTip ( const QString &  obj)
void SALOME_PYQT_ModuleLight::removeObject ( const QString &  obj)
void SALOME_PYQT_ModuleLight::removeChild ( const QString &  obj)
QStringList SALOME_PYQT_ModuleLight::getChildren ( const QString &  obj,
const bool  rec 
)
bool SALOME_PYQT_ModuleLight::activateModule ( SUIT_Study theStudy) [virtual, slot]

This function is usually used in order to show the module's specific menus and toolbars, update actions state and perform other such actions required when the module is activated.

Note, that returning false in this function prevents the module activation.

Parameters:
theStudyparent study
Returns:
true if activation is successful and false otherwise

Reimplemented from LightApp_Module.

Reimplemented in SALOME_PYQT_Module.

References activateModuleInternal().

bool SALOME_PYQT_ModuleLight::deactivateModule ( SUIT_Study theStudy) [virtual, slot]

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

Parameters:
theStudyparent study
Returns:
true if deactivation is successful and false otherwise

Reimplemented from LightApp_Module.

References SALOME_PYQT_ModuleLight.XmlHandler.activateMenus(), PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), LightApp_Module.getApp(), myInterp, PyInterp.myStudy, myXmlHandler, preferenceChanged(), CAM_Module.setMenuShown(), and CAM_Module.setToolShown().

void SALOME_PYQT_ModuleLight::preferenceChanged ( const QString &  module,
const QString &  section,
const QString &  setting 
) [slot]

Process application preferences changing.

Called when any application setting is changed.

Parameters:
modulepreference module
sectionpreference resource file section
settingpreference resource name

Reimplemented in SALOME_PYQT_Module.

References PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), CAM_Module.moduleName(), and myInterp.

void SALOME_PYQT_ModuleLight::onGUIEvent ( ) [slot]
void SALOME_PYQT_ModuleLight::onActiveViewChanged ( SUIT_ViewWindow pview) [slot]
Parameters:
pviewview being activated

Reimplemented in SALOME_PYQT_Module.

References PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), and myInterp.

void SALOME_PYQT_ModuleLight::onViewTryClose ( SUIT_ViewWindow pview) [slot]
Parameters:
pviewview being closed

Reimplemented in SALOME_PYQT_Module.

References PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), and myInterp.

void SALOME_PYQT_ModuleLight::onViewClosed ( SUIT_ViewWindow pview) [slot]
Parameters:
pviewview being closed

Reimplemented in SALOME_PYQT_Module.

References PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), and myInterp.

void SALOME_PYQT_ModuleLight::onViewCloned ( SUIT_ViewWindow pview) [slot]
Parameters:
pviewview being cloned

Reimplemented in SALOME_PYQT_Module.

References PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), and myInterp.

CAM_DataModel * SALOME_PYQT_ModuleLight::createDataModel ( ) [protected, virtual]

Create new instance of data model and return it.

Reimplemented from LightApp_Module.

Reimplemented in SALOME_PYQT_Module.

bool SALOME_PYQT_ModuleLight::activateModuleInternal ( SUIT_Study theStudy) [protected, virtual]

The only goal of this function is to extract common functionality for LightApp_Module and SalomeApp_module classes requried by the specific architecture aspects of "light" / "full" SALOME modes.

See also:
activateModule()

References SALOME_PYQT_ModuleLight.XmlHandler.activateMenus(), PyInterp_Dispatcher.Exec(), PyInterp_Dispatcher.Get(), LightApp_Module.getApp(), lastActivationStatus(), myLastActivateStatus, PyInterp.myStudy, myXmlHandler, preferenceChanged(), CAM_Module.setMenuShown(), and CAM_Module.setToolShown().

void SALOME_PYQT_ModuleLight::init ( CAM_Application app) [private]

Performs the following actions:

  • initialize or get the Python interpreter (one per study)
  • import the Python module
  • pass the workspace widget to the Python module
  • call Python module's initialize() method
  • call Python module's windows() method
  • call Python module's views() method
Parameters:
appparent application object

References SUIT_Application.activeStudy(), PyInterp_Interp.GetLockWrapper(), SUIT_Study.id(), importModule(), initInterp(), myInitModule, myInterp, myModule, myViewMgrList, myWindowsMap, LightApp_Application.WT_LogWindow, LightApp_Application.WT_ObjectBrowser, and LightApp_Application.WT_PyConsole.

void SALOME_PYQT_ModuleLight::activate ( SUIT_Study theStudy) [private]

Performs the following actions:

  • initialize or get the Python interpreter (one per study)
  • import the Python GUI module
  • call Python module's activate() method
Parameters:
theStudyparent study object

References activeViewChanged(), SUIT_Desktop.activeWindow(), SUIT_Study.application(), connectView(), SUIT_Application.desktop(), PyInterp_Interp.GetLockWrapper(), SUIT_Study.id(), importModule(), initInterp(), myInterp, myLastActivateStatus, myModule, onActiveViewChanged(), and SUIT_Desktop.windows().

void SALOME_PYQT_ModuleLight::deactivate ( SUIT_Study theStudy) [private]

Performs the following actions:

Parameters:
theStudyparent study object

References SUIT_Study.application(), SUIT_Application.desktop(), myInterp, myModule, and onActiveViewChanged().

bool SALOME_PYQT_ModuleLight::lastActivationStatus ( ) const [private]
Returns:
status of last module activation operation
See also:
activateModule()

References myLastActivateStatus.

void SALOME_PYQT_ModuleLight::customize ( SUIT_Study theStudy) [private]

Performs the following actions:

  • get the Python interpreter (one per study)
  • import the Python GUI module
  • call Python module's setSettings() method (obsolete function, used for compatibility with old code)
Parameters:
theStudyparent study object

References PyInterp_Interp.GetLockWrapper(), SUIT_Study.id(), importModule(), initInterp(), IsCallOldMethods, myInterp, myModule, and setWorkSpace().

void SALOME_PYQT_ModuleLight::studyChanged ( SUIT_Study theStudy) [private]

Called when active the study is actived (user brings its desktop to top):

  • initialize or get the Python interpreter (one per study)
  • import the Python GUI module
  • call Python module's activeStudyChanged() method
Parameters:
theStudystudy being activated

References PyInterp_Interp.GetLockWrapper(), SUIT_Study.id(), importModule(), initInterp(), IsCallOldMethods, myInterp, myModule, and setWorkSpace().

void SALOME_PYQT_ModuleLight::contextMenu ( const QString &  theContext,
QMenu thePopupMenu 
) [private]

Performs the following actions:

  • calls Python module's definePopup(...) method (obsolete function, used for compatibility with old code) to define the popup menu context
  • parses XML resourses file (if exists) and fills the popup menu with the items)
  • calls Python module's customPopup(...) method (obsolete function, used for compatibility with old code) to allow module to customize the popup menu
  • for new modules calls createPopupMenu() function to allow the modules to build the popup menu by using insertItem(...) Qt functions.
Parameters:
theContextpopup menu context
thePopupMenupopup menu

References SALOME_PYQT_ModuleLight.XmlHandler.createPopup(), PyObjWrapper.get(), IsCallOldMethods, myInterp, myModule, and myXmlHandler.

void SALOME_PYQT_ModuleLight::guiEvent ( const int  theId) [private]

Performs the following actions:

  • calls Python module's OnGUIEvent() method
Parameters:
theIdGUI action ID

References myInterp, and myModule.

void SALOME_PYQT_ModuleLight::initPreferences ( ) [private]

Performs the following actions:

References myInitModule, myInterp, and myModule.

void SALOME_PYQT_ModuleLight::prefChanged ( const QString &  section,
const QString &  setting 
) [private]

Performs the following actions:

Parameters:
sectionsetting section name
settingsetting name

References myInterp, and myModule.

void SALOME_PYQT_ModuleLight::initInterp ( int  theStudyId) [private, virtual]
void SALOME_PYQT_ModuleLight::importModule ( ) [private]

Attention! initInterp() should be called first!!!

References PyInterp_Interp.GetLockWrapper(), myInterp, myModule, and CAM_Module.name().

void SALOME_PYQT_ModuleLight::setWorkSpace ( ) [private]

Calls setWorkSpace() method of the Pythohn module with PyQt QWidget object to use with interpreter.

Attention! initInterp() and importModule() should be called first!!!

References SUIT_Application.desktop(), PyObjWrapper.get(), LightApp_Module.getApp(), PyInterp_Interp.GetLockWrapper(), IsCallOldMethods, myInterp, myModule, STD_MDIDesktop.workspace(), and STD_TabDesktop.workstack().

void SALOME_PYQT_ModuleLight::activeViewChanged ( const SUIT_ViewWindow pview) [private]
Parameters:
pviewview being activated

References connectView(), SUIT_ViewWindow.getId(), myInterp, and myModule.

void SALOME_PYQT_ModuleLight::viewTryClose ( const SUIT_ViewWindow pview) [private]
Parameters:
pviewview user tries to close

References SUIT_ViewWindow.getId(), myInterp, and myModule.

void SALOME_PYQT_ModuleLight::viewClosed ( const SUIT_ViewWindow pview) [private]
Parameters:
pviewview being closed

References SUIT_ViewWindow.getId(), myInterp, and myModule.

void SALOME_PYQT_ModuleLight::viewCloned ( const SUIT_ViewWindow pview) [private]
Parameters:
pviewview being cloned

References SUIT_ViewWindow.getId(), myInterp, and myModule.

void SALOME_PYQT_ModuleLight::connectView ( const SUIT_ViewWindow pview) [private]
Parameters:
pviewview which is connected/disconnected

References SUIT_ViewWindow.getViewManager(), SUIT_ViewManager.getViewModel(), onViewCloned(), onViewClosed(), onViewTryClose(), and viewCloned().

void SALOME_PYQT_ModuleLight::saveEvent ( QStringList &  theListOfFiles) [private]

References myInterp, and myModule.

void SALOME_PYQT_ModuleLight::openEvent ( QStringList  theListOfFiles,
bool &  opened 
) [private]
SALOME_PYQT_DataObjectLight * SALOME_PYQT_ModuleLight::findObject ( const QString &  entry) [private]
LightApp_Application * LightApp_Module::getApp ( ) const [inherited]

Gets application.

Reimplemented in SalomeApp_Module.

References CAM_Module.application().

void LightApp_Module::update ( const int  theFlags) [virtual, inherited]
Parameters:
theFlags- update flags

Update viewer or/and object browser etc. in accordance with update flags ( see LightApp_UpdateFlags enumeration ). Derived modules can redefine this method for their own purposes

References CAM_Module.dataModel(), LightApp_Module.getApp(), LightApp_Application.objectBrowser(), UF_Controls, UF_Model, UF_ObjBrowser, UF_Viewer, LightApp_Module.updateControls(), and SUIT_DataBrowser.updateTree().

void LightApp_Module::updateObjBrowser ( bool  theIsUpdateDataModel = true,
SUIT_DataObject theDataObject = 0 
) [virtual, inherited]
void LightApp_Module::selectionChanged ( ) [virtual, inherited]

NOT IMPLEMENTED

LightApp_Displayer * LightApp_Module::displayer ( ) [virtual, inherited]

Must be redefined in order to use standard displayer mechanism

Returns:
displayer of module
LightApp_Selection * LightApp_Module::createSelection ( ) const [virtual, inherited]

Create and return instance of LightApp_Selection.

Reimplemented in SalomeApp_Module.

bool LightApp_Module::canCopy ( ) const [virtual, inherited]

virtual method

Returns:
true if module can copy the current selection
bool LightApp_Module::canPaste ( ) const [virtual, inherited]

virtual method

Returns:
true if module can paste previously copied data
void LightApp_Module::copy ( ) [virtual, inherited]

virtual method

void LightApp_Module::paste ( ) [virtual, inherited]

virtual method

bool LightApp_Module::renameAllowed ( const QString &  ) const [virtual, inherited]

Reimplemented in SalomeApp_Module.

bool LightApp_Module::renameObject ( const QString &  ,
const QString &   
) [virtual, inherited]

Rename object by entry.

Parameters:
entryentry of the object
namenew name of the object

Reimplemented in SalomeApp_Module.

void LightApp_Module::MenuItem ( ) [slot, inherited]

NOT IMPLEMENTED

void LightApp_Module::onModelSaved ( ) [protected, virtual, slot, inherited]

NOT IMPLEMENTED

void LightApp_Module::onModelOpened ( ) [protected, virtual, slot, inherited]

NOT IMPLEMENTED

void LightApp_Module::onModelClosed ( ) [protected, virtual, slot, inherited]

NOT IMPLEMENTED

void LightApp_Module::onOperationStopped ( SUIT_Operation ) [protected, virtual, slot, inherited]
Parameters:
theOp- stopped operation

Virtual protected slot called when operation stopped. Redefine this slot if you want to perform actions after stopping operation

void LightApp_Module::onOperationDestroyed ( ) [protected, virtual, slot, inherited]
Parameters:
theOp- destroyed operation

Virtual protected slot called when operation destroyed. Redefine this slot if you want to perform actions after destroying operation. Base implementation removes pointer on destroyed operation from the map of operations

References LightApp_Module.myOperations.

void LightApp_Module::onShowHide ( ) [protected, virtual, slot, inherited]

SLOT: called on activating of standard operations show/hide

References CAM_Module.actionId(), LightApp_Module.popupMgr(), and LightApp_Module.startOperation().

void LightApp_Module::onViewManagerAdded ( SUIT_ViewManager ) [protected, virtual, slot, inherited]

virtual SLOT: called on view manager adding

void LightApp_Module::onViewManagerRemoved ( SUIT_ViewManager ) [protected, virtual, slot, inherited]

virtual SLOT: called on view manager removing

QtxPopupMgr * LightApp_Module::popupMgr ( ) [protected, virtual, inherited]
LightApp_Preferences * LightApp_Module::preferences ( ) const [protected, inherited]
bool LightApp_Module::reusableOperation ( const int  id) [protected, virtual, inherited]

virtual method called to manage the same operations

void LightApp_Module::startOperation ( const int  id) [protected, inherited]

Module stores operations in map. This method starts operation by id. If operation isn't in map, then it will be created by createOperation method and will be inserted to map

Parameters:
id- identifier of operation to be started

Module stores operations in map. This method starts operation by id. If operation isn't in map, then it will be created by createOperation method and will be inserted to map

References CAM_Module.application(), LightApp_Module.createOperation(), LightApp_Module.myOperations, LightApp_Module.onOperationDestroyed(), LightApp_Module.onOperationStopped(), LightApp_Module.reusableOperation(), LightApp_Operation.setModule(), SUIT_Operation.setStudy(), and SUIT_Operation.start().

LightApp_Operation * LightApp_Module::createOperation ( const int  id) const [protected, virtual, inherited]

Create operation by its id. You must not call this method, it will be called automatically by startOperation. Please redefine this method in current module

Parameters:
id- identifier of operation to be started
Returns:
Pointer on created operation or NULL if operation is not created

Creates operation with given id. You should not call this method, it will be called automatically from startOperation. You may redefine this method in concrete module to create operations.

References LightApp_ShowHideOp.DISPLAY, LightApp_ShowHideOp.DISPLAY_ONLY, LightApp_ShowHideOp.ERASE, LightApp_ShowHideOp.ERASE_ALL, LightApp_Module.myDisplay, LightApp_Module.myDisplayOnly, LightApp_Module.myErase, and LightApp_Module.myEraseAll.

void LightApp_Module::updateControls ( ) [protected, virtual, inherited]

Updates (i.e. disable/enable) controls states (menus, tool bars etc.). This method is called from update( UF_Controls ). You may redefine it in concrete module.

bool LightApp_Module::isSelectionCompatible ( ) [protected, virtual, inherited]
LightApp_Operation * LightApp_Module::operation ( const int  id) const [protected, inherited]
Parameters:
id- operation id
Returns:
operation instance

References LightApp_Module.myOperations.

QString CAM_Module::name ( ) const [inherited]
Returns:
module name
See also:
setName(), moduleName(), setModuleName()
QString CAM_Module::moduleName ( ) const [inherited]
Returns:
module title
See also:
setModuleName(), name(), setName()

References CAM_Module.myName.

QPixmap CAM_Module::moduleIcon ( ) const [virtual, inherited]
QString CAM_Module::iconName ( ) const [virtual, inherited]

This function is used to get module icon's file name. Default implementation returns empty string.

Returns:
module icon's name.
See also:
moduleIcon()

References CAM_Module.application(), CAM_Application.moduleIcon(), and CAM_Module.name().

CAM_DataModel * CAM_Module::dataModel ( ) const [inherited]

Creates data model, if it is not yet created.

Returns:
data model pointer
See also:
createDataModel()

References CAM_Module.createDataModel(), CAM_DataModel.initialize(), and CAM_Module.myDataModel.

CAM_Application * CAM_Module::application ( ) const [inherited]
Returns:
application pointer

References CAM_Module.myApp.

void CAM_Module::updateCommandsStatus ( ) [virtual, inherited]
void CAM_Module::putInfo ( const QString &  msg,
const int  msec = -1 
) [virtual, inherited]

If msec > 0, the message will be shown msec milliseconds. If msec < 0, the message will be constantly displayed until module is active.

Parameters:
msgtext message
msecmessage displaying duration in milliseconds

References CAM_Module.application(), CAM_Module.myInfo, and SUIT_Application.putInfo().

bool CAM_Module::isActiveModule ( ) const [inherited]
Returns:
true if module is active.

References CAM_Application.activeModule(), and CAM_Module.application().

void CAM_Module::setMenuShown ( const bool  on) [virtual, inherited]
void CAM_Module::setMenuShown ( QAction a,
const bool  on 
) [inherited]
Parameters:
aaction
onif true, show menu item, otherwise, hide it

References CAM_Module.actionId(), CAM_Module.menuMgr(), and QtxActionMenuMgr.setShown().

void CAM_Module::setMenuShown ( const int  id,
const bool  on 
) [inherited]
Parameters:
idmenu item ID
onif true, show menu item, otherwise, hide it

References CAM_Module.action(), and CAM_Module.setMenuShown().

void CAM_Module::setToolShown ( const bool  on) [virtual, inherited]
void CAM_Module::setToolShown ( QAction a,
const bool  on 
) [inherited]
Parameters:
aaction
onif true, show toolbar item, otherwise, hide it

References CAM_Module.actionId(), QtxActionToolMgr.setShown(), and CAM_Module.toolMgr().

void CAM_Module::setToolShown ( const int  id,
const bool  on 
) [inherited]
Parameters:
idtoolbar item ID
onif true, show toolbar item, otherwise, hide it

References CAM_Module.action(), and CAM_Module.setToolShown().

void CAM_Module::connectToStudy ( CAM_Study camStudy) [virtual, slot, inherited]
void CAM_Module::studyClosed ( SUIT_Study study) [virtual, slot, inherited]

Removes data model from the study.

Parameters:
studystudy being closed

Reimplemented in SalomeApp_Module.

References CAM_DataModel.close(), CAM_Study.containsDataModel(), CAM_Module.dataModel(), and CAM_Study.removeDataModel().

void CAM_Module::studyChanged ( SUIT_Study ,
SUIT_Study  
) [virtual, slot, inherited]

Default implementation does nothing.

Parameters:
oldStudyold study
newStudynew study
void CAM_Module::onApplicationClosed ( SUIT_Application theApp) [virtual, slot, inherited]

Nullify application pointer if the application is being closed.

Parameters:
theAppapplication

References CAM_Module.myApp.

void CAM_Module::setName ( const QString &  name) [protected, inherited]
Parameters:
namenew module name
See also:
name(), moduleName(), setModuleName()
void CAM_Module::setModuleName ( const QString &  name) [protected, virtual, inherited]
Parameters:
namenew module title
See also:
moduleName(), name(), setName()

References CAM_Module.myName, and CAM_Module.name().

QtxActionMenuMgr * CAM_Module::menuMgr ( ) const [protected, inherited]
Returns:
menu manager pointer

References CAM_Module.application(), SUIT_Application.desktop(), and SUIT_Desktop.menuMgr().

QtxActionToolMgr * CAM_Module::toolMgr ( ) const [protected, inherited]
Returns:
toolbar manager pointer

References CAM_Module.application(), SUIT_Application.desktop(), and SUIT_Desktop.toolMgr().

int CAM_Module::registerAction ( const int  id,
QAction a 
) [protected, inherited]

If action has been already added previously, its ID is just returned. If id < 0, the action ID is generated automatically.

Parameters:
idaction required ID
aaction
Returns:
action ID

References test_table.a, CAM_Module.application(), SUIT_Application.desktop(), CAM_Module.menuMgr(), CAM_Module.myActionMap, QtxActionMgr.registerAction(), and CAM_Module.toolMgr().

bool CAM_Module::unregisterAction ( const int  id) [protected, inherited]
Parameters:
idaction ID
Returns:
true on success or false if action is in use

References CAM_Module.action().

bool CAM_Module::unregisterAction ( QAction a) [protected, inherited]
Parameters:
aaction
Returns:
true on success or false if action is in use

References CAM_Module.actionId(), QtxActionMgr.actionId(), CAM_Module.menuMgr(), CAM_Module.toolMgr(), and QtxActionMgr.unRegisterAction().

QAction * CAM_Module::createAction ( const int  id,
const QString &  text,
const QIcon &  icon,
const QString &  menu,
const QString &  tip,
const int  key,
QObject parent = 0,
const bool  toggle = false,
QObject reciever = 0,
const char *  member = 0,
const QString &  shortcutAction = QString() 
) [protected, inherited]

Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.

If id < 0, the action ID is generated automatically.

Parameters:
idrequired action ID
texttooltip text
iconaction icon
menumenu text
tipstatus bar tip
keykeyboard accelerator
parentparent object
toggleif true, the action will be toggled
recieveraction activation signal receiver object
memberaction activation signal receiver slot

References test_table.a, and CAM_Module.registerAction().


Friends And Related Function Documentation

friend class XmlHandler [friend]

Field Documentation

QMap<int, int> SALOME_PYQT_ModuleLight.myWindowsMap [private]
PyObject* SALOME_PYQT_ModuleLight.myModule [protected]
int LightApp_Module.myDisplay [protected, inherited]
int LightApp_Module.myErase [protected, inherited]
int LightApp_Module.myDisplayOnly [protected, inherited]
int LightApp_Module.myEraseAll [protected, inherited]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS