diff --git a/eos/const.py b/eos/const.py index dfb1705ce..e0ae7c9ea 100644 --- a/eos/const.py +++ b/eos/const.py @@ -17,7 +17,8 @@ # along with pyfa. If not, see . # ============================================================================= -from enum import Enum,IntEnum,unique,auto +from enum import IntEnum,unique + @unique class FittingSlot(IntEnum): @@ -82,74 +83,3 @@ class FittingHardpoint(IntEnum): MISSILE = 1 TURRET = 2 -@unique -class FittingAttrGroup(IntEnum): - """ - Define the various groups of attributes - """ - FITTING = auto() - STRUCTURE = auto() - SHIELD = auto() - ARMOR = auto() - TARGETING = auto() - EWAR_RESISTS = auto() - CAPACITOR = auto() - SHARED_FACILITIES = auto() - FIGHTER_FACILITIES = auto() - ON_DEATH = auto() - JUMP_SYSTEMS = auto() - PROPULSIONS = auto() - FIGHTERS = auto() - -@unique -class EsiLoginMethod(IntEnum): - """ - Contains the method of ESI login - """ - SERVER = 0 - MANUAL = 1 - -@unique -class EsiSsoMode(IntEnum): - """ - Contains the mode of ESI sso mode - """ - AUTO = 0 - CUSTOM = 1 - -class EsiEndpoints(Enum): - """ - Contains the endpoint paths for the ESI access - """ - 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}/" - -@unique -class PortMultiBuyOptions(IntEnum): - """ - Contains different types of items to multibuy export - """ - IMPLANTS = 1 - CARGO = 2 - LOADED_CHARGES = 3 - -@unique -class PortEftOptions(IntEnum): - """ - Contains different options for eft-export - """ - IMPLANTS = 1 - MUTATIONS = 2 - LOADED_CHARGES = 3 - -@unique -class PortEftRigSize(IntEnum): - """ - Contains different sizes of ship rigs - """ - SMALL = 1 - MEDIUM = 2 - LARGE = 3 - CAPITAL = 4 diff --git a/gui/builtinItemStatsViews/attributeGrouping.py b/gui/builtinItemStatsViews/attributeGrouping.py index d27b1231d..c93e97010 100644 --- a/gui/builtinItemStatsViews/attributeGrouping.py +++ b/gui/builtinItemStatsViews/attributeGrouping.py @@ -1,4 +1,4 @@ -from eos.const import FittingAttrGroup +from service.const import GuiAttrGroup RequiredSkillAttrs = sum((["requiredSkill{}".format(x), "requiredSkill{}Level".format(x)] for x in range(1, 7)), []) @@ -27,7 +27,7 @@ for x in AttrGroups: # Start defining all the known attribute groups AttrGroupDict = { - FittingAttrGroup.FITTING : { + GuiAttrGroup.FITTING : { "label" : "Fitting", "attributes": [ # parent-level attributes @@ -49,7 +49,7 @@ AttrGroupDict = { # "mass", ] }, - FittingAttrGroup.STRUCTURE : { + GuiAttrGroup.STRUCTURE : { "label" : "Structure", "attributes": [ "hp", @@ -79,7 +79,7 @@ AttrGroupDict = { "explosiveDamageResonance" ] }, - FittingAttrGroup.ARMOR : { + GuiAttrGroup.ARMOR : { "label": "Armor", "attributes":[ "armorHP", @@ -91,7 +91,7 @@ AttrGroupDict = { ] }, - FittingAttrGroup.SHIELD : { + GuiAttrGroup.SHIELD : { "label": "Shield", "attributes": [ "shieldCapacity", @@ -104,7 +104,7 @@ AttrGroupDict = { ] }, - FittingAttrGroup.EWAR_RESISTS : { + GuiAttrGroup.EWAR_RESISTS : { "label": "Electronic Warfare", "attributes": [ "ECMResistance", @@ -117,14 +117,14 @@ AttrGroupDict = { "weaponDisruptionResistance", ] }, - FittingAttrGroup.CAPACITOR : { + GuiAttrGroup.CAPACITOR : { "label": "Capacitor", "attributes": [ "capacitorCapacity", "rechargeRate", ] }, - FittingAttrGroup.TARGETING : { + GuiAttrGroup.TARGETING : { "label": "Targeting", "attributes": [ "maxTargetRange", @@ -142,7 +142,7 @@ AttrGroupDict = { "scanLadarStrength", ] }, - FittingAttrGroup.SHARED_FACILITIES : { + GuiAttrGroup.SHARED_FACILITIES : { "label" : "Shared Facilities", "attributes": [ "fleetHangarCapacity", @@ -150,7 +150,7 @@ AttrGroupDict = { "maxJumpClones", ] }, - FittingAttrGroup.FIGHTER_FACILITIES: { + GuiAttrGroup.FIGHTER_FACILITIES: { "label": "Fighter Squadron Facilities", "attributes": [ "fighterCapacity", @@ -163,7 +163,7 @@ AttrGroupDict = { "fighterStandupHeavySlots", ] }, - FittingAttrGroup.ON_DEATH : { + GuiAttrGroup.ON_DEATH : { "label": "On Death", "attributes": [ "onDeathDamageEM", @@ -174,7 +174,7 @@ AttrGroupDict = { "onDeathSignatureRadius", ] }, - FittingAttrGroup.JUMP_SYSTEMS : { + GuiAttrGroup.JUMP_SYSTEMS : { "label": "Jump Drive Systems", "attributes": [ "jumpDriveCapacitorNeed", @@ -188,13 +188,13 @@ AttrGroupDict = { "jumpPortalDuration", ] }, - FittingAttrGroup.PROPULSIONS : { + GuiAttrGroup.PROPULSIONS : { "label": "Propulsion", "attributes": [ "maxVelocity" ] }, - FittingAttrGroup.FIGHTERS : { + GuiAttrGroup.FIGHTERS : { "label": "Fighter", "attributes": [ "mass", @@ -210,25 +210,25 @@ AttrGroupDict = { } Group1 = [ - FittingAttrGroup.FITTING, - FittingAttrGroup.STRUCTURE, - FittingAttrGroup.ARMOR, - FittingAttrGroup.SHIELD, - FittingAttrGroup.EWAR_RESISTS, - FittingAttrGroup.CAPACITOR, - FittingAttrGroup.TARGETING, - FittingAttrGroup.SHARED_FACILITIES, - FittingAttrGroup.FIGHTER_FACILITIES, - FittingAttrGroup.ON_DEATH, - FittingAttrGroup.JUMP_SYSTEMS, - FittingAttrGroup.PROPULSIONS, + GuiAttrGroup.FITTING, + GuiAttrGroup.STRUCTURE, + GuiAttrGroup.ARMOR, + GuiAttrGroup.SHIELD, + GuiAttrGroup.EWAR_RESISTS, + GuiAttrGroup.CAPACITOR, + GuiAttrGroup.TARGETING, + GuiAttrGroup.SHARED_FACILITIES, + GuiAttrGroup.FIGHTER_FACILITIES, + GuiAttrGroup.ON_DEATH, + GuiAttrGroup.JUMP_SYSTEMS, + GuiAttrGroup.PROPULSIONS, ] CategoryGroups = { "Fighter" : [ - FittingAttrGroup.FIGHTERS, - FittingAttrGroup.SHIELD, - FittingAttrGroup.TARGETING, + GuiAttrGroup.FIGHTERS, + GuiAttrGroup.SHIELD, + GuiAttrGroup.TARGETING, ], "Ship" : Group1, "Drone" : Group1, diff --git a/gui/builtinItemStatsViews/itemAttributes.py b/gui/builtinItemStatsViews/itemAttributes.py index 49149484d..fd1424687 100644 --- a/gui/builtinItemStatsViews/itemAttributes.py +++ b/gui/builtinItemStatsViews/itemAttributes.py @@ -1,15 +1,14 @@ import csv -import config # noinspection PyPackageRequirements import wx import wx.lib.agw.hypertreelist -from gui.builtinItemStatsViews.helpers import AutoListCtrl from gui.bitmap_loader import BitmapLoader from gui.utils.numberFormatter import formatAmount, roundDec from enum import IntEnum from gui.builtinItemStatsViews.attributeGrouping import * +from service.const import GuiAttrGroup class AttributeView(IntEnum): @@ -195,7 +194,7 @@ class ItemParams(wx.Panel): misc_parent = root # We must first deet4ermine if it's categorey already has defined groupings set for it. Otherwise, we default to just using the fitting group - order = CategoryGroups.get(self.item.category.categoryName, [FittingAttrGroup.FITTING]) + order = CategoryGroups.get(self.item.category.categoryName, [GuiAttrGroup.FITTING]) # start building out the tree for data in [AttrGroupDict[o] for o in order]: heading = data.get("label") diff --git a/service/const.py b/service/const.py new file mode 100644 index 000000000..990f71784 --- /dev/null +++ b/service/const.py @@ -0,0 +1,102 @@ +# ============================================================================= +# Copyright (C) 2019 Ryan Holmes +# +# This file is part of pyfa. +# +# pyfa is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# pyfa is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with pyfa. If not, see . +# ============================================================================= + +from enum import Enum, IntEnum, unique, auto + + +@unique +class EsiLoginMethod(IntEnum): + """ + Contains the method of ESI login + """ + SERVER = 0 + MANUAL = 1 + + +@unique +class EsiSsoMode(IntEnum): + """ + Contains the mode of ESI sso mode + """ + AUTO = 0 + CUSTOM = 1 + + +class EsiEndpoints(Enum): + """ + Contains the endpoint paths for the ESI access + """ + 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}/" + + +@unique +class PortMultiBuyOptions(IntEnum): + """ + Contains different types of items for multibuy export + """ + IMPLANTS = 1 + CARGO = 2 + LOADED_CHARGES = 3 + + +@unique +class PortEftOptions(IntEnum): + """ + Contains different options for eft-export + """ + IMPLANTS = 1 + MUTATIONS = 2 + LOADED_CHARGES = 3 + + +@unique +class PortEftRigSize(IntEnum): + """ + Contains different sizes of ship rigs + This enum is not actively used, but maybe useful someday. + """ + SMALL = 1 + MEDIUM = 2 + LARGE = 3 + CAPITAL = 4 + + +@unique +class GuiAttrGroup(IntEnum): + """ + Define the various groups of attributes. + This enum is used for GUI functions and getting redefined in + /gui/builtinItemStatsViews/attributeGrouping.py + """ + FITTING = auto() + STRUCTURE = auto() + SHIELD = auto() + ARMOR = auto() + TARGETING = auto() + EWAR_RESISTS = auto() + CAPACITOR = auto() + SHARED_FACILITIES = auto() + FIGHTER_FACILITIES = auto() + ON_DEATH = auto() + JUMP_SYSTEMS = auto() + PROPULSIONS = auto() + FIGHTERS = auto() \ No newline at end of file diff --git a/service/esi.py b/service/esi.py index c67ee76f8..88b704664 100644 --- a/service/esi.py +++ b/service/esi.py @@ -9,9 +9,9 @@ import config import webbrowser import eos.db -from eos.const import EsiLoginMethod +from service.const import EsiLoginMethod, EsiSsoMode from eos.saveddata.ssocharacter import SsoCharacter -from service.esiAccess import APIException, EsiSsoMode +from service.esiAccess import APIException import gui.globalEvents as GE from gui.ssoLogin import SsoLogin, SsoLoginServer from service.server import StoppableHTTPServer, AuthHandler diff --git a/service/esiAccess.py b/service/esiAccess.py index 8bb4aedcd..1b7a191c8 100644 --- a/service/esiAccess.py +++ b/service/esiAccess.py @@ -17,7 +17,7 @@ import config import base64 import datetime -from eos.const import EsiSsoMode, EsiEndpoints +from service.const import EsiSsoMode, EsiEndpoints from service.settings import EsiSettings, NetworkSettings from requests import Session diff --git a/service/port/eft.py b/service/port/eft.py index 9b9e97743..66b6aaba9 100644 --- a/service/port/eft.py +++ b/service/port/eft.py @@ -19,8 +19,7 @@ import re -from eos.const import PortEftRigSize -from eos.const import PortEftOptions +from service.const import PortEftOptions, PortEftRigSize from logbook import Logger diff --git a/service/port/multibuy.py b/service/port/multibuy.py index 46d7a72e1..bc63ec6b1 100644 --- a/service/port/multibuy.py +++ b/service/port/multibuy.py @@ -18,9 +18,7 @@ # ============================================================================= -from eos.const import PortMultiBuyOptions - - +from service.const import PortMultiBuyOptions MULTIBUY_OPTIONS = ( (PortMultiBuyOptions.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),