2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 11:18:27 +08:00

gui/log: ensure black/white colors

This commit is contained in:
Sebastien Bourdeauducq 2015-10-14 16:30:16 +08:00
parent 9f04af63e6
commit da159f11d4

View File

@ -28,6 +28,8 @@ class _LogModel(ListSyncModel):
self.fixed_font = QtGui.QFont()
self.fixed_font.setFamily("Monospace")
self.white = QtGui.QBrush(QtGui.QColor(255, 255, 255))
self.black = QtGui.QBrush(QtGui.QColor(0, 0, 0))
self.debug_fg = QtGui.QBrush(QtGui.QColor(55, 55, 55))
self.warning_bg = QtGui.QBrush(QtGui.QColor(255, 255, 180))
self.error_bg = QtGui.QBrush(QtGui.QColor(255, 150, 150))
@ -43,13 +45,13 @@ class _LogModel(ListSyncModel):
elif level >= logging.WARNING:
return self.warning_bg
else:
return ListSyncModel.data(self, index, role)
return self.white
elif role == QtCore.Qt.ForegroundRole and index.isValid():
level = self.backing_store[index.row()][0]
if level <= logging.DEBUG:
return self.debug_fg
else:
return ListSyncModel.data(self, index, role)
return self.black
else:
return ListSyncModel.data(self, index, role)