Expose more `pg.ArrowItem` params thru annot-ctl API

multiaddrs
Gud Boi 2026-01-27 16:20:23 -05:00
parent 8701b517e7
commit be28d083e4
4 changed files with 48 additions and 8 deletions

View File

@ -127,7 +127,6 @@ async def markup_gaps(
# BGM=0.16 is the normal diff from overlap between bars, SO
# just go slightly "in" from that "between them".
from_idx: int = BGM - .06 # = .10
lc: tuple[float, float] = (
istart + 1 - from_idx,
cls,
@ -162,14 +161,20 @@ async def markup_gaps(
'down' if sgn == 1
else 'up'
)
# TODO! mk this a `msgspec.Struct` which we deserialize
# on the server side!
arrow_kwargs: dict[str, Any] = dict(
fqme=fqme,
timeframe=timeframe,
x=iend,
y=cls,
color=color,
alpha=160,
alpha=169,
pointing=direction,
# TODO: expose these as params to markup_gaps()?
headLen=10,
headWidth=2.222,
pxMode=True,
)
aid: int = await actl.add_arrow(

View File

@ -243,8 +243,8 @@ async def maybe_fill_null_segments(
)
if (
from_timestamp(
array['time'][0]
frame_start_dt := (
from_timestamp(array['time'][0])
) < backfill_until_dt
):
await tractor.pause()

View File

@ -94,6 +94,11 @@ class ArrowEditor(Struct):
] = None,
alpha: int = 255,
zval: float = 1e9,
headLen: float|None = None,
headWidth: float|None = None,
tailLen: float|None = None,
tailWidth: float|None = None,
pxMode: bool = True,
) -> pg.ArrowItem:
'''
@ -109,6 +114,15 @@ class ArrowEditor(Struct):
# scale arrow sizing to dpi-aware font
size = _font.font.pixelSize() * 0.8
# allow caller override of head dimensions
if headLen is None:
headLen = size
if headWidth is None:
headWidth = size/2
# tail params default to None (no tail)
if tailWidth is None:
tailWidth = 3
color = color or 'default'
color = QColor(hcolor(color))
color.setAlpha(alpha)
@ -117,10 +131,11 @@ class ArrowEditor(Struct):
arrow = pg.ArrowItem(
angle=angle,
baseAngle=0,
headLen=size,
headWidth=size/2,
tailLen=None,
pxMode=True,
headLen=headLen,
headWidth=headWidth,
tailLen=tailLen,
tailWidth=tailWidth,
pxMode=pxMode,
# coloring
pen=pen,
brush=brush,

View File

@ -183,6 +183,11 @@ async def serve_rc_annots(
'color': color,
'aid': str()|None as aid,
'alpha': int(alpha),
'headLen': int()|float()|None as headLen,
'headWidth': int()|float()|None as headWidth,
'tailLen': int()|float()|None as tailLen,
'tailWidth': int()|float()|None as tailWidth,
'pxMode': bool(pxMode),
},
# ?TODO? split based on method fn-sigs?
# 'pointing',
@ -213,6 +218,11 @@ async def serve_rc_annots(
pointing=pointing,
color=color,
alpha=alpha,
headLen=headLen,
headWidth=headWidth,
tailLen=tailLen,
tailWidth=tailWidth,
pxMode=pxMode,
)
annots[aid] = arrow
_editors[aid] = arrows
@ -441,6 +451,11 @@ class AnnotCtl(Struct):
# domain: str = 'view', # or 'scene'
color: str = 'dad_blue',
alpha: int = 116,
headLen: float|None = None,
headWidth: float|None = None,
tailLen: float|None = None,
tailWidth: float|None = None,
pxMode: bool = True,
from_acm: bool = False,
@ -464,6 +479,11 @@ class AnnotCtl(Struct):
'pointing': pointing, # up|down
'alpha': alpha,
'aid': None,
'headLen': headLen,
'headWidth': headWidth,
'tailLen': tailLen,
'tailWidth': tailWidth,
'pxMode': pxMode,
},
})
aid: int = await ipc.receive()