More unified colors in foldertree and messagelists
Some parts still not colored in a unified way. Fixes #84
This commit is contained in:
parent
9d78ca5059
commit
f356d90397
|
@ -921,6 +921,7 @@ class MyForm(QtGui.QMainWindow):
|
||||||
toAddressItem.setToolTip(unicode(acct.toLabel, 'utf-8'))
|
toAddressItem.setToolTip(unicode(acct.toLabel, 'utf-8'))
|
||||||
toAddressItem.setIcon(avatarize(toAddress))
|
toAddressItem.setIcon(avatarize(toAddress))
|
||||||
toAddressItem.setData(Qt.UserRole, str(toAddress))
|
toAddressItem.setData(Qt.UserRole, str(toAddress))
|
||||||
|
toAddressItem.setTextColor(AccountColor(toAddress).accountColor())
|
||||||
toAddressItem.setFlags(
|
toAddressItem.setFlags(
|
||||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||||
tableWidget.setItem(0, 0, toAddressItem)
|
tableWidget.setItem(0, 0, toAddressItem)
|
||||||
|
@ -929,6 +930,7 @@ class MyForm(QtGui.QMainWindow):
|
||||||
fromAddressItem.setToolTip(unicode(acct.fromLabel, 'utf-8'))
|
fromAddressItem.setToolTip(unicode(acct.fromLabel, 'utf-8'))
|
||||||
fromAddressItem.setIcon(avatarize(fromAddress))
|
fromAddressItem.setIcon(avatarize(fromAddress))
|
||||||
fromAddressItem.setData(Qt.UserRole, str(fromAddress))
|
fromAddressItem.setData(Qt.UserRole, str(fromAddress))
|
||||||
|
fromAddressItem.setTextColor(AccountColor(fromAddress).accountColor())
|
||||||
fromAddressItem.setFlags(
|
fromAddressItem.setFlags(
|
||||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||||
tableWidget.setItem(0, 1, fromAddressItem)
|
tableWidget.setItem(0, 1, fromAddressItem)
|
||||||
|
@ -1058,10 +1060,7 @@ class MyForm(QtGui.QMainWindow):
|
||||||
if not read:
|
if not read:
|
||||||
to_item.setFont(font)
|
to_item.setFont(font)
|
||||||
to_item.setData(Qt.UserRole, str(toAddress))
|
to_item.setData(Qt.UserRole, str(toAddress))
|
||||||
if shared.safeConfigGetBoolean(toAddress, 'mailinglist'):
|
to_item.setTextColor(AccountColor(toAddress).accountColor())
|
||||||
to_item.setTextColor(QtGui.QColor(137, 04, 177)) # magenta
|
|
||||||
if shared.safeConfigGetBoolean(str(toAddress), 'chan'):
|
|
||||||
to_item.setTextColor(QtGui.QColor(216, 119, 0)) # orange
|
|
||||||
to_item.setIcon(avatarize(toAddress))
|
to_item.setIcon(avatarize(toAddress))
|
||||||
tableWidget.setItem(0, 0, to_item)
|
tableWidget.setItem(0, 0, to_item)
|
||||||
# from
|
# from
|
||||||
|
@ -1072,8 +1071,7 @@ class MyForm(QtGui.QMainWindow):
|
||||||
if not read:
|
if not read:
|
||||||
from_item.setFont(font)
|
from_item.setFont(font)
|
||||||
from_item.setData(Qt.UserRole, str(fromAddress))
|
from_item.setData(Qt.UserRole, str(fromAddress))
|
||||||
if shared.safeConfigGetBoolean(str(fromAddress), 'chan'):
|
from_item.setTextColor(AccountColor(fromAddress).accountColor())
|
||||||
from_item.setTextColor(QtGui.QColor(216, 119, 0)) # orange
|
|
||||||
from_item.setIcon(avatarize(fromAddress))
|
from_item.setIcon(avatarize(fromAddress))
|
||||||
tableWidget.setItem(0, 1, from_item)
|
tableWidget.setItem(0, 1, from_item)
|
||||||
# subject
|
# subject
|
||||||
|
|
|
@ -6,6 +6,7 @@ import sys
|
||||||
import inspect
|
import inspect
|
||||||
from helper_sql import *
|
from helper_sql import *
|
||||||
from addresses import decodeAddress
|
from addresses import decodeAddress
|
||||||
|
from foldertree import AccountMixin
|
||||||
from pyelliptic.openssl import OpenSSL
|
from pyelliptic.openssl import OpenSSL
|
||||||
from utils import str_broadcast_subscribers
|
from utils import str_broadcast_subscribers
|
||||||
import time
|
import time
|
||||||
|
@ -41,6 +42,24 @@ def accountClass(address):
|
||||||
# no gateway
|
# no gateway
|
||||||
return BMAccount(address)
|
return BMAccount(address)
|
||||||
|
|
||||||
|
class AccountColor(AccountMixin):
|
||||||
|
def __init__(self, address, type = None):
|
||||||
|
self.isEnabled = True
|
||||||
|
self.address = address
|
||||||
|
if type is None:
|
||||||
|
if shared.safeConfigGetBoolean(self.address, 'mailinglist'):
|
||||||
|
self.type = "mailinglist"
|
||||||
|
elif shared.safeConfigGetBoolean(self.address, 'chan'):
|
||||||
|
self.type = "chan"
|
||||||
|
elif sqlQuery(
|
||||||
|
'''select label from subscriptions where address=?''', self.address):
|
||||||
|
self.type = 'subscription'
|
||||||
|
else:
|
||||||
|
self.type = "normal"
|
||||||
|
else:
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
|
||||||
class BMAccount(object):
|
class BMAccount(object):
|
||||||
def __init__(self, address = None):
|
def __init__(self, address = None):
|
||||||
self.address = address
|
self.address = address
|
||||||
|
|
|
@ -6,13 +6,16 @@ import shared
|
||||||
class AccountMixin (object):
|
class AccountMixin (object):
|
||||||
def accountColor (self):
|
def accountColor (self):
|
||||||
if not self.isEnabled:
|
if not self.isEnabled:
|
||||||
return QtGui.QBrush(QtGui.QColor(128, 128, 128))
|
return QtGui.QColor(128, 128, 128)
|
||||||
elif self.type == "chan":
|
elif self.type == "chan":
|
||||||
return QtGui.QBrush(QtGui.QColor(216, 119, 0))
|
return QtGui.QColor(216, 119, 0)
|
||||||
elif self.type == "mailinglist" or self.type == "subscription":
|
elif self.type == "mailinglist" or self.type == "subscription":
|
||||||
return QtGui.QBrush(QtGui.QColor(137, 04, 177))
|
return QtGui.QColor(137, 04, 177)
|
||||||
else:
|
else:
|
||||||
return QtGui.QBrush(QtGui.QApplication.palette().text().color())
|
return QtGui.QApplication.palette().text().color()
|
||||||
|
|
||||||
|
def accountBrush(self):
|
||||||
|
return QtGui.QBrush(self.accountColor())
|
||||||
|
|
||||||
def setAddress(self, address):
|
def setAddress(self, address):
|
||||||
self.address = str(address)
|
self.address = str(address)
|
||||||
|
@ -121,7 +124,7 @@ class Ui_AddressWidget(QtGui.QTreeWidgetItem, AccountMixin):
|
||||||
self.setFont(0, font)
|
self.setFont(0, font)
|
||||||
|
|
||||||
#set text color
|
#set text color
|
||||||
brush = self.accountColor()
|
brush = self.accountBrush()
|
||||||
brush.setStyle(QtCore.Qt.NoBrush)
|
brush.setStyle(QtCore.Qt.NoBrush)
|
||||||
self.setForeground(0, brush)
|
self.setForeground(0, brush)
|
||||||
|
|
||||||
|
@ -204,7 +207,7 @@ class Ui_SubscriptionWidget(Ui_AddressWidget, AccountMixin):
|
||||||
self.setFont(0, font)
|
self.setFont(0, font)
|
||||||
|
|
||||||
#set text color
|
#set text color
|
||||||
brush = self.accountColor()
|
brush = self.accountBrush()
|
||||||
brush.setStyle(QtCore.Qt.NoBrush)
|
brush.setStyle(QtCore.Qt.NoBrush)
|
||||||
self.setForeground(0, brush)
|
self.setForeground(0, brush)
|
||||||
|
|
||||||
|
@ -246,7 +249,7 @@ class Ui_AddressBookWidgetItem(QtGui.QTableWidgetItem, AccountMixin):
|
||||||
except:
|
except:
|
||||||
self.type = 0
|
self.type = 0
|
||||||
self.setEnabled(True)
|
self.setEnabled(True)
|
||||||
brush = self.accountColor()
|
brush = self.accountBrush()
|
||||||
brush.setStyle(QtCore.Qt.NoBrush)
|
brush.setStyle(QtCore.Qt.NoBrush)
|
||||||
self.setForeground(brush)
|
self.setForeground(brush)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user