holypipette.gui.camera module

class holypipette.gui.camera.CameraGui(camera, image_edit=None, display_edit=None, with_tracking=False, base_directory='.')[source]

Bases: QMainWindow

The basic GUI for showing a camera image.

Parameters:
  • camera (Camera) – The Camera object that will be used for displaying an image via LiveFeedQt.

  • image_edit (function or list of functions, optional) – A function that will be called with the numpy array returned by the camera. Can be used to post-process the image, e.g. to change its brightness.

  • display_edit (function or list of functions, optional) – A function that will be called with the QPixmap that is based on the camera image. Can be used to display additional information on top of this image, e.g. a scale bar or text.

  • with_tracking (bool, optional) – Whether to activate the object tracking interface. Defaults to False.

abort_task()[source]
add_config_gui(config)[source]
camera_reset_signal
camera_signal
close()[source]

Close the GUI.

closeEvent(self, QCloseEvent)[source]
configuration_keypress()[source]

Show/hide the configuration pane

display_edit(pixmap)[source]

Applies the functions stored in display_edit_funcs to the video image pixmap.

Parameters:

pixmap (QPixmap) – The pixmap to draw on.

draw_cross(pixmap)[source]

Draws a cross at the center. Meant to be used as a display_edit function.

Parameters:

pixmap (QPixmap) – The pixmap to draw on.

error_status(message)[source]
exit()[source]

Exit the application

help_keypress()[source]

Toggle display of keyboard/mouse commands

image_edit(image)[source]

Applies the functions stored in image_edit_funcs to the video image. Each function works on the result of the previous function

Parameters:

image (ndarray) – The original video image or the image returned by a previously called function.

Returns:

new_image – The post-processed image. Should be of the same size and data type as the original image.

Return type:

ndarray

initialize()[source]
keyPressEvent(self, QKeyEvent)[source]
log_keypress()[source]

Toggle display of log output

log_signal
register_commands()[source]

Tie keypresses and mouse clicks to commands. Should call register_key_action and register_mouse_action. Overriding methods in subclass should call the superclass if they want to keep the commands registered by the superclass(es).

register_key_action(key, modifier, command, argument=None, default_doc=True)[source]

Link a keypress to an action.

Parameters:
  • key (Qt.Key) – The key that should be handled, specified as a Qt constant, e.g. Qt.Key_X or Qt.Key_5.

  • modifier (Qt.Modifer or None) – The modifier that needs to be pressed at the same time to trigger the action. The modifier needs to be given as a Qt constant, e.g. Qt.ShiftModifier or Qt.ControlModifier. Alternatively, None can be used to specify that the keypress should lead to the action independent of the modifier.

  • command (method) – A method implementing the action that has been annotated with the @command or @blocking_command decorator.

  • argument (object, optional) – An additional argument that should be handled to the method defined as command. Can be used to re-use the same action in a parametrized way (e.g. steps of different size).

  • default_doc (bool, optional) – Whether to include the action in the automatically generated help. Defaults to True.

register_mouse_action(click_type, modifier, command, default_doc=True)[source]

Link a mouse click on the camera image to an action.

Parameters:
  • click_type (Qt.MouseButton) – The type of click that should be handled as a Qt constant, e.g. Qt.LeftButton or Qt.RightButton.

  • modifier (Qt.Modifer or None) – The modifier that needs to be pressed at the same time to trigger the action. The modifier needs to be given as a Qt constant, e.g. Qt.ShiftModifier or Qt.ControlModifier. Alternatively, None can be used to specify that the mouse click should lead to the action independent of the modifier.

  • command (method) – A method implementing the action that has been annotated with the @command or @blocking_command decorator.

  • default_doc (bool, optional) – Whether to include the action in the automatically generated help. Defaults to True.

set_status_message(category, message)[source]
splitter_size_changed(pos, index)[source]
start_task(task_name, interface)[source]
status_message_updated(message)[source]
task_finished(exit_reason, controller_or_message)[source]
toggle_configuration_display()[source]
toggle_help()[source]
toggle_log()[source]
toggle_overlay()[source]

Show/hide the overlay information on the image

toggle_recording(*args)[source]

Toggle recording image files to disk

video_mouse_press(event)[source]
class holypipette.gui.camera.ConfigGui(config, show_name=False)[source]

Bases: QWidget

display_changed_value(key, value)[source]
load_config()[source]
save_config()[source]
set_boolean_value(name, widget)[source]
set_numerical_value(name, value)[source]
set_numerical_value_with_unit(name, magnitude, value)[source]
value_changed(key, value)[source]
value_changed_signal
class holypipette.gui.camera.ElidedLabel(text, minimum_width=200, *args, **kwds)[source]

Bases: QLabel

minimumSizeHint(self) QSize[source]
resizeEvent(self, QResizeEvent)[source]
class holypipette.gui.camera.KeyboardHelpWindow(parent)[source]

Bases: QMainWindow

closeEvent(self, QCloseEvent)[source]
close_signal
keyPressEvent(self, QKeyEvent)[source]
register_custom_action(category, action, description)[source]
register_key_action(key, modifier, category, description)[source]
register_mouse_action(click_type, modifier, category, description)[source]
update_text()[source]
class holypipette.gui.camera.LogNotifyHandler(signal)[source]

Bases: Handler

emit(record)[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

class holypipette.gui.camera.LogViewerWindow(parent)[source]

Bases: QMainWindow

closeEvent(self, QCloseEvent)[source]
close_signal
levels = {'DEBUG': 10, 'ERROR': 40, 'INFO': 20, 'WARN': 30}
save_log()[source]
set_level(level_idx)[source]
class holypipette.gui.camera.Logger[source]

Bases: QAbstractTableModel, Handler

columnCount(self, parent: QModelIndex = QModelIndex()) int[source]
data(self, QModelIndex, role: int = Qt.DisplayRole) Any[source]
emit(record)[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

headerData(self, int, Qt.Orientation, role: int = Qt.DisplayRole) Any[source]
rowCount(self, parent: QModelIndex = QModelIndex()) int[source]
save_to_file(filename)[source]
class holypipette.gui.camera.RecordingDialog(base_directory, frame_rate, pixels, settings, parent=None)[source]

Bases: QDialog

directory_clicked()[source]
memory_edited(value)[source]
prefix_edited()[source]
select_folder()[source]
skip_edited(value)[source]