]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Starting to reorganize ...
authorjh777916 <juba.hamma@cea.fr>
Thu, 7 Sep 2023 11:53:19 +0000 (13:53 +0200)
committerjh777916 <juba.hamma@cea.fr>
Thu, 7 Sep 2023 11:53:19 +0000 (13:53 +0200)
tools/CurvePlot/CMakeLists.txt
tools/CurvePlot/src/cpp/CMakeLists.txt
tools/CurvePlot/src/cpp/CurvePlot.cxx
tools/CurvePlot/src/cpp/test/test_curveplot.cxx
tools/CurvePlot/src/python/test/CMakeLists.txt
tools/CurvePlot/src/python/views/CurveView.py
tools/CurvePlot/src/python/views/XYView.py

index e70d4b14060d2979470c52dee183e1a33a28cdc7..98f2c494f2d9594625aa04c5e42dac861f8ebed6 100644 (file)
@@ -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)
index 4e33fae6400a244d5e504c0e81822876647aa77c..3728fec1f0333d2f34ccf462427bb1e18a9c3e09 100644 (file)
@@ -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}
index cd5e751ed25b59aad12f5ba14fd35f34fc4e3117..ebae22604469db0874ffbc604fe86d984b65b5f4 100644 (file)
@@ -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<char*>(code.c_str()));
     if (ret == -1)
       throw Exception("CurvePlot::CurvePlot(): Unable to load curveplot Python module!");
index 9189ac21f4964fd3594aa10ba1dd82dd6d507f5b..cfee766ab8ca13b784d12346e3a9e1e4121d8870 100644 (file)
@@ -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!
index de81a52dd654faef4db0652f6e03e81f48433494..57e6189996b1397330ae3e7d296e37f6b7a49869 100644 (file)
@@ -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)
 
index c585e0c1848b84c97e94a697119b8ee5e28852d8..8feae780da68dcde05ce3060a1c6f6cfd3f065c7 100644 (file)
@@ -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)
index a00310fc8bcd8506a6e7abd813cf18120184ffb1..738da3224c59556c2847ea98b8ce684350db8041 100644 (file)
@@ -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") :