From e2d6baaeb159416b4e9eccd62b7a96e40f10437d Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Tue, 6 Aug 2019 13:08:19 +0300 Subject: [PATCH] Add color named to dict with data --- graphs/colors.py | 21 ++++++++++++--------- gui/builtinViewColumns/color.py | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/graphs/colors.py b/graphs/colors.py index 112f2ff06..09dac3bc0 100644 --- a/graphs/colors.py +++ b/graphs/colors.py @@ -18,21 +18,24 @@ # ============================================================================= -from collections import OrderedDict +from collections import OrderedDict, namedtuple from service.const import Color +ColorData = namedtuple('ColorData', ('hsl', 'name', 'iconName')) + + # In HSL format BASE_COLORS = OrderedDict([ - (Color.red, ((0 / 360.0, 1.0, 0.5), 'color_red')), - (Color.green, ((120 / 360.0, 1.0, 0.5), 'color_green')), - (Color.blue, ((240 / 360.0, 1.0, 0.5), 'color_blue')), - (Color.yellow, ((56 / 360.0, 1.0, 0.5), 'color_yellow')), - (Color.cyan, ((180 / 360.0, 1.0, 0.5), 'color_cyan')), - (Color.magenta, ((300 / 360.0, 1.0, 0.5), 'color_magenta')), - (Color.orange, ((40 / 360.0, 1.0, 0.5), 'color_orange')), - (Color.purple, ((275 / 360.0, 1.0, 0.5), 'color_purple'))]) + (Color.red, ColorData((0 / 360.0, 1.0, 0.5), 'Red', 'color_red')), + (Color.green, ColorData((120 / 360.0, 1.0, 0.5), 'Green', 'color_green')), + (Color.blue, ColorData((240 / 360.0, 1.0, 0.5), 'Blue', 'color_blue')), + (Color.yellow, ColorData((56 / 360.0, 1.0, 0.5), 'Yellow', 'color_yellow')), + (Color.cyan, ColorData((180 / 360.0, 1.0, 0.5), 'Cyan', 'color_cyan')), + (Color.magenta, ColorData((300 / 360.0, 1.0, 0.5), 'Magenta', 'color_magenta')), + (Color.orange, ColorData((40 / 360.0, 1.0, 0.5), 'Orange', 'color_orange')), + (Color.purple, ColorData((275 / 360.0, 1.0, 0.5), 'Purple', 'color_purple'))]) def hsl_to_hsv(hsl): diff --git a/gui/builtinViewColumns/color.py b/gui/builtinViewColumns/color.py index 8b0f9c195..abad76239 100644 --- a/gui/builtinViewColumns/color.py +++ b/gui/builtinViewColumns/color.py @@ -42,7 +42,7 @@ class LineColor(ViewColumn): color_data = BASE_COLORS[stuff.color] except KeyError: return -1 - img = self.fittingView.imageList.GetImageIndex(color_data[1], 'gui') + img = self.fittingView.imageList.GetImageIndex(color_data.iconName, 'gui') return img return -1