mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-06-14 08:54:34 +12:00
Improves readabily of outline delegate
This commit is contained in:
parent
cc84f53f04
commit
0c3f96014a
|
@ -189,7 +189,7 @@ def outlineItemColors(item):
|
||||||
if item.compile() in [0, "0"]:
|
if item.compile() in [0, "0"]:
|
||||||
colors["Compile"] = mixColors(QColor(S.text), QColor(S.window))
|
colors["Compile"] = mixColors(QColor(S.text), QColor(S.window))
|
||||||
else:
|
else:
|
||||||
colors["Compile"] = QColor(S.text)
|
colors["Compile"] = QColor(Qt.transparent) # will use default
|
||||||
|
|
||||||
return colors
|
return colors
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from PyQt5.QtWidgets import qApp
|
||||||
from manuskript import settings
|
from manuskript import settings
|
||||||
from manuskript.enums import Character, Outline
|
from manuskript.enums import Character, Outline
|
||||||
from manuskript.functions import outlineItemColors, mixColors, colorifyPixmap, toInt, toFloat, drawProgress
|
from manuskript.functions import outlineItemColors, mixColors, colorifyPixmap, toInt, toFloat, drawProgress
|
||||||
|
from manuskript.ui import style as S
|
||||||
|
|
||||||
class outlineTitleDelegate(QStyledItemDelegate):
|
class outlineTitleDelegate(QStyledItemDelegate):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
|
@ -39,7 +39,7 @@ class outlineTitleDelegate(QStyledItemDelegate):
|
||||||
col = colors[settings.viewSettings["Outline"]["Background"]]
|
col = colors[settings.viewSettings["Outline"]["Background"]]
|
||||||
|
|
||||||
if col != QColor(Qt.transparent):
|
if col != QColor(Qt.transparent):
|
||||||
col2 = QColor(Qt.white)
|
col2 = QColor(S.base)
|
||||||
if opt.state & QStyle.State_Selected:
|
if opt.state & QStyle.State_Selected:
|
||||||
col2 = opt.palette.brush(QPalette.Normal, QPalette.Highlight).color()
|
col2 = opt.palette.brush(QPalette.Normal, QPalette.Highlight).color()
|
||||||
col = mixColors(col, col2, .2)
|
col = mixColors(col, col2, .2)
|
||||||
|
@ -76,10 +76,20 @@ class outlineTitleDelegate(QStyledItemDelegate):
|
||||||
# Text
|
# Text
|
||||||
if opt.text:
|
if opt.text:
|
||||||
painter.save()
|
painter.save()
|
||||||
|
textColor = QColor(S.text)
|
||||||
|
if option.state & QStyle.State_Selected:
|
||||||
|
col = QColor(S.highlightedText)
|
||||||
|
textColor = col
|
||||||
|
painter.setPen(col)
|
||||||
if settings.viewSettings["Outline"]["Text"] != "Nothing":
|
if settings.viewSettings["Outline"]["Text"] != "Nothing":
|
||||||
col = colors[settings.viewSettings["Outline"]["Text"]]
|
col = colors[settings.viewSettings["Outline"]["Text"]]
|
||||||
if col == Qt.transparent:
|
if col == Qt.transparent:
|
||||||
col = Qt.black
|
col = textColor
|
||||||
|
# If text color is Compile and item is selected, we have
|
||||||
|
# to change the color
|
||||||
|
if settings.viewSettings["Outline"]["Text"] == "Compile" and \
|
||||||
|
item.compile() in [0, "0"]:
|
||||||
|
col = mixColors(textColor, QColor(S.window))
|
||||||
painter.setPen(col)
|
painter.setPen(col)
|
||||||
f = QFont(opt.font)
|
f = QFont(opt.font)
|
||||||
painter.setFont(f)
|
painter.setFont(f)
|
||||||
|
|
|
@ -82,13 +82,20 @@ class treeTitleDelegate(QStyledItemDelegate):
|
||||||
# Text
|
# Text
|
||||||
if opt.text:
|
if opt.text:
|
||||||
painter.save()
|
painter.save()
|
||||||
|
textColor = QColor(S.text)
|
||||||
if option.state & QStyle.State_Selected:
|
if option.state & QStyle.State_Selected:
|
||||||
col = QColor(S.highlightedText)
|
col = QColor(S.highlightedText)
|
||||||
|
textColor = col
|
||||||
painter.setPen(col)
|
painter.setPen(col)
|
||||||
if settings.viewSettings["Tree"]["Text"] != "Nothing":
|
if settings.viewSettings["Tree"]["Text"] != "Nothing":
|
||||||
col = colors[settings.viewSettings["Tree"]["Text"]]
|
col = colors[settings.viewSettings["Tree"]["Text"]]
|
||||||
if col == Qt.transparent:
|
if col == Qt.transparent:
|
||||||
col = QColor(S.text)
|
col = textColor
|
||||||
|
# If text color is Compile and item is selected, we have
|
||||||
|
# to change the color
|
||||||
|
if settings.viewSettings["Outline"]["Text"] == "Compile" and \
|
||||||
|
item.compile() in [0, "0"]:
|
||||||
|
col = mixColors(textColor, QColor(S.window))
|
||||||
painter.setPen(col)
|
painter.setPen(col)
|
||||||
f = QFont(opt.font)
|
f = QFont(opt.font)
|
||||||
painter.setFont(f)
|
painter.setFont(f)
|
||||||
|
|
Loading…
Reference in a new issue