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

View File

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