4.4.1. Download, Compilation, and Running
This document guides the user on the creation of a new Demo Service Client, using Python, WAF modules,
Qt, Taurus and CUT plugins. As this is a programming tutorial, you will produce file and code as
instructed. You can also download a finalized version of the code from
https://gitlab.eso.org/ecos/cut/-/tree/master/examples/, so our first step will be to download it.
$ git clone https://gitlab.eso.org/ecos/cut
$ mv cut/examples/demo_service_client ./
$ rm -rf cut
The directory we will be using for this tutorial is the demo_service_client, and it contains the code for a
Python application. This is a waf project on its own, so it can be build in an independent manner from the rest
of Control UI Toolkit. In order to do so, the reader must execute:
$ cd demo_service_client
$ waf configure install
And to execute the application:
$ cutDemoServiceClient
Demo Service Client: The application will include these elements
4.4.2. Project Structure
This is the structure of the project. We use as build system WAF, and on top wtools extension to make ELT application definition easier:
demo_service_client
├── client
│ ├── src
│ │ ├── cut
│ │ │ └── examples
│ │ │ └── demo_service_client
│ │ │ ├── __init__.py
│ │ │ ├── applicationconfiguration.py
│ │ │ ├── mainwindow_ui.ui
│ │ │ └── mainwindowcontroller.py
│ │ └── cutdemoserviceclient.py
│ └── wscript
└── wscript
4.4.2.1. Project wscript
The first file we should take a look is demo_service_client/wscript:
1#!/usr/bin/env python3
2import os
3from wtools.project import declare_project
4
5
6def configure(cnf):
7 # We check which version of qt6 is requested and set the proper feature for later
8 if hasattr(cnf, "want_qt6") and cnf.want_qt6 is True:
9 cnf.check_python_module("PySide6")
10 else:
11 cnf.check_python_module("PySide2", condition="ver >= num(5, 14, 1) and ver < num(6, 0, 0)")
12 cnf.check_python_module("taurus")
13 cnf.check_python_module("elt.cut")
14 cnf.check_python_module("CutWidgets")
15 cnf.check_python_module("tauruscii")
16 cnf.check_python_module("taurusmal")
17
18
19def qtcallable(cnf):
20 # We can do some checks here, for example to discriminate between Qt6 and Qt5:
21 if os.environ.get("ELT_RELEASE", "6").startswith("6"):
22 return dict(version=6)
23 else:
24 return dict(version=5)
25
26
27declare_project(
28 "DemoServiceClient",
29 version="3.1.10-rc1",
30 requires=["cxx", "qt", "python", "pyqt"],
31 recurse="client",
32 qt=qtcallable,
33)
In contrast to what has been shown in the Python Application Tutorial, extra python module checks for tauruscii and taurusmal have been added. These modules provides the OLDB and MAL RR plugins for Taurus.
The rest of the project structure has not been changed.