Copy Enums to const.py
Switching to IntEnum where necessary.
This commit is contained in:
55
eos/const.py
55
eos/const.py
@@ -1,5 +1,5 @@
|
||||
from eos.enum import Enum
|
||||
|
||||
from enum import IntEnum
|
||||
|
||||
|
||||
class Slot(Enum):
|
||||
@@ -24,3 +24,56 @@ class Slot(Enum):
|
||||
FS_LIGHT = 13
|
||||
FS_SUPPORT = 14
|
||||
FS_HEAVY = 15
|
||||
|
||||
|
||||
class ImplantLocation(Enum):
|
||||
FIT = 0
|
||||
CHARACTER = 1
|
||||
|
||||
|
||||
class CalcType(Enum):
|
||||
LOCAL = 0
|
||||
PROJECTED = 1
|
||||
COMMAND = 2
|
||||
|
||||
class State(Enum):
|
||||
OFFLINE = -1
|
||||
ONLINE = 0
|
||||
ACTIVE = 1
|
||||
OVERHEATED = 2
|
||||
|
||||
class Hardpoint(Enum):
|
||||
NONE = 0
|
||||
MISSILE = 1
|
||||
TURRET = 2
|
||||
|
||||
class LoginMethod(Enum):
|
||||
SERVER = 0
|
||||
MANUAL = 1
|
||||
|
||||
class SsoMode(Enum):
|
||||
AUTO = 0
|
||||
CUSTOM = 1
|
||||
|
||||
class ESIEndpoints(Enum):
|
||||
CHAR = "/v4/characters/{character_id}/"
|
||||
CHAR_SKILLS = "/v4/characters/{character_id}/skills/"
|
||||
CHAR_FITTINGS = "/v1/characters/{character_id}/fittings/"
|
||||
CHAR_DEL_FIT = "/v1/characters/{character_id}/fittings/{fitting_id}/"
|
||||
|
||||
class MultiBuy_ItemType(IntEnum):
|
||||
IMPLANTS = 1
|
||||
CARGO = 2
|
||||
LOADED_CHARGES = 3
|
||||
|
||||
class Options(IntEnum):
|
||||
IMPLANTS = 1
|
||||
MUTATIONS = 2
|
||||
LOADED_CHARGES = 3
|
||||
|
||||
class RigSize(Enum):
|
||||
# Matches to item attribute "rigSize" on ship and rig items
|
||||
SMALL = 1
|
||||
MEDIUM = 2
|
||||
LARGE = 3
|
||||
CAPITAL = 4
|
||||
|
||||
@@ -29,6 +29,7 @@ import eos.db
|
||||
from eos import capSim
|
||||
from eos.effectHandlerHelpers import HandledModuleList, HandledDroneCargoList, HandledImplantBoosterList, HandledProjectedDroneList, HandledProjectedModList
|
||||
from eos.enum import Enum
|
||||
from eos.const import ImplantLocation, CalcType
|
||||
from eos.saveddata.ship import Ship
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.character import Character
|
||||
@@ -36,20 +37,10 @@ from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.module import Module, State, Slot, Hardpoint
|
||||
from eos.utils.stats import DmgTypes
|
||||
from logbook import Logger
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class ImplantLocation(Enum):
|
||||
FIT = 0
|
||||
CHARACTER = 1
|
||||
|
||||
|
||||
class CalcType(Enum):
|
||||
LOCAL = 0
|
||||
PROJECTED = 1
|
||||
COMMAND = 2
|
||||
|
||||
|
||||
class Fit(object):
|
||||
"""Represents a fitting, with modules, ship, implants, etc."""
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ from logbook import Logger
|
||||
from sqlalchemy.orm import reconstructor, validates
|
||||
|
||||
import eos.db
|
||||
from eos.const import Slot
|
||||
from eos.const import Slot, State, Hardpoint
|
||||
from eos.effectHandlerHelpers import HandledCharge, HandledItem
|
||||
from eos.enum import Enum
|
||||
from eos.modifiedAttributeDict import ChargeAttrShortcut, ItemAttrShortcut, ModifiedAttributeDict
|
||||
@@ -35,14 +35,6 @@ from eos.utils.stats import DmgTypes
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class State(Enum):
|
||||
OFFLINE = -1
|
||||
ONLINE = 0
|
||||
ACTIVE = 1
|
||||
OVERHEATED = 2
|
||||
|
||||
|
||||
ProjectedMap = {
|
||||
State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.OFFLINE,
|
||||
@@ -67,12 +59,6 @@ ProjectedSystem = {
|
||||
}
|
||||
|
||||
|
||||
class Hardpoint(Enum):
|
||||
NONE = 0
|
||||
MISSILE = 1
|
||||
TURRET = 2
|
||||
|
||||
|
||||
class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
"""An instance of this class represents a module together with its charge and modified attributes"""
|
||||
MINING_ATTRIBUTES = ("miningAmount",)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from enum import Enum, auto
|
||||
|
||||
|
||||
# Define the various groups of attributes
|
||||
class AttrGroup(Enum):
|
||||
FITTING = auto()
|
||||
|
||||
@@ -10,6 +10,7 @@ import webbrowser
|
||||
|
||||
import eos.db
|
||||
from eos.enum import Enum
|
||||
from eos.const import LoginMethod
|
||||
from eos.saveddata.ssocharacter import SsoCharacter
|
||||
from service.esiAccess import APIException, SsoMode
|
||||
import gui.globalEvents as GE
|
||||
@@ -24,11 +25,6 @@ from requests import Session
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class LoginMethod(Enum):
|
||||
SERVER = 0
|
||||
MANUAL = 1
|
||||
|
||||
|
||||
class Esi(EsiAccess):
|
||||
_instance = None
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import base64
|
||||
|
||||
import datetime
|
||||
from eos.enum import Enum
|
||||
from eos.const import SsoMode, ESIEndpoints
|
||||
from service.settings import EsiSettings, NetworkSettings
|
||||
|
||||
from requests import Session
|
||||
@@ -42,11 +43,6 @@ scopes = [
|
||||
]
|
||||
|
||||
|
||||
class SsoMode(Enum):
|
||||
AUTO = 0
|
||||
CUSTOM = 1
|
||||
|
||||
|
||||
class APIException(Exception):
|
||||
""" Exception for SSO related errors """
|
||||
|
||||
@@ -66,13 +62,6 @@ class APIException(Exception):
|
||||
return 'HTTP Error %s' % self.status_code
|
||||
|
||||
|
||||
class ESIEndpoints(Enum):
|
||||
CHAR = "/v4/characters/{character_id}/"
|
||||
CHAR_SKILLS = "/v4/characters/{character_id}/skills/"
|
||||
CHAR_FITTINGS = "/v1/characters/{character_id}/fittings/"
|
||||
CHAR_DEL_FIT = "/v1/characters/{character_id}/fittings/{fitting_id}/"
|
||||
|
||||
|
||||
class EsiAccess(object):
|
||||
def __init__(self):
|
||||
self.settings = EsiSettings.getInstance()
|
||||
|
||||
@@ -19,14 +19,6 @@ from logbook import Logger
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class RigSize(Enum):
|
||||
# Matches to item attribute "rigSize" on ship and rig items
|
||||
SMALL = 1
|
||||
MEDIUM = 2
|
||||
LARGE = 3
|
||||
CAPITAL = 4
|
||||
|
||||
|
||||
class EfsPort:
|
||||
wepTestSet = {}
|
||||
version = 0.03
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
import re
|
||||
from enum import Enum
|
||||
from eos.const import RigSize
|
||||
from eos.const import Options
|
||||
|
||||
from logbook import Logger
|
||||
|
||||
@@ -41,13 +43,6 @@ from service.port.shared import IPortUser, fetchItem, processing_notify
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class Options(Enum):
|
||||
IMPLANTS = 1
|
||||
MUTATIONS = 2
|
||||
LOADED_CHARGES = 3
|
||||
|
||||
|
||||
EFT_OPTIONS = (
|
||||
(Options.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
|
||||
(Options.MUTATIONS.value, 'Mutated Attributes', 'Export mutated modules\' stats', True),
|
||||
|
||||
@@ -19,18 +19,14 @@
|
||||
|
||||
|
||||
from enum import Enum
|
||||
from eos.const import MultiBuy_ItemType
|
||||
|
||||
|
||||
class Options(Enum):
|
||||
IMPLANTS = 1
|
||||
CARGO = 2
|
||||
LOADED_CHARGES = 3
|
||||
|
||||
|
||||
MULTIBUY_OPTIONS = (
|
||||
(Options.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
|
||||
(Options.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', False),
|
||||
(Options.CARGO.value, 'Cargo', 'Export cargo contents', True),
|
||||
(MultiBuy_ItemType.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
|
||||
(MultiBuy_ItemType.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', False),
|
||||
(MultiBuy_ItemType.CARGO.value, 'Cargo', 'Export cargo contents', True),
|
||||
)
|
||||
|
||||
|
||||
@@ -48,7 +44,7 @@ def exportMultiBuy(fit, options):
|
||||
if module.isMutated:
|
||||
continue
|
||||
addItem(module.item)
|
||||
if module.charge and options[Options.LOADED_CHARGES.value]:
|
||||
if module.charge and options[MultiBuy_ItemType.LOADED_CHARGES.value]:
|
||||
addItem(module.charge, module.numCharges)
|
||||
|
||||
for drone in fit.drones:
|
||||
@@ -57,11 +53,11 @@ def exportMultiBuy(fit, options):
|
||||
for fighter in fit.fighters:
|
||||
addItem(fighter.item, fighter.amountActive)
|
||||
|
||||
if options[Options.CARGO.value]:
|
||||
if options[MultiBuy_ItemType.CARGO.value]:
|
||||
for cargo in fit.cargo:
|
||||
addItem(cargo.item, cargo.amount)
|
||||
|
||||
if options[Options.IMPLANTS.value]:
|
||||
if options[MultiBuy_ItemType.IMPLANTS.value]:
|
||||
for implant in fit.implants:
|
||||
addItem(implant.item)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user