Mercurial > hg > orthanc-book
comparison Sphinx/source/plugins/python/changes-deadlock-3.0.py @ 703:a589668768d7
moving python samples in separate files (2)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 11 Jun 2021 10:07:12 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
702:6e02cd89eb6a | 703:a589668768d7 |
---|---|
1 import orthanc | |
2 import threading | |
3 | |
4 def OnChange(changeType, level, resource): | |
5 # One can safely invoke the "orthanc" module in this function | |
6 orthanc.LogWarning("Hello world") | |
7 | |
8 def _OnChange(changeType, level, resource): | |
9 # Invoke the actual "OnChange()" function in a separate thread | |
10 t = threading.Timer(0, function = OnChange, args = (changeType, level, resource)) | |
11 t.start() | |
12 | |
13 orthanc.RegisterOnChangeCallback(_OnChange) |