These documents provide guidelines and best practices explaining different aspects
and usage examples of SALOME platform.
-* :ref:`use_case_builder`:
-* :ref:`drag_and_drop`
-* :ref:`using_pluginsmanager`
-
-
.. toctree::
use_case_builder.rst
drag_and_drop.rst
using_pluginsmanager.rst
+ using_help_panel.rst
--- /dev/null
+.. _using_help_panel:
+
+****************
+Using Help Panel
+****************
+
+.. contents:: Table of Contents
+
+In SALOME, each module can show introduction information and/or context help
+in the **Help panel**. This panel is shown in the right dock area of the
+SALOME GUI desktop.
+
+.. figure:: ../images/help_panel.png
+ :align: center
+ :alt: Help panel
+
+.. _hp_show_help_panel:
+
+Show help panel
+===============
+
+In order to show *Help panel*, the module must request it in the standard way, in
+the ``windows()`` method, for example:
+
+.. code-block:: c++
+ :emphasize-lines: 4
+
+ void GeometryGUI::windows(QMap<int, int>& map) const
+ {
+ map.insert(SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea);
+ map.insert(SalomeApp_Application::WT_InfoPanel, Qt::RightDockWidgetArea);
+ map.insert(SalomeApp_Application::WT_NoteBook, Qt::LeftDockWidgetArea);
+ map.insert(SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea);
+ }
+
+.. note:: The dock area position flag is ignored for the *Help panel*.
+
+.. _hp_module_description:
+
+Module description
+==================
+
+To display short annotation of the module in the desktop in the application's
+*neutral point* (when there's no active module, see figure above),
+add the ``<description>`` parameter to the main module's section in the configuration
+file - ``LightApp.xml`` or ``SalomeApp.xml``, for example:
+
+.. code-block:: xml
+ :emphasize-lines: 6
+
+ <document>
+ <section name="SMESH">
+ <parameter name="name" value="Mesh"/>
+ <parameter name="icon" value="ModuleMesh.png"/>
+ <parameter name="version" value="9.6.0"/>
+ <parameter name="description" value="Generate mesh from CAD model or import mesh"/>
+ </section>
+ </document>
+
+Also, provide a translation of the module description to other languages in the
+corresponding translation files (``*.ts``).
+
+.. _hp_api:
+
+API of Help panel
+=================
+
+.. _hp_api_cpp:
+
+C++
+---
+
+Help panel is implemented in SALOME GUI module, via the ``QtxInfoPanel`` class.
+To obtain a reference to the Help panel, use method ``infoPanel()`` of the
+``LightApp_Application`` or ``SalomeApp_Application`` class:
+
+.. code-block:: c++
+
+ #include <QtxInfoPanel.h>
+ ...
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(application());
+ QtxInfoPanel* ip = app->infoPanel();
+
+The class ``QtxInfoPanel`` provides several methods which can be used to manage
+content of the *Help panel*. It is possible to add text labels and actions (these latter
+are presented as buttons). The items can be arranged into the logical blocks - groups;
+groups can contain other groups. All methods creating content items return unique
+identifier which can be later used to change item's visibility, enable/disable it
+(actions can be also enabled/disable directly), remove it or clear its contents
+(for groups). Top level container has identifier ``-1``.
+
+.. code-block:: c++
+
+ // Set panel's title (put empty string to hide title)
+ ip->setTitle("Welcome to my module");
+
+ // Create group box
+ int gb = ip->addGroup("General features");
+
+ // Add action to the group box
+ QAction* action = new QAction("My feature");
+ int id1 = ip->addAction(action, gb);
+
+ // Add informative label to the group box
+ int id2 = ip->addLabel("My cool feature", gb);
+
+ // Add another label, right-aligned, to the top-level container
+ int id3 = ip->addLabel("Some information", Qt::AlignRight);
+
+ // Change visibility of given item
+ ip->setVisible(id3, false);
+
+ // Enable/disable given item
+ ip->setEnabled(gb, false);
+
+ // Remove given item
+ ip->remove(id1);
+
+ // Remove all content of group
+ ip->clear(gb);
+
+ // Clear Help panel
+ ip->clear();
+
+.. _hp_api_python:
+
+Python
+------
+
+For Python modules, *Help panel* can be accessed via the ``SalomePyQt`` Python module.
+
+.. code-block:: python
+
+ from PyQt5 import Qt as Q
+ from SalomePyQt import SalomePyQt as sg
+
+ # Set panel's title (put empty string to hide title)
+ sg.infoSetTitle("Welcome to my module")
+
+ # Create group box
+ gb = sg.infoAddGroup("General features")
+
+ # Add action to the group box
+ action = Q.QAction("My feature")
+ id1 = sg.infoAddAction(action, gb)
+
+ # Add informative label to the group box
+ id2 = sg.infoAddLabel("My cool feature", gb)
+
+ # Add another label, right-aligned, to the top-level container
+ # Note: -1 is used explicitly as group identifier
+ id3 = sg.infoAddLabel("Some information", Q.Qt.AlignRight, -1)
+
+ # Change visibility of given item
+ sg.infoSetVisible(id3, False)
+
+ # Enable/disable given item
+ sg.infoSetEnabled(gb, False)
+
+ # Remove given item
+ sg.infoRemove(id1)
+
+ # Remove all content of group
+ sg.infoClear(gb)
+
+ # Clear Help panel
+ sg.infoClear()
+
+.. _hp_update_panel
+
+Notifications
+=============
+
+Each time when *Help panel* is shown, currently active module is informed via
+the virtual method ``updateInfoPanel()``. This method can be used to properly
+update the contents of the *Help panel*, depending on the current context.
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = NO
+REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = NO
/*!
\brief Get module icon name.
- \param name module name
+ \param name module name or title
\return module icon or null QString if module is not found
*/
QString CAM_Application::moduleIcon( const QString& name )
QString res;
for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isNull(); ++it )
{
- if ( (*it).name == name )
+ if ( (*it).name == name || (*it).title == name )
res = (*it).icon;
}
return res;
}
+/*!
+ \brief Get module description.
+ \param name module name or title
+ \return module description or null QString if description is not provided in config file.
+*/
+QString CAM_Application::moduleDescription( const QString& name )
+{
+ QString res;
+ for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isNull(); ++it )
+ {
+ if ( (*it).name == name || (*it).title == name )
+ res = tr((*it).description.toUtf8());
+ }
+ return res;
+}
+
/*!
\brief Get module library name by its title (user name).
- \param title module title (user name)
+ \param title module name or title
\param full if \c true, return full library name, otherwise return its internal name
\return module library name or null QString if module is not found
*/
-QString CAM_Application::moduleLibrary( const QString& title, const bool full )
+QString CAM_Application::moduleLibrary( const QString& name, const bool full )
{
QString res;
for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
{
- if ( (*it).title == title )
+ if ( (*it).name == name || (*it).title == name )
res = (*it).library;
}
if ( !res.isEmpty() && full )
QString modIcon = resMgr->stringValue( *it, "icon", QString() );
+ QString modDescription = resMgr->stringValue( *it, "description", QString() );
+
QString modLibrary = resMgr->stringValue( *it, "library", QString() ).trimmed();
if ( !modLibrary.isEmpty() )
{
inf.status = hasGui ? stUnknown : stNoGui;
if ( hasGui ) inf.library = modLibrary;
inf.icon = modIcon;
+ inf.description = modDescription;
inf.version = version;
myInfoList.append( inf );
}
static QString moduleName( const QString& );
static QString moduleTitle( const QString& );
static QString moduleIcon( const QString& );
+ static QString moduleDescription( const QString& );
static QString moduleLibrary( const QString&, const bool = true );
virtual void createEmptyStudy();
private:
enum { stUnknown = 0, stNoGui, stInaccessible, stReady };
typedef struct {
- QString name, title, icon, library, version;
+ QString name, title, icon, library, version, description;
int status;
} ModuleInfo;
typedef QList<ModuleInfo> ModuleInfoList;
#include <QtxFontEdit.h>
#include <QtxToolBar.h>
#include <QtxTreeView.h>
+#include <QtxInfoPanel.h>
#include <QtxMRUAction.h>
#include <QtxDockAction.h>
#include <QtxDockWidget.h>
saveDockWindowsState();
+ if ( infoPanel() )
+ infoPanel()->clear();
+
bool status = CAM_Application::activateModule( modName );
updateModuleActions();
QString url = resMgr->stringValue("GUI", "site_url");
if ( !url.isEmpty() ) {
QString title = tr ( "SALOME_SITE" );
- QAction* as = createAction( id, title,
+ QAction* as = createAction( WebSiteId, title,
resMgr->loadPixmap( "LightApp", tr( "ICON_WWW" ), false ),
title, title,
0, desk, false, this, SLOT( onHelpContentsModule() ) );
as->setData( url );
createMenu( as, helpMenu, -1, 0 );
- id++;
}
// b) Link to Forum
url = resMgr->stringValue("GUI", "forum_url");
if ( !url.isEmpty() ) {
QString title = tr ( "SALOME_FORUM" );
- QAction* af = createAction( helpMenu, title,
+ QAction* af = createAction( ForumId, title,
resMgr->loadPixmap( "LightApp", tr( "ICON_WWW" ), false ),
title, title,
0, desk, false, this, SLOT( onHelpContentsModule() ) );
af->setData( url );
createMenu( af, helpMenu, -1, 0 );
- id++;
}
// c) Link to YouTube channel
if ( !url.isEmpty() ) {
createMenu( separator(), helpMenu, -1, 0 );
QString title = tr ( "SALOME_VIDEO_TUTORIALS" );
- QAction* av = createAction( helpMenu, title,
+ QAction* av = createAction( VideosId, title,
resMgr->loadPixmap( "LightApp", tr( "ICON_LIFE_RIGN" ), false ),
- title, title,
+ title, tr( "PRP_SALOME_VIDEO_TUTORIALS" ),
0, desk, false, this, SLOT( onHelpContentsModule() ) );
av->setData( url );
createMenu( av, helpMenu, -1, 0 );
- id++;
}
- // d) Help for modules
+ // d) Link to Tutorials
+
+ url = resMgr->stringValue("GUI", "tutorials_url");
+ if ( !url.isEmpty() ) {
+ QString title = tr ( "SALOME_TUTORIALS" );
+ QAction* as = createAction( TutorialsId, title,
+ resMgr->loadPixmap( "LightApp", tr( "ICON_WWW" ), false ),
+ title, tr( "PRP_SALOME_TUTORIALS" ),
+ 0, desk, false, this, SLOT( onHelpContentsModule() ) );
+ as->setData( url );
+ createMenu( as, helpMenu, -1, 0 );
+ }
+
+ // e) Help for modules
// - First create top-level menus to preserve correct order
QString userGuide = "User's Guide";
myWin.insert( id, wid );
QtxDockWidget* dock = new QtxDockWidget( true, desktop() );
+ if ( id == WT_InfoPanel ) {
+ // Info panel's position is strongly limited to the right area;
+ // It is not movable and not floatable.
+ dock->setAllowedAreas( Qt::RightDockWidgetArea );
+ dock->setFeatures( QDockWidget::DockWidgetClosable );
+ connect( dock, SIGNAL( aboutToShow()), this, SLOT( onInfoPanelShown() ) );
+ }
+ else {
+ dock->setFeatures( QDockWidget::AllDockWidgetFeatures );
+ }
connect( dock, SIGNAL( destroyed( QObject* ) ), this, SLOT( onWCDestroyed( QObject* ) ) );
- dock->setFeatures( QDockWidget::AllDockWidgetFeatures );
dock->setObjectName( wid->objectName().isEmpty() ? QString( "window_%1" ).arg( id ) :
QString( "%1Dock" ).arg( wid->objectName() ) );
dock->setWidget( wid );
return qobject_cast<SUIT_DataBrowser*>( dockWindow( WT_ObjectBrowser ) );
}
+QtxInfoPanel* LightApp_Application::infoPanel()
+{
+ return qobject_cast<QtxInfoPanel *>( dockWindow( WT_InfoPanel ));
+}
+
/*!
\return Log Window
*/
}
getWindow( WT_ObjectBrowser );
+ getWindow( WT_InfoPanel );
loadDockWindowsState();
}
getWindow( WT_ObjectBrowser );
+ getWindow( WT_InfoPanel );
loadDockWindowsState();
wid = ob;
ob->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
}
+ else if ( flag == WT_InfoPanel)
+ {
+ QtxInfoPanel* ipanel = new QtxInfoPanel( desktop() );
+ ipanel->setObjectName( "infoPanel" );
+ ipanel->setWindowTitle( tr( "INFO_PANEL" ) );
+ wid = ipanel;
+ }
#ifndef DISABLE_PYCONSOLE
else if ( flag == WT_PyConsole )
{
#endif
if ( activeStudy() ) {
aMap.insert( WT_ObjectBrowser, Qt::LeftDockWidgetArea );
+ aMap.insert( WT_InfoPanel, Qt::RightDockWidgetArea );
// aMap.insert( WT_LogWindow, Qt::DockBottom );
}
}
}
loadDockWindowsState();
+
+ if ( !activeModule() && infoPanel() )
+ {
+ infoPanel()->clear();
+ infoPanel()->setTitle( tr( "INFO_WELCOME_TO_SALOME" ) );
+
+ int grp = infoPanel()->addGroup( tr( "INFO_GETTING_STARTED" ) );
+ infoPanel()->addAction( action( FileNewId ), grp );
+ infoPanel()->addLabel( action( FileNewId )->statusTip(), grp );
+ infoPanel()->addAction( action( FileOpenId ), grp );
+ infoPanel()->addLabel( action( FileOpenId )->statusTip(), grp );
+ infoPanel()->addAction( action( TutorialsId ), grp );
+ infoPanel()->addLabel( action( TutorialsId )->statusTip(), grp );
+ infoPanel()->addAction( action( VideosId ), grp );
+ infoPanel()->addLabel( action( VideosId )->statusTip(), grp );
+
+ LightApp_ModuleAction* ma = qobject_cast<LightApp_ModuleAction*>(action(ModulesListId));
+ if ( ma && ma->count() > 0 )
+ {
+ grp = infoPanel()->addGroup( tr( "INFO_AVAILABLE_MODULES" ) );
+ foreach ( QString mname, ma->modules() )
+ {
+ infoPanel()->addAction( ma->moduleAction( mname ), grp );
+ if ( !moduleDescription( mname ).isEmpty() )
+ infoPanel()->addLabel( moduleDescription( mname ), grp );
+ }
+ }
+ }
}
/*!
}
}
+void LightApp_Application::onInfoPanelShown()
+{
+ if ( activeModule() && activeModule()->inherits( "LightApp_Module" ) )
+ ((LightApp_Module*)activeModule())->updateInfoPanel();
+}
+
/*!
Internal method.
Returns all top level toolbars.
#include <QStringList>
class LogWindow;
+class QtxInfoPanel;
#ifndef DISABLE_PYCONSOLE
class PyConsole_Console;
class PyConsole_Interp;
public:
typedef enum { WT_ObjectBrowser,
+ WT_InfoPanel,
#ifndef DISABLE_PYCONSOLE
WT_PyConsole,
#endif
PreferencesId, MRUId, ModulesListId,
NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId,
NewQxSceneViewId, NewGraphicsViewId, NewPVViewId, NewPyViewerId, StyleId, FullScreenId,
+ WebSiteId, ForumId, VideosId, TutorialsId,
UserID };
protected:
LogWindow* logWindow();
SUIT_DataBrowser* objectBrowser();
+ QtxInfoPanel* infoPanel();
#ifndef DISABLE_PYCONSOLE
PyConsole_Console* pythonConsole(const bool force = false);
#endif
virtual void onDesktopMessage( const QString& );
+ virtual void onInfoPanelShown();
+
private slots:
void onSelection();
void onRefresh();
{
}
+/*!NOT IMPLEMENTED*/
+void LightApp_Module::updateInfoPanel()
+{
+}
+
/*!NOT IMPLEMENTED*/
void LightApp_Module::createPreferences()
{
void MenuItem();
+ virtual void updateInfoPanel();
+
protected slots:
virtual void onModelSaved();
virtual void onModelOpened();
{
}
+/*!
+ \brief Get number of registered modules.
+ \return modules count
+*/
+int LightApp_ModuleAction::count() const
+{
+ return modules().count();
+}
+
/*!
\brief Get list of modules.
\return modules names list
update();
}
+/*!
+ \brief Get module action.
+ \param name module name
+*/
+QAction* LightApp_ModuleAction::moduleAction( const QString& name ) const
+{
+ return mySet->moduleAction( name );
+}
+
/*!
\brief Add module into the list.
\param name module name
LightApp_ModuleAction( const QString&, const QIcon&, QObject* = 0 );
virtual ~LightApp_ModuleAction();
+ int count() const;
QStringList modules() const;
QIcon moduleIcon( const QString& ) const;
void setModuleIcon( const QString&, const QIcon& );
+ QAction* moduleAction( const QString& ) const;
+
void insertModule( const QString&, const QIcon&, const int = -1 );
void removeModule( const QString& );
<section name="GUI" >
<parameter name="documentation" value="gui_help"/>
<parameter name="site_url" value="http://www.salome-platform.org"/>
+ <parameter name="tutorials_url" value="https://www.salome-platform.org/user-section/salome-tutorials"/>
<parameter name="forum_url" value="http://www.salome-platform.org/forum"/>
<parameter name="channel_url" value="https://www.youtube.com/playlist?list=PLgvBxFyGVRbZZz4wVvP36xXQL-S81RZsc&disable_polymer=true"/>
</section>
<parameter name="Developer resources" value="${DOCUMENTATION_ROOT_DIR}/index.html;;http://docs.salome-platform.org/latest/index.html" />
</section>
<section name="windows_geometry">
- <parameter name="nomodule" value="#00 #00 #00 #FF #00 #00 #00 #00 #FD #00 #00 #00 #02 #00 #00 #00 #00 #00 #00 #01 #00 #00 #00 #02 #8D #FC #02 #00 #00 #00 #01 #FB #00 #00 #00 #22 #00 #6F #00 #62 #00 #6A #00 #65 #00 #63 #00 #74 #00 #42 #00 #72 #00 #6F #00 #77 #00 #73 #00 #65 #00 #72 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #37 #00 #00 #02 #8D #00 #00 #00 #53 #00 #FF #FF #FF #00 #00 #00 #03 #00 #00 #05 #40 #00 #00 #00 #53 #FC #01 #00 #00 #00 #01 #FB #00 #00 #00 #22 #00 #70 #00 #79 #00 #74 #00 #68 #00 #6F #00 #6E #00 #43 #00 #6F #00 #6E #00 #73 #00 #6F #00 #6C #00 #65 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #00 #00 #00 #05 #40 #00 #00 #00 #46 #00 #FF #FF #FF #00 #00 #04 #38 #00 #00 #02 #8D #00 #00 #00 #04 #00 #00 #00 #04 #00 #00 #00 #08 #00 #00 #00 #08 #FC #00 #00 #00 #01 #00 #00 #00 #02 #00 #00 #00 #02 #00 #00 #00 #1C #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #00 #00 #00 #00 #FF #FF #FF #FF #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #1A #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #CE #FF #FF #FF #FF #00 #00 #00 #00 #00 #00 #00 #00" />
- <parameter name="" value="#00 #00 #00 #FF #00 #00 #00 #00 #FD #00 #00 #00 #02 #00 #00 #00 #00 #00 #00 #01 #00 #00 #00 #02 #8D #FC #02 #00 #00 #00 #01 #FB #00 #00 #00 #22 #00 #6F #00 #62 #00 #6A #00 #65 #00 #63 #00 #74 #00 #42 #00 #72 #00 #6F #00 #77 #00 #73 #00 #65 #00 #72 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #37 #00 #00 #02 #8D #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #03 #00 #00 #05 #40 #00 #00 #00 #74 #FC #01 #00 #00 #00 #01 #FB #00 #00 #00 #22 #00 #70 #00 #79 #00 #74 #00 #68 #00 #6F #00 #6E #00 #43 #00 #6F #00 #6E #00 #73 #00 #6F #00 #6C #00 #65 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #00 #00 #00 #05 #40 #00 #00 #00 #46 #00 #FF #FF #FF #00 #00 #05 #40 #00 #00 #02 #6C #00 #00 #00 #04 #00 #00 #00 #04 #00 #00 #00 #08 #00 #00 #00 #08 #FC #00 #00 #00 #01 #00 #00 #00 #02 #00 #00 #00 #02 #00 #00 #00 #1C #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #00 #00 #00 #00 #FF #FF #FF #FF #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #1A #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #CE #FF #FF #FF #FF #00 #00 #00 #00 #00 #00 #00 #00" />
+ <parameter name="nomodule" value="#00 #00 #00 #FF #00 #00 #00 #00 #FD #00 #00 #00 #03 #00 #00 #00 #00 #00 #00 #01 #00 #00 #00 #02 #62 #FC #02 #00 #00 #00 #01 #FB #00 #00 #00 #22 #00 #6F #00 #62 #00 #6A #00 #65 #00 #63 #00 #74 #00 #42 #00 #72 #00 #6F #00 #77 #00 #73 #00 #65 #00 #72 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #3B #00 #00 #02 #62 #00 #00 #00 #59 #00 #FF #FF #FF #00 #00 #00 #01 #00 #00 #00 #DC #00 #00 #02 #62 #FC #02 #00 #00 #00 #01 #FB #00 #00 #00 #1A #00 #69 #00 #6E #00 #66 #00 #6F #00 #50 #00 #61 #00 #6E #00 #65 #00 #6C #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #3B #00 #00 #02 #62 #00 #00 #02 #62 #00 #FF #FF #FF #00 #00 #00 #03 #00 #00 #04 #C3 #00 #00 #00 #59 #FC #01 #00 #00 #00 #01 #FB #00 #00 #00 #22 #00 #70 #00 #79 #00 #74 #00 #68 #00 #6F #00 #6E #00 #43 #00 #6F #00 #6E #00 #73 #00 #6F #00 #6C #00 #65 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #00 #00 #00 #04 #C3 #00 #00 #00 #46 #00 #FF #FF #FF #00 #00 #02 #DB #00 #00 #02 #62 #00 #00 #00 #04 #00 #00 #00 #04 #00 #00 #00 #08 #00 #00 #00 #08 #FC #00 #00 #00 #01 #00 #00 #00 #02 #00 #00 #00 #03 #00 #00 #00 #1C #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #00 #00 #00 #00 #FF #FF #FF #FF #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #1A #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #BC #FF #FF #FF #FF #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #0E #00 #50 #00 #6C #00 #75 #00 #67 #00 #69 #00 #6E #00 #73 #00 #00 #00 #00 #22 #FF #FF #FF #FF #00 #00 #00 #00 #00 #00 #00 #00"/>
+ <parameter name="" value="#00 #00 #00 #FF #00 #00 #00 #00 #FD #00 #00 #00 #02 #00 #00 #00 #00 #00 #00 #01 #00 #00 #00 #02 #8D #FC #02 #00 #00 #00 #01 #FB #00 #00 #00 #22 #00 #6F #00 #62 #00 #6A #00 #65 #00 #63 #00 #74 #00 #42 #00 #72 #00 #6F #00 #77 #00 #73 #00 #65 #00 #72 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #37 #00 #00 #02 #8D #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #03 #00 #00 #04 #C3 #00 #00 #00 #74 #FC #01 #00 #00 #00 #01 #FB #00 #00 #00 #22 #00 #70 #00 #79 #00 #74 #00 #68 #00 #6F #00 #6E #00 #43 #00 #6F #00 #6E #00 #73 #00 #6F #00 #6C #00 #65 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #00 #00 #00 #04 #C3 #00 #00 #00 #46 #00 #FF #FF #FF #00 #00 #04 #C3 #00 #00 #02 #5E #00 #00 #00 #04 #00 #00 #00 #04 #00 #00 #00 #08 #00 #00 #00 #08 #FC #00 #00 #00 #01 #00 #00 #00 #02 #00 #00 #00 #03 #00 #00 #00 #1C #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #00 #00 #00 #00 #FF #FF #FF #FF #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #1A #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #11 #FF #FF #FF #FF #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #00 #0E #00 #50 #00 #6C #00 #75 #00 #67 #00 #69 #00 #6E #00 #73 #01 #00 #00 #00 #22 #FF #FF #FF #FF #00 #00 #00 #00 #00 #00 #00 #00"/>
</section>
<section name="windows_visibility">
- <parameter name="nomodule" value="#00 #00 #00 #00 #04 #00 #00 #00 #0E #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #1A #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #1C #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #00 #00 #00 #10 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #01 #00 #00 #00 #05 #00 #00 #00 #22 #00 #6F #00 #62 #00 #6A #00 #65 #00 #63 #00 #74 #00 #42 #00 #72 #00 #6F #00 #77 #00 #73 #00 #65 #00 #72 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #22 #00 #70 #00 #79 #00 #74 #00 #68 #00 #6F #00 #6E #00 #43 #00 #6F #00 #6E #00 #73 #00 #6F #00 #6C #00 #65 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #30 #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #31 #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #33 #01" />
- <parameter name="" value="#00 #00 #00 #00 #04 #00 #00 #00 #0E #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #1A #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #1C #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #00 #00 #00 #10 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #01 #00 #00 #00 #05 #00 #00 #00 #22 #00 #6F #00 #62 #00 #6A #00 #65 #00 #63 #00 #74 #00 #42 #00 #72 #00 #6F #00 #77 #00 #73 #00 #65 #00 #72 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #22 #00 #70 #00 #79 #00 #74 #00 #68 #00 #6F #00 #6E #00 #43 #00 #6F #00 #6E #00 #73 #00 #6F #00 #6C #00 #65 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #30 #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #31 #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #33 #01" />
+ <parameter name="" value="#00 #00 #00 #00 #05 #00 #00 #00 #0E #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #0E #00 #50 #00 #6C #00 #75 #00 #67 #00 #69 #00 #6E #00 #73 #01 #00 #00 #00 #1A #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #1C #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #00 #00 #00 #10 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #01 #00 #00 #00 #05 #00 #00 #00 #22 #00 #6F #00 #62 #00 #6A #00 #65 #00 #63 #00 #74 #00 #42 #00 #72 #00 #6F #00 #77 #00 #73 #00 #65 #00 #72 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #22 #00 #70 #00 #79 #00 #74 #00 #68 #00 #6F #00 #6E #00 #43 #00 #6F #00 #6E #00 #73 #00 #6F #00 #6C #00 #65 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #30 #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #31 #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #33 #01"/>
+ <parameter name="nomodule" value="#00 #00 #00 #00 #05 #00 #00 #00 #0E #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #0E #00 #50 #00 #6C #00 #75 #00 #67 #00 #69 #00 #6E #00 #73 #00 #00 #00 #00 #1A #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #4D #00 #6F #00 #64 #00 #75 #00 #6C #00 #65 #00 #73 #01 #00 #00 #00 #1C #00 #53 #00 #61 #00 #6C #00 #6F #00 #6D #00 #65 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #00 #00 #00 #10 #00 #53 #00 #74 #00 #61 #00 #6E #00 #64 #00 #61 #00 #72 #00 #64 #01 #01 #00 #00 #00 #06 #00 #00 #00 #1A #00 #69 #00 #6E #00 #66 #00 #6F #00 #50 #00 #61 #00 #6E #00 #65 #00 #6C #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #22 #00 #6F #00 #62 #00 #6A #00 #65 #00 #63 #00 #74 #00 #42 #00 #72 #00 #6F #00 #77 #00 #73 #00 #65 #00 #72 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #22 #00 #70 #00 #79 #00 #74 #00 #68 #00 #6F #00 #6E #00 #43 #00 #6F #00 #6E #00 #73 #00 #6F #00 #6C #00 #65 #00 #44 #00 #6F #00 #63 #00 #6B #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #30 #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #31 #01 #00 #00 #00 #10 #00 #77 #00 #69 #00 #6E #00 #64 #00 #6F #00 #77 #00 #5F #00 #33 #01"/>
</section>
</document>
<source>SALOME_VIDEO_TUTORIALS</source>
<translation>Video Tutorials</translation>
</message>
+ <message>
+ <source>PRP_SALOME_VIDEO_TUTORIALS</source>
+ <translation>Visit YouTube channel with some videos</translation>
+ </message>
+ <message>
+ <source>SALOME_TUTORIALS</source>
+ <translation>Tutorials</translation>
+ </message>
+ <message>
+ <source>PRP_SALOME_TUTORIALS</source>
+ <translation>Try tutorials from SALOME site</translation>
+ </message>
<message>
<source>ENTRY_COLUMN</source>
<translation>Entry</translation>
<source>OBJECT_BROWSER</source>
<translation>Object Browser</translation>
</message>
+ <message>
+ <source>INFO_PANEL</source>
+ <translation>Help panel</translation>
+ </message>
<message>
<source>PRP_DESK_PREFERENCES</source>
<translation>Allow to change the preferences</translation>
<source>PREF_PY_NUM_COLUMNS</source>
<translation>Number of columns:</translation>
</message>
+ <message>
+ <source>INFO_WELCOME_TO_SALOME</source>
+ <translation>Welcome to SALOME</translation>
+ </message>
+ <message>
+ <source>INFO_GETTING_STARTED</source>
+ <translation>Getting started</translation>
+ </message>
+ <message>
+ <source>INFO_AVAILABLE_MODULES</source>
+ <translation>Available modules</translation>
+ </message>
</context>
<context>
<name>LightApp_Module</name>
<source>SALOME_VIDEO_TUTORIALS</source>
<translation type="unfinished">Video Tutorials</translation>
</message>
+ <message>
+ <source>PRP_SALOME_VIDEO_TUTORIALS</source>
+ <translation type="unfinished">Visit YouTube channel with some videos</translation>
+ </message>
+ <message>
+ <source>SALOME_TUTORIALS</source>
+ <translation type="unfinished">Tutorials</translation>
+ </message>
+ <message>
+ <source>PRP_SALOME_TUTORIALS</source>
+ <translation type="unfinished">Try tutorials from SALOME site</translation>
+ </message>
<message>
<source>ENTRY_COLUMN</source>
<translation>Entrée</translation>
<source>OBJECT_BROWSER</source>
<translation>Arbre d'étude</translation>
</message>
+ <message>
+ <source>INFO_PANEL</source>
+ <translation type="unfinished">Help panel</translation>
+ </message>
<message>
<source>PRP_DESK_PREFERENCES</source>
<translation>Permettre de changer les préférences</translation>
<source>PREF_PY_NUM_COLUMNS</source>
<translation>Nombre de colonnes:</translation>
</message>
+ <message>
+ <source>INFO_WELCOME_TO_SALOME</source>
+ <translation type="unfinished">Welcome to SALOME</translation>
+ </message>
+ <message>
+ <source>INFO_GETTING_STARTED</source>
+ <translation type="unfinished">Getting started</translation>
+ </message>
+ <message>
+ <source>INFO_AVAILABLE_MODULES</source>
+ <translation type="unfinished">Available modules</translation>
+ </message>
</context>
<context>
<name>LightApp_Module</name>
<source>SALOME_VIDEO_TUTORIALS</source>
<translation type="unfinished">Video Tutorials</translation>
</message>
+ <message>
+ <source>PRP_SALOME_VIDEO_TUTORIALS</source>
+ <translation type="unfinished">Visit YouTube channel with some videos</translation>
+ </message>
+ <message>
+ <source>SALOME_TUTORIALS</source>
+ <translation type="unfinished">Tutorials</translation>
+ </message>
+ <message>
+ <source>PRP_SALOME_TUTORIALS</source>
+ <translation type="unfinished">Try tutorials from SALOME site</translation>
+ </message>
<message>
<source>ENTRY_COLUMN</source>
<translation>エントリ</translation>
<source>OBJECT_BROWSER</source>
<translation>オブジェクトブラウザー</translation>
</message>
+ <message>
+ <source>INFO_PANEL</source>
+ <translation type="unfinished">Help panel</translation>
+ </message>
<message>
<source>PRP_DESK_PREFERENCES</source>
<translation>設定を変更することができます。</translation>
<source>PREF_PY_NUM_COLUMNS</source>
<translation>列数</translation>
</message>
+ <message>
+ <source>INFO_WELCOME_TO_SALOME</source>
+ <translation type="unfinished">Welcome to SALOME</translation>
+ </message>
+ <message>
+ <source>INFO_GETTING_STARTED</source>
+ <translation type="unfinished">Getting started</translation>
+ </message>
+ <message>
+ <source>INFO_AVAILABLE_MODULES</source>
+ <translation type="unfinished">Available modules</translation>
+ </message>
</context>
<context>
<name>LightApp_Module</name>
# --- headers ---
# header files / to be processed by moc
-SET(_moc_HEADERS
+SET(_moc_HEADERS
QtxAction.h
QtxActionGroup.h
QtxActionMenuMgr.h
QtxFontEdit.h
QtxGridBox.h
QtxGroupBox.h
+ QtxInfoPanel.h
QtxIntSpinBox.h
QtxIntSpinSlider.h
QtxListAction.h
QtxFontEdit.cxx
QtxGridBox.cxx
QtxGroupBox.cxx
+ QtxInfoPanel.cxx
QtxIntSpinBox.cxx
QtxIntSpinSlider.cxx
QtxListAction.cxx
*/
QSize QtxDockWidget::sizeHint() const
{
- QSize sz = QDockWidget::sizeHint();
-
- // printf( "----------------> QtxDockWidget::sizeHint()\n" );
-
return QSize( 500, 100 );
-
- return sz;
}
/*!
*/
QSize QtxDockWidget::minimumSizeHint() const
{
- QSize sz = QDockWidget::minimumSizeHint();
-
- return sz;
+ return QDockWidget::minimumSizeHint();
}
/*!
else
myWatcher->hidden( this );
}
+
+ if ( on )
+ emit( aboutToShow() );
}
/*!
signals:
void orientationChanged( Qt::Orientation );
+ void aboutToShow();
public slots:
virtual void setVisible( bool );
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "QtxInfoPanel.h"
+
+#include <QAction>
+#include <QFont>
+#include <QGroupBox>
+#include <QLabel>
+#include <QMap>
+#include <QPalette>
+#include <QSizePolicy>
+#include <QToolButton>
+#include <QVBoxLayout>
+#include <QScrollArea>
+
+/*!
+ \internal
+ \class QtxInfoPanel::Container
+ \brief Container to store widgets within info panel
+*/
+class QtxInfoPanel::Container: public QWidget
+{
+public:
+ Container( QWidget* = 0 );
+ Container( const QString&, QWidget* = 0 );
+
+ void addAction( QAction*, const int );
+ void addLabel( const QString&, Qt::Alignment, const int );
+ void addGroup( const QString&, const int );
+
+ QWidget* find( const int ) const;
+
+ void remove( const int );
+ void clear();
+
+ void put( QWidget* );
+
+private:
+ QMap<int, QWidget*> ids;
+ QGroupBox* group;
+};
+
+QtxInfoPanel::Container::Container( QWidget* parent )
+ : QWidget( parent ), group( 0 )
+{
+ QVBoxLayout* l = new QVBoxLayout( this );
+ l->setContentsMargins( 0, 0, 0, 0 );
+}
+
+QtxInfoPanel::Container::Container( const QString& title, QWidget* parent )
+ : Container( parent )
+{
+ QVBoxLayout* l = dynamic_cast<QVBoxLayout*>( layout() );
+ group = new QGroupBox( title );
+ group->setLayout( new QVBoxLayout() );
+ l->addWidget( group );
+}
+
+void QtxInfoPanel::Container::put( QWidget* widget )
+{
+ QVBoxLayout* l = group ? dynamic_cast<QVBoxLayout*>( group->layout() ) : dynamic_cast<QVBoxLayout*>( layout() );
+ l->addWidget( widget );
+}
+
+void QtxInfoPanel::Container::addLabel( const QString& text, Qt::Alignment alignment, const int id )
+{
+ QLabel* label = new QLabel( text );
+ QFont f = label->font();
+ f.setItalic( true );
+ label->setFont( f );
+ label->setAlignment( alignment );
+ label->setWordWrap( true );
+ put( label );
+ ids[ id ] = label;
+}
+
+void QtxInfoPanel::Container::addAction( QAction* action, const int id )
+{
+ QToolButton* button = new QToolButton( this );
+ button->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+ button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ button->setAutoRaise( true );
+ button->setDefaultAction( action );
+ put( button );
+ ids[ id ] = button;
+}
+
+void QtxInfoPanel::Container::addGroup( const QString& text, const int id )
+{
+ Container* group = new Container( text, this );
+ put( group );
+ ids[ id ] = group;
+}
+
+QWidget* QtxInfoPanel::Container::find( const int id ) const
+{
+ if ( ids.contains( id ) )
+ return ids[id];
+
+ QMap<int, QWidget*>::ConstIterator it;
+ QWidget* widget = 0;
+ for( it = ids.begin(); it != ids.end() && !widget; ++it )
+ {
+ Container* group = dynamic_cast<Container*>( it.value() );
+ if ( group )
+ widget = group->find( id );
+ }
+
+ return widget;
+}
+
+void QtxInfoPanel::Container::remove( const int id )
+{
+ if ( ids.contains( id ) )
+ {
+ QVBoxLayout* l = group ? dynamic_cast<QVBoxLayout*>( group->layout() ) : dynamic_cast<QVBoxLayout*>( layout() );
+ l->removeWidget( ids[id] );
+ ids[id]->deleteLater();
+ l->invalidate();
+ ids.remove( id );
+ }
+}
+
+void QtxInfoPanel::Container::clear()
+{
+ QVBoxLayout* l = group ? dynamic_cast<QVBoxLayout*>( group->layout() ) : dynamic_cast<QVBoxLayout*>( layout() );
+
+ QList<QWidget*> widgets = ids.values();
+ foreach( QWidget* widget, widgets )
+ {
+ l->removeWidget( widget );
+ widget->deleteLater();
+ }
+
+ l->invalidate();
+ ids.clear();
+}
+
+
+/*!
+ \internal
+ \class QtxInfoPanel::Title
+ \brief Info panel's title widget
+*/
+class QtxInfoPanel::Title: public QLabel
+{
+public:
+ Title( QWidget* parent = 0 );
+};
+
+QtxInfoPanel::Title::Title( QWidget* parent )
+ : QLabel( parent )
+{
+ setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+ QString bg = palette().color( QPalette::Highlight ).name();
+ QString fg = palette().color( QPalette::HighlightedText ).name();
+ setStyleSheet( QString( "QLabel { background:%1; color:%2; }" ).arg( bg ).arg( fg ) );
+ setTextFormat( Qt::PlainText );
+ QFont f = font();
+ f.setBold( true );
+ setFont( f );
+ setContentsMargins( 2, 5, 2, 5 );
+}
+
+
+/*!
+ \class QtxInfoPanel
+ \brief Info panel which allows presenting welcome, useful hints
+ and other information dynamically, e.g. in the dock panel of main
+ application's window.
+
+ The *Info panel* normally has a title (aimed to shortly present the
+ current application's context) and a set of buttons and text labels
+ combined into the groups (which may be nested).
+
+ Buttons normally represent some quick actions which are applicable in
+ the current context. Text labels can be used to show additional information
+ like hints, proposed actions, etc.
+
+ To set the title to the panel, use method setTitle(). Text label can be
+ added to the panel with addLabel() method, action (button) is added via
+ addAction() method.
+
+ By default, items are added to the top level, untitled group. Additionally,
+ panel allows arranging items into groups; new group can be added with the
+ addGroup() method.
+
+ Each of addAction(), addLabel(), addGroup() methods return item's unique
+ identifier. This identifier can be used, for instance, to enable/disable
+ item with setEnabled() method, hide/show with setVisible() method, remove
+ from panel with remove() method. The same action can be added to the panel
+ several times, e.g. to the different groups - the corresponding buttons will
+ have different unique ids.
+
+ To remove all contents of panel, use clear() method.
+*/
+
+/*!
+ \brief Create panel.
+ \param parent Parent widget.
+ */
+QtxInfoPanel::QtxInfoPanel( QWidget* parent )
+ : QWidget( parent )
+{
+ title = new Title( this );
+ container = new Container( this );
+
+ QVBoxLayout* layout = new QVBoxLayout( this );
+ layout->setContentsMargins( 0, 0, 0, 0 );
+
+ QWidget* wg = new QWidget();
+ QVBoxLayout* wg_layout = new QVBoxLayout( wg );
+ wg_layout->setContentsMargins( 0, 0, 0, 0 );
+ wg_layout->addWidget( container );
+ wg_layout->addStretch();
+
+ QScrollArea* scroll = new QScrollArea();
+ scroll->setWidgetResizable( true );
+ scroll->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
+ scroll->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding );
+ scroll->setSizeAdjustPolicy( QScrollArea::AdjustToContents );
+ scroll->setFrameStyle( QScrollArea::NoFrame );
+ scroll->setContentsMargins( 0, 0, 0, 0 );
+ scroll->setWidget( wg );
+
+ layout->addWidget( title );
+ layout->addWidget( scroll );
+ setTitle( "" );
+}
+
+/*!
+ \brief Destructor.
+*/
+QtxInfoPanel::~QtxInfoPanel()
+{
+}
+
+/*!
+ \brief Add left-aligned text label to the given group.
+ \param text Label's text.
+ \param groupId Group's identifier. Value -1 (default) is used
+ to add label to the top-level (untitled) group.
+ \return Label's unique identifier.
+*/
+int QtxInfoPanel::addLabel( const QString& text, const int groupId )
+{
+ return addLabel( text, Qt::AlignLeft, groupId );
+}
+
+/*!
+ \brief Add text label to the given group.
+ \param text Label's text.
+ \param alignment Label's alignment.
+ \param groupId Group's identifier. Value -1 (default) is used
+ to add label to the top-level (untitled) group.
+ \return Label's unique identifier.
+*/
+int QtxInfoPanel::addLabel( const QString& text, Qt::Alignment alignment, const int groupId )
+{
+ int id = 0;
+ Container* c = dynamic_cast<Container*>( find( groupId ) );
+ if ( c )
+ {
+ id = generateId();
+ c->addLabel( text, alignment, id );
+ }
+ return id;
+}
+
+/*!
+ \brief Add action button to the given group.
+ \param action Action being added (note: parent is not changed).
+ \param groupId Group's identifier. Value -1 (default) is used
+ to add button to the top-level (untitled) group.
+ \return Button's unique identifier.
+*/
+int QtxInfoPanel::addAction( QAction* action, const int groupId )
+{
+ int id = 0;
+ Container* c = dynamic_cast<Container*>( find( groupId ) );
+ if ( c )
+ {
+ id = generateId();
+ c->addAction( action, id );
+ }
+ return id;
+}
+
+/*!
+ \brief Add (sub-)group to the given group.
+ \param text Group's title.
+ \param groupId Parent group's identifier. Value -1 (default) is used
+ to add (sub-)group to the top-level (untitled) group (i.e. panel itself).
+ \return Group's unique identifier.
+*/
+int QtxInfoPanel::addGroup( const QString& text, const int groupId )
+{
+ int id = 0;
+ Container* c = dynamic_cast<Container*>( find( groupId ) );
+ if ( c )
+ {
+ id = generateId();
+ c->addGroup( text, id );
+ }
+ return id;
+}
+
+/*!
+ \brief Set panel's title.
+ \param text %Title text (empty string removes title).
+*/
+void QtxInfoPanel::setTitle( const QString& text )
+{
+ title->setText( text );
+ title->setVisible( !title->text().isEmpty() );
+}
+
+/*!
+ \brief Remove given item from panel.
+ \note If a group is removed, all its contents (recursively) is removed
+ as well.
+ \param id Item's (label's, button's, group's) identifier.
+*/
+void QtxInfoPanel::remove( const int id )
+{
+ QWidget* widget = find( id );
+ if ( widget )
+ {
+ Container* group = dynamic_cast<Container*>( widget->parentWidget() );
+ if ( !group )
+ group = dynamic_cast<Container*>( widget->parentWidget()->parentWidget() );
+ if ( group )
+ group->remove( id );
+ }
+}
+
+/*!
+ \brief Clear contents of panel of group.
+ \param groupId Group's identifier. Value -1 (default) is used
+ to clear all contents of panel.
+*/
+void QtxInfoPanel::clear( const int groupId )
+{
+ Container* c = dynamic_cast<Container*>( find( groupId ) );
+ if ( c )
+ c->clear();
+}
+
+/*!
+ \internal
+ \brief Find widget that represents given item.
+ \param id Item's (label's, button's, group's) identifier.
+ \return Item's widget (0 if not found).
+*/
+QWidget* QtxInfoPanel::find( const int id ) const
+{
+ if ( id == -1 )
+ return container;
+ return container->find( id );
+}
+
+/*!
+ \brief Change item's visibility.
+ \param id Item's (label's, button's, group's) identifier.
+ \param visible \c true to show item, \c false to hide it.
+*/
+void QtxInfoPanel::setVisible( const int id, bool visible )
+{
+ QWidget* widget = find( id );
+ if ( widget )
+ widget->setVisible( visible );
+}
+
+/*!
+ \brief Enable / disable item.
+ \param id Item's (label's, button's, group's) identifier.
+ \param enabled \c true to enable item, \c false to disable it.
+*/
+void QtxInfoPanel::setEnabled( const int id, bool enabled )
+{
+ QWidget* widget = find( id );
+ if ( widget )
+ widget->setEnabled( enabled );
+}
+
+/*!
+ \internal
+ \brief Generate new unique identifier.
+ \return Unique identifier.
+*/
+int QtxInfoPanel::generateId() const
+{
+ static int id = -100;
+ return --id;
+}
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef QTXINFOPANEL_H
+#define QTXINFOPANEL_H
+
+#include "Qtx.h"
+
+#include <QWidget>
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+class QAction;
+
+class QTX_EXPORT QtxInfoPanel : public QWidget
+{
+ Q_OBJECT
+
+ class Container;
+ class Title;
+
+public:
+ QtxInfoPanel( QWidget* = 0 );
+ ~QtxInfoPanel();
+
+ void setTitle( const QString& );
+ int addLabel( const QString&, const int = -1 );
+ int addLabel( const QString&, Qt::Alignment, const int = -1 );
+ int addAction( QAction*, const int = -1 );
+ int addGroup( const QString&, const int = -1 );
+
+ void remove( const int );
+ void clear( const int = -1 );
+
+ void setVisible( const int, bool );
+ void setEnabled( const int, bool );
+
+private:
+ int generateId() const;
+ QWidget* find( const int ) const;
+
+private:
+ Title* title;
+ Container* container;
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif // QTXINFOPANEL_H
#include "QtxActionMenuMgr.h"
#include "QtxWorkstack.h"
#include "QtxTreeView.h"
+#include "QtxInfoPanel.h"
#include "SALOME_Event.h"
#include "STD_TabDesktop.h"
#include "SUIT_DataBrowser.h"
ProcessVoidEvent( new TEvent( msg, addSeparator ) );
}
+/*!
+ \brief Set the title to the Help panel.
+ \param title Title text (empty string removes title)
+*/
+void SalomePyQt::infoSetTitle( const QString& title )
+{
+ class TEvent: public SALOME_Event
+ {
+ QString myTitle;
+ public:
+ TEvent( const QString& title )
+ : myTitle( title ) {}
+ virtual void Execute()
+ {
+ if ( LightApp_Application* anApp = getApplication() ) {
+ QtxInfoPanel* ip = anApp->infoPanel();
+ if ( ip )
+ ip->setTitle( myTitle );
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( title ) );
+}
+
+/*!
+ \fn int SalomePyQt::infoAddLabel( const QString& text, const int groupId )
+ \brief Insert left-aligned text label into the Help panel
+ \param text Label text
+ \param groupId Parent group's identifier (defaults to -1 for top-level group)
+ \return Label's identifier
+*/
+
+class TInfoAddLabel2paramEvent: public SALOME_Event
+{
+public:
+ typedef int TResult;
+ TResult myResult;
+ QString myText;
+ int myGroupId;
+ TInfoAddLabel2paramEvent( const QString& text, const int groupId )
+ : myText( text ), myGroupId( groupId ) {}
+ virtual void Execute()
+ {
+ if ( LightApp_Application* anApp = getApplication() ) {
+ QtxInfoPanel* ip = anApp->infoPanel();
+ if ( ip )
+ myResult = ip->addLabel( myText, myGroupId );
+ }
+ }
+};
+int SalomePyQt::infoAddLabel( const QString& text, const int groupId )
+{
+ return ProcessEvent( new TInfoAddLabel2paramEvent( text, groupId ) );
+}
+
+/*!
+ \fn int SalomePyQt::infoAddLabel( const QString& text, Qt::Alignment alignment, const int groupId )
+ \brief Insert text label into the Help panel
+ \param text Label text
+ \param alignment Alignment flag for text label
+ \param groupId Parent group's identifier (defaults to -1 for top-level group)
+ \return Label's identifier
+*/
+
+class TInfoAddLabel3paramEvent: public SALOME_Event
+{
+public:
+ typedef int TResult;
+ TResult myResult;
+ QString myText;
+ Qt::Alignment myAlignment;
+ int myGroupId;
+ TInfoAddLabel3paramEvent( const QString& text, Qt::Alignment alignment, const int groupId )
+ : myText( text ), myAlignment( alignment ), myGroupId( groupId ) {}
+ virtual void Execute()
+ {
+ if ( LightApp_Application* anApp = getApplication() ) {
+ QtxInfoPanel* ip = anApp->infoPanel();
+ if ( ip )
+ myResult = ip->addLabel( myText, myAlignment, myGroupId );
+ }
+ }
+};
+int SalomePyQt::infoAddLabel( const QString& text, Qt::Alignment alignment, const int groupId )
+{
+ return ProcessEvent( new TInfoAddLabel3paramEvent( text, alignment, groupId ) );
+}
+
+/*!
+ \fn int SalomePyQt::infoAddAction( QAction* action, const int groupId )
+ \brief Insert action button into the Help panel
+ \param action Action being added
+ \param groupId Parent group's identifier (defaults to -1 for top-level group)
+ \return Action's identifier
+*/
+
+class TInfoAddActionEvent: public SALOME_Event
+{
+public:
+ typedef int TResult;
+ TResult myResult;
+ QAction* myAction;
+ int myGroupId;
+ TInfoAddActionEvent( QAction* action, const int groupId )
+ : myAction( action ), myGroupId( groupId ) {}
+ virtual void Execute()
+ {
+ if ( LightApp_Application* anApp = getApplication() ) {
+ QtxInfoPanel* ip = anApp->infoPanel();
+ if ( ip )
+ myResult = ip->addAction( myAction, myGroupId );
+ }
+ }
+};
+int SalomePyQt::infoAddAction( QAction* action, const int groupId )
+{
+ return ProcessEvent( new TInfoAddActionEvent( action, groupId ) );
+}
+
+/*!
+ \fn int SalomePyQt::infoAddGroup( const QString& text, const int groupId )
+ \brief Create a (sub-)group in the Help panel
+ \param text Group title
+ \param groupId Parent group's identifier (defaults to -1 for top-level group)
+ \return Group's identifier
+*/
+
+class TInfoAddGroupEvent: public SALOME_Event
+{
+public:
+ typedef int TResult;
+ TResult myResult;
+ QString myText;
+ int myGroupId;
+ TInfoAddGroupEvent( const QString& text, const int groupId )
+ : myText( text ), myGroupId( groupId ) {}
+ virtual void Execute()
+ {
+ if ( LightApp_Application* anApp = getApplication() ) {
+ QtxInfoPanel* ip = anApp->infoPanel();
+ if ( ip )
+ myResult = ip->addGroup( myText, myGroupId );
+ }
+ }
+};
+int SalomePyQt::infoAddGroup( const QString& text, const int groupId )
+{
+ return ProcessEvent( new TInfoAddGroupEvent( text, groupId ) );
+}
+
+/*!
+ \brief Remove item from the Help panel
+ \param id Item's (label's, action's, group's, ...) identifier
+*/
+void SalomePyQt::infoRemove( const int id )
+{
+ class TEvent: public SALOME_Event
+ {
+ int myId;
+ public:
+ TEvent( const int id )
+ : myId( id ) {}
+ virtual void Execute()
+ {
+ if ( LightApp_Application* anApp = getApplication() ) {
+ QtxInfoPanel* ip = anApp->infoPanel();
+ if ( ip )
+ ip->remove( myId );
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( id ) );
+}
+
+/*!
+ \brief Clear Help panel's contents
+ \param groupId Group's identifier (default is -1, to clear whole panel)
+*/
+void SalomePyQt::infoClear( const int groupId )
+{
+ class TEvent: public SALOME_Event
+ {
+ int myGroupId;
+ public:
+ TEvent( const int groupId )
+ : myGroupId( groupId ) {}
+ virtual void Execute()
+ {
+ if ( LightApp_Application* anApp = getApplication() ) {
+ QtxInfoPanel* ip = anApp->infoPanel();
+ if ( ip )
+ ip->clear( myGroupId );
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( groupId ) );
+}
+
+/*!
+ \brief Set item's visibility in the Help panel
+ \param id Item's (label's, action's, group's, ...) identifier
+ \param visible Visibility flag
+*/
+void SalomePyQt::infoSetVisible( const int id, bool visible )
+{
+ class TEvent: public SALOME_Event
+ {
+ int myId;
+ bool myVisible;
+ public:
+ TEvent( const int id, bool visible )
+ : myId( id ), myVisible( visible ) {}
+ virtual void Execute()
+ {
+ if ( LightApp_Application* anApp = getApplication() ) {
+ QtxInfoPanel* ip = anApp->infoPanel();
+ if ( ip )
+ ip->setVisible( myId, myVisible );
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( id, visible ) );
+}
+
+/*!
+ \brief Enable/disable item in the Help panel
+ \param id Item's (label's, action's, group's, ...) identifier
+ \param enabled Enabled state
+*/
+void SalomePyQt::infoSetEnabled( const int id, bool enabled )
+{
+ class TEvent: public SALOME_Event
+ {
+ int myId;
+ bool myEnabled;
+ public:
+ TEvent( const int id, bool enabled )
+ : myId( id ), myEnabled( enabled ) {}
+ virtual void Execute()
+ {
+ if ( LightApp_Application* anApp = getApplication() ) {
+ QtxInfoPanel* ip = anApp->infoPanel();
+ if ( ip )
+ ip->setEnabled( myId, myEnabled );
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( id, enabled ) );
+}
+
/*!
\brief Remove all the messages from the Log messages output window.
*/
WT_ObjectBrowser = LightApp_Application::WT_ObjectBrowser,
WT_PyConsole = LightApp_Application::WT_PyConsole,
WT_LogWindow = LightApp_Application::WT_LogWindow,
+ WT_InfoPanel = LightApp_Application::WT_InfoPanel,
#ifndef GUI_DISABLE_CORBA
WT_NoteBook = SalomeApp_Application::WT_NoteBook,
WT_User = SalomeApp_Application::WT_User
static void registerModule( const QString& );
static void updateObjBrowser();
+ static void infoSetTitle( const QString& );
+ static int infoAddLabel( const QString&, const int = -1 );
+ static int infoAddLabel( const QString&, Qt::Alignment, const int = -1 );
+ static int infoAddAction( QAction*, const int = -1 );
+ static int infoAddGroup( const QString&, const int = -1 );
+
+ static void infoRemove( const int );
+ static void infoClear( const int = -1 );
+
+ static void infoSetVisible( const int, bool );
+ static void infoSetEnabled( const int, bool );
+
static void putInfo( const QString&, const int = 0 );
static int showNotification( const QString&, const QString&, const int = -1 );
static void hideNotification( const QString& );
WT_ObjectBrowser,
WT_PyConsole,
WT_LogWindow,
+ WT_InfoPanel,
%If (ENABLE_CORBA)
WT_NoteBook,
%End
static void registerModule( const QString& ) /ReleaseGIL/ ;
static void updateObjBrowser() /ReleaseGIL/ ;
+ static void infoSetTitle( const QString& ) /ReleaseGIL/ ;
+ static int infoAddLabel( const QString&, const int = -1 ) /ReleaseGIL/ ;
+ static int infoAddLabel( const QString&, Qt::Alignment, const int = -1 ) /ReleaseGIL/ ;
+ static int infoAddAction( QAction*, const int = -1 ) /ReleaseGIL/ ;
+ static int infoAddGroup( const QString&, const int = -1 ) /ReleaseGIL/ ;
+
+ static void infoRemove( const int ) /ReleaseGIL/ ;
+ static void infoClear( const int = -1 ) /ReleaseGIL/ ;
+
+ static void infoSetVisible( const int, bool ) /ReleaseGIL/ ;
+ static void infoSetEnabled( const int, bool ) /ReleaseGIL/ ;
+
static void putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ;
static int showNotification( const QString&, const QString&, const int = -1 ) /ReleaseGIL/ ;
static void hideNotification( const QString& ) /ReleaseGIL/ ;
</message>
<message>
<source>PRP_DESK_FILE_NEW</source>
- <translation>Creates a new document</translation>
+ <translation>Create a new document</translation>
</message>
<message>
<source>PRP_DESK_FILE_MRU</source>
- <translation>Opens a document</translation>
+ <translation>Open a document</translation>
</message>
<message>
<source>MEN_DESK_FILE_NEW</source>
</message>
<message>
<source>PRP_DESK_FILE_OPEN</source>
- <translation>Opens an existing document</translation>
+ <translation>Open an existing document</translation>
</message>
<message>
<source>PRP_DESK_FILE_REOPEN</source>
</message>
<message>
<source>PRP_DESK_FILE_SAVE</source>
- <translation>Saves the active document</translation>
+ <translation>Save the active document</translation>
</message>
<message>
<source>PRP_DESK_WINDOW_HTILE</source>