Some slight tweaks to work done by @tonycoz for #1839
This commit is contained in:
13
config.py
13
config.py
@@ -6,6 +6,7 @@ import wx
|
||||
from logbook import CRITICAL, DEBUG, ERROR, FingersCrossedHandler, INFO, Logger, NestedSetup, NullHandler, \
|
||||
StreamHandler, TimedRotatingFileHandler, WARNING
|
||||
import hashlib
|
||||
from eos.const import Slot
|
||||
|
||||
from cryptography.fernet import Fernet
|
||||
|
||||
@@ -48,11 +49,13 @@ LOGLEVEL_MAP = {
|
||||
"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: '' }
|
||||
slotColourMap = {
|
||||
Slot.LOW: wx.Colour(250, 235, 204), # yellow = low slots
|
||||
Slot.MED: wx.Colour(188, 215, 241), # blue = mid slots
|
||||
Slot.HIGH: wx.Colour(235, 204, 209), # red = high slots
|
||||
Slot.RIG: '',
|
||||
Slot.SUBSYSTEM: ''
|
||||
}
|
||||
|
||||
def getClientSecret():
|
||||
return clientHash
|
||||
|
||||
26
eos/const.py
Normal file
26
eos/const.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from eos.enum import Enum
|
||||
|
||||
|
||||
|
||||
class Slot(Enum):
|
||||
# These are self-explanatory
|
||||
LOW = 1
|
||||
MED = 2
|
||||
HIGH = 3
|
||||
RIG = 4
|
||||
SUBSYSTEM = 5
|
||||
# not a real slot, need for pyfa display rack separation
|
||||
MODE = 6
|
||||
# system effects. They are projected "modules" and pyfa assumes all modules
|
||||
# have a slot. In this case, make one up.
|
||||
SYSTEM = 7
|
||||
# used for citadel services
|
||||
SERVICE = 8
|
||||
# fighter 'slots'. Just easier to put them here...
|
||||
F_LIGHT = 10
|
||||
F_SUPPORT = 11
|
||||
F_HEAVY = 12
|
||||
# fighter 'slots' (for structures)
|
||||
FS_LIGHT = 13
|
||||
FS_SUPPORT = 14
|
||||
FS_HEAVY = 15
|
||||
@@ -240,7 +240,6 @@ class Item(EqBase):
|
||||
self.__assistive = None
|
||||
self.__overrides = None
|
||||
self.__priceObj = None
|
||||
self.__slot = None
|
||||
|
||||
@property
|
||||
def attributes(self):
|
||||
@@ -480,21 +479,6 @@ class Item(EqBase):
|
||||
def isCharge(self):
|
||||
return self.category.name == "Charge"
|
||||
|
||||
effectSlots = { 'loPower' : 1,
|
||||
'medPower' : 2,
|
||||
'hiPower' : 3,
|
||||
'rigSlot' : 4,
|
||||
'subSystem': 5 }
|
||||
@property
|
||||
def slot(self):
|
||||
if self.__slot is None:
|
||||
self.__slot = 0
|
||||
for effectName in self.effectSlots:
|
||||
if effectName in self.effects:
|
||||
self.__slot = self.effectSlots[effectName]
|
||||
break
|
||||
return self.__slot;
|
||||
|
||||
def __repr__(self):
|
||||
return "Item(ID={}, name={}) at {}".format(
|
||||
self.ID, self.name, hex(id(self))
|
||||
|
||||
@@ -23,6 +23,7 @@ from logbook import Logger
|
||||
from sqlalchemy.orm import reconstructor, validates
|
||||
|
||||
import eos.db
|
||||
from eos.const import Slot
|
||||
from eos.effectHandlerHelpers import HandledCharge, HandledItem
|
||||
from eos.enum import Enum
|
||||
from eos.modifiedAttributeDict import ChargeAttrShortcut, ItemAttrShortcut, ModifiedAttributeDict
|
||||
@@ -42,30 +43,6 @@ class State(Enum):
|
||||
OVERHEATED = 2
|
||||
|
||||
|
||||
class Slot(Enum):
|
||||
# These are self-explanatory
|
||||
LOW = 1
|
||||
MED = 2
|
||||
HIGH = 3
|
||||
RIG = 4
|
||||
SUBSYSTEM = 5
|
||||
# not a real slot, need for pyfa display rack separation
|
||||
MODE = 6
|
||||
# system effects. They are projected "modules" and pyfa assumes all modules
|
||||
# have a slot. In this case, make one up.
|
||||
SYSTEM = 7
|
||||
# used for citadel services
|
||||
SERVICE = 8
|
||||
# fighter 'slots'. Just easier to put them here...
|
||||
F_LIGHT = 10
|
||||
F_SUPPORT = 11
|
||||
F_HEAVY = 12
|
||||
# fighter 'slots' (for structures)
|
||||
FS_LIGHT = 13
|
||||
FS_SUPPORT = 14
|
||||
FS_HEAVY = 15
|
||||
|
||||
|
||||
ProjectedMap = {
|
||||
State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.OFFLINE,
|
||||
@@ -185,7 +162,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
self.__itemModifiedAttributes.original = self.__item.attributes
|
||||
self.__itemModifiedAttributes.overrides = self.__item.overrides
|
||||
self.__hardpoint = self.__calculateHardpoint(self.__item)
|
||||
self.__slot = self.__calculateSlot(self.__item)
|
||||
self.__slot = self.calculateSlot(self.__item)
|
||||
|
||||
# Instantiate / remove mutators if this is a mutated module
|
||||
if self.__baseItem:
|
||||
@@ -755,7 +732,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
return Hardpoint.NONE
|
||||
|
||||
@staticmethod
|
||||
def __calculateSlot(item):
|
||||
def calculateSlot(item):
|
||||
effectSlotMap = {
|
||||
"rigSlot" : Slot.RIG,
|
||||
"loPower" : Slot.LOW,
|
||||
@@ -772,7 +749,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
if item.group.name in Module.SYSTEM_GROUPS:
|
||||
return Slot.SYSTEM
|
||||
|
||||
raise ValueError("Passed item does not fit in any known slot")
|
||||
return None
|
||||
|
||||
@validates("ID", "itemID", "ammoID")
|
||||
def validator(self, key, val):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import wx
|
||||
from logbook import Logger
|
||||
|
||||
from eos.saveddata.module import Module
|
||||
import gui.builtinMarketBrowser.pfSearchBox as SBox
|
||||
from gui.builtinMarketBrowser.events import ItemSelected, MAX_RECENTLY_USED_MODULES, RECENTLY_USED_MODULES
|
||||
from gui.contextMenu import ContextMenu
|
||||
@@ -271,7 +272,6 @@ class ItemView(Display):
|
||||
|
||||
def columnBackground(self, colItem, item):
|
||||
if self.sFit.serviceFittingOptions["colorFitBySlot"]:
|
||||
slot = item.slot
|
||||
return slotColourMap.get(slot) or self.GetBackgroundColour()
|
||||
return slotColourMap.get(Module.calculateSlot(item)) or self.GetBackgroundColour()
|
||||
else:
|
||||
return self.GetBackgroundColour()
|
||||
|
||||
Reference in New Issue
Block a user