Developer Guide

This GUI is constructed on the top of Qt framework (Qt for Python).

Dependencies

Architecture

The classes in module are listed below.

m2gui

@startuml
package "layout" #DDDDDD {
  class LayoutDefault
}

package "controltab" #DDDDDD {
  TabDefault <|-- TabSettings
}

MainWindow *-- Model
MainWindow *-- ControlTabs
MainWindow *-- TabSettings
MainWindow "1" *-- "3" LayoutDefault
MainWindow *-- SignalMessage
MainWindow ..> LogWindowHandler

Model *-- FaultManager
Model *-- UtilityMonitor
Model *-- SignalControl : emit()
Model *-- SignalStatus : emit()
Model *-- SignalConfig : emit()
Model *-- SignalScript : emit()
Model ..> Config

FaultManager *-- SignalError : emit()
FaultManager *-- SignalLimitSwitch : emit()

UtilityMonitor *-- SignalUtility : emit()
UtilityMonitor *-- SignalDetailedForce : emit()
UtilityMonitor *-- SignalPosition : emit()

UtilityMonitor *-- ActuatorForce
UtilityMonitor *-- ForceErrorTangent

LayoutDefault *-- Model
LayoutDefault --> SignalControl : connect()

LogWindowHandler *-- SignalMessage : emit()

ControlTabs ..> Model
ControlTabs "1" *-- "9" TabDefault

TabDefault *-- Model
@enduml

Figure 14 Class diagram of M2 GUI

  • MainWindow is the main window of the application.

  • Model contains the main business logic in the application.

  • Config is a data class that has the configuration details in the M2 cell control system.

  • FaultManager records the system error.

  • UtilityMonitor monitors the utility status.

  • ActuatorForce is a data class that has the force details contain the look-up table (LUT) information, force balance system, etc.

  • ForceErrorTangent is a data class that is used to monitor the supporting force of mirror according to the tangential link force error.

  • ControlTabs has the control tables.

  • LogWindowHandler handles the log window.

The model–view–controller (MVC) architecture is used in this module. In this design, the view always shows the data sent from the model. This helps to minimize the business logic in view and makes the tests easier. If you want to cache the data for a smooth showing in view, you need to do this in the Model.

The Qt signal is used to do the data exchange. The emit() and connect() in the class diagrams mean the class emits a specific signal and connects it to a specific callback function. The controller is reused from the ts_m2com. Most of signals are holded and emitted from the Model or its components to simplify the management of signals. Only the SignalMessage is holded by the MainView. The SignalMessage is unrelated to the Model, which is only used to show the logged message on the overview table.

Qt provides its event loop that is different from the event loop in Python asyncio library. The qasync allows coroutines (async/await keywords) to be used in PyQt/PySide applications by providing an implementation of the PEP-3156 event-loop. For the other tasks in a loop to run, an awaitable must be called from another coroutine. This allow for the coroutine to claim CPU and performs its operations. Therefore await asyncio.sleep() calls are placed in unit tests calls, so the signal handling etc. can occur.

m2gui.signals

The available Qt signals are listed below:

  • SignalControl sends the event that the control is updated or not.

  • SignalError sends the error code.

  • SignalLimitSwitch sends the event of limit switch status.

  • SignalMessage sends the message event.

  • SignalStatus sends the event of system status.

  • SignalConfig sends the configuration.

  • SignalUtility sends the utility status.

  • SignalDetailedForce sends the calculated and measured force details contains LUT, force balance system, etc.

  • SignalPosition sends the rigid body position.

  • SignalScript sends the status of script progress.

m2gui.layout

@startuml
LayoutDefault <|-- LayoutControl
LayoutDefault <|-- LayoutControlMode
LayoutDefault <|-- LayoutLocalMode
@enduml

Figure 15 Class diagram of layout module

  • LayoutDefault is the default parent panel of other child classes in this module.

  • LayoutControl is the panel of control.

  • LayoutControlMode is the panel of control mode.

  • LayoutLocalMode is the panel of local mode.

m2gui.display

@startuml
class FigureConstant
ViewMirror "1" *-- "n" ItemActuator
ItemActuator ..> Gauge
@enduml

Figure 16 Class diagram of display module

  • ViewMirror is the view on the mirror populated by actuators.

  • ItemActuator is the actuator item used in the ViewMirror class to show the actuator information.

  • Gauge provides the color scale.

  • FigureConstant is the figure to show the constant line data in real-time.

m2gui.controltab

@startuml
TabDefault <|-- TabActuatorControl
TabDefault <|-- TabAlarmWarn
TabDefault <|-- TabCellStatus
TabDefault <|-- TabConfigView
TabDefault <|-- TabDetailedForce
TabDefault <|-- TabDiagnostics
TabDefault <|-- TabOverview
TabDefault <|-- TabRigidBodyPos
TabDefault <|-- TabUtilityView
TabDefault <|-- TabSettings
@enduml

Figure 17 Class diagram of controltab module

  • TabDefault is the default parent table of other child classes in this module.

  • TabActuatorControl controls the actuator.

  • TabAlarmWarn shows the alarms and warnings.

  • TabCellStatus shows the cell status.

  • TabConfigView shows the configuration in the M2 cell control system.

  • TabDetailedForce shows the detailed force data.

  • TabDiagnostics shows the diagnostics information.

  • TabOverview shows the overview of system status.

  • TabRigidBodyPos controls the rigid body position.

  • TabUtilityView shows the utility status.

  • TabSettings shows the settings of GUI.

The class diagrams for each table child class are listed below to give you the idea of class relationship.

m2gui.controltab.TabActuatorControl

@startuml
package "m2gui" #DDDDDD {
  Model *-- UtilityMonitor
  Model *-- SignalScript : emit()
  UtilityMonitor *-- SignalDetailedForce : emit()
  UtilityMonitor ..> ActuatorForce
}

TabDefault *-- Model
TabDefault <|-- TabActuatorControl

TabActuatorControl --> SignalScript : connect()
TabActuatorControl --> SignalDetailedForce : connect()
TabActuatorControl ..> ActuatorForce
@enduml

Figure 18 Class diagram of TabActuatorControl class

m2gui.controltab.TabAlarmWarn

@startuml
package "m2gui" #DDDDDD {
  Model *-- FaultManager
  FaultManager *-- SignalError : emit()
  FaultManager *-- SignalLimitSwitch : emit()
}

TabDefault *-- Model
TabDefault <|-- TabAlarmWarn

TabAlarmWarn --> SignalError : connect()
TabAlarmWarn --> SignalLimitSwitch : connect()
@enduml

Figure 19 Class diagram of TabAlarmWarn class

m2gui.controltab.TabCellStatus

@startuml
package "m2gui" #DDDDDD {
  Model *-- UtilityMonitor
  UtilityMonitor *-- SignalDetailedForce : emit()
  UtilityMonitor ..> ActuatorForce
}

package "display" #DDDDDD {
  class FigureConstant
  ViewMirror "1" *-- "n" ItemActuator
  ItemActuator ..> Gauge
}

TabDefault *-- Model
TabDefault <|-- TabCellStatus

TabCellStatus *-- ViewMirror
TabCellStatus "1" *-- "3" FigureConstant
TabCellStatus ..> Gauge
TabCellStatus ..> ItemActuator

TabCellStatus --> SignalDetailedForce : connect()
TabCellStatus *-- ActuatorForce
@enduml

Figure 20 Class diagram of TabCellStatus class

m2gui.controltab.TabConfigView

@startuml
package "m2gui" #DDDDDD {
  Model *-- SignalConfig : emit()
  Model ..> Config
}

TabDefault *-- Model
TabDefault <|-- TabConfigView

TabConfigView --> SignalConfig : connect()
TabConfigView ..> Config
@enduml

Figure 21 Class diagram of TabConfigView class

m2gui.controltab.TabDetailedForce

@startuml
package "m2gui" #DDDDDD {
  Model *-- UtilityMonitor
  UtilityMonitor *-- SignalDetailedForce : emit()
  UtilityMonitor ..> ActuatorForce
}

TabDefault *-- Model
TabDefault <|-- TabDetailedForce

TabDetailedForce --> SignalDetailedForce : connect()
TabDetailedForce ..> ActuatorForce
@enduml

Figure 22 Class diagram of TabDetailedForce class

m2gui.controltab.TabDiagnostics

@startuml
package "m2gui" #DDDDDD {
  Model *-- UtilityMonitor
  UtilityMonitor *-- SignalUtility : emit()
  UtilityMonitor *-- SignalDetailedForce : emit()
}

TabDefault *-- Model
TabDefault <|-- TabDiagnostics

TabDiagnostics --> SignalUtility : connect()
TabDiagnostics --> SignalDetailedForce : connect()
@enduml

Figure 23 Class diagram of TabDiagnostics class

m2gui.controltab.TabOverview

@startuml
package "m2gui" #DDDDDD {
  class SignalMessage
  class SignalControl

  Model *-- SignalStatus : emit()
}

TabDefault *-- Model
TabDefault <|-- TabOverview

TabOverview --> SignalMessage : connect()
TabOverview --> SignalControl : connect()
TabOverview --> SignalStatus : connect()
@enduml

Figure 24 Class diagram of TabOverview class

m2gui.controltab.TabRigidBodyPos

@startuml
package "m2gui" #DDDDDD {
  Model *-- UtilityMonitor
  UtilityMonitor *-- SignalPosition : emit()
}

TabDefault *-- Model
TabDefault <|-- TabRigidBodyPos

TabRigidBodyPos --> SignalPosition : connect()
@enduml

Figure 25 Class diagram of TabRigidBodyPos class

m2gui.controltab.TabUtilityView

@startuml
package "m2gui" #DDDDDD {
  Model *-- UtilityMonitor
  UtilityMonitor *-- SignalUtility : emit()
}

TabDefault *-- Model
TabDefault <|-- TabUtilityView

TabUtilityView --> SignalUtility : connect()
@enduml

Figure 26 Class diagram of TabUtilityView class

m2gui.controltab.TabSettings

@startuml
package "m2gui" #DDDDDD {
  class Model
}

TabDefault *-- Model
TabDefault <|-- TabSettings
@enduml

Figure 27 Class diagram of TabSettings class

APIs

This section is autogenerated from docstrings.

lsst.ts.m2gui Package

Functions

create_group_box(name, layout)

Create the group box.

create_label([name, point_size, is_bold])

Create the label.

create_table(header_text[, ...])

Create the table.

get_num_actuator_ring(ring)

Get the number of actuators on the specific ring.

get_tol(num_digit_after_decimal)

Get the tolerance.

prompt_dialog_warning(title, description[, ...])

Shows a warning dialog.

run_application(argv)

Run the application.

run_command(command, *args[, is_prompted])

Run the command.

set_button(name, callback, *args[, ...])

Set the button.

Classes

ActuatorForce(f_e, f_0, f_a, f_f, f_delta, ...)

Actuator force class to have the force details contain the look-up table (LUT) information.

Config([file_configuration, file_version, ...])

Configuration class to have the configuration details.

ControlTabs(model)

Control tables.

DisplacementSensorDirection(value)

Direction of the displacement sensors.

FaultManager(limit_switch_status)

Fault manager to record the system error.

FigureActuatorData(value)

Select the actuator data to show on the figures.

ForceErrorTangent(error_force, error_weight, ...)

Tangential link force error class to monitor the supporting force of mirror.

LimitSwitchType(value)

Type of the limit switches on actuators.

LocalMode(value)

Operation mode of the engineering user interface (EUI).

LogWindowHandler(signal_message, message_format)

Log window handler.

MainWindow(is_output_log_on_screen, ...[, log])

Main window of the application.

Model(log[, host, port_command, ...])

Model class of the application.

Ring(value)

Ring of the actuators.

SignalConfig

Configuration signal to send the configuration.

SignalControl

Control signal to send the event that the control is updated or not.

SignalDetailedForce

Detailed force signal to send the calculated and measured force details contains the look-up table (LUT).

SignalError

Error signal to send the error code.

SignalLimitSwitch

Status signal to send the event of limit switch status.

SignalMessage

Message signal to send the message event.

SignalPosition

Position signal to send the rigid body position.

SignalScript

Script signal to send the status of script progress.

SignalStatus

Status signal to send the event of system status.

SignalUtility

Utility signal to send the utility status.

TemperatureGroup(value)

Group of the temperature sensors.

UtilityMonitor()

Utility monitor to monitor the utility status.