From 6290515c347010dfe6a8e954c6d4119313e5ed20 Mon Sep 17 00:00:00 2001 From: jh777916 Date: Tue, 3 Oct 2023 14:47:18 +0200 Subject: [PATCH] Adding SetLegendVisible method to the cpp library --- tools/CurvePlot/src/cpp/CurvePlot.cxx | 10 ++++++++++ tools/CurvePlot/src/cpp/CurvePlot.hxx | 2 ++ 2 files changed, 12 insertions(+) diff --git a/tools/CurvePlot/src/cpp/CurvePlot.cxx b/tools/CurvePlot/src/cpp/CurvePlot.cxx index 0a1f20ecb..4c90126eb 100644 --- a/tools/CurvePlot/src/cpp/CurvePlot.cxx +++ b/tools/CurvePlot/src/cpp/CurvePlot.cxx @@ -487,6 +487,16 @@ namespace CURVEPLOT HandleAndPrintPyError("CurvePlot::SetCurrentPlotSet(): unexpected error!"); } + void CurvePlot::SetLegendVisible(PlotID plot_set_id, bool visible) + { + PyLockWrapper lock; + PyObject * cont = GetInstance()->_impl->_controller; + + PyObjWrapper ret( + PyObject_CallMethod(cont, (char *)"SetLegendVisible", (char *)"ii", plot_set_id, visible ? 1 : 0)); + HandleAndPrintPyError("CurvePlot::SetLegendVisible(): unexpected error!"); + } + bool CurvePlot::IsValidPlotSetID(PlotID plot_set_id) { PyLockWrapper lock; diff --git a/tools/CurvePlot/src/cpp/CurvePlot.hxx b/tools/CurvePlot/src/cpp/CurvePlot.hxx index d59b9f961..4b43c7c79 100644 --- a/tools/CurvePlot/src/cpp/CurvePlot.hxx +++ b/tools/CurvePlot/src/cpp/CurvePlot.hxx @@ -130,6 +130,8 @@ namespace CURVEPLOT static void ToggleCurveBrowser(bool with_curve_browser); + static void SetLegendVisible(PlotID plot_set_id, bool visible=true); + static bool IsValidPlotSetID(PlotID plot_set_id=-1); static int GetSalomeViewID(PlotID plot_set_id); -- 2.39.2