Skip to content

Commit 4502959

Browse files
committed
Updated docs
1 parent cd4676c commit 4502959

10 files changed

Lines changed: 44 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
* Added `is_connected` method
99

1010
* New `widgets` module:
11-
* New `DataLabConnectionDialog` class:
11+
* New `ConnectionDialog` class:
1212
* Ready-to-use dialog box to connect to a DataLab server
13-
* `from cdlclient.widgets import DataLabConnectionDialog`
13+
* `from cdlclient.widgets import ConnectionDialog`
1414
* See example in `cdlclient/tests/connect_dialog.py`
1515

1616
## Version 0.4.0 ##

cdlclient/tests/connect_dialog.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,21 @@
1010
# guitest: show
1111

1212
from guidata.qthelpers import qt_app_context
13+
from qtpy import QtWidgets as QW
1314

1415
from cdlclient import SimpleRemoteProxy
15-
from cdlclient.widgets import DataLabConnectionDialog
16+
from cdlclient.widgets import ConnectionDialog
1617

1718

1819
def test_dialog():
1920
"""Test connection dialog"""
2021
proxy = SimpleRemoteProxy()
2122
with qt_app_context():
22-
dlg = DataLabConnectionDialog(proxy.connect)
23-
dlg.exec()
23+
dlg = ConnectionDialog(proxy.connect)
24+
if dlg.exec():
25+
QW.QMessageBox.information(None, "Connection", "Successfully connected")
26+
else:
27+
QW.QMessageBox.critical(None, "Connection", "Connection failed")
2428

2529

2630
if __name__ == "__main__":

cdlclient/tests/remoteclient_app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from cdlclient import SimpleRemoteProxy
2626
from cdlclient.tests.remoteclient_base import AbstractClientWindow
2727
from cdlclient.tests.remoteclient_unit import multiple_commands
28-
from cdlclient.widgets import DataLabConnectionDialog
28+
from cdlclient.widgets import ConnectionDialog
2929

3030
APP_NAME = "Remote client test"
3131

@@ -73,7 +73,7 @@ def init_cdl(self):
7373
"""Open DataLab test"""
7474
if self.cdl is None:
7575
self.cdl: SimpleRemoteProxy = SimpleRemoteProxy()
76-
connect_dlg = DataLabConnectionDialog(self.cdl.connect, self)
76+
connect_dlg = ConnectionDialog(self.cdl.connect, self)
7777
ok = connect_dlg.exec()
7878
if ok:
7979
self.host.log("✨ Initialized DataLab connection ✨")

cdlclient/widgets/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
"""
1212

1313
# pylint: disable=unused-import
14-
from cdlclient.widgets.connection import DataLabConnectionDialog
14+
from cdlclient.widgets.connection import ConnectionDialog

cdlclient/widgets/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def run(self) -> None:
4343
self.SIG_CONNECTION_KO.emit()
4444

4545

46-
class DataLabConnectionDialog(QW.QDialog):
46+
class ConnectionDialog(QW.QDialog):
4747
"""DataLab Connection dialog
4848
4949
Args:
@@ -125,5 +125,5 @@ def fake_connect():
125125
# raise ConnectionRefusedError("Connection refused")
126126

127127
with qt_app_context():
128-
dlg = DataLabConnectionDialog(fake_connect)
128+
dlg = ConnectionDialog(fake_connect)
129129
dlg.exec()

doc/api.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ objects.
2828

2929
.. autoclass:: cdlclient.simplemodel.ImageObj
3030
:members:
31+
32+
Connection dialog
33+
^^^^^^^^^^^^^^^^^
34+
35+
.. autoclass:: cdlclient.widgets.ConnectionDialog
36+
:members:
12.6 KB
Loading

doc/index.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ DataLab Simple Client (``cdlclient`` package) is a Python library providing a
1313
remote proxy to a DataLab application (server). It allows to use DataLab
1414
features from a remote computer, and/or from a third-party application.
1515

16+
It also provides widgets to embed DataLab features in a Qt application
17+
(connection dialog, etc.). For this particular use case, the library relies
18+
on `QtPy`_.
19+
1620
.. figure:: _static/plotpy-stack-powered.png
1721
:align: center
1822

@@ -44,6 +48,7 @@ Copyrights and licensing
4448
.. _PlotPyStack: https://github.com/PlotPyStack
4549
.. _guidata: https://pypi.python.org/pypi/guidata
4650
.. _PlotPy: https://pypi.python.org/pypi/PlotPy
51+
.. _QtPy: https://pypi.python.org/pypi/QtPy
4752
.. _PyPI: https://pypi.python.org/pypi/DataLab
4853
.. _Home: https://github.com/Codra-Ingenierie-Informatique/DataLabSimpleClient/
4954
.. _Documentation: https://cdlapp.readthedocs.io/

doc/overview.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,19 @@ class (on the section "Remote control").
8585
.. _XML-RPC: https://docs.python.org/3/library/xmlrpc.html
8686

8787
.. _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

scripts/build_doc.bat

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ cd %SCRIPTPATH%\..
1818
set PATH=C:\Program Files\HTML Help Workshop;C:\Program Files (x86)\HTML Help Workshop;%PATH%
1919
sphinx-build -b latex doc build\doc
2020
cd build\doc
21-
pdflatex %LIBNAME%.tex
21+
pdflatex -interaction=nonstopmode -quiet %LIBNAME%.tex
22+
@REM Build again to fix table of contents
23+
pdflatex -interaction=nonstopmode -quiet %LIBNAME%.tex
2224
start %LIBNAME%.pdf
2325
call %FUNC% EndOfScript

0 commit comments

Comments
 (0)