fix: busy flag in Axis views as plain status text, not a badge
CI / lint (push) Skipped
CI / test (3.11) (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (push) Skipped
CI / test (3.11) (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
Gonio camera, Beamline view and the combined view showed BEAMLINE BUSY in the rounded badge pill, which reads as a clickable button. These views are passive, so draw the same shadowed colored text the sample camera uses for its warnings; the pill stays only on the sample-camera session badges, which really are click targets. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
75d7bed380
commit
69d552c068
2 files changed
+29
-4
No files matched your search
@@ -23,6 +23,7 @@ from aare.gui.styles import (
|
||||
BUSY_YELLOW_BORDER,
|
||||
BUSY_YELLOW_DOT,
|
||||
BUSY_YELLOW_TEXT_DARK,
|
||||
SHADOW,
|
||||
WHITE,
|
||||
qcolor,
|
||||
)
|
||||
@@ -99,6 +100,30 @@ def draw_busy_badge(
|
||||
return bg_rect
|
||||
|
||||
|
||||
def draw_busy_status_text(
|
||||
painter: QPainter,
|
||||
viewport_width: int,
|
||||
viewport_height: int,
|
||||
style: BusyOverlayStyle,
|
||||
) -> None:
|
||||
"""Non-clickable busy status for the passive Axis views: solid colored
|
||||
text with a 1px shadow, no badge box — the pill read as a button (same
|
||||
look as the sample camera's own warning text). Same position/typeface as
|
||||
draw_busy_badge so the message reads identically everywhere."""
|
||||
font = QFont()
|
||||
font.setPointSize(24)
|
||||
font.setBold(True)
|
||||
font_metrics = QFontMetrics(font)
|
||||
painter.setFont(font)
|
||||
|
||||
x = (viewport_width - font_metrics.horizontalAdvance(style.text)) // 2
|
||||
baseline = int(viewport_height * 0.68) + font_metrics.ascent() // 2
|
||||
painter.setPen(QPen(qcolor(SHADOW, 200)))
|
||||
painter.drawText(QPoint(x + 1, baseline + 1), style.text)
|
||||
painter.setPen(QPen(qcolor(style.badge_bg)))
|
||||
painter.drawText(QPoint(x, baseline), style.text)
|
||||
|
||||
|
||||
def build_busy_overlay_style(
|
||||
*,
|
||||
is_busy: bool,
|
||||
|
||||
@@ -2,7 +2,7 @@ from PySide6.QtCore import QRectF, Qt, Slot
|
||||
from PySide6.QtGui import QImage, QPainter, QPixmap
|
||||
from PySide6.QtWidgets import QGraphicsPixmapItem, QGraphicsScene, QGraphicsView
|
||||
|
||||
from aare.gui.widgets.busy_overlay import BusyOverlayStyle, draw_busy_badge
|
||||
from aare.gui.widgets.busy_overlay import BusyOverlayStyle, draw_busy_status_text
|
||||
|
||||
|
||||
class VideoGraphicsView(QGraphicsView):
|
||||
@@ -114,9 +114,9 @@ class VideoGraphicsView(QGraphicsView):
|
||||
painter.save()
|
||||
painter.resetTransform()
|
||||
painter.setRenderHint(QPainter.RenderHint.Antialiasing, True)
|
||||
# Shared renderer with the sample camera, so every view shows the
|
||||
# identical badge (this view used to draw its own dot+text variant).
|
||||
draw_busy_badge(
|
||||
# Plain shadowed text like the sample camera's warnings, not the
|
||||
# badge pill: these views are passive and the pill read as a button.
|
||||
draw_busy_status_text(
|
||||
painter, self.viewport().width(), self.viewport().height(), self._busy_overlay_style
|
||||
)
|
||||
painter.restore()
|
||||
Reference in new issue
Block a user