aboutsummaryrefslogtreecommitdiffstats
path: root/sb_builder/dashboard.py
diff options
context:
space:
mode:
Diffstat (limited to 'sb_builder/dashboard.py')
-rw-r--r--sb_builder/dashboard.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/sb_builder/dashboard.py b/sb_builder/dashboard.py
index d4152ae..85c19f4 100644
--- a/sb_builder/dashboard.py
+++ b/sb_builder/dashboard.py
@@ -19,7 +19,7 @@
import html
import time
-from PyQt6.QtCore import QEvent, QRectF, Qt
+from PyQt6.QtCore import QEvent, QRectF, Qt, pyqtSignal
from PyQt6.QtGui import QColor, QFont, QPainter, QPalette
from PyQt6.QtWidgets import (QFrame, QGridLayout, QHBoxLayout, QLabel, QPushButton,
QToolTip, QVBoxLayout, QWidget)
@@ -44,12 +44,24 @@ def muted(label):
class Card(QFrame):
"""Rounded panel with a muted title; content goes into self.body."""
+ clicked = pyqtSignal()
+
def __init__(self, title):
super().__init__(objectName="card")
self.body = QVBoxLayout(self)
self.body.setContentsMargins(16, 12, 16, 14)
self.body.addWidget(muted(QLabel(title)))
+ def link(self, slot):
+ """Make the whole card open something."""
+ self.clicked.connect(slot)
+ self.setCursor(Qt.CursorShape.PointingHandCursor)
+
+ def mouseReleaseEvent(self, event):
+ if event.button() == Qt.MouseButton.LeftButton:
+ self.clicked.emit()
+ super().mouseReleaseEvent(event)
+
class Tile(Card):
"""Stat tile: title, one large value, a muted detail line."""