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.

do_auto_scale()[source]
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.

set_roi_lines(X, Y)[source]
setup_cross_cut(max_size)[source]

Set ups the horizontal line for the cross cut.

setup_cross_hair(max_size)[source]

Sets up a cross hair.

setup_mouse_tracking()[source]
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
update_image(image)[source]
class pynta.view.GUI.config_tracking_widget.ConfigTrackingWidget(parent=None)[source]

Bases: PyQt5.QtWidgets.QWidget

apply_config
flags = 262144
get_config()[source]
print_config(config)[source]
revert_changes()[source]
update_config(config)[source]
Parameters

config (dict) – Dictionary with the new values

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.config_widget.ConfigWidget(parent=None)[source]

Bases: PyQt5.QtWidgets.QWidget

Widget for configuring the main parameters of the camera.

apply_config
flags = 262144
get_config()[source]
revert_changes()[source]
update_config(config)[source]
Parameters

config (dict) – Dictionary with the new values

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

update_distribution(values)[source]
class pynta.view.GUI.main_window.MainWindowGUI(refresh_time=30)[source]

Bases: PyQt5.QtWidgets.QMainWindow

background_reduction()[source]
calculate_histogram()[source]
clear_roi()[source]
closeEvent(self, QCloseEvent)[source]
configure()[source]
connect_actions()[source]
connect_buttons()[source]
connect_signals()[source]
initialize_camera()[source]
load_config()[source]
load_data()[source]
safe_close()[source]
save_image()[source]
set_roi()[source]
show_about()[source]
show_cheat_sheet()[source]
snap()[source]
start_continuous_saves()[source]
start_linking()[source]
start_movie()[source]
start_saving_tracks()[source]
start_tracking()[source]
stop_continuous_saves()[source]
stop_linking()[source]
stop_movie()[source]
stop_saving_tracks()[source]
stop_tracking()[source]
update_config(config)[source]
update_gui()[source]
update_tracking_config(config)[source]
update_tracks()[source]

In this example we draw two different kinds of histogram.

class pynta.view.GUI.tracks_widget.TracksWidget(parent=None)[source]

Bases: PyQt5.QtWidgets.QWidget

plot_trajectories(locations)[source]
Parameters

locations – Dataframe of locations as given by trackpy