RodTracker.ui.rodnumberwidget
Includes classes which define the widget used to add/manipulate the particle numbers to the image overlay in RodTracker GUI.
Author: Adrian Niemann (adrian.niemann@ovgu.de)
Date: 2022-2024
- class RodNumberWidget(color, parent=None, text='', pos=QtCore.QPoint(0, 0))[source]
Bases:
QLineEditA custom
QLineEditto display rod numbers and have associated rods.- Parameters:
color (str) – The color of the rod that this widget represents.
parent (QWidget, optional) – The widgets parent widget. Default is
None.text (str, optional) – The text displayed by the widget. Default is
"".pos (QPoint, optional) – The position of the widget (relative to its parent widget). Default is
QPoint(0, 0).
Signals
Slots
- rod_points
The starting and ending points of the rod in UNSCALED form:
[x1, y1, x2, y2]- Type:
List[int]
- rod_center
Center of the rod in SCALED form, i.e. adjusted to zoom levels and offsets.
- Type:
np.array[float]
- color
The color of the rod being represented.
- Type:
str
- activated
Notifies, that this rod has been activated.
- Type:
pyqtSignal(int)
- copy()[source]
Copies this instance of a
RodNumberWidget.- Returns:
RodNumberWidget
- dropped
Notifies, that his widget has been dropped after dragging it to a new location.
- Type:
pyqtSignal(QPoint)
- id_changed
Notifies, that this rod has changed its ID (number).
- Type:
pyqtSignal(QLineEdit, int)
- keyPressEvent(e: QKeyEvent) None[source]
Reimplements
QLineEdit.keyPressEvent(e).Handles the confirmation and exiting during rod number editing using keyboard keys.
- Parameters:
e (QMouseEvent)
- Returns:
None
- mouseDoubleClickEvent(e: QMouseEvent) None[source]
Reimplements
QLineEdit.mouseDoubleClickEvent(e).Handles the selection of a rod number for editing.
- Parameters:
e (QMouseEvent)
- Returns:
None
- mouseMoveEvent(e: QMouseEvent) None[source]
Reimplements
QLineEdit.mouseMoveEvent(e).Handles the position updating during drag&drop of this widget by the user.
- Parameters:
e (QMouseEvent)
- Returns:
None
- mousePressEvent(event)[source]
Reimplements
QLineEdit.mousePressEvent(event).Handles the selection of a rod for corrections and drag&drop of this widget by the user.
- Parameters:
event (QMouseEvent)
- Returns:
None
- mouseReleaseEvent(event) None[source]
Reimplements
QLineEdit.mouseReleaseEvent(event).Handles ending of drag&drop of this widget by the user.
- Parameters:
event (QMouseEvent)
- Returns:
None
- property pen
Holds the
QPenwith the visual settings defined by the current state of this rod.- Returns:
QPen
- Raises:
- request_delete
Requests the deletion of this rod by the managing object.
- Type:
pyqtSignal(QLineEdit)
- resolution_adjust(font_size, bound_offset=5)[source]
Sets the new font size and adapts the widgets size to it. Currently not used.
- property rod_id
Property that represents the rod’s ID (number).
- Returns:
int
- property rod_state
Holds the state of the rod.
State of the rod also determines the visual appearance.
- Returns:
RodState
- seen: bool = False
- settings_signal: pyqtBoundSignal = None
Signal to connect to for receiving updates of settings.
Must be set before the creation of an instance to be used by that instance.
By default
None.- Type:
pyqtBoundSignal
- classmethod update_defaults(settings: dict) None[source]
Catches updates of the settings from a
Settingsclass.Checks for the keys relevant to itself and updates the corresponding class attributes. Updates those attributes to already have the correct values when a new
RodNumberWidgetis created.- Parameters:
settings (dict)
- Returns:
None
- class RodState(value)[source]
Bases:
EnumStates of a rod.
- CHANGED = 3
- CONFLICT = 4
- EDITING = 2
- NORMAL = 0
- SELECTED = 1
- exception RodStateError[source]
Bases:
ValueErrorCustom error that is raised when an unknown
RodStateis encountered.
- class RodStyle(value)[source]
Bases:
str,EnumStyles for rod numbers.
- CHANGED = 'background-color: transparent;color: green; font: {}px; font-weight: bold;'
- CONFLICT = 'background-color: transparent;color: red; font: {}px; font-weight: bold;'
- GENERAL = 'background-color: transparent;color: rgb({},{},{}); font: {}px; font-weight: bold;'
- SELECTED = 'background-color: transparent;color: white; font: {}px; font-weight: bold;'
- __format__(format_spec)
Returns format using actual value type unless __str__ has been overridden.