from __future__ import annotations import bisect import generator.model def column(index, time, system_start, fonts): position = bisect.bisect_right(index.scale_starts, time) - 1 if position < 0: return [] span = index.scale_spans[position] if time >= generator.model.fraction(span['end']) or time not in (system_start, index.scale_starts[position]): return [] return [fonts.text(span['label'], 0, 0, 16, 'scale', (span['id'],))]