From: jh777916 Date: Thu, 7 Sep 2023 11:53:19 +0000 (+0200) Subject: Starting to reorganize ... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6349a80d60cba133d7fd145587a772fcf5fc766d;p=modules%2Fgui.git Starting to reorganize ... --- diff --git a/tools/CurvePlot/CMakeLists.txt b/tools/CurvePlot/CMakeLists.txt index e70d4b140..98f2c494f 100644 --- a/tools/CurvePlot/CMakeLists.txt +++ b/tools/CurvePlot/CMakeLists.txt @@ -36,7 +36,7 @@ SET(${PROJECT_NAME_UC}_VERSION_DEV 0) # User options # ============ OPTION(SALOME_CURVEPLOT_STANDALONE "Standalone installation of CURVEPLOT" OFF) -OPTION(SALOME_BUILD_DOC "Generate SALOME CURVEPLOT documentation" OFF) +OPTION(SALOME_BUILD_DOC "Generate SALOME CURVEPLOT documentation" ON) OPTION(SALOME_BUILD_TESTS "Generate SALOME CURVEPLOT tests" ON) # Common CMake macros @@ -116,6 +116,13 @@ SALOME_PACKAGE_REPORT_AND_CHECK() # Directories # =========== +message(STATUS "*********************************************************************************************************") +message(STATUS "------- CURVE PLOT : SALOME_INSTALL_PYTHON=${SALOME_INSTALL_PYTHON}") +message(STATUS "------- CURVE PLOT : SALOME_INSTALL_SCRIPT_PYTHON=${SALOME_INSTALL_SCRIPT_PYTHON}") +message(STATUS "------- CURVE PLOT : SALOME_CURVEPLOT_INSTALL_PYTHON=${SALOME_CURVEPLOT_INSTALL_PYTHON}") +message(STATUS "------- CURVE PLOT : SALOME_CURVEPLOT_INSTALL_SCRIPT_PYTHON=${SALOME_CURVEPLOT_INSTALL_SCRIPT_PYTHON}") +message(STATUS "*********************************************************************************************************") + IF(SALOME_CURVEPLOT_STANDALONE) SET(SALOME_INSTALL_LIBS lib/salome CACHE PATH "Install path: SALOME libs") SET(_pydir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages) diff --git a/tools/CurvePlot/src/cpp/CMakeLists.txt b/tools/CurvePlot/src/cpp/CMakeLists.txt index 4e33fae64..3728fec1f 100644 --- a/tools/CurvePlot/src/cpp/CMakeLists.txt +++ b/tools/CurvePlot/src/cpp/CMakeLists.txt @@ -22,6 +22,17 @@ ADD_SUBDIRECTORY(test) # --- options --- # additional include directories + +MESSAGE(STATUS "*======================================================================*") +MESSAGE(STATUS "VARIABLE PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}") +MESSAGE(STATUS "VARIABLE NUMPY_INCLUDE_DIRS = ${NUMPY_INCLUDE_DIRS}") +MESSAGE(STATUS "VARIABLE GUI_INCLUDE_DIRS = ${GUI_INCLUDE_DIRS}") +MESSAGE(STATUS "VARIABLE PYTHON_DEFINITIONS = ${PYTHON_DEFINITIONS}") +MESSAGE(STATUS "VARIABLE PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}") +MESSAGE(STATUS "VARIABLE GUI_PyInterp = ${GUI_PyInterp}") + +MESSAGE(STATUS "*======================================================================*") + INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR} diff --git a/tools/CurvePlot/src/cpp/CurvePlot.cxx b/tools/CurvePlot/src/cpp/CurvePlot.cxx index cd5e751ed..ebae22604 100644 --- a/tools/CurvePlot/src/cpp/CurvePlot.cxx +++ b/tools/CurvePlot/src/cpp/CurvePlot.cxx @@ -205,6 +205,9 @@ namespace CURVEPLOT code = std::string("import curveplot;")+ std::string("__cont=curveplot.PlotController.GetInstance()"); + PyRun_SimpleString("import site\n"); + PyRun_SimpleString("print(site.getsitepackages())\n"); + int ret = PyRun_SimpleString(const_cast(code.c_str())); if (ret == -1) throw Exception("CurvePlot::CurvePlot(): Unable to load curveplot Python module!"); diff --git a/tools/CurvePlot/src/cpp/test/test_curveplot.cxx b/tools/CurvePlot/src/cpp/test/test_curveplot.cxx index 9189ac21f..cfee766ab 100644 --- a/tools/CurvePlot/src/cpp/test/test_curveplot.cxx +++ b/tools/CurvePlot/src/cpp/test/test_curveplot.cxx @@ -83,9 +83,17 @@ void initPython() PyRun_SimpleString("import threading\n"); + std::cout << " > Inside initPython() - inside condition" << std::endl; + + // PyRun_SimpleString("import site\n"); + // PyRun_SimpleString("print(site.getsitepackages())\n"); + PyThreadState *pts = PyGILState_GetThisThreadState(); PyEval_ReleaseThread(pts); + } + std::cout << " > Inside initPython()" << std::endl; + } /* Little hack to gather widgets created on the Python side */ @@ -115,7 +123,11 @@ int main(int argc, char ** argv) mw.show(); initPython(); // mimic SALOME Python's initialisation. + std::cout << " > initPython() done" << std::endl; + + InitializeCurvePlot(); + std::cout << " > InitializeCurvePlot() done" << std::endl; { // Make sure the first instanciation of CurvePlot is made in test mode! diff --git a/tools/CurvePlot/src/python/test/CMakeLists.txt b/tools/CurvePlot/src/python/test/CMakeLists.txt index de81a52dd..57e618999 100644 --- a/tools/CurvePlot/src/python/test/CMakeLists.txt +++ b/tools/CurvePlot/src/python/test/CMakeLists.txt @@ -36,6 +36,8 @@ SET(_test_SCRIPTS SALOME_INSTALL_SCRIPTS("${_all_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}/tests) SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/mockup/SalomePyQt_MockUp.py ${SALOME_INSTALL_SCRIPT_PYTHON}/tests) +SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/mockup/SalomePyQt_MockUp.py ${SALOME_CURVEPLOT_INSTALL_PYTHON}) + INSTALL(DIRECTORY baselines DESTINATION ${SALOME_INSTALL_SCRIPT_PYTHON}/tests) diff --git a/tools/CurvePlot/src/python/views/CurveView.py b/tools/CurvePlot/src/python/views/CurveView.py index c585e0c18..8feae780d 100644 --- a/tools/CurvePlot/src/python/views/CurveView.py +++ b/tools/CurvePlot/src/python/views/CurveView.py @@ -197,10 +197,10 @@ class CurveView(View): def setAlpha(self, opacity): m = self._model - # Check si BarModel ou CurveModel + # Check si BarModel ou CurveModel00 if (m._name == "BarModel"): - bar = self._mplBars - bar.set_alpha(opacity) + for rect in self._mplBars: + rect.set_alpha(opacity) else: lin = self._mplLines[0] lin.set_alpha(opacity) diff --git a/tools/CurvePlot/src/python/views/XYView.py b/tools/CurvePlot/src/python/views/XYView.py index a00310fc8..738da3224 100644 --- a/tools/CurvePlot/src/python/views/XYView.py +++ b/tools/CurvePlot/src/python/views/XYView.py @@ -185,10 +185,18 @@ class XYView(View): a = event.artist Logger.Debug(" > Artist picked : {}".format(a)) - for crv_id, legHandler in enumerate(self._legend.legendHandles): - if legHandler is a : - selected_id = crv_id - Logger.Debug("Legend {} selected".format(selected_id)) + if self._legend is not None: + for leg_idx,legHandler in enumerate(self._legend.legendHandles): + if legHandler is a : + selected_id = leg_idx + Logger.Debug("Legend {} selected".format(selected_id)) + # if legHandler is a: + # Logger.Debug(" ---> Picked artist : {}, adress : {}".format(legHandler, id(legHandler))) + # for crv_id, cv in list(self._curveViews.items()): + # if (cv._model._name == "BarModel") : + # if legHandler in cv._mplBars: + # selected_id = crv_id + # Logger.Debug("Barplot {} selected".format(selected_id)) for crv_id, cv in list(self._curveViews.items()): if (cv._model._name == "BarModel") :