From cfea0bbdd1ede1f1b26d2ac4faf5b51863a4d8a2 Mon Sep 17 00:00:00 2001 From: mailchuck Date: Mon, 9 Nov 2015 18:58:27 +0100 Subject: [PATCH] Disabled folder color Fixes #92 --- src/bitmessageqt/foldertree.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/bitmessageqt/foldertree.py b/src/bitmessageqt/foldertree.py index 1aab7e0e..8bbba0c9 100644 --- a/src/bitmessageqt/foldertree.py +++ b/src/bitmessageqt/foldertree.py @@ -14,10 +14,21 @@ class AccountMixin (object): else: 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): brush = QtGui.QBrush(self.accountColor()) brush.setStyle(QtCore.Qt.NoBrush) return brush + + def folderBrush(self): + brush = QtGui.QBrush(self.folderColor()) + brush.setStyle(QtCore.Qt.NoBrush) + return brush def setAddress(self, address): self.address = str(address) @@ -53,6 +64,7 @@ class Ui_FolderWidget(QtGui.QTreeWidgetItem, AccountMixin): self.setAddress(address) self.setFolderName(folderName) self.setUnreadCount(unreadCount) + self.parent = parent self.initialised = True self.updateText() parent.insertChild(pos, self) @@ -73,6 +85,7 @@ class Ui_FolderWidget(QtGui.QTreeWidgetItem, AccountMixin): else: font.setBold(False) self.setFont(0, font) + self.setForeground(0, self.folderBrush()) self.setText(0, text) self.setToolTip(0, text) # self.setData(0, QtCore.Qt.UserRole, [self.address, self.folderName])