Debian Codegraph @

doc/overview.rst

raw
1 Overview
2 ========
3
4 DataLab may be controlled remotely using the `XML-RPC`_ protocol which is
5 natively supported by Python (and many other languages). Remote controlling
6 allows to access DataLab main features from a separate process.
7
8 From an IDE
9 ^^^^^^^^^^^
10
11 DataLab may be controlled remotely from an IDE (e.g. `Spyder`_ or any other
12 IDE, or even a Jupyter Notebook) that runs a Python script. It allows to
13 connect to a running DataLab instance, adds a signal and an image, and then
14 runs calculations. This feature is exposed by the `cdlclient.SimpleRemoteProxy`
15 class.
16
17 From a third-party application
18 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
20 DataLab may also be controlled remotely from a third-party application, for the
21 same purpose.
22
23 If the third-party application is written in Python 3, it may directly use
24 :py:class:`cdlclient.SimpleRemoteProxy` as mentioned above. From another language,
25 it is also achievable, but it requires to implement a XML-RPC client in this
26 language using the same methods of proxy server as in the
27 :py:class:`cdlclient.SimpleRemoteProxy` class.
28
29 Data (signals and images) may also be exchanged between DataLab and the remote
30 client application, in both directions.
31
32 The remote client application may be run on the same computer as DataLab or on
33 different computer. In the latter case, the remote client application must
34 know the IP address of the computer running DataLab.
35
36 The remote client application may be run before or after DataLab. In the latter
37 case, the remote client application must try to connect to DataLab until it
38 succeeds.
39
40 Supported features
41 ^^^^^^^^^^^^^^^^^^
42
43 Supported features are the following:
44
45 - Switch to signal or image panel
46 - Remove all signals and images
47 - Save current session to a HDF5 file
48 - Open HDF5 files into current session
49 - Browse HDF5 file
50 - Open a signal or an image from file
51 - Add a signal
52 - Add an image
53 - Get object list
54 - Run calculation with parameters
55
56 Some examples are provided to help implementing such a communication
57 between your application and DataLab:
58
59 - See module: ``cdlclient.tests.remoteclient_app``
60 - See module: ``cdlclient.tests.remoteclient_unit``
61
62 .. figure:: /images/shots/remote_control_test.png
63
64 Screenshot of remote client application test (``cdlclient.tests.remoteclient_app``)
65
66 Example
67 ^^^^^^^
68
69 Here is an example in Python 3 of a script that connects to a running DataLab
70 instance, adds a signal and an image, and then runs calculations (the cell
71 structure of the script make it convenient to be used in `Spyder`_ IDE):
72
73 .. literalinclude:: remote_example.py
74
75 Additional features
76 ^^^^^^^^^^^^^^^^^^^
77
78 For simple remote controlling, :py:class:`cdlclient.SimpleRemoteProxy` may be
79 used. For more advanced remote controlling, the `cdl.RemoteCDLProxy` class
80 provided by the DataLab (``cdl``) package may be used.
81
82 See DataLab documentation for more details about the ``cdl.RemoteCDLProxy``
83 class (on the section "Remote control").
84
85 .. _XML-RPC: https://docs.python.org/3/library/xmlrpc.html
86
87 .. _Spyder: https://www.spyder-ide.org/
88
89
90 Connection dialog
91 ^^^^^^^^^^^^^^^^^
92
93 The DataLab Simple Client package provides a connection dialog that may be used
94 to connect to a running DataLab instance. It is exposed by the
95 :py:class:`cdlclient.widgets.ConnectionDialog` class.
96
97 .. figure:: /images/shots/connect_dialog.png
98
99 Screenshot of connection dialog (``cdlclient.widgets.ConnectionDialog``)
100
101 Example of use:
102
103 .. literalinclude:: ../cdlclient/tests/connect_dialog.py
104
105
106 Get object dialog
107 ^^^^^^^^^^^^^^^^^
108
109 The DataLab Simple Client package provides a dialog that may be used to get
110 an object from a running DataLab instance. It is exposed by the
111 :py:class:`cdlclient.widgets.GetObjectDialog` class.
112
113 .. figure:: /images/shots/get_object_dialog.png
114
115 Screenshot of get object dialog (``cdlclient.widgets.GetObjectDialog``)
116
117 Example of use:
118
119 .. literalinclude:: ../cdlclient/tests/get_object_dialog.py