The first thing to do is to give a name to the whole set of your classes. This name will be the name of your component in salome in addition of pre-existing salome components (like GEOM, SMESH, VISU, ...). In python gui provided with xdata, it will be the same. In fact, in python gui, you usually have only one component so its name is less important because if you have only one component, it is activated by default, but you can imagine to have more that one, and in that case, the behaviour will be exactly the same as in salome.
For instance, if you want to create a component named AAA
,
the only thing to do to accomplish that is to create a
AAA_xdata.py
file in your sources.
For obscure reasons (in salome), the name must be uppercase ...
Now, you have to indicate what are the classes, actions and so on
contained in your component. To do that, you have to imagine your
component as a graphical one and in your _xdata
file, you
just describe the menus you want to appear in the menu bar of the
application.
For instance, the TECHOBJ_xdata.py
boostrap file present
in the TECHOBJ
template is the following :
# -- # Copyright (C) CEA, EDF # Author : Erwan ADAM (CEA) # -- __xdata__items__ = [ "tefile", "geometry", "salomeref", "material", "technologyobject", "menuxtypes", "hydraulicmodule", ] __comment__ = "Techobj template from xdata (not the real techobj !)"
The __xdata__items__
keyword indicates the menus that you
want to be present in the main menubar. A little subtility is that
you can insert your own menus into pre-existing menus (like File
or Help
for instance), to do that you have to add a 'file'
or 'help'
line into the __xdata__items__
. The second solution
is to add 'myfile'
in __xdata__items__
and declare
__xdata__name__ = 'File'
into 'myfile.py'
. The
__xdata__name__
keyword will be explained later.
Now let see how the process run, in short how the __xdata__items__
list is treaten.