The C++ GUI is very similar to the python GUI except that the cppcomposGUI.h file is processed by the moc and the demo.ui
is processed by the uic qt tool.
-By default, a Makefile.am and a SalomeApp.xml files are generated but you can put your own Makefile.am or SalomeApp.xml
+By default, a CMakeLists.txt and a SalomeApp.xml files are generated but you can put your own CMakeLists.txt or SalomeApp.xml
in the list to override this default.
Add an online documentation
(name with extension .rst) in the reStructured format (see http://docutils.sourceforge.net/) and image files (\*.png, ...).
The main file must be named index.rst.
-By default, a sphinx configuration file conf.py and a Makefile.am are generated but you can put your own Makefile.am or conf.py
+By default, a sphinx configuration file conf.py and a CMakeLists.txt are generated but you can put your own CMakeLists.txt or conf.py
in the list to override this default.
Here is an excerpt from pygui1 example that shows how to add a documentation to a module::
compodefs=r"""
class A:
- def createObject( self, study, name ):
+ def createObject( self, name ):
"Create object. "
- builder = study.NewBuilder()
- father = study.FindComponent( "pycompos" )
+ builder = salome.myStudy.NewBuilder()
+ father = salome.myStudy.FindComponent( "pycompos" )
if father is None:
father = builder.NewComponent( "pycompos" )
attr = builder.FindOrCreateAttribute( father, "AttributeName" )
Here is an excerpt from cppgui1 example that shows how to redefine the DumpPython method in a C++ component::
compomethods=r"""
- Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean isPublished,
+ Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
CORBA::Boolean& isValidScript)
{
- SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
- if(CORBA::is_nil(aStudy))
- return new Engines::TMPFile(0);
- SALOMEDS::SObject_var aSO = aStudy->FindComponent("cppcompos");
+ SALOMEDS::SObject_var aSO = KERNEL::getStudy()->FindComponent("cppcompos");
if(CORBA::is_nil(aSO))
return new Engines::TMPFile(0);
std::string Script = "import cppcompos_ORB\n";
Script += "import salome\n";
Script += "compo = salome.lcc.FindOrLoadComponent('FactoryServer','cppcompos')\n";
- Script += "def RebuildData(theStudy):\n";
- Script += " compo.SetCurrentStudy(theStudy)\n";
const char* aScript=Script.c_str();
char* aBuffer = new char[strlen(aScript)+1];
strcpy(aBuffer, aScript);
SALOME_DriverPy.SALOME_DriverPy_i.__init__(self,"pycompos")
return
- def createObject( self, study, name ):
+ def createObject( self, name ):
"Create object. "
- builder = study.NewBuilder()
- father = study.FindComponent( "pycompos" )
+ builder = salome.myStudy.NewBuilder()
+ father = salome.myStudy.FindComponent( "pycompos" )
if father is None:
father = builder.NewComponent( "pycompos" )
attr = builder.FindOrCreateAttribute( father, "AttributeName" )
interface Idl_A : SALOMEDS::Driver
{
- void createObject(in SALOMEDS::Study theStudy, in string name) raises (SALOME::SALOME_Exception);
+ void createObject(in string name) raises (SALOME::SALOME_Exception);
};
In this simple case, it is also possible to include directly the content of the file with the *interfacedefs* parameter.