From: Yoann Audouin Date: Tue, 20 Jul 2021 06:26:31 +0000 (+0200) Subject: First version of working dummy application X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b413c471efb159b68969a3911d803ae3bcf55a28;p=modules%2Fgui.git First version of working dummy application --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f0ad22d05..60d3beb2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -318,7 +318,7 @@ INCLUDE(CMakePackageConfigHelpers) # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup" SET(_${PROJECT_NAME}_exposed_targets CAM CASCatch DDS Event LightApp LogWindow ObjBrowser - QDS qtx SalomePrs SalomeStyle std SUITApp lightapplication suit ViewerTools ViewerData + QDS qtx SalomePrs SalomeStyle std SUITApp dummyapplication suit ViewerTools ViewerData ImageComposer ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 443ce10f4..d9ed20b52 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -41,7 +41,7 @@ ADD_SUBDIRECTORY(ViewerData) ADD_SUBDIRECTORY(ViewerTools) ADD_SUBDIRECTORY(ImageComposer) ADD_SUBDIRECTORY(GUI_PY) -ADD_SUBDIRECTORY(LightApplication) +ADD_SUBDIRECTORY(DummyApplication) ## # SALOME object diff --git a/src/DummyApplication/CMakeLists.txt b/src/DummyApplication/CMakeLists.txt new file mode 100644 index 000000000..7161cb67f --- /dev/null +++ b/src/DummyApplication/CMakeLists.txt @@ -0,0 +1,92 @@ +# Copyright (C) 2012-2021 CEA/DEN, EDF R&D, OPEN CASCADE +# +# 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(UseQtExt) + +# --- options --- + +# additional include directories +INCLUDE_DIRECTORIES( + ${QT_INCLUDES} + ${PROJECT_SOURCE_DIR}/src/Qtx + ${PROJECT_SOURCE_DIR}/src/ObjBrowser +) + +# additional preprocessor / compiler flags +ADD_DEFINITIONS(${QT_DEFINITIONS}) + +# libraries to link to +SET(_link_LIBRARIES ${PLATFORM_LIBS} ${QT_LIBRARIES} qtx ObjBrowser) + +# --- headers --- + +# header files / to be processed by moc +SET(_moc_HEADERS + DummyApplication.h + DummyDesktop.h +) + +# header files / no moc processing +SET(_other_HEADERS +) + +# header files / to install +SET(dummyapplication_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) + +# --- resources --- + +# resource files / to be processed by lrelease +SET(_ts_RESOURCES + resources/DummyApplication_msg_en.ts + resources/DummyApplication_msg_fr.ts + resources/DummyApplication_msg_ja.ts + resources/DummyApplication_images.ts +) + +# resource files / static +SET(_other_RESOURCES + resources/icon_visibility_on.png + resources/icon_visibility_off.png + resources/view_sync.png +) + +# --- sources --- + +# sources / moc wrappings +QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS}) + +# sources / static +SET(_other_SOURCES + DummyApplication.cxx + DummyDesktop.cxx +) + +# sources / to compile +SET(dummyapplication_SOURCES ${_other_SOURCES} ${_moc_SOURCES}) + +# --- rules --- + +ADD_LIBRARY(dummyapplication ${dummyapplication_SOURCES}) +TARGET_LINK_LIBRARIES(dummyapplication ${_link_LIBRARIES}) +INSTALL(TARGETS dummyapplication EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) + +INSTALL(FILES ${dummyapplication_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) +QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") + +INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA}) diff --git a/src/DummyApplication/DummyApplication.cxx b/src/DummyApplication/DummyApplication.cxx new file mode 100644 index 000000000..86997e09b --- /dev/null +++ b/src/DummyApplication/DummyApplication.cxx @@ -0,0 +1,49 @@ +// Copyright (C) 2007-2021 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 "DummyApplication.h" +#include "DummyDesktop.h" + +/*! + Default constructor +*/ +DummyApplication::DummyApplication() +: QObject( 0 ) +{ + myDesktop = new DummyDesktop(); +} + +/*! + Destructor +*/ +DummyApplication::~DummyApplication() +{ + +} + +/*! + Shows the application's main widget. For non GUI application must be redefined. +*/ +void DummyApplication::start() +{ + myDesktop->show(); +} diff --git a/src/DummyApplication/DummyApplication.h b/src/DummyApplication/DummyApplication.h new file mode 100644 index 000000000..92a1a7b8f --- /dev/null +++ b/src/DummyApplication/DummyApplication.h @@ -0,0 +1,47 @@ +// Copyright (C) 2007-2021 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 DUMMYAPPLICATION_H +#define DUMMYAPPLICATION_H + +#include "DummyDesktop.h" + +#include + + +class DummyApplication : public QObject +{ + Q_OBJECT + +public: + DummyApplication(); + virtual ~DummyApplication(); + + //! Shows the application's main widget. For non GUI application must be redefined. + virtual void start(); + +private: + DummyDesktop * myDesktop = 0; + +}; + +#endif diff --git a/src/DummyApplication/DummyDesktop.cxx b/src/DummyApplication/DummyDesktop.cxx new file mode 100644 index 000000000..0b5a394a8 --- /dev/null +++ b/src/DummyApplication/DummyDesktop.cxx @@ -0,0 +1,127 @@ +// Copyright (C) 2007-2021 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 // this include must be the first one as it includes Python.h +#include "DummyDesktop.h" + +#include "utilities.h" + + +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/*!\class SUIT_Desktop + * Provide desktop management:\n + * \li menu manager + * \li tool manager + * \li windows + */ + +/*! + Constructor. +*/ +DummyDesktop::DummyDesktop() +: QtxMainWindow() +{ + myMenuMgr = new QtxActionMenuMgr( this ); + myToolMgr = new QtxActionToolMgr( this ); + myLogoMgr = new QtxLogoMgr( menuBar() ); + + createMenus(); +} + +/*! + Destructor. +*/ +DummyDesktop::~DummyDesktop() +{ + +} + +void DummyDesktop::createMenus() +{ + //QPushButton *mybutton = new QPushButton("Test", this); + //connect(mybutton, &QPushButton::released, this, &DummyDesktop::RunScript); + + //this->setCentralWidget(mybutton); + QMenu *fileMenu = menuBar()->addMenu("File"); + fileMenu->addAction("Open File", this, &DummyDesktop::RunScript, QKeySequence::Open); + fileMenu->addAction("Dummy", this, SLOT( Dummy()), QKeySequence::New); +} + +void DummyDesktop::Dummy() +{ + QMessageBox msgBox; + msgBox.setText("Dummy text"); + msgBox.exec(); +} + +void DummyDesktop::RunScript() +{ + QString fileName = QFileDialog::getOpenFileName(this, + tr("Open Python File"), "/home/B61570/work_in_progress/salome2810", "Python Files (*.py)"); + + std::ifstream ifs(fileName.toStdString()); + std::string content( (std::istreambuf_iterator(ifs) ), + (std::istreambuf_iterator() ) ); + + + // Lock Python Global Interperter + MESSAGE("Starting Python script"); + MESSAGE("**********************"); + PyGILState_STATE gstate = PyGILState_Ensure(); + PyObject* myMainMod = PyImport_AddModule("__main__"); + PyObject* myMainDict = PyModule_GetDict(myMainMod); + + PyObject* obj = PyRun_String(content.c_str(), Py_file_input, myMainDict, NULL); + + if(obj == NULL){ + MESSAGE("Script crashed"); + PyErr_Print(); + PyGILState_Release(gstate); + } else{ + MESSAGE("ALL is well"); + Py_DECREF(obj); + } + // Get data from script + //PyObject* py_i = PyObject_GetAttrString(myMainMod, "i"); + //double i = PyFloat_AsDouble(py_i); + //Display value of i value + //std::cerr << "i: " << i << std::endl; + // Release GIL + PyGILState_Release(gstate); +} diff --git a/src/DummyApplication/DummyDesktop.h b/src/DummyApplication/DummyDesktop.h new file mode 100644 index 000000000..3225b4b65 --- /dev/null +++ b/src/DummyApplication/DummyDesktop.h @@ -0,0 +1,49 @@ +// Copyright (C) 2007-2021 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 DUMMYDESKTOP_H +#define DUMMYDESKTOP_H + +#include + +class QtxLogoMgr; +class QtxActionMenuMgr; +class QtxActionToolMgr; + +class DummyDesktop : public QtxMainWindow +{ + Q_OBJECT + +public: + DummyDesktop(); + virtual ~DummyDesktop(); + + void RunScript(); + void Dummy(); + void createMenus(); + +private: + QtxActionMenuMgr* myMenuMgr; + QtxActionToolMgr* myToolMgr; + QtxLogoMgr* myLogoMgr; +}; + +#endif diff --git a/src/DummyApplication/resources/DummyApplication_images.ts b/src/DummyApplication/resources/DummyApplication_images.ts new file mode 100644 index 000000000..63c601050 --- /dev/null +++ b/src/DummyApplication/resources/DummyApplication_images.ts @@ -0,0 +1,19 @@ + + + + + @default + + ICON_DATAOBJ_VISIBLE + icon_visibility_on.png + + + ICON_DATAOBJ_INVISIBLE + icon_visibility_off.png + + + ICON_VIEW_SYNC + view_sync.png + + + diff --git a/src/DummyApplication/resources/DummyApplication_msg_en.ts b/src/DummyApplication/resources/DummyApplication_msg_en.ts new file mode 100644 index 000000000..03659c6a8 --- /dev/null +++ b/src/DummyApplication/resources/DummyApplication_msg_en.ts @@ -0,0 +1,174 @@ + + + + + @default + + MEN_DESK_WINDOW + &Window + + + ERR_CANT_DUMP_VIEW + Can't dump view contents to the file. + + + TLT_IMAGE_FILES + Images Files (*.bmp *.png *.jpg *.jpeg) + + + MEN_DESK_WINDOW_CASCADE + &Cascade + + + PRP_DESK_WINDOW_CASCADE + Arranges the windows as overlapping tiles + + + ERR_DIR_NOT_EXIST + The directory "%1" does not exist! + + + ERR_FILE_NOT_DIR + "%1" is not a directory! + + + CONTINUE + Continue + + + CANCEL + Cancel + + + ERR_FILE_NOT_EXIST + The file "%1" does not exist! + + + QUE_DOC_FILEEXISTS + The file %1 already exists. +Do you want to overwrite it ? + + + PRP_DESK_WINDOW_ACTIVATE + Activates this window + + + ERR_PERMISSION_DENIED + Can't save file "%1". +Permission denied. + + + ERR_OPEN_PERMISSION_DENIED + Can't open file "%1". +Permission denied. + + + ERR_DIR_READ_PERMISSION_DENIED + Can't read directory "%1". +Permission denied. + + + ERR_DIR_WRITE_PERMISSION_DENIED + Can't write directory "%1". +Permission denied. + + + ERR_ERROR + Error + + + QUE_FILE_EXISTS + The file %1 already exists. +Do you want to overwrite it? + + + WRN_WARNING + Warning + + + TLT_DUMP_VIEW + Dump View to File + + + PRP_DESK_WINDOW_TILE + Arranges the windows as nonoverlapping tiles + + + MEN_DESK_WINDOW_VTILE + Tile &Vertically + + + INF_DIRECTORIES_FILTER + Directories + + + PRP_DESK_WINDOW_VTILE + Arranges the windows as nonoverlapping vertical tiles + + + MEN_DESK_WINDOW_TILE + &Tile + + + NAME_COLUMN + Name + + + MNU_SYNCHRONIZE_VIEW + Synchronize + + + DSC_SYNCHRONIZE_VIEW + Synchronize view + + + MNU_SYNC_NO_VIEW + [ No appropriate view ] + + + + SUIT_Study + + OPERATION_LAUNCH + Operation launch + + + PREVIOUS_NOT_FINISHED + Previous operation is not finished and will be aborted + + + + SUIT_FileDlg + + LAB_QUICK_PATH + Quick path: + + + BUT_ADD_PATH + Add path + + + INF_DESK_DOC_OPEN + Open File + + + INF_DESK_DOC_SAVE + Save File + + + ALL_FILES_FILTER + All files (*) + + + + SUIT_ViewWindow + + TLT_DUMP_VIEW + Dump view to file + + + TLT_IMAGE_FILES + Images Files (*.bmp *.png *.jpg *.jpeg) + + + diff --git a/src/DummyApplication/resources/DummyApplication_msg_fr.ts b/src/DummyApplication/resources/DummyApplication_msg_fr.ts new file mode 100644 index 000000000..97f2cf33d --- /dev/null +++ b/src/DummyApplication/resources/DummyApplication_msg_fr.ts @@ -0,0 +1,174 @@ + + + + + @default + + MEN_DESK_WINDOW + &Fenêtre + + + ERR_CANT_DUMP_VIEW + Impossible de sauvegarder le contenu de la vue dans le fichier. + + + TLT_IMAGE_FILES + Fichiers images (*.bmp *.png *.jpg *.jpeg) + + + MEN_DESK_WINDOW_CASCADE + &Cascade + + + PRP_DESK_WINDOW_CASCADE + Superpose les fenêtres + + + ERR_DIR_NOT_EXIST + Le répertoire "%1" n'existe pas ! + + + ERR_FILE_NOT_DIR + "%1" n'est pas un répertoire ! + + + CONTINUE + Continuer + + + CANCEL + Annuler + + + ERR_FILE_NOT_EXIST + Le fichier "%1" n'existe pas ! + + + QUE_DOC_FILEEXISTS + Le fichier %1 existe déjà. +Voulez-vous l'écraser ? + + + PRP_DESK_WINDOW_ACTIVATE + Active la fenêtre + + + ERR_PERMISSION_DENIED + Impossible de sauvegarder le fichier "%1". +Autorisation interdite. + + + ERR_OPEN_PERMISSION_DENIED + Impossible d'ouvrir le fichier "%1". +Autorisation interdite. + + + ERR_DIR_READ_PERMISSION_DENIED + Impossible de lire le répertoire "%1". +Autorisation interdite. + + + ERR_DIR_WRITE_PERMISSION_DENIED + Impossible d'écrire dans le répertoire "%1". +Autorisation interdite. + + + ERR_ERROR + Erreur + + + QUE_FILE_EXISTS + Le fichier %1 existe déjà. +Voulez-vous l'écraser ? + + + WRN_WARNING + Avertissement + + + TLT_DUMP_VIEW + Enregistrer la vue dans le fichier + + + PRP_DESK_WINDOW_TILE + Place les fenêtres en mosaïque + + + MEN_DESK_WINDOW_VTILE + Mosaïque &verticale + + + INF_DIRECTORIES_FILTER + Répertoires + + + PRP_DESK_WINDOW_VTILE + Place les fenêtres en mosaïque verticale + + + MEN_DESK_WINDOW_TILE + &Mosaïque + + + NAME_COLUMN + Nom + + + MNU_SYNCHRONIZE_VIEW + Synchroniser + + + DSC_SYNCHRONIZE_VIEW + Synchroniser la vue + + + MNU_SYNC_NO_VIEW + [ Pas de vue appropriée ] + + + + SUIT_Study + + OPERATION_LAUNCH + Lancer l'opération + + + PREVIOUS_NOT_FINISHED + L'opération précédente n'est pas aboutie et sera interrompue + + + + SUIT_FileDlg + + LAB_QUICK_PATH + Emplacement : + + + BUT_ADD_PATH + Ajouter un chemin + + + INF_DESK_DOC_OPEN + Ouvrir un fichier + + + INF_DESK_DOC_SAVE + Sauvegarder un fichier + + + ALL_FILES_FILTER + Tous les fichiers (*) + + + + SUIT_ViewWindow + + TLT_DUMP_VIEW + Enregistrer la vue dans le fichier + + + TLT_IMAGE_FILES + Fichiers images (*.bmp *.png *.jpg *.jpeg) + + + diff --git a/src/DummyApplication/resources/DummyApplication_msg_ja.ts b/src/DummyApplication/resources/DummyApplication_msg_ja.ts new file mode 100644 index 000000000..8da7266db --- /dev/null +++ b/src/DummyApplication/resources/DummyApplication_msg_ja.ts @@ -0,0 +1,168 @@ + + + + + @default + + MEN_DESK_WINDOW + ウィンドウ(&W) + + + ERR_CANT_DUMP_VIEW + ビューの内容をファイルに保存できませんでした。 + + + TLT_IMAGE_FILES + イメージ (*.bmp *.png *.jpg *.jpeg) ファイル + + + MEN_DESK_WINDOW_CASCADE + カスケード(&C) + + + PRP_DESK_WINDOW_CASCADE + Windows ではスーパーイン ポーズ + + + ERR_DIR_NOT_EXIST + ディレクトリ"%1"は存在しません! + + + ERR_FILE_NOT_DIR + "%1"はディレクトリではありません ! + + + CONTINUE + 続行 + + + CANCEL + キャンセル + + + ERR_FILE_NOT_EXIST + ファイル"%1"は存在しません! + + + QUE_DOC_FILEEXISTS + ファイル %1 は既に存在します。それを上書きしますか。 + + + PRP_DESK_WINDOW_ACTIVATE + アクティブ ウィンドウ + + + ERR_PERMISSION_DENIED + ファイル"%1"を保存できません。アクセス許可は、禁じられています。 + + + ERR_OPEN_PERMISSION_DENIED + ファイル"%1"を開けません。アクセス許可は、禁じられています。 + + + ERR_DIR_READ_PERMISSION_DENIED + ディレクトリ"%1"を読み取れません。アクセス許可は、禁じられています。 + + + ERR_DIR_WRITE_PERMISSION_DENIED + ディレクトリ"%1"に書き込めませんでした。アクセス許可は、禁じられています。 + + + ERR_ERROR + エラー + + + QUE_FILE_EXISTS + ファイル %1 は既に存在します。それを上書きしますか。 + + + WRN_WARNING + 注意 ! + + + TLT_DUMP_VIEW + ビューでファイルを保存します。 + + + PRP_DESK_WINDOW_TILE + ウィンドウの場所 + + + MEN_DESK_WINDOW_VTILE + 垂直方向のモザイク(&V) + + + INF_DIRECTORIES_FILTER + ディレクトリ + + + PRP_DESK_WINDOW_VTILE + 垂直方向のモザイクで Windows の場所 + + + MEN_DESK_WINDOW_TILE + モザイク(&T) + + + NAME_COLUMN + 名前 + + + MNU_SYNCHRONIZE_VIEW + 同期 + + + DSC_SYNCHRONIZE_VIEW + ビューを同期します。 + + + MNU_SYNC_NO_VIEW + [適切なビューを使用しない] + + + + SUIT_Study + + OPERATION_LAUNCH + 操作を開始します。 + + + PREVIOUS_NOT_FINISHED + 前の操作が開発し、中断されます。 + + + + SUIT_FileDlg + + LAB_QUICK_PATH + 場所: + + + BUT_ADD_PATH + パスの追加 + + + INF_DESK_DOC_OPEN + ファイルを開く + + + INF_DESK_DOC_SAVE + ファイルを保存します。 + + + ALL_FILES_FILTER + すべてのファイル (*) + + + + SUIT_ViewWindow + + TLT_DUMP_VIEW + ビューでファイルを保存します。 + + + TLT_IMAGE_FILES + イメージ (*.bmp *.png *.jpg *.jpeg) ファイル + + + diff --git a/src/DummyApplication/resources/icon_visibility_off.png b/src/DummyApplication/resources/icon_visibility_off.png new file mode 100644 index 000000000..31c505d82 Binary files /dev/null and b/src/DummyApplication/resources/icon_visibility_off.png differ diff --git a/src/DummyApplication/resources/icon_visibility_on.png b/src/DummyApplication/resources/icon_visibility_on.png new file mode 100644 index 000000000..61ebe4703 Binary files /dev/null and b/src/DummyApplication/resources/icon_visibility_on.png differ diff --git a/src/DummyApplication/resources/view_sync.png b/src/DummyApplication/resources/view_sync.png new file mode 100644 index 000000000..32b95228a Binary files /dev/null and b/src/DummyApplication/resources/view_sync.png differ diff --git a/src/LightApplication/CMakeLists.txt b/src/LightApplication/CMakeLists.txt deleted file mode 100644 index 5b69459d4..000000000 --- a/src/LightApplication/CMakeLists.txt +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (C) 2012-2021 CEA/DEN, EDF R&D, OPEN CASCADE -# -# 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(UseQtExt) - -# --- options --- - -# additional include directories -INCLUDE_DIRECTORIES( - ${QT_INCLUDES} - ${PROJECT_SOURCE_DIR}/src/Qtx - ${PROJECT_SOURCE_DIR}/src/ObjBrowser -) - -# additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) - -# libraries to link to -SET(_link_LIBRARIES ${PLATFORM_LIBS} ${QT_LIBRARIES} qtx ObjBrowser) - -# --- headers --- - -# header files / to be processed by moc -SET(_moc_HEADERS - LightApplication.h - LightDesktop.h -) - -# header files / no moc processing -SET(_other_HEADERS -) - -# header files / to install -SET(lightapplication_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) - -# --- resources --- - -# resource files / to be processed by lrelease -SET(_ts_RESOURCES - resources/LightApplication_msg_en.ts - resources/LightApplication_msg_fr.ts - resources/LightApplication_msg_ja.ts - resources/LightApplication_images.ts -) - -# resource files / static -SET(_other_RESOURCES - resources/icon_visibility_on.png - resources/icon_visibility_off.png - resources/view_sync.png -) - -# --- sources --- - -# sources / moc wrappings -QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS}) - -# sources / static -SET(_other_SOURCES - LightApplication.cxx - LightDesktop.cxx -) - -# sources / to compile -SET(lightapplication_SOURCES ${_other_SOURCES} ${_moc_SOURCES}) - -# --- rules --- - -ADD_LIBRARY(lightapplication ${lightapplication_SOURCES}) -TARGET_LINK_LIBRARIES(lightapplication ${_link_LIBRARIES}) -INSTALL(TARGETS lightapplication EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) - -INSTALL(FILES ${lightapplication_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) -QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") - -INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA}) \ No newline at end of file diff --git a/src/LightApplication/LightApplication.cxx b/src/LightApplication/LightApplication.cxx deleted file mode 100644 index 3b3fa2498..000000000 --- a/src/LightApplication/LightApplication.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2021 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 "LightApplication.h" -#include "LightDesktop.h" - -/*! - Default constructor -*/ -LightApplication::LightApplication() -: QObject( 0 ) -{ - myDesktop = new LightDesktop(); -} - -/*! - Destructor -*/ -LightApplication::~LightApplication() -{ - -} - -/*! - Shows the application's main widget. For non GUI application must be redefined. -*/ -void LightApplication::start() -{ - myDesktop->show(); -} \ No newline at end of file diff --git a/src/LightApplication/LightApplication.h b/src/LightApplication/LightApplication.h deleted file mode 100644 index fd9412529..000000000 --- a/src/LightApplication/LightApplication.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2007-2021 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 LIGHTAPPLICATION_H -#define LIGHTAPPLICATION_H - -#include "LightDesktop.h" - -#include - - -class LightApplication : public QObject -{ - Q_OBJECT - -public: - LightApplication(); - virtual ~LightApplication(); - - //! Shows the application's main widget. For non GUI application must be redefined. - virtual void start(); - -private: - LightDesktop * myDesktop = 0; - -}; - -#endif \ No newline at end of file diff --git a/src/LightApplication/LightDesktop.cxx b/src/LightApplication/LightDesktop.cxx deleted file mode 100644 index 847d8d4b5..000000000 --- a/src/LightApplication/LightDesktop.cxx +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (C) 2007-2021 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 // this include must be the first one as it includes Python.h -#include "LightDesktop.h" - -#include "utilities.h" - - -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/*!\class SUIT_Desktop - * Provide desktop management:\n - * \li menu manager - * \li tool manager - * \li windows - */ - -/*! - Constructor. -*/ -LightDesktop::LightDesktop() -: QtxMainWindow() -{ - myMenuMgr = new QtxActionMenuMgr( this ); - myToolMgr = new QtxActionToolMgr( this ); - myLogoMgr = new QtxLogoMgr( menuBar() ); - - createMenus(); -} - -/*! - Destructor. -*/ -LightDesktop::~LightDesktop() -{ - -} - -void LightDesktop::createMenus() -{ - //QPushButton *mybutton = new QPushButton("Test", this); - //connect(mybutton, &QPushButton::released, this, &LightDesktop::RunScript); - - //this->setCentralWidget(mybutton); - QMenu *fileMenu = menuBar()->addMenu("File"); - fileMenu->addAction("Open File", this, &LightDesktop::RunScript, QKeySequence::Open); - fileMenu->addAction("Dummy", this, SLOT( Dummy()), QKeySequence::New); -} - -void LightDesktop::Dummy() -{ - QMessageBox msgBox; - msgBox.setText("Dummy text"); - msgBox.exec(); -} - -void LightDesktop::RunScript() -{ - QString fileName = QFileDialog::getOpenFileName(this, - tr("Open Python File"), "/home/B61570/work_in_progress/salome2810", "Python Files (*.py)"); - - std::ifstream ifs(fileName.toStdString()); - std::string content( (std::istreambuf_iterator(ifs) ), - (std::istreambuf_iterator() ) ); - - - // Lock Python Global Interperter - MESSAGE("Starting Python script"); - MESSAGE("**********************"); - PyGILState_STATE gstate = PyGILState_Ensure(); - PyObject* myMainMod = PyImport_AddModule("__main__"); - PyObject* myMainDict = PyModule_GetDict(myMainMod); - - PyObject* obj = PyRun_String(content.c_str(), Py_file_input, myMainDict, NULL); - - if(obj == NULL){ - MESSAGE("Script crashed"); - PyErr_Print(); - PyGILState_Release(gstate); - } else{ - MESSAGE("ALL is well"); - Py_DECREF(obj); - } - // Get data from script - //PyObject* py_i = PyObject_GetAttrString(myMainMod, "i"); - //double i = PyFloat_AsDouble(py_i); - //Display value of i value - //std::cerr << "i: " << i << std::endl; - // Release GIL - PyGILState_Release(gstate); -} \ No newline at end of file diff --git a/src/LightApplication/LightDesktop.h b/src/LightApplication/LightDesktop.h deleted file mode 100644 index 394f39083..000000000 --- a/src/LightApplication/LightDesktop.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2021 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 LIGHTDESKTOP_H -#define LIGHTDESKTOP_H - -#include - -class QtxLogoMgr; -class QtxActionMenuMgr; -class QtxActionToolMgr; - -class LightDesktop : public QtxMainWindow -{ - Q_OBJECT - -public: - LightDesktop(); - virtual ~LightDesktop(); - - void RunScript(); - void Dummy(); - void createMenus(); - -private: - QtxActionMenuMgr* myMenuMgr; - QtxActionToolMgr* myToolMgr; - QtxLogoMgr* myLogoMgr; -}; - -#endif \ No newline at end of file diff --git a/src/LightApplication/resources/LightApplication_images.ts b/src/LightApplication/resources/LightApplication_images.ts deleted file mode 100644 index 63c601050..000000000 --- a/src/LightApplication/resources/LightApplication_images.ts +++ /dev/null @@ -1,19 +0,0 @@ - - - - - @default - - ICON_DATAOBJ_VISIBLE - icon_visibility_on.png - - - ICON_DATAOBJ_INVISIBLE - icon_visibility_off.png - - - ICON_VIEW_SYNC - view_sync.png - - - diff --git a/src/LightApplication/resources/LightApplication_msg_en.ts b/src/LightApplication/resources/LightApplication_msg_en.ts deleted file mode 100644 index 03659c6a8..000000000 --- a/src/LightApplication/resources/LightApplication_msg_en.ts +++ /dev/null @@ -1,174 +0,0 @@ - - - - - @default - - MEN_DESK_WINDOW - &Window - - - ERR_CANT_DUMP_VIEW - Can't dump view contents to the file. - - - TLT_IMAGE_FILES - Images Files (*.bmp *.png *.jpg *.jpeg) - - - MEN_DESK_WINDOW_CASCADE - &Cascade - - - PRP_DESK_WINDOW_CASCADE - Arranges the windows as overlapping tiles - - - ERR_DIR_NOT_EXIST - The directory "%1" does not exist! - - - ERR_FILE_NOT_DIR - "%1" is not a directory! - - - CONTINUE - Continue - - - CANCEL - Cancel - - - ERR_FILE_NOT_EXIST - The file "%1" does not exist! - - - QUE_DOC_FILEEXISTS - The file %1 already exists. -Do you want to overwrite it ? - - - PRP_DESK_WINDOW_ACTIVATE - Activates this window - - - ERR_PERMISSION_DENIED - Can't save file "%1". -Permission denied. - - - ERR_OPEN_PERMISSION_DENIED - Can't open file "%1". -Permission denied. - - - ERR_DIR_READ_PERMISSION_DENIED - Can't read directory "%1". -Permission denied. - - - ERR_DIR_WRITE_PERMISSION_DENIED - Can't write directory "%1". -Permission denied. - - - ERR_ERROR - Error - - - QUE_FILE_EXISTS - The file %1 already exists. -Do you want to overwrite it? - - - WRN_WARNING - Warning - - - TLT_DUMP_VIEW - Dump View to File - - - PRP_DESK_WINDOW_TILE - Arranges the windows as nonoverlapping tiles - - - MEN_DESK_WINDOW_VTILE - Tile &Vertically - - - INF_DIRECTORIES_FILTER - Directories - - - PRP_DESK_WINDOW_VTILE - Arranges the windows as nonoverlapping vertical tiles - - - MEN_DESK_WINDOW_TILE - &Tile - - - NAME_COLUMN - Name - - - MNU_SYNCHRONIZE_VIEW - Synchronize - - - DSC_SYNCHRONIZE_VIEW - Synchronize view - - - MNU_SYNC_NO_VIEW - [ No appropriate view ] - - - - SUIT_Study - - OPERATION_LAUNCH - Operation launch - - - PREVIOUS_NOT_FINISHED - Previous operation is not finished and will be aborted - - - - SUIT_FileDlg - - LAB_QUICK_PATH - Quick path: - - - BUT_ADD_PATH - Add path - - - INF_DESK_DOC_OPEN - Open File - - - INF_DESK_DOC_SAVE - Save File - - - ALL_FILES_FILTER - All files (*) - - - - SUIT_ViewWindow - - TLT_DUMP_VIEW - Dump view to file - - - TLT_IMAGE_FILES - Images Files (*.bmp *.png *.jpg *.jpeg) - - - diff --git a/src/LightApplication/resources/LightApplication_msg_fr.ts b/src/LightApplication/resources/LightApplication_msg_fr.ts deleted file mode 100644 index 97f2cf33d..000000000 --- a/src/LightApplication/resources/LightApplication_msg_fr.ts +++ /dev/null @@ -1,174 +0,0 @@ - - - - - @default - - MEN_DESK_WINDOW - &Fenêtre - - - ERR_CANT_DUMP_VIEW - Impossible de sauvegarder le contenu de la vue dans le fichier. - - - TLT_IMAGE_FILES - Fichiers images (*.bmp *.png *.jpg *.jpeg) - - - MEN_DESK_WINDOW_CASCADE - &Cascade - - - PRP_DESK_WINDOW_CASCADE - Superpose les fenêtres - - - ERR_DIR_NOT_EXIST - Le répertoire "%1" n'existe pas ! - - - ERR_FILE_NOT_DIR - "%1" n'est pas un répertoire ! - - - CONTINUE - Continuer - - - CANCEL - Annuler - - - ERR_FILE_NOT_EXIST - Le fichier "%1" n'existe pas ! - - - QUE_DOC_FILEEXISTS - Le fichier %1 existe déjà. -Voulez-vous l'écraser ? - - - PRP_DESK_WINDOW_ACTIVATE - Active la fenêtre - - - ERR_PERMISSION_DENIED - Impossible de sauvegarder le fichier "%1". -Autorisation interdite. - - - ERR_OPEN_PERMISSION_DENIED - Impossible d'ouvrir le fichier "%1". -Autorisation interdite. - - - ERR_DIR_READ_PERMISSION_DENIED - Impossible de lire le répertoire "%1". -Autorisation interdite. - - - ERR_DIR_WRITE_PERMISSION_DENIED - Impossible d'écrire dans le répertoire "%1". -Autorisation interdite. - - - ERR_ERROR - Erreur - - - QUE_FILE_EXISTS - Le fichier %1 existe déjà. -Voulez-vous l'écraser ? - - - WRN_WARNING - Avertissement - - - TLT_DUMP_VIEW - Enregistrer la vue dans le fichier - - - PRP_DESK_WINDOW_TILE - Place les fenêtres en mosaïque - - - MEN_DESK_WINDOW_VTILE - Mosaïque &verticale - - - INF_DIRECTORIES_FILTER - Répertoires - - - PRP_DESK_WINDOW_VTILE - Place les fenêtres en mosaïque verticale - - - MEN_DESK_WINDOW_TILE - &Mosaïque - - - NAME_COLUMN - Nom - - - MNU_SYNCHRONIZE_VIEW - Synchroniser - - - DSC_SYNCHRONIZE_VIEW - Synchroniser la vue - - - MNU_SYNC_NO_VIEW - [ Pas de vue appropriée ] - - - - SUIT_Study - - OPERATION_LAUNCH - Lancer l'opération - - - PREVIOUS_NOT_FINISHED - L'opération précédente n'est pas aboutie et sera interrompue - - - - SUIT_FileDlg - - LAB_QUICK_PATH - Emplacement : - - - BUT_ADD_PATH - Ajouter un chemin - - - INF_DESK_DOC_OPEN - Ouvrir un fichier - - - INF_DESK_DOC_SAVE - Sauvegarder un fichier - - - ALL_FILES_FILTER - Tous les fichiers (*) - - - - SUIT_ViewWindow - - TLT_DUMP_VIEW - Enregistrer la vue dans le fichier - - - TLT_IMAGE_FILES - Fichiers images (*.bmp *.png *.jpg *.jpeg) - - - diff --git a/src/LightApplication/resources/LightApplication_msg_ja.ts b/src/LightApplication/resources/LightApplication_msg_ja.ts deleted file mode 100644 index 8da7266db..000000000 --- a/src/LightApplication/resources/LightApplication_msg_ja.ts +++ /dev/null @@ -1,168 +0,0 @@ - - - - - @default - - MEN_DESK_WINDOW - ウィンドウ(&W) - - - ERR_CANT_DUMP_VIEW - ビューの内容をファイルに保存できませんでした。 - - - TLT_IMAGE_FILES - イメージ (*.bmp *.png *.jpg *.jpeg) ファイル - - - MEN_DESK_WINDOW_CASCADE - カスケード(&C) - - - PRP_DESK_WINDOW_CASCADE - Windows ではスーパーイン ポーズ - - - ERR_DIR_NOT_EXIST - ディレクトリ"%1"は存在しません! - - - ERR_FILE_NOT_DIR - "%1"はディレクトリではありません ! - - - CONTINUE - 続行 - - - CANCEL - キャンセル - - - ERR_FILE_NOT_EXIST - ファイル"%1"は存在しません! - - - QUE_DOC_FILEEXISTS - ファイル %1 は既に存在します。それを上書きしますか。 - - - PRP_DESK_WINDOW_ACTIVATE - アクティブ ウィンドウ - - - ERR_PERMISSION_DENIED - ファイル"%1"を保存できません。アクセス許可は、禁じられています。 - - - ERR_OPEN_PERMISSION_DENIED - ファイル"%1"を開けません。アクセス許可は、禁じられています。 - - - ERR_DIR_READ_PERMISSION_DENIED - ディレクトリ"%1"を読み取れません。アクセス許可は、禁じられています。 - - - ERR_DIR_WRITE_PERMISSION_DENIED - ディレクトリ"%1"に書き込めませんでした。アクセス許可は、禁じられています。 - - - ERR_ERROR - エラー - - - QUE_FILE_EXISTS - ファイル %1 は既に存在します。それを上書きしますか。 - - - WRN_WARNING - 注意 ! - - - TLT_DUMP_VIEW - ビューでファイルを保存します。 - - - PRP_DESK_WINDOW_TILE - ウィンドウの場所 - - - MEN_DESK_WINDOW_VTILE - 垂直方向のモザイク(&V) - - - INF_DIRECTORIES_FILTER - ディレクトリ - - - PRP_DESK_WINDOW_VTILE - 垂直方向のモザイクで Windows の場所 - - - MEN_DESK_WINDOW_TILE - モザイク(&T) - - - NAME_COLUMN - 名前 - - - MNU_SYNCHRONIZE_VIEW - 同期 - - - DSC_SYNCHRONIZE_VIEW - ビューを同期します。 - - - MNU_SYNC_NO_VIEW - [適切なビューを使用しない] - - - - SUIT_Study - - OPERATION_LAUNCH - 操作を開始します。 - - - PREVIOUS_NOT_FINISHED - 前の操作が開発し、中断されます。 - - - - SUIT_FileDlg - - LAB_QUICK_PATH - 場所: - - - BUT_ADD_PATH - パスの追加 - - - INF_DESK_DOC_OPEN - ファイルを開く - - - INF_DESK_DOC_SAVE - ファイルを保存します。 - - - ALL_FILES_FILTER - すべてのファイル (*) - - - - SUIT_ViewWindow - - TLT_DUMP_VIEW - ビューでファイルを保存します。 - - - TLT_IMAGE_FILES - イメージ (*.bmp *.png *.jpg *.jpeg) ファイル - - - diff --git a/src/LightApplication/resources/icon_visibility_off.png b/src/LightApplication/resources/icon_visibility_off.png deleted file mode 100644 index 31c505d82..000000000 Binary files a/src/LightApplication/resources/icon_visibility_off.png and /dev/null differ diff --git a/src/LightApplication/resources/icon_visibility_on.png b/src/LightApplication/resources/icon_visibility_on.png deleted file mode 100644 index 61ebe4703..000000000 Binary files a/src/LightApplication/resources/icon_visibility_on.png and /dev/null differ diff --git a/src/LightApplication/resources/view_sync.png b/src/LightApplication/resources/view_sync.png deleted file mode 100644 index 32b95228a..000000000 Binary files a/src/LightApplication/resources/view_sync.png and /dev/null differ diff --git a/src/Session/CMakeLists.txt b/src/Session/CMakeLists.txt index c39457539..e6e342f69 100644 --- a/src/Session/CMakeLists.txt +++ b/src/Session/CMakeLists.txt @@ -35,7 +35,7 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/SUIT ${PROJECT_SOURCE_DIR}/src/Event ${PROJECT_SOURCE_DIR}/src/Style - ${PROJECT_SOURCE_DIR}/src/LightApplication + ${PROJECT_SOURCE_DIR}/src/DummyApplication ${PROJECT_SOURCE_DIR}/src/STD ${PROJECT_SOURCE_DIR}/src/CAM ${PROJECT_SOURCE_DIR}/src/OBJECT @@ -69,7 +69,7 @@ SET(_link_LIBRARIES ${KERNEL_SalomeLauncher} ${KERNEL_Registry} ${KERNEL_SALOMEBasics} - qtx lightapplication suit Event SalomeStyle SalomeApp SalomeIDLGUI + qtx dummyapplication suit Event SalomeStyle SalomeApp SalomeIDLGUI ) # --- headers --- diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index f7ca70ebe..34122b747 100644 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -56,7 +56,7 @@ #include "SUIT_Session.h" #include "SUIT_Tools.h" -#include "LightApplication.h" +#include "DummyApplication.h" #include #include CORBA_SERVER_HEADER(SALOME_Session) @@ -733,7 +733,7 @@ int AbstractGUIAppMain(int argc, char **argv) MESSAGE("creation SUIT_Application"); MESSAGE(NamingServiceImplementation::LibName ); //SUIT_Application *aGUIApp = aGUISession->startApplication(NamingServiceImplementation::LibName, 0, 0); - LightApplication *aGUIApp = new LightApplication(); + DummyApplication *aGUIApp = new DummyApplication(); aGUIApp->start(); if (aGUIApp) diff --git a/src/Session/salomeLight.cxx b/src/Session/salomeLight.cxx new file mode 100644 index 000000000..a273572b8 --- /dev/null +++ b/src/Session/salomeLight.cxx @@ -0,0 +1,110 @@ +// Copyright (C) 2021 CEA/DEN, EDF R&D +// +// 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 +#include +#include + +#include +#include + +int main(int argc, char *argv[]) +{ + constexpr char MAIN_PROGRAM[] = "SALOME_Session_Server_No_Server"; + constexpr char NO_SERVER_ENV_VAR[] = "SALOME_EMB_SERVANT"; + constexpr char PYQT5_NOT_MASTER[] = "PYQT5_NOT_MASTER"; + const char *MODULES[]={"GUI"}; + const char *MODULES_PATH[]={"PYHELLO","GUI","SHAPER","SHAPERSTUDY","GEOM","SMESH","HYBRIDPLUGIN","BLSURFPLUGIN","GMSHPLUGIN","HEXABLOCKPLUGIN","NETGENPLUGIN"}; +// #ifndef WIN32 +// const char *MODULES[]={"SHAPERSTUDY","GEOM","SMESH","YACS","HYBRIDPLUGIN","GHS3DPLUGIN","BLSURFPLUGIN","GMSHPLUGIN","HEXABLOCKPLUGIN","HEXOTICPLUGIN","GHS3DPRLPLUGIN","NETGENPLUGIN"}; +// const char *MODULES_PATH[]={"GUI","SHAPER","SHAPERSTUDY","GEOM","SMESH","YACS","HYBRIDPLUGIN","GHS3DPLUGIN","BLSURFPLUGIN","GMSHPLUGIN","HEXABLOCKPLUGIN","GHS3DPRLPLUGIN","NETGENPLUGIN"}; +// #else +// const char *MODULES[]={"SHAPERSTUDY","GEOM","SMESH","HYBRIDPLUGIN","BLSURFPLUGIN","GMSHPLUGIN","HEXABLOCKPLUGIN","HEXOTICPLUGIN","NETGENPLUGIN"}; +// const char *MODULES_PATH[]={"GUI","SHAPER","SHAPERSTUDY","GEOM","SMESH","HYBRIDPLUGIN","BLSURFPLUGIN","GMSHPLUGIN","HEXABLOCKPLUGIN","NETGENPLUGIN"}; +// #endif + constexpr char APPCONFIG[]="SalomeAppSLConfig"; + QProcessEnvironment pe(QProcessEnvironment::systemEnvironment()); + QStringList modulesPaths; + for(auto elt : MODULES_PATH) + { + QString elt_root_dir( QString("%1_ROOT_DIR").arg(elt) ); + if( !pe.contains(elt_root_dir) || pe.value(elt_root_dir).isEmpty() ) + { + std::cerr << elt_root_dir.toStdString() << " is not defined in your environment !" << std::endl; + return 1; + } + modulesPaths << QDir::fromNativeSeparators( QString("%1/share/salome/resources/%2").arg( pe.value(elt_root_dir) ).arg( QString(elt).toLower() ) ); + } + // fill LightAppConfig env var + QString appconfig_val( modulesPaths.join(QDir::listSeparator())); + pe.insert(APPCONFIG,appconfig_val); + //tells shutup to salome.salome_init invoked at shaper engine ignition + pe.insert(NO_SERVER_ENV_VAR,"1"); + pe.insert(PYQT5_NOT_MASTER,"1"); + //resource file retrieve + QString resfile; + { + QProcess proc; + proc.setProcessEnvironment(pe); + proc.setProgram("python3"); + proc.setArguments({"-c","from launchConfigureParser import userFile ; import sys ; sys.stdout.write(userFile(\"SalomeApp\",\"salome\"))"}); + proc.start(); + proc.waitForFinished(-1); + if(proc.exitStatus() != QProcess::NormalExit) + { + std::cerr << "Fail to retrieve resource file from launchConfigureParser python module !" << std::endl; + return 1; + } + QByteArray val(proc.readAllStandardOutput()); + resfile = QString::fromUtf8(val); + } + // + QProcess proc; + proc.setProcessEnvironment(pe); + proc.setProgram(MAIN_PROGRAM); + + QStringList args({"--with","Registry","(","--salome_session","theSession",")","--with","ModuleCatalog","(","-common"}); + QStringList catalogs; + for(std::size_t im = 0 ; im < sizeof(MODULES)/sizeof(decltype(MODULES[0])) ; ++im ) + { + QString root_dir = pe.value( QString("%1_ROOT_DIR").arg(MODULES[im]) ); + catalogs << QDir::toNativeSeparators( QString("%1/share/salome/resources/%2/%3Catalog.xml").arg(root_dir).arg(QString(MODULES[im]).toLower()).arg(MODULES[im]) ); + } + args << catalogs.join("::"); + args << ")" << "--hide-splash" << "--modules" << "(GUI)"; + args << "--with" << "SALOMEDS" << "(" << ")" << "--with" << "Container" << "(" << "FactoryServer" << ")"; + if( pe.contains("VERBOSE") ) + { + std::cout << "Overloaded env var :" << std::endl; + std::cout << " - " << NO_SERVER_ENV_VAR << std::endl; + std::cout << " - " << APPCONFIG << " = " << appconfig_val.toStdString() << std::endl; + std::cout << "Command launched :" << std::endl; + // Building string of command + std::string cmd = args.join(" ").toStdString(); + // Adding quotes around ( and ) as they are interpreted by bash + cmd = std::regex_replace(cmd, std::regex("\\("), "\"(\""); + cmd = std::regex_replace(cmd, std::regex("\\)"), "\")\""); + std::cout << MAIN_PROGRAM << " " << cmd << std::endl; + } + proc.setArguments(args); + proc.setProcessChannelMode( QProcess::ForwardedErrorChannel ); + proc.start(); + proc.waitForFinished(-1); + return proc.exitCode(); +}