Proof of concept for gathering fits based on modules that are fit
This commit is contained in:
@@ -30,6 +30,7 @@ from eos.saveddata.targetResists import TargetResists
|
||||
from eos.saveddata.character import Character
|
||||
from eos.saveddata.implantSet import ImplantSet
|
||||
from eos.saveddata.fit import Fit
|
||||
from eos.saveddata.module import Module
|
||||
from eos.saveddata.miscData import MiscData
|
||||
from eos.saveddata.override import Override
|
||||
|
||||
@@ -241,22 +242,17 @@ def getFitsWithShip(shipID, ownerID=None, where=None, eager=None):
|
||||
return fits
|
||||
|
||||
|
||||
def getBoosterFits(ownerID=None, where=None, eager=None):
|
||||
def getFitsWithModules(typeIDs, eager=None):
|
||||
"""
|
||||
Get all the fits that are flagged as a boosting ship
|
||||
If no user is passed, do this for all users.
|
||||
Get all the fits that have typeIDs fitted to them
|
||||
"""
|
||||
|
||||
if ownerID is not None and not isinstance(ownerID, int):
|
||||
raise TypeError("OwnerID must be integer")
|
||||
filter = Fit.booster == 1
|
||||
if ownerID is not None:
|
||||
filter = and_(filter, Fit.ownerID == ownerID)
|
||||
if not hasattr(typeIDs, "__iter__"):
|
||||
typeIDs = (typeIDs,)
|
||||
|
||||
filter = processWhere(filter, where)
|
||||
eager = processEager(eager)
|
||||
with sd_lock:
|
||||
fits = removeInvalid(saveddata_session.query(Fit).options(*eager).filter(filter).all())
|
||||
fits = removeInvalid(saveddata_session.query(Fit).join(Module).options(*eager).filter(Module.itemID.in_(typeIDs)).all())
|
||||
|
||||
return fits
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import gui.droneView
|
||||
from gui.builtinViewColumns.state import State
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.fit import Fit
|
||||
from service.market import Market
|
||||
from eos.saveddata.drone import Drone as es_Drone
|
||||
|
||||
|
||||
@@ -63,6 +64,15 @@ class CommandView(d.Display):
|
||||
|
||||
self.lastFitId = None
|
||||
|
||||
# Get list of items that define a command fit
|
||||
sMkt = Market.getInstance()
|
||||
grp = sMkt.getGroup(1770) # Command burst group
|
||||
self.commandTypeIDs = [item.ID for item in grp.items]
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
commandFits = sFit.getFitsWithModules(self.commandTypeIDs)
|
||||
print (commandFits)
|
||||
|
||||
self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged)
|
||||
self.Bind(wx.EVT_LEFT_DOWN, self.click)
|
||||
self.Bind(wx.EVT_RIGHT_DOWN, self.click)
|
||||
|
||||
@@ -95,15 +95,10 @@ class Fit(object):
|
||||
return names
|
||||
|
||||
@staticmethod
|
||||
def getBoosterFits():
|
||||
def getFitsWithModules(typeIDs):
|
||||
""" Lists fits flagged as booster """
|
||||
pyfalog.debug("Fetching all fits flagged as a booster.")
|
||||
fits = eos.db.getBoosterFits()
|
||||
names = []
|
||||
for fit in fits:
|
||||
names.append((fit.ID, fit.name, fit.shipID))
|
||||
|
||||
return names
|
||||
fits = eos.db.getFitsWithModules(typeIDs)
|
||||
return fits
|
||||
|
||||
@staticmethod
|
||||
def countAllFits():
|
||||
|
||||
Reference in New Issue
Block a user