spacr.qt.widgets.tile_chrome¶
Draw rounded crop tiles with shared annotation-screen chrome.
The annotation and montage views use this module so their clipping and selection states stay visually consistent. A tile composes three layers:
┌── current ring (white) — the tile the next action targets │ ┌── state ring — resting gray, or the crop’s class colour │ │ ┌── the crop itself, clipped to a rounded rect (a real round │ │ │ corner, not a rounded frame laid over a square image)
The rings use fixed insets, so hover adds the outer current ring without moving the crop or replacing its class-colored state ring.
Functions¶
|
Rect to draw |
|
Draw one tile: the clipped crop, its state ring, and the hover ring. |
|
Stroke one rounded rect inset by |
Module Contents¶
- spacr.qt.widgets.tile_chrome.cover_rect(pixmap: PySide6.QtGui.QPixmap, box: PySide6.QtCore.QRectF) PySide6.QtCore.QRectF[source]¶
Rect to draw
pixmapinto so it fillsboxat its own aspect.Crops rather than letterboxes – the clip path trims the overflow – so a tile is always a complete rounded square with no canvas showing through at the corners. A crop that already matches the box comes back unchanged.
- Parameters:
pixmap – the image to draw; only its size is read. An empty pixmap returns
boxunchanged.box – the rectangle to fill.
- spacr.qt.widgets.tile_chrome.paint_tile(painter: PySide6.QtGui.QPainter, w: float, h: float, pixmap, *, border_colour: str, ring_colour: str = '', current: bool = False) None[source]¶
Draw one tile: the clipped crop, its state ring, and the hover ring.
- Parameters:
painter – active Qt painter for the tile widget.
w – tile width in painter coordinates.
h – tile height in painter coordinates.
pixmap – the crop, or
Nonefor an empty slot – which still gets its rings, because an empty tile the cursor is on has to look like the tile the cursor is on.border_colour – colour of the persistent state border; an empty string omits the border.
current – whether the cursor (or the keyboard) is on this tile.
- spacr.qt.widgets.tile_chrome.stroke_ring(painter: PySide6.QtGui.QPainter, colour: str, width: int, inset: float, w: float, h: float) None[source]¶
Stroke one rounded rect inset by
insetfrom the widget edge.- Parameters:
painter – the active painter; its pen is replaced.
colour – stroke colour, any string
QColoraccepts.width – pen width in pixels.
inset – distance of the ring from the widget edge, in pixels; the corner radius shrinks by the same amount (to at least 1).
w – widget width in pixels.
h – widget height in pixels. Nothing is drawn when the inset leaves no room in either dimension.