RodTracker.ui.mainwindow
TBD
- class RodTrackWindow(*args, **kwargs)[source]
Bases:
QMainWindowThe main window for the Rod Tracker application.
This class handles most of the interaction between the user and the GUI elements of the Rod Tracker application. It also sets up the backend objects necessary for this application.
- Parameters:
*args (iterable) – Positional arguments for the
QMainWindowsuperclass.**kwargs (dict) – Keyword arguments for the
QMainWindowsuperclass.
Signals
Slots
- ui
The GUI main window object, that contains all other visual objects.
- Type:
- cameras
A copy of all image display objects (views) from the GUI main window.
- Type:
List[RodImageWidget]
- image_managers
Manager objects for loaded/selected image datasets. There is one associated with each
RodImageWidgetincameras.- Type:
List[ImageData]
- change_color(to_color: str)[source]
Activates the given color QRadioButton in the GUI.
- Parameters:
to_color (str) – The color that is activated.
- Returns:
None
- change_view(direction: int) None[source]
Helper method for programmatic changes of the camera tabs.
- closeEvent(a0: QCloseEvent) None[source]
Reimplements
QMainWindow.closeEvent(a0).In case of unsaved changes, the user is asked to save or discard these before closing the application. The closing can be aborted with this dialog.
- Parameters:
a0 (QCloseEvent)
- Returns:
None
- display_rod_changed(number: str)[source]
Handles a change of rod numbers in the user’s input field.
- eventFilter(source: QObject, event: QEvent) bool[source]
Intercepts events, here modified scroll events for zooming.
- Parameters:
source (QObject)
event (QEvent)
- Returns:
bool –
True, if the event shall not be propagated further.False, if the event shall be passed to the next object to be handled.
- fit_to_window()[source]
Fits the image to the space available in the GUI.
Fits the image to the space available for the image in the GUI and keeps the aspect ratio as in the original.
- Returns:
None
- get_selected_color()[source]
Gets the currently selected color in the GUI.
- Returns:
str – The color that is currently selected in the GUI.
- images_loaded(frames: int, cam_id: str, folder: Path)[source]
Handles updates of loaded image datasets.
Updates GUI elements to match the newly loaded image dataset.
- Parameters:
frames (int) – Number of loaded frames.
cam_id (str) – ID of the loaded dataset/folder/camera.
folder (Path) – Folder from which the images were loaded.
- logger: ActionLogger
A logger object keeping track of users’ actions performed on the main window, i.e. data and image loading and saving.
- Type:
- logger_id: str = 'main'
The ID provided to the logger for accountability of the actions in the GUI.
Default is
"main".- Type:
str
- next_image(frame: int, frame_idx: int)[source]
Handles updates of the currently displayed image.
Updates the GUI controls to match the currently displayed image.
- Parameters:
frame (int) – Frame number of the newly displayed image.
frame_idx (int) – Index of the newly displayed image in the whole image dataset.
- request_redo
Is emitted when the user wants to redo a previously reverted action.
The payload is the ID of the widget on which the last action shall be redone.
- Type:
pyqtSignal(str)
- request_undo
Is emitted when the user wants to revert an action.
The payload is the ID of the widget on which the last action shall be reverted.
- Type:
pyqtSignal(str)
- resizeEvent(a0: QResizeEvent) None[source]
Reimplements QMainWindow.resizeEvent(a0).
Currently not used.
- Parameters:
a0 (QResizeEvent.)
- Returns:
None
- rods_loaded(input: Path, output: Path, new_colors: List[str])[source]
Handles updates of loaded rod position datasets.
Updates GUI elements to match the newly loaded rod position dataset.
- Parameters:
input (Path) – Path to the folder the position data is loaded from.
output (Path) – Path to the (automatically) selected folder for later output of the corrected dataset.
new_colors (List[str]) – Colors for which data is available in the loaded dataset.
- scale_image(factor: float)[source]
Sets a new relative scaling for the current image.
Sets a new scaling to the currently displayed image. The scaling factor acts relative to the already applied scaling.
- Parameters:
factor (float) –
The relative scaling factor. Example:
factor=1.1, current scaling:2.0==> new scaling:2.2- Returns:
None
- show_2D_changed(state: int)[source]
Catches a
QCheckBoxstate change to display or clear rods in 2D.- Parameters:
state (int) – The new state of the QCheckbox {0, 2}
- Returns:
None
- show_3D_changed(state: int)[source]
Catches a
QCheckBoxstate change to display or clear rods in 3D.- Parameters:
state (int) – The new state of the QCheckbox {0, 2}
- Returns:
None
- show_next(direction: int)[source]
Attempt to open the next image.
Attempt to open the next image in the direction provided relative to the currently opened image.
- Parameters:
direction (int) – Direction of the image to open next. Its the index relative to the currently opened image. a) direction = 3 -> opens the image three positions further b) direction = -1 -> opens the previous image c) direction = 0 -> keeps the current image open
- Returns:
None
- slider_moved(pos: int)[source]
Handle image displays corresponding to slider movements.
- Parameters:
pos (int) – New position of the slider, that is thereby the new image index to be displayed.
- tab_has_changes(has_changes: bool, cam_id: str) None[source]
Changes the tabs text to indicate it has (no) changes.
- Parameters:
has_changes (bool)
cam_id (str) – Camera which indicated it now has (no) changes.
- tree_selection(item: QTreeWidgetItem, col: int)[source]
Handle the selection of a rod & frame in the
RodTreewidget.
- update_settings(settings: dict)[source]
Catches updates of the settings from a
Settingsclass.Checks for the keys relevant to itself and updates the corresponding attributes. Updates itself with the new settings in place.
- Parameters:
settings (dict)
- Returns:
None
- view_changed(new_idx: int)[source]
Handles switches between the camera tabs.
Handles the switches between the camera tabs and depending on the GUI state tries to load the same frame for the newly displayed tab as in the old one.
- Parameters:
new_idx (int) – The index of the tab that is shown next.
- Returns:
None
- static warning_unsaved() bool[source]
Warns that there are unsaved changes that might get lost.
Issues a warning popup to the user to either discard any unsaved changes or stay in the current state to prevent changes get lost.
- Returns:
bool –
True, if changes shall be discarded.False, if the user aborted.