5. Examples

CUT code repository includes code that describes the following examples.

5.1. Python Application

Created from the Python Application Template, it shows a very basic GUI Application and how its project is to be structured.

A throughouth explanation on the details of this example can be found in the Python Application Tutorial, see Python Application Tutorial.

The code can be found at https://gitlab.eso.org/ecos/cut/-/tree/master/examples/python_application

5.2. Widget Library

Created from the Widget Library Template, this example introduces the structure needed to produce a widget library. Special emphasis in WAF project wscripts file is given.

The code can be found at https://gitlab.eso.org/ecos/cut/-/tree/master/examples/widget_library

5.3. Analog Clock

Based on Qt’s Analog Clock, it shows how a new widget is created. It also uses WAF and the widget library template.

Please take a look at the examples/analogclock/widgets directory (where the code of the widget is located), and Creating a New Widget for more details on the implementation.

The code can be found at https://gitlab.eso.org/ecos/cut/-/tree/master/examples/analogclock

5.4. RAD Hello GUI

Created from the Python Application Template, the example adapts the template to connect and interact with a RAD application using its interface.

This example requires the user to follow first the RAD Tutorial 1.

The code can be found at https://gitlab.eso.org/ecos/cut/-/tree/master/examples/rad_hello

5.5. RAD Hello Custom GUI

This example customizes the previous one to interact with the RAD application that results from completing the RAD Tutorial 2.

This examples requires the user to follow the RAD Tutorial 2.

The code can be found at https://gitlab.eso.org/ecos/cut/-/tree/master/examples/rad_hello_custom

5.6. Complex Application

This application has many widgets, tabs, and dialogs. Most of them are placeholders, but this project structure exemplifies how you can also structure a complex GUI application.

5.7. cutDemoService

This tools is not a graphical application, but provides datapoints needed to demonstrate and test the capabilities of CUT, its widgets, and its taurus plugins.

The code of this application can be found at https://gitlab.eso.org/ecos/cut/-/tree/master/examples/demo_service

It has an icd module to interact with it, and a service module that uses the icd to create a server application that publishes many datapoints.

$ cutDemoService --help
Demo Service
Options for cutDemoService:
  -i [ --instance ] arg (=1)  Instance in OLDB used in path of the URI. Use it
                              to avoid conflicts with other users.
  -f [ --frequency ] arg (=3) Frequency in Hz at which datapoints are updated
                              and published.
  -p [ --port ] arg (=12801)  Base value for port: Will be used to RR, and
                              subsequent numbers for PS.
  -o [ --oldb ] arg (=1)      Initializes and publishes example datapoints to
                              OLDB.
  --ps arg (=0)               Creates MAL publisher using the example
                              datapoints.
  --rr arg (=0)               Creates MAL request-reply server using ZeroMQ and
                              Protocol Buffers.
  -l [ --list ]               List the datapoints available and exit.
  -h [ --help ]               show help for cutDemoService.

The user may customize its behaviour using the presented options.

Once started cutDemoService will present the list of datapoints.

$ cutDemoService
Demo Service
Initializing datapoints...
  Datapoints initialized...
Initializing OLDB...
  cii.oldb:///cut/demoservice/instance1/boolean-scalar-fixed  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/boolean-scalar-twosecs  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/int-scalar-add  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/int-vector-sin  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/int-matrix-sin-cos  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/uint64-scalar-sin  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-scalar-add  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-scalar-sin  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-scalar-cos  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-scalar-tan  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-scalar-sin-bad  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-scalar-sin-suspect  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-vector-rand  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-vector-current-radec  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-vector-target-radec  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-vector-current-altaz  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-vector-target-altaz  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-vector-sin  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-vector-cos  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-vector-tan  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-matrix-sin  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-matrix-cos  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-matrix-sin-wave  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/double-matrix-sin-cos  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/string-scalar-fixed  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/string-scalar-timestamp  MD DP  VAL   OK
  cii.oldb:///cut/demoservice/instance1/string-vector-galaxies  MD DP  VAL   OK
  OLDB Initialized
Starting Datapoint updates...
  Datapoint updates started
Press ENTER to exit

The cutDemoService will publish the folowing datapoints into the OLDB:

cii.oldb:///cut/demoservice/instance1/boolean-scalar-fixed

Fixed boolean

cii.oldb:///cut/demoservice/instance1/int-scalar-add

Integer datapoint, add 1 every update

cii.oldb:///cut/demoservice/instance1/double-scalar-add

Double datapoint adds 1 every update

cii.oldb:///cut/demoservice/instance1/double-scalar-sin

Double datapoint, returns the value of sin(t) with a period of 10 seconds.

cii.oldb:///cut/demoservice/instance1/double-scalar-cos

Double datapoint, returns the value of cos(t) with a period of 10 seconds.

cii.oldb:///cut/demoservice/instance1/double-scalar-tan

Double datapoint, returns the value of tan(t) with a period of 10 seconds.

cii.oldb:///cut/demoservice/instance1/double-vector-rand

Vector of doubles, size 5, randomly generated between 0 and 1.

cii.oldb:///cut/demoservice/instance1/double-vector-sin

Vector of 100 double datapoints, describes sin(t+dx) with period 2Pi covered of 10 seconds

cii.oldb:///cut/demoservice/instance1/double-vector-cos

Vector of 100 double datapoints, describes sin(t+dx) with period 2Pi covered of 10 seconds

cii.oldb:///cut/demoservice/instance1/double-vector-tan

Vector of 100 double datapoints, describes sin(t+dx) with period 2Pi covered of 10 seconds

cii.oldb:///cut/demoservice/instance1/double-matrix-sin

Matrix of 16x16 double datapoints, describes sin(t+dx) with a period of 10 second fitted over x, copied over y.

cii.oldb:///cut/demoservice/instance1/double-matrix-cos

Matrix of 16x16 double datapoints, describes cos(t+dx) with a period of 10 second fitted over x, copied over y.

cii.oldb:///cut/demoservice/instance1/double-matrix-sin-wave

Matrix of 64x64 double datapoints, describes sin(t+dx+dy) with a period of 10 seconds.

cii.oldb:///cut/demoservice/instance1/double-matrix-sin-cos

Matrix of 101x101 double datapoints, describes sin(t+dx)*cos(t+dy) with a period of 10 seconds.

cii.oldb:///cut/demoservice/instance1/string-scalar-fixed

String datapoint, fixed.

cii.oldb:///cut/demoservice/instance1/string-scalar-timestamp

String datapoint, published the ISO timestamp on the server.

cii.oldb:///cut/demoservice/instance1/string-vector-galaxies

String vector with random galaxy names.