forked from M-Labs/artiq
1
0
Fork 0

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
1 changed files with 4 additions and 2 deletions

View File

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