From 76e43ea5bf26a2348d4999895efd705af601a385 Mon Sep 17 00:00:00 2001 From: mzn Date: Thu, 20 Oct 2016 11:22:02 +0300 Subject: [PATCH] Lot4: add new files to installation. --- CMakeLists.txt | 1 + src/CMakeLists.txt | 1 + src/HYDROGUI/BndConditionsDialog.py | 18 ++++++++-------- src/HYDROGUI/CMakeLists.txt | 6 ++++++ tests/CMakeLists.txt | 33 +++++++++++++++++++++++++++++ tests/boundaryConditionsDlgTest.py | 3 ++- tests/boundaryConditionsTest.py | 3 ++- 7 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 tests/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 81d5846..27adaaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,6 +152,7 @@ ADD_SUBDIRECTORY(adm_local) ADD_SUBDIRECTORY(resources) ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(idl) +ADD_SUBDIRECTORY(tests) IF(SALOME_BUILD_DOC) ADD_SUBDIRECTORY(doc) ENDIF() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b128c53..51f4070 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,5 +17,6 @@ ADD_SUBDIRECTORY(HYDRO) ADD_SUBDIRECTORY(HYDROGUI) +ADD_SUBDIRECTORY(HYDROTools) ADD_SUBDIRECTORY(salome_hydro) #ADD_SUBDIRECTORY(mascaret_wrapper) diff --git a/src/HYDROGUI/BndConditionsDialog.py b/src/HYDROGUI/BndConditionsDialog.py index 2d1200e..29cb4ba 100644 --- a/src/HYDROGUI/BndConditionsDialog.py +++ b/src/HYDROGUI/BndConditionsDialog.py @@ -18,15 +18,15 @@ import os import sys -from PyQt4 import QtCore, QtGui +from PyQt4 import QtCore, QtGui, uic from MEDLoader import MEDFileMesh # TODO: get rid of sys.path.append() ? -sys.path.append(os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'src', 'HYDROTools')) -import boundaryConditions +hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome') +sys.path.append(os.path.join(hydro_solver_root, 'salome', 'hydrotools')) -from Ui_BndConditionsDialog import Ui_BoundaryConditionsDialog +import boundaryConditions ROW_PROPERTY_NAME = "row" @@ -100,13 +100,12 @@ class ValueDelegate(QtGui.QStyledItemDelegate): editor.setGeometry(option.rect) """Boundary conditions definition dialog""" -class BoundaryConditionsDialog(Ui_BoundaryConditionsDialog, QtGui.QDialog): +class BoundaryConditionsDialog(QtGui.QDialog): def __init__(self, parent = None, modal = 0): QtGui.QDialog.__init__(self, parent) - Ui_BoundaryConditionsDialog.__init__(self) - self.setupUi(self) - + uic.loadUi(os.path.join(hydro_solver_root,'BndConditionsDialog.ui'), self) + # Connections self.medFileButton.clicked.connect(self.on_med_file_browse) self.bndConditionsFileButton.clicked.connect(self.on_bnd_file_browse) @@ -135,7 +134,8 @@ class BoundaryConditionsDialog(Ui_BoundaryConditionsDialog, QtGui.QDialog): """Initialize presets""" def init_presets(self): # TODO: determine another presets path - file_path = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'tests', 'data', 'bnd_conditions_presets.txt') + presets_data_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome', 'tests', 'data') + file_path = os.path.join(presets_data_root, 'bnd_conditions_presets.txt') reader = boundaryConditions.PresetReader(file_path) self.presets = reader.read() diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index b6738e5..af6eb29 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -19,10 +19,16 @@ SET(PYFILES HYDROSOLVERGUI.py + BndConditionsDialog.py +) + +SET(UIFILES + BndConditionsDialog.ui ) # --- rules --- SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}) +INSTALL( FILES ${UIFILES} DESTINATION ${SALOME_INSTALL_PYTHON}) # The file TextDisplayDialog.ui is not compiled here because it is not used anymore. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..ffa9d54 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright (C) 2012-2013 EDF +# +# This file is part of SALOME HYDRO module. +# +# SALOME HYDRO module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME HYDRO module 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with SALOME HYDRO module. If not, see . + +# --- Python files --- + +SET(DATAFILES + data/bnd_conditions_presets.txt + data/bnd_conditions1.cli +) + +SET(PYFILES + boundaryConditionsTest.py + boundaryConditionsDlgTest.py +) + +# --- rules --- + +SALOME_INSTALL_SCRIPTS( "${PYFILES}" ${SALOME_INSTALL_PYTHON}/tests) +INSTALL( FILES ${DATAFILES} DESTINATION ${SALOME_INSTALL_PYTHON}/tests/data) \ No newline at end of file diff --git a/tests/boundaryConditionsDlgTest.py b/tests/boundaryConditionsDlgTest.py index 0390952..b38b0c0 100644 --- a/tests/boundaryConditionsDlgTest.py +++ b/tests/boundaryConditionsDlgTest.py @@ -6,7 +6,8 @@ from PyQt4 import QtGui cur_dir = os.path.dirname(os.path.realpath(__file__)) data_dir = os.path.join(cur_dir, "data") -sys.path.append(os.path.join(cur_dir, "..", "src", "HYDROGUI")) +hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome') +sys.path.append(hydro_solver_root) from BndConditionsDialog import BoundaryConditionsDialog # Show the dialog diff --git a/tests/boundaryConditionsTest.py b/tests/boundaryConditionsTest.py index 0c22492..1ea91eb 100644 --- a/tests/boundaryConditionsTest.py +++ b/tests/boundaryConditionsTest.py @@ -8,7 +8,8 @@ import unittest cur_dir = os.path.dirname(os.path.realpath(__file__)) data_dir = os.path.join(cur_dir, "data") -sys.path.append(os.path.join(cur_dir, "..", "src", "HYDROTools")) +hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', 'python2.7', 'site-packages', 'salome') +sys.path.append(hydro_solver_root) import boundaryConditions -- 2.39.2