visiannot.visiannot.components.ProgressWidget

Summary

Module defining ProgressWidget

Classes

visiannot.visiannot.components.ProgressWidget.ProgressWidget(…)

Widget with the progression bar for video/signal navigation in a ViSiAnnoT window

API

Class ProgressWidget

class visiannot.visiannot.components.ProgressWidget.ProgressWidget(visi, widget_position, parent=None, progress_style={'brush': '#F00', 'size': 7, 'symbol': 'o'}, bg_progress_style={'pen': {'color': 'b', 'width': 2}}, line_style={'color': (0, 0, 0), 'width': 2}, title='', title_style={'color': '#000', 'size': '9pt'}, ticks_color='#000', ticks_size=9, ticks_offset=0, maximum_height=80, nb_ticks=5, current_fmt='%Y-%m-%dT%H:%M:%S.%s', range_fmt='%H:%M:%S.%s', ticks_fmt='%H:%M:%S.%s')[source]

Bases: pyqtgraph.widgets.PlotWidget.PlotWidget

Widget with the progression bar for video/signal navigation in a ViSiAnnoT window

Inherits from pyqtgraph.PlotWidget, see https://pyqtgraph.readthedocs.io/en/latest/widgets/plotwidget.html for details about parent class.

The constructor is re-implemented. It calls the constructor of PlotWidget and adds new attributes.

Parameters
  • visi – associated instance of ViSiAnnoT

  • widget_position (tuple or list) – position of the widget in the layout of the associated instance of ViSiAnnoT

  • parent – see https://pyqtgraph.readthedocs.io/en/latest/widgets/plotwidget.html

  • progress_style (dict) – plot style of the sliding progression point

  • bg_progress_style (dict) – plot style of the background progression bar

  • line_style (dict) – plot style of the current temporal range bounds

  • title (str) – progress bar title

  • title_style (dict) – title style

  • ticks_color (str or tuple) – color of the ticks text in HEX string or RGB format

  • ticks_size (float or int) – font size of the ticks text in pt

  • ticks_offset (int) – ticks text offset

  • maximum_height (int) – maximum height in pixels of the widget

  • nb_ticks (int) – number of ticks on the progress bar axis

  • current_fmt (str) – datetime string format of the current temporal position in progress bar, see https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes

  • range_fmt (str) – datetime string format of the temporal range duration in progress bar, see keyword argument fmt of convert_datetime_to_string()

  • ticks_fmt (str) – datetime string format of X axis ticks text, see keyword argument fmt of convert_datetime_to_string()

Methods:

getMouseXPosition(ev)

Computes the position of the mouse on the X axis in the progress plot coordinates

mouseDraggedProgress(visi)

Callback method for mouse dragging of the navigation point in the progress bar

mouseMoveEvent(ev)

Re-implemented in order to set the new position of the sliding progression point while dragging

mousePressEvent(ev)

Re-implemented in order to set the new position of the sliding progression point and launch the mouse dragging

mouseReleaseEvent(ev)

Re-implemented in order to set the new position of the sliding progression point and terminate the mouse dragging

setBoundaries(first_frame, last_frame)

Sets the position of the current temporal range boundaries

setProgressPlot(frame_id)

Sets the position of the sliding progress point

updateFromViSiAnnoT(nframes, first_frame, …)

Sets the attribute ProgressWidget.nframes with regards to the associated instance of ViSiAnnoT and updates the plot (useful for long recordings)

updateTitle(fps, beginning_datetime)

Updates the title of the progress bar

Attributes:

nframes

(int) Number of frames on the progress bar (defined by the associated instance of ViSiAnnoT)

current_fmt

(str) Datetime string format of the current temporal position in progress bar

range_fmt

(str) Datetime string format of the temporal range duration in progress bar

ticks_fmt

(str) Datetime string format of the text of X axis ticks

nb_ticks

(int) Number of ticks on the progress bar axis

flag_dragged

(bool) Specify if the sliding progress point is dragged

progress_curve

(pyqtgraph.PlotCurveItem) Background progression bar

progress_plot

(pyqtgraph.ScatterPlotItem) Sliding progress point

first_line

(pyqtgraph.InfiniteLine) Start boundary of the current temporal range in the associated ViSiAnnoT window

last_line

(pyqtgraph.InfiniteLine) End boundary of the current temporal range in the associated ViSiAnnoT window

getMouseXPosition(ev)[source]

Computes the position of the mouse on the X axis in the progress plot coordinates

Parameters

ev (QtGui.QMouseEvent) – emitted when the mouse is clicked/moved

Returns

position of the mouse

Return type

int

mouseDraggedProgress(visi)[source]

Callback method for mouse dragging of the navigation point in the progress bar

It updates the current frame ViSiAnnoT.frame_id at the current position defined by the mouse in the progress bar widget.

Connected to the signal sigPlotChanged of the scatter plot item of wid_progress (accessed with the method graphicsoverlayer.pyqtgraph_overlayer.ProgressWidget.getProgressPlot()).

mouseMoveEvent(ev)[source]

Re-implemented in order to set the new position of the sliding progression point while dragging

Parameters

ev (QtGui.QMouseEvent) – emitted when the mouse is clicked/moved

mousePressEvent(ev)[source]

Re-implemented in order to set the new position of the sliding progression point and launch the mouse dragging

Parameters

ev (QtGui.QMouseEvent) – emitted when the mouse is clicked/moved

mouseReleaseEvent(ev)[source]

Re-implemented in order to set the new position of the sliding progression point and terminate the mouse dragging

Parameters

ev (QtGui.QMouseEvent) – emitted when the mouse is clicked/moved

setBoundaries(first_frame, last_frame)[source]

Sets the position of the current temporal range boundaries

Parameters
  • first_frame (int) – new position of the start boundary

  • last_frame (int) – new position of the end boundary

setProgressPlot(frame_id)[source]

Sets the position of the sliding progress point

Parameters

frame_id (int) – new position of the sliding progress point

updateFromViSiAnnoT(nframes, first_frame, last_frame, fps, beginning_datetime)[source]

Sets the attribute ProgressWidget.nframes with regards to the associated instance of ViSiAnnoT and updates the plot (useful for long recordings)

Parameters
  • nframes (int) – new number of frames in the progress bar with regards to the associated instance of ViSiAnnoT

  • first_frame (int) – new position of the start boundary in frame number

  • last_frame (int) – new position of the end boundary in frame number

  • fps (float) – reference frequency of the associated instance of ViSiAnnoT

  • beginning_datetime (datetime.datetime) – beginning datetime of the current file in the long recording of the associated instance of ViSiAnnoT

updateTitle(fps, beginning_datetime)[source]

Updates the title of the progress bar

Parameters
  • fps (float) – reference frequency of the associated instance of ViSiAnnoT

  • beginning_datetime (datetime.datetime) – beginning datetime of the current file in the long recording of the associated instance of ViSiAnnoT

current_fmt

(str) Datetime string format of the current temporal position in progress bar

first_line

(pyqtgraph.InfiniteLine) Start boundary of the current temporal range in the associated ViSiAnnoT window

flag_dragged

(bool) Specify if the sliding progress point is dragged

last_line

(pyqtgraph.InfiniteLine) End boundary of the current temporal range in the associated ViSiAnnoT window

nb_ticks

(int) Number of ticks on the progress bar axis

nframes

(int) Number of frames on the progress bar (defined by the associated instance of ViSiAnnoT)

progress_curve

(pyqtgraph.PlotCurveItem) Background progression bar

progress_plot

(pyqtgraph.ScatterPlotItem) Sliding progress point

range_fmt

(str) Datetime string format of the temporal range duration in progress bar

ticks_fmt

(str) Datetime string format of the text of X axis ticks