parent
2783a1c1e5
commit
4aaf0048c6
|
@ -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])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user