move the item slot colours to config and use it from there

This commit is contained in:
Tony Cook
2019-03-01 19:47:04 +11:00
parent af17a4f1c9
commit 9bdb4ea967
3 changed files with 13 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
import os import os
import sys import sys
import yaml import yaml
import wx
from logbook import CRITICAL, DEBUG, ERROR, FingersCrossedHandler, INFO, Logger, NestedSetup, NullHandler, \ from logbook import CRITICAL, DEBUG, ERROR, FingersCrossedHandler, INFO, Logger, NestedSetup, NullHandler, \
StreamHandler, TimedRotatingFileHandler, WARNING StreamHandler, TimedRotatingFileHandler, WARNING
@@ -47,6 +48,11 @@ LOGLEVEL_MAP = {
"debug": DEBUG, "debug": DEBUG,
} }
slotColourMap = {1: wx.Colour(250, 235, 204), # yellow = low slots
2: wx.Colour(188, 215, 241), # blue = mid slots
3: wx.Colour(235, 204, 209), # red = high slots
4: '',
5: '' }
def getClientSecret(): def getClientSecret():
return clientHash return clientHash

View File

@@ -8,6 +8,7 @@ from gui.display import Display
from gui.utils.staticHelpers import DragDropHelper from gui.utils.staticHelpers import DragDropHelper
from service.attribute import Attribute from service.attribute import Attribute
from service.fit import Fit from service.fit import Fit
from config import slotColourMap
pyfalog = Logger(__name__) pyfalog = Logger(__name__)
@@ -268,13 +269,9 @@ class ItemView(Display):
i += 1 i += 1
return revmap return revmap
slotColourMap = { 1: wx.Colour(250, 235, 204),
2: wx.Colour(188, 215, 241),
3: wx.Colour(235, 204, 209) }
def columnBackground(self, colItem, item): def columnBackground(self, colItem, item):
if self.sFit.serviceFittingOptions["colorFitBySlot"]: if self.sFit.serviceFittingOptions["colorFitBySlot"]:
slot = item.slot; slot = item.slot
if slot in self.slotColourMap: return slotColourMap.get(slot) or self.GetBackgroundColour()
return self.slotColourMap[slot] else:
return wx.Colour(255, 255, 255) return self.GetBackgroundColour()

View File

@@ -40,6 +40,7 @@ from gui.contextMenu import ContextMenu
from gui.utils.staticHelpers import DragDropHelper from gui.utils.staticHelpers import DragDropHelper
from service.fit import Fit from service.fit import Fit
from service.market import Market from service.market import Market
from config import slotColourMap
pyfalog = Logger(__name__) pyfalog = Logger(__name__)
@@ -629,14 +630,8 @@ class FittingView(d.Display):
else: else:
event.Skip() event.Skip()
slotColourMap = {1: wx.Colour(250, 235, 204), # yellow = low slots
2: wx.Colour(188, 215, 241), # blue = mid slots
3: wx.Colour(235, 204, 209), # red = high slots
4: '',
5: ''}
def slotColour(self, slot): def slotColour(self, slot):
return self.slotColourMap.get(slot) or self.GetBackgroundColour() return slotColourMap.get(slot) or self.GetBackgroundColour()
def refresh(self, stuff): def refresh(self, stuff):
""" """