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

View File

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

View File

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

View File

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