Skip to content

0. What is swift?

Jaehun You edited this page Apr 7, 2023 · 4 revisions

SWIFT

SNU widget integration framework for PyQt

A framework for integration of PyQt widgets where they can communicate with each other.
This project is mainly developed for trapped ion experiment controller GUI in SNU QuIQCL.

swift provides a dashboard-like main window, in which variety of Frames reside.
A Frame is in fact a special QWidget which obeys the interface of swift, and it will be wrapped by a QDockWidget.

Features

  • Independent development of each Frame, which is a sub-window application resides in the framework
  • Communication channel between Frames
  • Thread-safety

Structure chart

Overall structure

image

App structure

image

Components

App

A Frame simply means a window of PyQt that we see.

In fact, an engine which makes a Frame works is an App. An App can

  • show/hide Frames, which the App manages
  • set a slot for each signal of Frame
  • receive a signal which the Frame emits
  • emit a signal to Frame or channel to swift
  • communicate backend APIs

A swift recognizes only App, not Frame or backend. Thus, every order for Frame is implemented in App.

A backend is a set of APIs for handling UI-independent operations, such as controlling hardwards, polling something, and connecting DB.

Swift

The swift is an overall manager for this system.
It can

  • manage for all apps
  • broadcast a message among apps
  • handle a swift-call request

Message Transfer Protocol

  1. Departure app: Emit the broadcastRequested signal with a message. Its slot is the _broadcast() in swift.
  2. swift: Routes the message to subscriber apps in _broadcast(). It emits received signals of the subscriber apps.
  3. Destination app: Receive the message to receivedSlot method. The received signal calls it.

Handle swift-call Protocol

  1. Departure app: Emit the swiftcallRequested signal with a message. Its slot is the _swiftcall() slot in swift.
  2. swift: Receive the message to _swiftcall() and handle the request.