Disabled folder color

Fixes #92
This commit is contained in:
mailchuck 2015-11-09 18:58:27 +01:00
parent e72773c5bb
commit cfea0bbdd1
Signed by untrusted user who does not match committer: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -14,11 +14,22 @@ class AccountMixin (object):
else: else:
return QtGui.QApplication.palette().text().color() return QtGui.QApplication.palette().text().color()
def folderColor (self):
if not self.parent.isEnabled:
return QtGui.QColor(128, 128, 128)
else:
return QtGui.QApplication.palette().text().color()
def accountBrush(self): def accountBrush(self):
brush = QtGui.QBrush(self.accountColor()) brush = QtGui.QBrush(self.accountColor())
brush.setStyle(QtCore.Qt.NoBrush) brush.setStyle(QtCore.Qt.NoBrush)
return brush return brush
def folderBrush(self):
brush = QtGui.QBrush(self.folderColor())
brush.setStyle(QtCore.Qt.NoBrush)
return brush
def setAddress(self, address): def setAddress(self, address):
self.address = str(address) self.address = str(address)
self.updateText() self.updateText()
@ -53,6 +64,7 @@ class Ui_FolderWidget(QtGui.QTreeWidgetItem, AccountMixin):
self.setAddress(address) self.setAddress(address)
self.setFolderName(folderName) self.setFolderName(folderName)
self.setUnreadCount(unreadCount) self.setUnreadCount(unreadCount)
self.parent = parent
self.initialised = True self.initialised = True
self.updateText() self.updateText()
parent.insertChild(pos, self) parent.insertChild(pos, self)
@ -73,6 +85,7 @@ class Ui_FolderWidget(QtGui.QTreeWidgetItem, AccountMixin):
else: else:
font.setBold(False) font.setBold(False)
self.setFont(0, font) self.setFont(0, font)
self.setForeground(0, self.folderBrush())
self.setText(0, text) self.setText(0, text)
self.setToolTip(0, text) self.setToolTip(0, text)
# self.setData(0, QtCore.Qt.UserRole, [self.address, self.folderName]) # self.setData(0, QtCore.Qt.UserRole, [self.address, self.folderName])