${OpenCASCADE_FoundationClasses_LIBRARIES}
${QT_LIBRARIES}
${HDF5_LIBRARIES}
- CASCatch qtx suit std SalomeStyle SalomePrs CAM LogWindow ObjBrowser Event
+ CASCatch qtx suit std SalomeStyle SalomePrs CAM LogWindow ObjBrowser Event
${KERNEL_SalomeHDFPersist} ${KERNEL_SALOMELocalTrace}
)
IF(SALOME_USE_SALOMEOBJECT)
# --- headers ---
# header files / to be processed by moc
-SET(_moc_HEADERS
+SET(_moc_HEADERS
LightApp_AboutDlg.h
LightApp_Application.h
LightApp_DataModel.h
LightApp_Study.h
LightApp_SwitchOp.h
LightApp_WgViewModel.h
+ LightApp_ExtInfoDlg.h
)
IF(SALOME_USE_GLVIEWER)
LIST(APPEND _moc_HEADERS LightApp_GLSelector.h)
LightApp_Study.cxx
LightApp_SwitchOp.cxx
LightApp_WgViewModel.cxx
+ LightApp_ExtInfoDlg.cxx
)
IF(SALOME_USE_GLVIEWER)
LIST(APPEND _other_SOURCES LightApp_GLSelector.cxx)
#include "LightApp_PreferencesDlg.h"
#include "LightApp_ModuleDlg.h"
#include "LightApp_AboutDlg.h"
+#include "LightApp_ExtInfoDlg.h"
#include "LightApp_ModuleAction.h"
// temporary commented
#include "LightApp_EventFilter.h"
foreach( QString aModule, aModuleList )
createHelpItems( aModule );
-
+
// f) Additional help items
int id = LightApp_Application::UserID + FIRST_HELP_ID + 1000;
this, SLOT( onModuleAdding() ) );
connect( moduleAction, SIGNAL( removing( QString ) ),
this, SLOT( onModuleRemoving( QString ) ) );
+ connect( moduleAction, SIGNAL(showExtInfo()),
+ this, SLOT(onShowExtInfo()));
// New window
int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, MenuWindowId, 100 );
updateWindows();
}
+/*!On show extension info action.*/
+void LightApp_Application::onShowExtInfo()
+{
+ // Show dialog with information about loaded salome extensions
+ LightApp_ExtInfoDlg dlg(desktop());
+ dlg.exec();
+}
+
/*!Default module activation.*/
QString LightApp_Application::defaultModule() const
{
void LightApp_Application::onOpenDoc()
{
SUIT_Study* study = activeStudy();
-
+
if ( !checkExistingDoc( false ) )
return;
-
+
QString aName = getFileName( true, QString(), getFileFilter( true ), QString(), 0 );
if ( aName.isNull() ) //Cancel
return;
-
+
onOpenDoc( aName );
-
+
if ( !study ) // new study will be create in THIS application
{
updateWindows();
#else
QString cmdLine = QString( "%1 %2 \"%3\"" ).arg( myBrowser, myParameters, myUrl );
// remove LD_LIBRARY_PATH from the environement before starting launcher to avoid bad interactions.
- // (especially in the case of universal binaries)
+ // (especially in the case of universal binaries)
env.remove("LD_LIBRARY_PATH");
#endif
QProcess* proc = new QProcess();
int vtkSelectionGroup = pref->addPreference( tr( "PREF_GROUP_SELECTION" ), vtkGroup );
pref->setItemProperty( "columns", 2, vtkSelectionGroup );
// .... -> preselection
- int vtkPreselection = pref->addPreference( tr( "PREF_PRESELECTION" ), vtkSelectionGroup,
+ int vtkPreselection = pref->addPreference( tr( "PREF_PRESELECTION" ), vtkSelectionGroup,
LightApp_Preferences::Selector, "VTKViewer", "preselection" );
aValuesList.clear();
anIndicesList.clear();
int spacemousePref2 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_2" ), vtkSM,
LightApp_Preferences::Selector, "VTKViewer",
"spacemouse_func2_btn" );
- // .... -> dominant / combined switch
+ // .... -> dominant / combined switch
int spacemousePref3 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_3" ), vtkSM,
LightApp_Preferences::Selector, "VTKViewer",
"spacemouse_func5_btn" ); //
aResMgr->value( "windows_visibility", modName, aDefaultVisibility );
bool hasDefaultVisibility = !aDefaultVisibility.isEmpty();
aResMgr->setWorkingMode( prevMode );
-
+
if( !storeWin && !storeTb && aDefaultState.isEmpty() && !hasDefaultVisibility)
return;
QMap<QString, bool> *tbMap = 0;
QMap<QString, bool> *dwMap = 0;
-
+
QMap<QString, bool> userTbMap, userDwMap;
dockWindowsState( myWinVis[modName], userTbMap, userDwMap );
QMap<QString, bool> defaultTbMap, defaultDwMap;
if(hasDefaultVisibility) {
- dockWindowsState( aDefaultVisibility, defaultTbMap, defaultDwMap);
+ dockWindowsState( aDefaultVisibility, defaultTbMap, defaultDwMap);
}
if(storeTb) {
if(tbMap) {
QList<QToolBar*> tbList = findToolBars();
for ( QList<QToolBar*>::iterator tit = tbList.begin(); tit != tbList.end(); ++tit )
- {
+ {
QToolBar* tb = *tit;
- if ( tbMap->contains( tb->objectName() ) ) {
+ if ( tbMap->contains( tb->objectName() ) ) {
tb->setVisible( (*tbMap)[tb->objectName()] );
}
}
for ( QList<QDockWidget*>::iterator dit = dwList.begin(); dit != dwList.end(); ++dit )
{
QDockWidget* dw = *dit;
-
+
QObject* po = Qtx::findParent( dw, "QMainWindow" );
if ( po != desktop() )
continue;
-
+
if ( dwMap->contains( dw->objectName() ) )
dw->setVisible( (*dwMap)[dw->objectName()] );
}
}
else if ( message.toLower().startsWith("register_module_in_study" ) ) {
QString moduleName = message.split( sectionSeparator ).last();
- // Check name of current activating module name in order to avoid ciclik
+ // Check name of current activating module name in order to avoid ciclik
// call because of messages
if (!property("activateModule").toBool()) {
CAM_Module* mod = module(moduleName);
}
/*!
- Internal method.
+ Internal method.
Returns all top level toolbars.
Note : Result list contains only main window toolbars, not including toolbars from viewers.
*/
virtual void onModuleActivation( const QString& );
void onModuleAdding();
void onModuleRemoving( const QString& );
+ void onShowExtInfo();
void onCloseView( SUIT_ViewManager* );
virtual void onStudyCreated( SUIT_Study* );
--- /dev/null
+// Copyright (C) 2007-2022 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 https://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: LightApp_ExtInfoDlg.cxx
+// Author: Konstantin Leontev
+//
+#include "LightApp_ExtInfoDlg.h"
+#include "LightApp_Application.h"
+#include "utilities.h"
+
+// Prevent slot compilation error
+#pragma push_macro("slots")
+#undef slots
+#include "PyInterp_Utils.h"
+#pragma pop_macro("slots")
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <QtxGridBox.h>
+
+#include <QLabel>
+#include <QHBoxLayout>
+#include <QPixmap>
+#include <QIcon>
+#include <QGroupBox>
+#include <QTabWidget>
+#include <QPushButton>
+#include <QFileInfo> // to get path to the file
+
+/*!Constructor.*/
+LightApp_ExtInfoDlg::LightApp_ExtInfoDlg(QWidget* parent)
+: QtxDialog(parent, true, true, ButtonFlags::OK)
+{
+ MESSAGE("Start creating a dialog...\n");
+
+ setObjectName("salome_ext_info_dialog");
+ QString capText = tr("EXT_INFO_CAPTION");
+ setWindowTitle(capText);
+ setSizeGripEnabled(true);
+ setButtonPosition(ButtonPosition::Center, ButtonFlags::OK);
+
+ auto extInfoWiget = getExtListWidget(mainFrame());
+ auto extTreeWiget = getExtTreeWidget(mainFrame());
+
+ auto layout = new QHBoxLayout(mainFrame());
+ layout->addWidget(extInfoWiget);
+ layout->addWidget(extTreeWiget);
+ layout->setStretch(0, 5);
+ layout->setStretch(1, 5);
+}
+
+/*!Destructor.*/
+LightApp_ExtInfoDlg::~LightApp_ExtInfoDlg()
+{
+ //! Do nothing.
+}
+
+/*! Return widget with info about installed extensions */
+QWidget* LightApp_ExtInfoDlg::getExtListWidget(QWidget* parent) const
+{
+ MESSAGE("Start to get modules info...\n");
+
+ auto extListWidget = new QWidget(parent);
+ auto app = dynamic_cast<LightApp_Application*>(SUIT_Session::session()->activeApplication());
+ ASSERT(app);
+ if (!app)
+ {
+ return extListWidget;
+ }
+
+ auto gridLayout = new QGridLayout(extListWidget);
+ gridLayout->setSpacing(5);
+
+ // Import Python module that manages SALOME extensions
+ PyLockWrapper lck; // acquire GIL
+ PyObjWrapper extensionQuery = PyImport_ImportModule((char*)"SalomeOnDemandTK.extension_query");
+ auto extRootDir = getenv("SALOME_APPLICATION_DIR");
+ PyObjWrapper extInfoDict = PyObject_CallMethod(extensionQuery, (char*)"ext_info_dict", (char*)"s", extRootDir);
+ ASSERT(extInfoDict);
+
+ if (extInfoDict)
+ {
+ PyObject *key = nullptr;
+ PyObject *value = nullptr;
+ Py_ssize_t pos = 0;
+
+ while (PyDict_Next(extInfoDict, &pos, &key, &value))
+ {
+ auto name = new QLabel(PyUnicode_AsUTF8(key), extListWidget);
+ auto size = new QLabel(PyUnicode_AsUTF8(value), extListWidget);
+
+ gridLayout->addWidget(name , pos, 0);
+ gridLayout->addWidget(size , pos, 1);
+
+ SCRUTE(name->text().toStdString());
+ SCRUTE(size->text().toStdString());
+ }
+ }
+ else
+ {
+ PyErr_Print();
+ }
+
+ return extListWidget;
+}
+
+/*! Return widget with an image of dependency tree fot installed extensions */
+QWidget* LightApp_ExtInfoDlg::getExtTreeWidget(QWidget* parent) const
+{
+ MESSAGE("Start to get extensions dependency tree...\n");
+
+ auto extTreeWidget = new QWidget(parent);
+ auto app = dynamic_cast<LightApp_Application*>(SUIT_Session::session()->activeApplication());
+ ASSERT(app);
+ if (!app)
+ {
+ return extTreeWidget;
+ }
+
+ // TODO: replace this list with diagram
+ auto gridLayout = new QGridLayout(extTreeWidget);
+ gridLayout->setSpacing(5);
+
+ // Import Python module that manages SALOME extensions
+ PyLockWrapper lck; // acquire GIL
+ PyObjWrapper extensionQuery = PyImport_ImportModule((char*)"SalomeOnDemandTK.extension_query");
+ auto extRootDir = getenv("SALOME_APPLICATION_DIR");
+ PyObjWrapper dependencyTree = PyObject_CallMethod(extensionQuery, (char*)"dependency_tree", (char*)"s", extRootDir);
+ ASSERT(dependencyTree);
+
+ if (dependencyTree)
+ {
+ PyObject *extName = nullptr;
+ PyObject *dependantsList = nullptr;
+ Py_ssize_t pos = 0;
+
+ // Iterate the tree
+ while (PyDict_Next(dependencyTree, &pos, &extName, &dependantsList))
+ {
+ auto name = new QLabel(PyUnicode_AsUTF8(extName), extTreeWidget);
+ gridLayout->addWidget(name, pos, 0);
+
+ SCRUTE(name->text().toStdString());
+
+ // Iterate a list of dependants
+ for (Py_ssize_t depPos = 0; depPos < PyList_Size(dependantsList); ++depPos)
+ {
+ auto dependant = PyList_GetItem(dependantsList, depPos);
+ auto dependantLabel = new QLabel(PyUnicode_AsUTF8(dependant), extTreeWidget);
+ gridLayout->addWidget(dependantLabel , pos, depPos + 1);
+
+ SCRUTE(dependantLabel->text().toStdString());
+ }
+ }
+ }
+ else
+ {
+ PyErr_Print();
+ }
+
+ return extTreeWidget;
+}
--- /dev/null
+// Copyright (C) 2007-2022 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 https://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: LightApp_ExtInfoDlg.h
+// Author: Konstantin Leontev
+//
+#ifndef LIGHTAPP_EXTINFODLG_H
+#define LIGHTAPP_EXTINFODLG_H
+
+#include "LightApp.h"
+
+#include <QtxDialog.h>
+
+class QLabel;
+
+/*!
+ \class LightApp_ExtInfoDlg
+ LightApp dialog with info about loaded extensions
+*/
+class LIGHTAPP_EXPORT LightApp_ExtInfoDlg : public QtxDialog
+{
+ Q_OBJECT
+
+public:
+ LightApp_ExtInfoDlg(QWidget* = 0);
+ virtual ~LightApp_ExtInfoDlg();
+
+private:
+ QWidget* getExtListWidget(QWidget* parent) const;
+ QWidget* getExtTreeWidget(QWidget* parent) const;
+};
+
+#endif
connect( this, SIGNAL( changed() ), this, SLOT( onChanged() ) );
connect( myAdd, SIGNAL( triggered( bool ) ), this, SIGNAL( adding() ) );
+ connect( myInfo, SIGNAL( triggered( bool ) ), this, SIGNAL( showExtInfo() ) );
connect( mySet, SIGNAL( triggered( int ) ), this, SLOT( onTriggered( int ) ) );
connect( myCombo, SIGNAL( activatedId( int ) ), this, SLOT( onComboActivated( int ) ) );
connect( myMapper, SIGNAL( mapped( QString ) ), this, SIGNAL( removing( QString ) ) );
void moduleActivated( const QString& );
void adding();
void removing( const QString& );
+ void showExtInfo();
private:
void update();
<source>ABOUT_MODULE_INFOS</source>
<translation>Modules information</translation>
</message>
+ <message>
+ <source>EXT_INFO_CAPTION</source>
+ <translation>Extensions information</translation>
+ </message>
<message>
<source>ABOUT_UNKNOWN_VERSION</source>
<translation>Unknown</translation>
<source>ABOUT_MODULE_INFOS</source>
<translation>Modules</translation>
</message>
+ <message>
+ <source>EXT_INFO_CAPTION</source>
+ <translation>Informations sur les extensions</translation>
+ </message>
<message>
<source>ABOUT_UNKNOWN_VERSION</source>
<translation>Inconnue</translation>
<source>ABOUT_MODULE_INFOS</source>
<translation>モジュール情報</translation>
</message>
+ <message>
+ <source>EXT_INFO_CAPTION</source>
+ <translation>内線情報</translation>
+ </message>
<message>
<source>ABOUT_UNKNOWN_VERSION</source>
<translation>不明</translation>