BCDA-APS / gemviz

Data visualization for tiled
https://bcda-aps.github.io/gemviz/
Other
4 stars 0 forks source link

Mark unsuccessful runs with different background color in table #157

Closed prjemian closed 1 year ago

prjemian commented 1 year ago
prjemian commented 1 year ago
exit status background color
success standard (alternate white and not white, Qt's choice)
fail mistyrose (#ffe4e1)
abort lightyellow (#ffffe0)
other lightslategrey (#778899)

Example: image

rodolakis commented 1 year ago

While researching Qt.BackgroundRole, I found this list of common roles in the QAbstractItemModel class for different kinds of data and formatting:

Qt.DisplayRole: Data to be rendered as text. Qt.DecorationRole: Data to be rendered as an icon. Qt.EditRole: Data that can be edited. Qt.ToolTipRole: Data to be displayed as a tooltip. Qt.StatusTipRole: Data to be displayed in a status bar. Qt.WhatsThisRole: Data that can be used to populate "What's This?" help messages. Qt.FontRole: Font used to display data. Qt.TextAlignmentRole: Alignment of the data. Qt.BackgroundRole: Background color. Qt.ForegroundRole: Foreground color (e.g., text color). Qt.CheckStateRole: Check state (e.g., for checkable items).

We could use Qt.TextAlignmentRole instead of a delegate to center the "Scan ID" and "#points" in the table:

if role == Qt.TextAlignmentRole:
        if index.column() in [0,4]:
            return Qt.AlignCenter
        else:
            return Qt.AlignLeft
prjemian commented 1 year ago

with color 0xe2e2ec: image

prjemian commented 1 year ago

Just manufactured the variety of different cases we're showing: image

prjemian commented 1 year ago

@rodolakis This is ready now. I'm putting off the Qt.TextAlignmentRole handling to a different issue. I'm glad you pointed that out!