MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / Fit

Class Fit

eos/saveddata/fit.py:65–1977  ·  view source on GitHub ↗

Represents a fitting, with modules, ship, implants, etc.

Source from the content-addressed store, hash-verified

63
64
65class Fit:
66 """Represents a fitting, with modules, ship, implants, etc."""
67
68 PEAK_RECHARGE = 0.25
69
70 def __init__(self, ship=None, name=""):
71 """Initialize a fit from the program"""
72 self.__ship = None
73 self.__mode = None
74 # use @mode.setter's to set __attr and IDs. This will set mode as well
75 self.ship = ship
76 if self.ship:
77 self.ship.owner = self
78
79 self.__modules = HandledModuleList()
80 self.__drones = HandledDroneCargoList()
81 self.__fighters = HandledDroneCargoList()
82 self.__cargo = HandledDroneCargoList()
83 self.__implants = HandledImplantList()
84 self.__boosters = HandledBoosterList()
85 # self.__projectedFits = {}
86 self.__projectedModules = HandledProjectedModList()
87 self.__projectedDrones = HandledProjectedDroneList()
88 self.__projectedFighters = HandledProjectedDroneList()
89 self.__character = None
90 self.__owner = None
91
92 self.projected = False
93 self.name = name
94 self.timestamp = time.time()
95 self.created = None
96 self.modified = None
97 self.modeID = None
98
99 self.build()
100
101 @reconstructor
102 def init(self):
103 """Initialize a fit from the database and validate"""
104 self.__ship = None
105 self.__mode = None
106
107 if self.shipID:
108 item = eos.db.getItem(self.shipID)
109 if item is None:
110 pyfalog.error("Item (id: {0}) does not exist", self.shipID)
111 return
112
113 try:
114 try:
115 self.__ship = Ship(item, self)
116 except ValueError:
117 self.__ship = Citadel(item, self)
118 # @todo extra attributes is now useless, however it set to be
119 # the same as ship attributes for ease (so we don't have to
120 # change all instances in source). Remove this at some point
121 self.extraAttributes = self.__ship.itemModifiedAttributes
122 except ValueError:

Callers 1

__deepcopy__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected