From: jh777916 Date: Tue, 3 Oct 2023 12:47:18 +0000 (+0200) Subject: Adding SetLegendVisible method to the cpp library X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6290515c347010dfe6a8e954c6d4119313e5ed20;p=modules%2Fgui.git Adding SetLegendVisible method to the cpp library --- 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);