BCDA-APS / gemviz

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

Failed runs should be marked by background color. #108

Closed prjemian closed 1 year ago

prjemian commented 1 year ago

On first public demonstration, a user asks if, in the QTableView, can the background color be changed for runs where the exit status is other than "successful"?

prjemian commented 1 year ago

To set background color of a cell, see: https://stackoverflow.com/a/60768287

prjemian commented 1 year ago

The table QAbstractTableModel emits a custom signal (unsuccessfulRun) from its data() method when the run's exit_status is not successful. Arguments needed are row, column, and exit_status. The table object is useful. The QTableView connects that signal to its own custom slot to change the cell's background color.

prjemian commented 1 year ago

Perhaps a different strategy, see https://stackoverflow.com/a/44104745, in short, return a QBrush for BackgroundRole:

        elif role == QtCore.Qt.BackgroundRole:
            return QtGui.QBrush("blue")