named constants for dot colors

This commit is contained in:
2022-12-19 21:30:52 +01:00
parent cff6602cd6
commit 7f82bb73c4
2 changed files with 10 additions and 6 deletions

View File

@ -2,7 +2,7 @@ from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QListWidgetItem
from PyQt5.QtGui import QIcon, QPixmap, QPainter
from ..theme import VIOLET, GREY4
from ..theme import DOT_PEN, DOT_BRUSH, DOT_SIZE
class DictListItem(QListWidgetItem):
@ -24,11 +24,11 @@ class DictListItem(QListWidgetItem):
def set_dot(self, state):
pixmap = QPixmap(8, 8)
pixmap = QPixmap(DOT_SIZE, DOT_SIZE)
pixmap.fill(Qt.transparent)
if state:
draw_dot(pixmap, GREY4, VIOLET)
draw_dot(pixmap, DOT_PEN, DOT_BRUSH)
icon = QIcon(pixmap)
self.setIcon(icon)

View File

@ -16,6 +16,10 @@ GREY4 = QColor(200, 200, 200) # light
MDI_BKG = QColor(150, 150, 150)
DOT_PEN = GREY4
DOT_BRUSH = VIOLET
DOT_SIZE = 8
def apply(app):
apply_qapp(app)
@ -75,9 +79,9 @@ def pg_plot_style():
style = dict(
pen=pen,
symbol="o",
symbolPen=GREY4,
symbolBrush=VIOLET,
symbolSize=8
symbolPen=DOT_PEN,
symbolBrush=DOT_BRUSH,
symbolSize=DOT_SIZE
)
return style