jdxi_editor.ui.widgets.midi.time_ruler
TimeRulerWidget
Time axis above the track viewer. Shows the playback position, the loop range and program-change markers, and is the place to seek (click/drag) and to move or delete program changes (drag/right-click a marker handle).
Attributes
Classes
A bar on the ruler: where it starts, its number, and the time signature |
|
A marker on the ruler. Markers with a key can be dragged and deleted. |
|
TimeRulerWidget |
Functions
|
Tempo changes [(tick, µs per beat)], time signatures [(tick, num, den)] and |
|
The bars and beats of midi_file, in seconds, following its time |
|
Module Contents
- class jdxi_editor.ui.widgets.midi.time_ruler.BarLine[source]
A bar on the ruler: where it starts, its number, and the time signature when one starts there (None otherwise).
- jdxi_editor.ui.widgets.midi.time_ruler._conductor(midi_file: mido.MidiFile) tuple[list, list, int][source]
Tempo changes [(tick, µs per beat)], time signatures [(tick, num, den)] and the last tick of midi_file, from all its tracks (as the playback engine reads them: one entry per tick, the last one wins).
- jdxi_editor.ui.widgets.midi.time_ruler.bar_grid(midi_file: mido.MidiFile) tuple[list[BarLine], list[float]][source]
The bars and beats of midi_file, in seconds, following its time signatures and tempo changes.
Bars are counted as the playback engine counts them (
bar_beat_at_tick, the position shown in the player and «Snap to bars»): at a change of time signature a new bar starts, and an unfinished bar before it still counts. Returns ([], []) when the file has more than MAX_GRID_BARS bars.
- jdxi_editor.ui.widgets.midi.time_ruler._signature_before(bars: list[BarLine], line: BarLine) tuple[int, int] | None[source]
- class jdxi_editor.ui.widgets.midi.time_ruler.RulerMarker[source]
A marker on the ruler. Markers with a key can be dragged and deleted.
- class jdxi_editor.ui.widgets.midi.time_ruler.TimeRulerWidget(midi_file: mido.MidiFile = None, parent: PySide6.QtWidgets.QWidget = None)[source]
Bases:
PySide6.QtWidgets.QWidgetTimeRulerWidget
- Signals:
seek_requested(float): user clicked/dragged to a time (seconds) marker_moved(object, float): marker key dragged to a new time marker_delete_requested(object): delete the marker with key marker_edit_requested(object): edit the marker with key (double-click)
- _markers: list[RulerMarker] = [][source]
- _dragging_marker: RulerMarker | None = None[source]
- grid() tuple[list[BarLine], list[float]][source]
The file’s bars and beats (see bar_grid), worked out once per file.
- set_loop_region(loop_range: tuple[float, float] | None, enabled: bool) None[source]
Show the A–B range (None = whole file) and whether looping is on.
- set_loop_marks(a: float | None, b: float | None) None[source]
The A and B points as they are set: one shows at once, before the other makes the range (A alone used to show nothing).
- add_marker(seconds: float, color: PySide6.QtGui.QColor | None = None, label: str | None = None, key: Any = None) None[source]
Add a time marker in seconds and repaint. Markers with a key are draggable.
- set_markers(markers: list[RulerMarker]) None[source]
Replace all markers.
- _marker_at(pos: PySide6.QtCore.QPoint) RulerMarker | None[source]
Draggable marker whose handle is under pos.
- _paint_bar_beat_grid(painter: PySide6.QtGui.QPainter, width: int, height: int, duration: float) None[source]
Bars (numbered) and beats, with the file’s time signatures and tempo changes; the time signature where it starts (when not 4/4 throughout). Seconds when the file has no usable bars.
- static _label_interval(bar_px: float, painter: PySide6.QtGui.QPainter, bar_count: float) int[source]
Number every 1, 2, 4, 8… bars so labels are MIN_LABEL_SPACING apart.
- _marker_groups() list[list[RulerMarker]][source]
Markers drawn within MARKER_GROUP_PX of each other, left to right.
- _paint_markers(painter: PySide6.QtGui.QPainter, height: int) None[source]
One flag per group; a label only where it fits before the next one.
- _markers_near(pos: PySide6.QtCore.QPoint) list[RulerMarker][source]
Markers in the group under pos (for the tooltip).