The src contains all source files required to build and install CORBA engine and (optionally) GUI of the module. Each of these entities usually has (but this is not actually obligatory) its own directory.
The CMakeLists.txt
file triggers the path of sub-directories described by the ADD_SUBDIRECTORY() command.
This directory contains the Python files that implement the engine of the module. The CMakeLists.txt
defines the rules used to install these files to the destination folder. The name of the module engine Python file is predefined and should be set as <MODULE>.py where <MODULE> is a name of the module. In the case of the PYHELLO module, the name of the engine Python script should be PYHELLO.so.
The PYHELLO.py
Python script implements PYHELLO class that is derived from the PYHELLO_Gen interface of the PYHELLO_ORB__POA CORBA module, the SALOME_ComponentPy_i class (base implementation of SALOME Python module engine exported by the KERNEL module) and SALOME_DriverPy_i class that provides base implementation of persistence mechanism.
In particular, PYHELLO class implements makeBanner() function that is defined in the IDL interface PYHELLO_ORB::PYHELLO_Gen.
Other services defined in PYHELLO_Gen CORBA interface also should be implemented by this class.
This directory contains the Python files that implement the GUI of PYHELLO module. The name of the module GUI Python script is predefined and should be set as <MODULE>GUI.py where <MODULE> is a name of the module. In the case of the PYHELLO module, the name of the GUI Python script should be PYHELLOGUI.py.
The implementation of GUI of the PYHELLO module should be done according to the architecture and rules specified by the SALOME GUI module. The PYHELLO.py script should implement a set of the functions which define the module behavior in GUI, for example, create menus, toolbars, define context popup menus, objects selection behavior, implement dialog boxes etc.
Here below is a short description of these methods. For more details please refer to the SALOME GUI module documentation.
Note, that some of these methods are optional and need not be obligatory implemented because SalomePyQtGUI_Module class provides a base implementation of these functions. It's sometimes enough to implement only some of them, depending on the module needs.
In the case of PYHELLO module, some of these functions are implemented to provide a sample for the development:
Please refer to PYHELLOGUI.py script for more details about implementation of other callback functions.
An implemention of the ShowHello() function is quite simple. It shows the small dialog box allowing user to enter the name, and then uses reference to the module CORBA engine to invoke its makeBanner() service.
Note, that GUI elements of the Python module are implemented with help of PyQt toolkit which provides a Python wrappings of the Qt library.