comparison Sphinx/source/plugins/python.rst @ 975:eb49a4ad8fbc

Python plugin: Extending the Orthanc Explorer interface
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Aug 2023 14:04:48 +0200
parents 2d817288cad4
children e7a3b3d76f1c
comparison
equal deleted inserted replaced
974:01f61385877f 975:eb49a4ad8fbc
811 811
812 .. literalinclude:: python/storage-commitment-default.py 812 .. literalinclude:: python/storage-commitment-default.py
813 :language: python 813 :language: python
814 814
815 815
816 .. _python_extend_orthanc_explorer:
817
818 Extending the Orthanc Explorer interface
819 ........................................
820
821 Here is a sample plugin that adds a new button to Orthanc Explorer
822 that triggers a Python function:
823
824 .. literalinclude:: python/sample-python-button.py
825 :language: python
826
827 As can be seen in this sample:
828
829 * The call to ``orthanc.ExtendOrthancExplorer()`` installs the button
830 with JavaScript code that uses the `jQuery Mobile framework
831 <https://demos.jquerymobile.com/1.1.0/>`__ (as of Orthanc 1.12.1,
832 version 1.1.0 of jQuery Mobile is used in Orthanc Explorer).
833
834 * If clicking on the button, a GET call to the REST API is made to
835 ``../execute-python``. The prefix ``../`` stems from the fact that
836 Orthanc Explorer is branched inside the ``app/`` folder of the REST
837 API of Orthanc.
838
839 * The GET call to ``../execute-python`` executes the
840 ``ExecutePython()`` callback function that is written in Python.
841
842 Note that it is only possible to extend Orthanc Explorer 1, which is
843 the built-in Web interface of Orthanc. It is not possible to extend
844 the :ref:`Orthanc Explorer 2 <orthanc-explorer-2>` interface.
845
846
816 Performance and concurrency 847 Performance and concurrency
817 --------------------------- 848 ---------------------------
818 849
819 **Important:** This section only applies to UNIX-like systems. The 850 **Important:** This section only applies to UNIX-like systems. The
820 ``multiprocessing`` package will not work on Microsoft Windows as the 851 ``multiprocessing`` package will not work on Microsoft Windows as the