From 587bb57ce32e63bb10832a21ecdc3e73a49fcce7 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 26 Mar 2025 14:27:36 +0900 Subject: [PATCH 1/2] remove sofaguiqt references --- .../SofaGui/Bindings.SofaGuiConfig.cmake.in | 4 --- bindings/SofaGui/CMakeLists.txt | 6 ---- .../SofaPython3/SofaGui/Module_SofaGui.cpp | 30 ------------------- 3 files changed, 40 deletions(-) diff --git a/bindings/SofaGui/Bindings.SofaGuiConfig.cmake.in b/bindings/SofaGui/Bindings.SofaGuiConfig.cmake.in index e2b8ade00..84ca38dae 100644 --- a/bindings/SofaGui/Bindings.SofaGuiConfig.cmake.in +++ b/bindings/SofaGui/Bindings.SofaGuiConfig.cmake.in @@ -12,10 +12,6 @@ if(Sofa.GUI.Batch_FOUND) find_package(Sofa.GUI.Batch QUIET REQUIRED) endif() -if(Sofa.GUI.Qt_FOUND) - find_package(Sofa.GUI.Qt QUIET REQUIRED) -endif() - if(Sofa.GUI.HeadlessRecorder_FOUND) find_package(Sofa.GUI.HeadlessRecorder QUIET REQUIRED) endif() diff --git a/bindings/SofaGui/CMakeLists.txt b/bindings/SofaGui/CMakeLists.txt index 5109b90fc..1b45ce512 100644 --- a/bindings/SofaGui/CMakeLists.txt +++ b/bindings/SofaGui/CMakeLists.txt @@ -21,12 +21,6 @@ if(Sofa.GUI.Batch_FOUND AND SP3_WITH_SOFAGUIBATCH) list(APPEND SUPPORTED_GUIS Sofa.GUI.Batch) endif() -sofa_find_package(Sofa.GUI.Qt QUIET) -CMAKE_DEPENDENT_OPTION(SP3_WITH_SOFAGUIQT "Enable the SOFA Qt gui component." ON "Sofa.GUI.Qt_FOUND" OFF) -if(Sofa.GUI.Qt_FOUND AND SP3_WITH_SOFAGUIQT) - list(APPEND SUPPORTED_GUIS Sofa.GUI.Qt) -endif() - sofa_find_package(Sofa.GUI.HeadlessRecorder QUIET) CMAKE_DEPENDENT_OPTION(SP3_WITH_SOFAGUIHEADLESSRECORDER "Enable the SOFA HeadlessRecorder gui component." ON "Sofa.GUI.HeadlessRecorder_FOUND" OFF) if(Sofa.GUI.HeadlessRecorder_FOUND AND SP3_WITH_SOFAGUIHEADLESSRECORDER) diff --git a/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp b/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp index 486a0354c..a7a84d1f0 100644 --- a/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp +++ b/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp @@ -31,12 +31,6 @@ using sofa::helper::system::FileSystem; #define HAS_GUI_BATCH #endif -#if __has_include() -#include -#include -#define HAS_GUI_QT -#endif - #if __has_include() #include #define HAS_GUI_HEADLESSRECORDER @@ -70,34 +64,10 @@ PYBIND11_MODULE(Gui, m) { )doc"; -#ifdef HAS_GUI_QT - std::string sofaPrefixAbsolute = sofa::helper::Utils::getSofaPathPrefix(); - std::string inputFilepath = FileSystem::cleanPath(sofaPrefixAbsolute + "/bin/qt.conf"); - bool success = sofa::gui::qt::loadQtConfWithCustomPrefix(inputFilepath, sofaPrefixAbsolute); - if(success) - { - msg_info("Sofa.Gui") << "Loaded qt.conf from " << inputFilepath << " customized with Prefix = " << sofaPrefixAbsolute; - } - else - { - msg_warning("Sofa.Gui") << "Failed loading and/or customizing qt.conf from " << inputFilepath; - - std::cout << "qt_resource_data:" << std::endl; - for (auto d : qt_resource_data) - { - std::cout << d; - } - std::cout << std::endl; - } -#endif // HAS_GUI_QT - // forcefullly link libraries at compile-time #ifdef HAS_GUI_BATCH sofa::gui::batch::init(); #endif -#ifdef HAS_GUI_QT - sofa::gui::qt::init(); -#endif #ifdef HAS_GUI_HEADLESSRECORDER sofa::gui::headlessrecorder::init(); #endif From 1b3043db2f680b8b61357ce4393843f20a971ae2 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Mon, 31 Mar 2025 15:30:31 +0900 Subject: [PATCH 2/2] update examples using qt guis --- examples/basic-addGUI.py | 3 ++- examples/emptyController.py | 1 + examples/emptyDataEngine.py | 1 + examples/emptyForceField.py | 1 + examples/example-forcefield.py | 1 + examples/liver-scriptcontroller.py | 2 ++ examples/liver.py | 2 ++ examples/loadXMLfromPython.py | 1 + 8 files changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/basic-addGUI.py b/examples/basic-addGUI.py index f69551134..e18beda83 100644 --- a/examples/basic-addGUI.py +++ b/examples/basic-addGUI.py @@ -5,7 +5,6 @@ # Choose in your script to activate or not the GUI USE_GUI = True - def main(): import SofaRuntime import Sofa.Gui @@ -21,6 +20,8 @@ def main(): for iteration in range(10): Sofa.Simulation.animate(root, root.dt.value) else: + import SofaQt + # Find out the supported GUIs print ("Supported GUIs are: " + Sofa.Gui.GUIManager.ListSupportedGUI(",")) # Launch the GUI (qt or qglviewer) diff --git a/examples/emptyController.py b/examples/emptyController.py index 60a74fca6..e99d609e0 100644 --- a/examples/emptyController.py +++ b/examples/emptyController.py @@ -96,6 +96,7 @@ def createScene(root): def main(): import SofaRuntime import Sofa.Gui + import SofaQt root=Sofa.Core.Node("root") createScene(root) diff --git a/examples/emptyDataEngine.py b/examples/emptyDataEngine.py index ff30eda63..e11c7579a 100644 --- a/examples/emptyDataEngine.py +++ b/examples/emptyDataEngine.py @@ -33,6 +33,7 @@ def createScene(root): def main(): import Sofa.Gui import SofaRuntime + import SofaQt root=Sofa.Core.Node("root") createScene(root) diff --git a/examples/emptyForceField.py b/examples/emptyForceField.py index f6e130e45..7956dfa5e 100644 --- a/examples/emptyForceField.py +++ b/examples/emptyForceField.py @@ -58,6 +58,7 @@ def createScene(root): def main(): import SofaRuntime import Sofa.Gui + import SofaQt root=Sofa.Core.Node("root") createScene(root) diff --git a/examples/example-forcefield.py b/examples/example-forcefield.py index 9322bbb53..b8bbfb948 100644 --- a/examples/example-forcefield.py +++ b/examples/example-forcefield.py @@ -60,6 +60,7 @@ def createScene(root): def main(): import SofaRuntime import Sofa.Gui + import SofaQt root=Sofa.Core.Node("root") createScene(root) diff --git a/examples/liver-scriptcontroller.py b/examples/liver-scriptcontroller.py index 40fdc468e..c2aa1ab6e 100644 --- a/examples/liver-scriptcontroller.py +++ b/examples/liver-scriptcontroller.py @@ -15,6 +15,8 @@ def main(): Sofa.Simulation.initRoot(root) if not USE_GUI: + import SofaQt + for iteration in range(10): Sofa.Simulation.animate(root, root.dt.value) else: diff --git a/examples/liver.py b/examples/liver.py index f2391d5c3..7f48be5a8 100644 --- a/examples/liver.py +++ b/examples/liver.py @@ -18,6 +18,8 @@ def main(): for iteration in range(10): Sofa.Simulation.animate(root, root.dt.value) else: + import SofaQt + Sofa.Gui.GUIManager.Init("myscene", "qglviewer") Sofa.Gui.GUIManager.createGUI(root, __file__) Sofa.Gui.GUIManager.SetDimension(1080, 1080) diff --git a/examples/loadXMLfromPython.py b/examples/loadXMLfromPython.py index 94f68798f..29476ec01 100644 --- a/examples/loadXMLfromPython.py +++ b/examples/loadXMLfromPython.py @@ -31,6 +31,7 @@ def createScene(root): def main(): import SofaRuntime import Sofa.Gui + import SofaQt root = Sofa.Core.Node("root") createScene(root)