GUI modules¶
GUI¶
Developing a GUI for an application is a delicated task. On the one hand, developers want to deliver quick solutions. On the other, users are exposed to programs developed over decades, by large teams, including designers. Therefore, it is very hard for a single developer to obtain user interfaces as beautiful as the ones you can get from commercial suppliers.
However, it is possible to build a collection of tools that can be reused and that can generate a much more consistent result throughout different applications. The approach PyNTA follows is to develop GUI’s using Qt5. There are different ports of Qt for Python, such as PySide and PyQt. For the time being, PyNTA is based on PyQt5, but this can change without previous notice.
To develop a Graphical User Interface (GUI), we have opted to use Qt Designer, and the files are loaded directly to
the class through uic.loadUi
instead of compiling the files into a Python class. On the one hand, this
simplifies the cycle for updating the interface, on the other it does not make explicit which methods are available.
Compiling the files is up to the developer, but the official approach is to use only the UI files generated by
Qt Designer.
Todo
Different wrappers of Qt for Python expose the same API in different ways. We should explore using an intermediate package to unify the use of Qt.
- copyright
Aquiles Carattino <aquiles@uetke.com>
- license
GPLv3, see LICENSE for more details
-
class
pynta.view.GUI.camera_focusing.
CameraFocusing
(experiment=None, parent=None)[source]¶ Bases:
PyQt5.QtWidgets.QMainWindow
-
class
pynta.view.GUI.camera_viewer_widget.
CameraViewerWidget
(parent=None)[source]¶ Bases:
PyQt5.QtWidgets.QWidget
Widget for holding the images generated by the camera.
-
draw_target_pointer
(locations)[source]¶ gets an image and draws a circle around the target locations.
- Parameters
locations (DataFrame) – DataFrame generated by trackpy’s locate method. It only requires columns x and y with coordinates.
-
get_roi_values
()[source]¶ Get’s the ROI values in camera-space. It keeps track of the top left corner in order to update the values before returning. :return: Position of the corners of the ROI region assuming 0-indexed cameras.
-
keyPressEvent
(key)[source]¶ Triggered when there is a key press with some modifier. Shift+C: Removes the cross hair from the screen Ctrl+C: Emits a specialTask signal Ctrl+V: Emits a stopSpecialTask signal These last two events have to be handeled in the mainWindow that implemented this widget.
-
mouseMoved
(arg)[source]¶ Updates the position of the cross hair. The mouse has to be moved while pressing down the Ctrl button.
-
setup_roi_lines
(max_size)[source]¶ Sets up the ROI lines surrounding the image.
- Parameters
max_size (list) – List containing the maximum size of the image to avoid ROIs bigger than the CCD.
-
specialTask
¶
-
stopSpecialTask
¶
-
-
class
pynta.view.GUI.config_tracking_widget.
ConfigTrackingWidget
(parent=None)[source]¶ Bases:
PyQt5.QtWidgets.QWidget
-
apply_config
¶
-
flags
= 262144¶
-
Configuration Widget¶
Simple widget for storing the parameters of the UUTrack.Model._session
. It creates and populates tree thanks to the UUTrack.Model._session._session.getParams()
.
The widget has two buttons, one that updates the session by emitting a signal to the main thread and another the repopulates the tree whith the available parameters.
Todo
Remove the printing to screen of the parameters once the debugging is done.
-
class
pynta.view.GUI.histogram_tracks_widget.
HistogramTracksWidget
(parent=None)[source]¶ Bases:
PyQt5.QtWidgets.QWidget
In this example we draw two different kinds of histogram.
-
class
pynta.view.GUI.histogram_widget.
HistogramWidget
(parent=None)[source]¶ Bases:
PyQt5.QtWidgets.QWidget
-
class
pynta.view.GUI.main_window.
MainWindowGUI
(refresh_time=30)[source]¶ Bases:
PyQt5.QtWidgets.QMainWindow
In this example we draw two different kinds of histogram.