View Package¶
view.window module¶
Main Window Module.
Contains the main application window class and related widgets.
- class view.window.Window[source]¶
Bases:
QMainWindow
Main Application Window.
Represents the main application window for the FKF App. The View in the MVC. Manages all widgets and all GUI operations.
- monitor¶
A QWidget representing the monitoring widget.
- joystick¶
A QJoystick instance representing the joystick widget.
- rotation_widget¶
A RotationWidget instance representing the rotation control widget.
- button_water¶
A QPushButton for water control.
- button_light¶
A QPushButton for light control.
- button_sound¶
A QPushButton for sound control.
- button_sth¶
A QPushButton for other function control.
- selected_port¶
The selected port from the dialog for serial communication.
- controls_functions¶
A dictionary mapping control signals to corresponding functions.
- critical_dialog(label: str, text: str) None [source]¶
Display a critical dialog with the given label and text.
- Parameters:
label (str) – The label of the dialog.
text (str) – The text to display in the dialog.
- handle_port_selection_dialog() str [source]¶
Handle the port selection dialog.
- Returns:
The selected port for serial communication.
- Return type:
str
- staticMetaObject = PySide6.QtCore.QMetaObject("Window" inherits "QMainWindow": Methods: #39 type=Slot, signature=accepted_slot(QDialog*), parameters=QDialog* #40 type=Slot, signature=rejected_slot() )¶
view.joystick module¶
Custom Qt Widget for a Joystick.
This module provides a custom Qt widget, QJoystick, to display a joystick. The widget allows users to simulate joystick movement by moving a handle within a circular boundary.
- Example usage:
joystick_widget = QJoystick() layout.addWidget(joystick_widget)
- class view.joystick.QJoystick(parent: QWidget | None = None)[source]¶
Bases:
QWidget
Custom Qt Widget for Joystick Control.
Represents a custom Qt widget for joystick control, allowing users to simulate joystick movement.
- radius¶
represents the radius of the joystick boundary.
- Type:
int
- handle_radius¶
represents the radius of the joystick handle.
- Type:
int
- handle_x¶
represents the x-coordinate of the joystick handle.
- Type:
int
- handle_y¶
represents the y-coordinate of the joystick handle.
- Type:
int
- handle_coords¶
represents the coordinates of the joystick handle.
- Type:
QPointF
- get_distance() QPointF [source]¶
Calculate the distance between the handle and the center.
- Returns:
The distance between the handle and the center.
- Return type:
QPointF
- handle() QRectF [source]¶
Define the area of the joystick handle.
- Returns:
The area of the joystick handle.
- Return type:
QRectF
- staticMetaObject = PySide6.QtCore.QMetaObject("QJoystick" inherits "QWidget": )¶
view.rotation_widget module¶
Custom Qt Widget for Rotation Control.
This module provides a custom Qt widget to display a pointer being rotated on the circle. The widget allows users to rotate a pointer on a circle boundary.
- Example usage:
rotation_widget = RotationWidget() layout.addWidget(rotation_widget)
- class view.rotation_widget.RotationWidget(parent: QWidget | None = None)[source]¶
Bases:
QWidget
Custom Qt Widget for Rotation Control.
Represents a custom Qt widget for rotation control, showing where a pointer is on a circle.
- joystick_x¶
An int representing the x-coordinate of the joystick.
- joystick_y¶
An int representing the y-coordinate of the joystick.
- radius¶
An int representing the radius of the rotation control area.
- pointer_radius¶
An int representing the radius of the rotation control pointer.
- pointer() QRectF [source]¶
Define the area of the rotation control pointer.
- Returns:
The area of the rotation control pointer.
- Return type:
QRectF
- set_joystick_position(x: float, y: float) None [source]¶
Set the position of the joystick pointer.
- Parameters:
x (float) – The x-coordinate of the joystick.
y (float) – The y-coordinate of the joystick.
- staticMetaObject = PySide6.QtCore.QMetaObject("RotationWidget" inherits "QWidget": )¶
- view.rotation_widget.cartesian_to_polar(x: float, y: float) Tuple[float, float] [source]¶
Convert Cartesian coordinates to polar coordinates.
- Parameters:
x (float) – The x-coordinate.
y (float) – The y-coordinate.
- Returns:
The polar coordinates (r, theta).
- Return type:
Tuple[float, float]
- view.rotation_widget.polar_to_cartesian(r: float, theta: float) Tuple[float, float] [source]¶
Convert polar coordinates to Cartesian coordinates.
- Parameters:
r (float) – The radial distance.
theta (float) – The angle in radians.
- Returns:
The Cartesian coordinates (x, y).
- Return type:
Tuple[float, float]
view.custom_dialog module¶
Contains a custom dialog with a dropdown out of a given list, where a user has to choose one option.
- Typical usage:
dlg = CustomDialog([“option 1”, “option 2”], self) # self is an instance of QMainWindow
- class view.custom_dialog.CustomDialog(options: List[str], parent: QMainWindow | None = None)[source]¶
Bases:
QDialog
A dialog for selecting an option from a list of options.
This dialog prompts the user to select an option from a given list. It is typically used for selecting a serial port for communication with an ESP32 device.
- message_label¶
A Qlabel displaying the instruction message.
- label¶
A Qlabel prompting the user to choose an option.
- combo_box¶
A combo box populated with the provided options.
- button_box¶
A button box containing OK and Cancel buttons.
- get_selected_option() str [source]¶
Get the selected option from the combo box.
- Returns:
The selected option.
- Return type:
str
- staticMetaObject = PySide6.QtCore.QMetaObject("CustomDialog" inherits "QDialog": )¶