7 .. contents:: Table of Contents
9 In SALOME, each module can show introduction information and/or context help
10 in the **Help panel**. This panel is shown in the right dock area of the
13 .. figure:: ../images/help_panel.png
17 .. _hp_show_help_panel:
22 In order to show *Help panel*, the module must request it in the standard way, in
23 the ``windows()`` method, for example:
28 void GeometryGUI::windows(QMap<int, int>& map) const
30 map.insert(SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea);
31 map.insert(SalomeApp_Application::WT_InfoPanel, Qt::RightDockWidgetArea);
32 map.insert(SalomeApp_Application::WT_NoteBook, Qt::LeftDockWidgetArea);
33 map.insert(SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea);
36 .. note:: The dock area position flag is ignored for the *Help panel*.
38 .. _hp_module_description:
43 To display short annotation of the module in the desktop in the application's
44 *neutral point* (when there's no active module, see figure above),
45 add the ``<description>`` parameter to the main module's section in the configuration
46 file - ``LightApp.xml`` or ``SalomeApp.xml``, for example:
52 <section name="SMESH">
53 <parameter name="name" value="Mesh"/>
54 <parameter name="icon" value="ModuleMesh.png"/>
55 <parameter name="version" value="9.6.0"/>
56 <parameter name="description" value="Generate mesh from CAD model or import mesh"/>
60 Also, provide a translation of the module description to other languages in the
61 corresponding translation files (``*.ts``).
73 Help panel is implemented in SALOME GUI module, via the ``QtxInfoPanel`` class.
74 To obtain a reference to the Help panel, use method ``infoPanel()`` of the
75 ``LightApp_Application`` or ``SalomeApp_Application`` class:
79 #include <QtxInfoPanel.h>
81 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(application());
82 QtxInfoPanel* ip = app->infoPanel();
84 The class ``QtxInfoPanel`` provides several methods which can be used to manage
85 content of the *Help panel*. It is possible to add text labels and actions (these latter
86 are presented as buttons). The items can be arranged into the logical blocks - groups;
87 groups can contain other groups. All methods creating content items return unique
88 identifier which can be later used to change item's visibility, enable/disable it
89 (actions can be also enabled/disable directly), remove it or clear its contents
90 (for groups). Top level container has identifier ``-1``.
94 // Set panel's title (put empty string to hide title)
95 ip->setTitle("Welcome to my module");
98 int gb = ip->addGroup("General features");
100 // Add action to the group box
101 QAction* action = new QAction("My feature");
102 int id1 = ip->addAction(action, gb);
104 // Add informative label to the group box
105 int id2 = ip->addLabel("My cool feature", gb);
107 // Add another label, right-aligned, to the top-level container
108 int id3 = ip->addLabel("Some information", Qt::AlignRight);
110 // Change visibility of given item
111 ip->setVisible(id3, false);
113 // Enable/disable given item
114 ip->setEnabled(gb, false);
119 // Remove all content of group
130 For Python modules, *Help panel* can be accessed via the ``SalomePyQt`` Python module.
132 .. code-block:: python
134 from PyQt5 import Qt as Q
135 from SalomePyQt import SalomePyQt as sg
137 # Set panel's title (put empty string to hide title)
138 sg.infoSetTitle("Welcome to my module")
141 gb = sg.infoAddGroup("General features")
143 # Add action to the group box
144 action = Q.QAction("My feature")
145 id1 = sg.infoAddAction(action, gb)
147 # Add informative label to the group box
148 id2 = sg.infoAddLabel("My cool feature", gb)
150 # Add another label, right-aligned, to the top-level container
151 # Note: -1 is used explicitly as group identifier
152 id3 = sg.infoAddLabel("Some information", Q.Qt.AlignRight, -1)
154 # Change visibility of given item
155 sg.infoSetVisible(id3, False)
157 # Enable/disable given item
158 sg.infoSetEnabled(gb, False)
163 # Remove all content of group
174 Each time when *Help panel* is shown, currently active module is informed via
175 the virtual method ``updateInfoPanel()``. This method can be used to properly
176 update the contents of the *Help panel*, depending on the current context.