File tree Expand file tree Collapse file tree 8 files changed +30
-11
lines changed
Expand file tree Collapse file tree 8 files changed +30
-11
lines changed Original file line number Diff line number Diff line change 11# DataLab Simple Client Releases #
22
3+ ## Version 0.9.0 ##
4+
5+ DataLab Simple Client is fully compatible with ** DataLab 0.11.0** and above.
6+ With older versions of the DataLab server, some features may not work.
7+
8+ 💥 Changes:
9+
10+ * Remote API (` SimpleRemoteProxy ` ):
11+ * Changed constructor signature to accept ` autoconnect ` as argument,
12+ defaulting to ` True `
13+ * Thus, when creating a ` SimpleRemoteProxy ` instance, the connection to the
14+ server is now established automatically by default (i.e. same behavior as
15+ DataLab's ` cdl.proxy.RemoteProxy ` class)
16+
317## Version 0.8.1 ##
418
519DataLab Simple Client is fully compatible with ** DataLab 0.11.0** and above.
Original file line number Diff line number Diff line change 1717from cdlclient .baseproxy import SimpleBaseProxy # noqa: F401
1818from cdlclient .remote import SimpleRemoteProxy # noqa: F401
1919
20- __version__ = "0.8.1 "
20+ __version__ = "0.9.0 "
2121__required_server_version__ = "0.11.0"
2222__docurl__ = "https://cdlclient.readthedocs.io/en/latest/"
2323__homeurl__ = "https://github.com/Codra-Ingenierie-Informatique/DataLabSimpleClient/"
Original file line number Diff line number Diff line change @@ -230,13 +230,19 @@ class SimpleRemoteProxy(SimpleBaseProxy):
230230 This is a subset of DataLab's `RemoteClient` class, with only the methods
231231 that do not require DataLab object model to be implemented.
232232
233+ Args:
234+ autoconnect: If True, automatically connect to DataLab XML-RPC server.
235+ Defaults to True.
236+
237+ Raises:
238+ ConnectionRefusedError: DataLab is currently not running
239+
233240 Examples:
234241 Here is a simple example of how to use SimpleRemoteProxy in a Python script
235242 or in a Jupyter notebook:
236243
237244 >>> from cdlclient import SimpleRemoteProxy
238- >>> proxy = SimpleRemoteProxy()
239- >>> proxy.connect()
245+ >>> proxy = SimpleRemoteProxy() # autoconnect is on by default
240246 Connecting to DataLab XML-RPC server...OK (port: 28867)
241247 >>> proxy.get_version()
242248 '1.0.0'
@@ -254,10 +260,12 @@ class SimpleRemoteProxy(SimpleBaseProxy):
254260 array([1., 2., 3.])
255261 """
256262
257- def __init__ (self ) -> None :
263+ def __init__ (self , autoconnect : bool = True ) -> None :
258264 super ().__init__ ()
259265 self .port : str = None
260266 self ._cdl : ServerProxy
267+ if autoconnect :
268+ self .connect ()
261269
262270 def __connect_to_server (self , port : str | None = None ) -> None :
263271 """Connect to DataLab XML-RPC server.
Original file line number Diff line number Diff line change 1818
1919def test_dialog ():
2020 """Test connection dialog"""
21- proxy = SimpleRemoteProxy ()
21+ proxy = SimpleRemoteProxy (autoconnect = False )
2222 with qt_app_context ():
2323 dlg = ConnectionDialog (proxy .connect )
2424 if dlg .exec ():
Original file line number Diff line number Diff line change 1818def test_dialog ():
1919 """Test connection dialog"""
2020 proxy = SimpleRemoteProxy ()
21- proxy .connect ()
2221 with qt_app_context ():
2322 # 1. Select an image or signal object
2423 dlg = GetObjectDialog (None , proxy )
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ class HostWindow(AbstractClientWindow):
7373 def init_cdl (self ):
7474 """Open DataLab test"""
7575 if self .cdl is None :
76- self .cdl : SimpleRemoteProxy = SimpleRemoteProxy ()
76+ self .cdl = SimpleRemoteProxy (autoconnect = False )
7777 connect_dlg = ConnectionDialog (self .cdl .connect , self )
7878 ok = connect_dlg .exec ()
7979 if ok :
Original file line number Diff line number Diff line change @@ -77,7 +77,6 @@ def multiple_commands(remote: SimpleRemoteProxy):
7777def test ():
7878 """Remote client test"""
7979 remote = SimpleRemoteProxy ()
80- remote .connect ()
8180 execenv .print ("Executing multiple commands..." , end = "" )
8281 multiple_commands (remote )
8382 execenv .print ("OK" )
Original file line number Diff line number Diff line change 1414import numpy as np
1515
1616# DataLab remote control client:
17- from cdlclient import SimpleRemoteProxy
17+ from cdlclient import SimpleRemoteProxy as RemoteProxy
1818
1919# %% Connecting to DataLab current session
2020
21- proxy = SimpleRemoteProxy ()
22- proxy .connect ()
21+ proxy = RemoteProxy ()
2322
2423# %% Executing commands in DataLab (...)
2524
You can’t perform that action at this time.
0 commit comments