changeset 144:93c6f12bf339

improved support for /reset but still not ok
author Alain Mazy <am@osimis.io>
date Wed, 08 Nov 2023 08:55:12 +0100
parents d63c58d650ff
children 8b310d571e5b
files Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Sources/Plugin.cpp TODO
diffstat 4 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp	Sat Oct 14 17:12:55 2023 +0200
+++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp	Wed Nov 08 08:55:12 2023 +0100
@@ -79,6 +79,10 @@
     }
   }
 
+  void ResetGlobalContext()
+  {
+    globalContext_ = NULL;
+  }
 
   bool HasGlobalContext()
   {
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h	Sat Oct 14 17:12:55 2023 +0200
+++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h	Wed Nov 08 08:55:12 2023 +0100
@@ -137,6 +137,8 @@
 
   void SetGlobalContext(OrthancPluginContext* context);
 
+  void ResetGlobalContext();
+
   bool HasGlobalContext();
 
   OrthancPluginContext* GetGlobalContext();
--- a/Sources/Plugin.cpp	Sat Oct 14 17:12:55 2023 +0200
+++ b/Sources/Plugin.cpp	Wed Nov 08 08:55:12 2023 +0100
@@ -319,7 +319,8 @@
 {
   if (!globalFunctions_.empty())
   {
-    ORTHANC_PLUGINS_THROW_EXCEPTION(BadSequenceOfCalls);
+    return;
+//    ORTHANC_PLUGINS_THROW_EXCEPTION(BadSequenceOfCalls);
   }
 
   /**
@@ -664,6 +665,8 @@
       
       PythonLock::GlobalFinalize();
     }
+
+    OrthancPlugins::ResetGlobalContext();
   }
 
 
--- a/TODO	Sat Oct 14 17:12:55 2023 +0200
+++ b/TODO	Wed Nov 08 08:55:12 2023 +0100
@@ -1,3 +1,16 @@
+Bug:
+===
+
+* The plugin does not support calls to 'curl http://localhost:8042/tools/reset -d ""' 
+  if the script registers the OnChangeCallback. Ex:
+
+    import orthanc
+
+    def OnChange(changeType, level, resource):
+      print("OnChange")
+    orthanc.RegisterOnChangeCallback(OnChange)
+
+
 
 Primitives the Orthanc community is missing
 ===========================================