Merge branch 'master' into ammo_graph

This commit is contained in:
DarkPhoenix
2019-10-10 12:41:30 +03:00
49 changed files with 155 additions and 225 deletions

View File

@@ -25,7 +25,7 @@ from sqlalchemy.orm.collections import attribute_mapped_collection
from eos.db import gamedata_meta
from eos.db.gamedata.dynamicAttributes import dynamicApplicable_table
from eos.db.gamedata.effect import typeeffects_table
from eos.gamedata import Attribute, DynamicItem, Effect, Group, Item, MetaType, Traits
from eos.gamedata import Attribute, DynamicItem, Effect, Group, Item, Traits, MetaGroup
items_table = Table("invtypes", gamedata_meta,
Column("typeID", Integer, primary_key=True),
@@ -41,9 +41,11 @@ items_table = Table("invtypes", gamedata_meta,
Column("iconID", Integer),
Column("graphicID", Integer),
Column("groupID", Integer, ForeignKey("invgroups.groupID"), index=True),
Column("metaLevel", Integer),
Column("metaGroupID", Integer, ForeignKey("invmetagroups.metaGroupID"), index=True),
Column("variationParentTypeID", Integer, ForeignKey("invtypes.typeID"), index=True),
Column("replacements", String))
from .metaGroup import metatypes_table # noqa
from .traits import traits_table # noqa
mapper(Item, items_table,
@@ -51,9 +53,8 @@ mapper(Item, items_table,
"group" : relation(Group, backref=backref("items", cascade="all,delete")),
"_Item__attributes": relation(Attribute, cascade='all, delete, delete-orphan', collection_class=attribute_mapped_collection('name')),
"effects": relation(Effect, secondary=typeeffects_table, collection_class=attribute_mapped_collection('name')),
"metaGroup" : relation(MetaType,
primaryjoin=metatypes_table.c.typeID == items_table.c.typeID,
uselist=False),
"metaGroup" : relation(MetaGroup, backref=backref("items", cascade="all,delete")),
"varParent" : relation(Item, backref=backref("varChildren", cascade="all,delete"), remote_side=items_table.c.typeID),
"ID" : synonym("typeID"),
"name" : synonym("typeName"),
"description" : deferred(items_table.c.description),
@@ -64,7 +65,6 @@ mapper(Item, items_table,
primaryjoin=dynamicApplicable_table.c.applicableTypeID == items_table.c.typeID,
secondaryjoin=dynamicApplicable_table.c.typeID == DynamicItem.typeID,
secondary=dynamicApplicable_table,
backref="applicableItems")
})
backref="applicableItems")})
Item.category = association_proxy("group", "category")

View File

@@ -17,35 +17,17 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, String
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import relation, mapper, synonym
from sqlalchemy import Table, Column, Integer, String
from sqlalchemy.orm import mapper, synonym
from eos.db import gamedata_meta
from eos.db.gamedata.item import items_table
from eos.gamedata import Item, MetaGroup, MetaType
from eos.gamedata import MetaGroup
metagroups_table = Table("invmetagroups", gamedata_meta,
Column("metaGroupID", Integer, primary_key=True),
Column("metaGroupName", String))
metatypes_table = Table("invmetatypes", gamedata_meta,
Column("typeID", Integer, ForeignKey("invtypes.typeID"), primary_key=True),
Column("parentTypeID", Integer, ForeignKey("invtypes.typeID")),
Column("metaGroupID", Integer, ForeignKey("invmetagroups.metaGroupID")))
mapper(MetaGroup, metagroups_table,
properties={
"ID" : synonym("metaGroupID"),
"name": synonym("metaGroupName")
})
mapper(MetaType, metatypes_table,
properties={
"ID" : synonym("metaGroupID"),
"parent": relation(Item, primaryjoin=metatypes_table.c.parentTypeID == items_table.c.typeID),
"items" : relation(Item, primaryjoin=metatypes_table.c.typeID == items_table.c.typeID),
"info" : relation(MetaGroup, lazy=False)
})
MetaType.name = association_proxy("info", "name")
"name": synonym("metaGroupName")})

View File

@@ -23,8 +23,8 @@ from sqlalchemy.sql import and_, or_, select
import eos.config
from eos.db import gamedata_session
from eos.db.gamedata.item import items_table
from eos.db.gamedata.group import groups_table
from eos.db.gamedata.metaGroup import items_table, metatypes_table
from eos.db.util import processEager, processWhere
from eos.gamedata import AlphaClone, Attribute, AttributeInfo, Category, DynamicItem, Group, Item, MarketGroup, MetaData, MetaGroup
@@ -259,6 +259,10 @@ def getMetaGroup(lookfor, eager=None):
return metaGroup
def getMetaGroups():
return gamedata_session.query(MetaGroup).all()
@cachedQuery(1, "lookfor")
def getMarketGroup(lookfor, eager=None):
if isinstance(lookfor, int):
@@ -342,11 +346,9 @@ def getVariations(itemids, groupIDs=None, where=None, eager=None):
if len(itemids) == 0:
return []
itemfilter = or_(*(metatypes_table.c.parentTypeID == itemid for itemid in itemids))
itemfilter = or_(*(items_table.c.variationParentTypeID == itemid for itemid in itemids))
filter = processWhere(itemfilter, where)
joinon = items_table.c.typeID == metatypes_table.c.typeID
vars = gamedata_session.query(Item).options(*processEager(eager)).join((metatypes_table, joinon)).filter(
filter).all()
vars = gamedata_session.query(Item).options(*processEager(eager)).filter(filter).all()
if vars:
return vars

View File

@@ -11746,7 +11746,7 @@ class Effect3771(BaseEffect):
armorHPBonusAddPassive
Used by:
Subsystems from group: Defensive Systems (9 of 12)
Subsystems from group: Defensive Subsystem (9 of 12)
"""
type = 'passive'
@@ -11761,7 +11761,7 @@ class Effect3773(BaseEffect):
hardPointModifierEffect
Used by:
Subsystems from group: Offensive Systems (12 of 12)
Subsystems from group: Offensive Subsystem (12 of 12)
"""
type = 'passive'
@@ -11794,7 +11794,7 @@ class Effect3782(BaseEffect):
powerOutputAddPassive
Used by:
Subsystems from group: Offensive Systems (8 of 12)
Subsystems from group: Offensive Subsystem (8 of 12)
"""
type = 'passive'
@@ -11809,7 +11809,7 @@ class Effect3783(BaseEffect):
cpuOutputAddCpuOutputPassive
Used by:
Subsystems from group: Offensive Systems (8 of 12)
Subsystems from group: Offensive Subsystem (8 of 12)
"""
type = 'passive'
@@ -11824,7 +11824,7 @@ class Effect3797(BaseEffect):
droneBandwidthAddPassive
Used by:
Subsystems from group: Offensive Systems (12 of 12)
Subsystems from group: Offensive Subsystem (12 of 12)
"""
type = 'passive'
@@ -11839,7 +11839,7 @@ class Effect3799(BaseEffect):
droneCapacityAdddroneCapacityPassive
Used by:
Subsystems from group: Offensive Systems (12 of 12)
Subsystems from group: Offensive Subsystem (12 of 12)
"""
type = 'passive'
@@ -11869,7 +11869,7 @@ class Effect3808(BaseEffect):
signatureRadiusAddPassive
Used by:
Subsystems from group: Defensive Systems (8 of 12)
Subsystems from group: Defensive Subsystem (8 of 12)
Subsystems named like: Propulsion Interdiction Nullifier (4 of 4)
"""
@@ -11916,7 +11916,7 @@ class Effect3831(BaseEffect):
shieldCapacityAddPassive
Used by:
Subsystems from group: Defensive Systems (8 of 12)
Subsystems from group: Defensive Subsystem (8 of 12)
"""
type = 'passive'
@@ -18769,7 +18769,7 @@ class Effect5262(BaseEffect):
covertOpsCloakCpuPenalty
Used by:
Subsystems from group: Defensive Systems (8 of 12)
Subsystems from group: Defensive Subsystem (8 of 12)
"""
type = 'passive'
@@ -18785,7 +18785,7 @@ class Effect5263(BaseEffect):
covertCynoCpuPenalty
Used by:
Subsystems from group: Defensive Systems (8 of 12)
Subsystems from group: Defensive Subsystem (8 of 12)
"""
type = 'passive'
@@ -18817,7 +18817,7 @@ class Effect5265(BaseEffect):
warfareLinkCpuPenalty
Used by:
Subsystems from group: Offensive Systems (8 of 12)
Subsystems from group: Offensive Subsystem (8 of 12)
"""
type = 'passive'
@@ -36010,7 +36010,7 @@ class Effect7232(BaseEffect):
modifyDamageMultiplierBonusMax
Used by:
Implants named like: Low Grade Mimesis (5 of 6)
Implants named like: Grade Mimesis (10 of 12)
"""
type = 'passive'
@@ -36027,7 +36027,7 @@ class Effect7233(BaseEffect):
modifyDamageMultiplierBonusPerCycle
Used by:
Implants named like: Low Grade Mimesis (5 of 6)
Implants named like: Grade Mimesis (10 of 12)
"""
type = 'passive'
@@ -36044,7 +36044,7 @@ class Effect7234(BaseEffect):
implantSetMimesis
Used by:
Implants named like: Low Grade Mimesis (6 of 6)
Implants named like: Grade Mimesis (12 of 12)
"""
runTime = 'early'

View File

@@ -609,10 +609,6 @@ class MetaGroup(EqBase):
pass
class MetaType(EqBase):
pass
class Unit(EqBase):
def __init__(self):

View File

@@ -122,7 +122,7 @@ class Booster(HandledItem, ItemAttrShortcut):
(effect.isType("passive") or effect.isType("boosterSideEffect")):
if effect.isType("boosterSideEffect") and effect not in self.activeSideEffectEffects:
continue
effect.handler(fit, self, ("booster",), None)
effect.handler(fit, self, ("booster",), None, effect=effect)
@validates("ID", "itemID", "ammoID", "active")
def validator(self, key, val):

View File

@@ -422,7 +422,7 @@ class Skill(HandledItem):
(not fit.isStructure or effect.isType("structure")) and \
effect.activeByDefault:
try:
effect.handler(fit, self, ("skill",), None)
effect.handler(fit, self, ("skill",), None, effect=effect)
except AttributeError:
continue

View File

@@ -334,7 +334,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
if self.charge:
for effect in self.charge.effects.values():
if effect.runTime == runTime and effect.activeByDefault:
effect.handler(fit, self, ("droneCharge",), projectionRange)
effect.handler(fit, self, ("droneCharge",), projectionRange, effect=effect)
def __deepcopy__(self, memo):
copy = Drone(self.item)

View File

@@ -95,7 +95,7 @@ class Implant(HandledItem, ItemAttrShortcut):
return
for effect in self.item.effects.values():
if effect.runTime == runTime and effect.isType("passive") and effect.activeByDefault:
effect.handler(fit, self, ("implant",), None)
effect.handler(fit, self, ("implant",), None, effect=effect)
@validates("fitID", "itemID", "active")
def validator(self, key, val):

View File

@@ -54,7 +54,7 @@ class Mode(ItemAttrShortcut, HandledItem):
if self.item:
for effect in self.item.effects.values():
if effect.runTime == runTime and effect.activeByDefault:
effect.handler(fit, self, ("module",), None)
effect.handler(fit, self, ("module",), None, effect=effect)
def __deepcopy__(self, memo):
copy = Mode(self.item)

View File

@@ -882,7 +882,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
and not forceProjected \
and effect.activeByDefault \
and ((gang and effect.isType("gang")) or not gang):
effect.handler(fit, self, context, projectionRange)
effect.handler(fit, self, context, projectionRange, effect=effect)
for effect in self.item.effects.values():
if effect.runTime == runTime and \

View File

@@ -98,7 +98,7 @@ class Ship(ItemAttrShortcut, HandledItem):
# skillbook modifiers will use the stale modifier value
# GH issue #351
fit.register(self)
effect.handler(fit, self, ("ship",), None)
effect.handler(fit, self, ("ship",), None, effect=effect)
def validateModeItem(self, item, owner=None):
""" Checks if provided item is a valid mode """

BIN
eve.db

Binary file not shown.

View File

@@ -116,9 +116,7 @@ class GraphFrame(AuxiliaryFrame):
self.SetMinSize(newSize)
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -152,10 +152,10 @@ class BaseWrapperList(gui.display.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
modifiers = event.GetModifiers()
if keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
self.removeWrappers(self.getSelectedWrappers())
event.Skip()

View File

@@ -88,12 +88,12 @@ class BoosterView(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
boosters = self.getSelectedBoosters()
self.removeBoosters(boosters)
event.Skip()

View File

@@ -104,12 +104,12 @@ class CargoView(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
cargos = self.getSelectedCargos()
self.removeCargos(cargos)
event.Skip()

View File

@@ -102,12 +102,12 @@ class CommandView(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
commandFits = self.getSelectedCommandFits()
self.removeCommandFits(commandFits)
event.Skip()

View File

@@ -120,12 +120,12 @@ class DroneView(Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
drones = self.getSelectedDrones()
self.removeDroneStacks(drones)
event.Skip()
@@ -260,7 +260,7 @@ class DroneView(Display):
drone = self.drones[row]
except IndexError:
return
if wx.GetMouseState().GetModifiers() == wx.MOD_ALT:
if event.GetModifiers() == wx.MOD_ALT:
self.removeDroneStacks([drone])
else:
self.removeDrone(drone)

View File

@@ -205,12 +205,12 @@ class FighterDisplay(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
fighters = self.getSelectedFighters()
self.removeFighters(fighters)
event.Skip()
@@ -315,12 +315,11 @@ class FighterDisplay(d.Display):
if row != -1:
col = self.getColumn(event.Position)
if col != self.getColIndex(State):
mstate = wx.GetMouseState()
try:
fighter = self.fighters[row]
except IndexError:
return
if mstate.GetModifiers() == wx.MOD_ALT:
if event.GetModifiers() == wx.MOD_ALT:
fighters = getSimilarFighters(self.original, fighter)
else:
fighters = [fighter]

View File

@@ -162,12 +162,12 @@ class ImplantDisplay(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
implants = self.getSelectedImplants()
self.removeImplants(implants)
event.Skip()

View File

@@ -129,12 +129,12 @@ class ProjectedView(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedItemsCommand(
fitID=self.mainFrame.getActiveFit(),
items=self.getSelectedProjectors(),
@@ -267,7 +267,7 @@ class ProjectedView(d.Display):
selection = self.getSelectedProjectors()
if mainItem not in selection:
selection = [mainItem]
modPressed = wx.GetMouseState().GetModifiers() == wx.MOD_ALT
modPressed = event.GetModifiers() == wx.MOD_ALT
fitID = self.mainFrame.getActiveFit()
if isinstance(mainItem, EosModule) and modPressed:
fit = Fit.getInstance().getFit(fitID)
@@ -342,7 +342,7 @@ class ProjectedView(d.Display):
if mainItem is None:
return
fitID = self.mainFrame.getActiveFit()
modPressed = wx.GetMouseState().GetModifiers() == wx.MOD_ALT
modPressed = event.GetModifiers() == wx.MOD_ALT
if isinstance(mainItem, EosFit):
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedItemsCommand(
fitID=fitID, items=[mainItem], amount=math.inf if modPressed else 1))

View File

@@ -1,7 +1,6 @@
# noinspection PyPackageRequirements
import wx
import gui.fitCommands as cmd
import gui.mainFrame
from gui.builtinViews.emptyView import BlankPage
from gui.contextMenu import ContextMenuUnconditional

View File

@@ -52,19 +52,18 @@ class ChangeItemProjectionRange(ContextMenuCombined):
newRange = cleanInputFloat * 1000
else:
newRange = None
fitID = self.mainFrame.getActiveFit()
items = selection
if wx.GetMouseState().GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL):
if isinstance(mainItem, EosModule):
fit = Fit.getInstance().getFit(fitID)
positions = getSimilarModPositions(fit.projectedModules, mainItem)
items = [fit.projectedModules[p] for p in positions]
elif isinstance(mainItem, EosFighter):
fit = Fit.getInstance().getFit(fitID)
items = getSimilarFighters(fit.projectedFighters, mainItem)
self.mainFrame.command.Submit(cmd.GuiChangeProjectedItemsProjectionRangeCommand(
fitID=fitID, items=items, projectionRange=newRange))
fitID = self.mainFrame.getActiveFit()
items = selection
if wx.GetMouseState().GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL):
if isinstance(mainItem, EosModule):
fit = Fit.getInstance().getFit(fitID)
positions = getSimilarModPositions(fit.projectedModules, mainItem)
items = [fit.projectedModules[p] for p in positions]
elif isinstance(mainItem, EosFighter):
fit = Fit.getInstance().getFit(fitID)
items = getSimilarFighters(fit.projectedFighters, mainItem)
self.mainFrame.command.Submit(cmd.GuiChangeProjectedItemsProjectionRangeCommand(
fitID=fitID, items=items, projectionRange=newRange))
ChangeItemProjectionRange.register()

View File

@@ -48,10 +48,9 @@ class ItemStats(ContextMenuSingle):
if srcContext == "fittingModule" and stuff.isEmpty:
return
mstate = wx.GetMouseState()
reuse = False
if mstate.GetModifiers() == wx.MOD_SHIFT:
if wx.GetMouseState().GetModifiers() == wx.MOD_SHIFT:
reuse = True
if self.mainFrame.GetActiveStatsWindow() is None and reuse:

View File

@@ -56,9 +56,7 @@ class ChangeItemToVariation(ContextMenuCombined):
fit = sFit.getFit(self.mainFrame.getActiveFit())
def get_metalevel(x):
if 'metaLevel' not in x.attributes:
return 0
return x.attributes['metaLevel'].value
return x.metaLevel or 0
def get_metagroup(x):
# We want deadspace before officer mods

View File

@@ -226,9 +226,8 @@ class ChangeModuleAmmo(ContextMenuCombined):
fitID = self.mainFrame.getActiveFit()
sFit = Fit.getInstance()
fit = sFit.getFit(fitID)
mstate = wx.GetMouseState()
# Switch in selection or all modules, depending on modifier key state and settings
switchAll = sFit.serviceFittingOptions['ammoChangeAll'] is not (mstate.GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL))
switchAll = sFit.serviceFittingOptions['ammoChangeAll'] is not (wx.GetMouseState().GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL))
if switchAll:
if self.srcContext == 'fittingModule':
command = cmd.GuiChangeLocalModuleChargesCommand

View File

@@ -9,7 +9,7 @@ from gui.utils.numberFormatter import formatAmount
def defaultSort(item):
return (item.attributes['metaLevel'].value if 'metaLevel' in item.attributes else 0, item.name)
return (item.metaLevel or 0, item.name)
class ItemCompare(wx.Panel):

View File

@@ -215,7 +215,7 @@ class ItemView(Display):
# Get position of market group
metagrpid = sMkt.getMetaGroupIdByItem(item)
metatab = self.metaMap.get(metagrpid)
metalvl = self.metalvls.get(item.ID, 0)
metalvl = item.metaLevel or 0
return catname, mktgrpid, parentname, metatab, metalvl, item.name
@@ -237,11 +237,6 @@ class ItemView(Display):
def populate(self, items):
if len(items) > 0:
# Get dictionary with meta level attribute
sAttr = Attribute.getInstance()
attrs = sAttr.getAttributeInfo("metaLevel")
sMkt = self.sMkt
self.metalvls = sMkt.directAttrRequest(items, attrs)
# Clear selection
self.unselectAll()
# Perform sorting, using item's meta levels besides other stuff
@@ -254,11 +249,6 @@ class ItemView(Display):
def refresh(self, items):
if len(items) > 1:
# Get dictionary with meta level attribute
sAttr = Attribute.getInstance()
attrs = sAttr.getAttributeInfo("metaLevel")
sMkt = self.sMkt
self.metalvls = sMkt.directAttrRequest(items, attrs)
# Re-sort stuff
if self.marketBrowser.mode != 'recent':
items.sort(key=self.itemSort)

View File

@@ -283,9 +283,7 @@ class FitItem(SFItem.SFBrowserItem):
event.Skip()
def editCheckEsc(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.RestoreEditButton()
else:
event.Skip()

View File

@@ -109,10 +109,10 @@ class NavigationPanel(SFItem.SFBrowserItem):
def OnBrowserSearchBoxKeyPress(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.BrowserSearchBox.Show(False)
elif event.RawControlDown() and event.GetKeyCode() == wx.WXK_BACK:
elif keycode == wx.WXK_BACK and modifiers == wx.MOD_CONTROL:
HandleCtrlBackspace(self.BrowserSearchBox)
else:
event.Skip()

View File

@@ -176,9 +176,7 @@ class ShipItem(SFItem.SFBrowserItem):
self.Refresh()
def editCheckEsc(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.tcFitName.Show(False)
else:
event.Skip()

View File

@@ -689,9 +689,8 @@ class Miscellanea(ViewColumn):
baseRange = stuff.getModifiedChargeAttr("baseScanRange")
if not scanStr or not baseRange:
return "", None
strTwoAu = scanStr / (2.0 / baseRange)
text = "{0}".format(formatAmount(strTwoAu, 3, 0, 3))
tooltip = "Scan strength with 2 AU scan range"
text = "{}".format(formatAmount(scanStr, 4, 0, 3))
tooltip = "Scan strength at {} AU scan range".format(formatAmount(baseRange, 3, 0, 0))
return text, tooltip
else:
return "", None

View File

@@ -280,12 +280,12 @@ class FittingView(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
modules = [m for m in self.getSelectedMods() if not m.isEmpty]
self.removeModule(modules)
event.Skip()

View File

@@ -258,9 +258,7 @@ class CharacterEditor(AuxiliaryFrame):
wx.PostEvent(self, GE.CharListUpdated())
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -92,9 +92,7 @@ class EveFittings(AuxiliaryFrame):
self.charChoice.SetSelection(0)
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()
@@ -248,9 +246,7 @@ class ExportToEve(AuxiliaryFrame):
self.charChoice.SetSelection(0)
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()
@@ -358,9 +354,7 @@ class SsoCharacterMgmt(AuxiliaryFrame):
event.Skip()
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -133,9 +133,7 @@ class ItemStatsFrame(AuxiliaryFrame):
self.parentWnd.SetActiveStatsWindow(self)
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -281,9 +281,7 @@ class DmgPatternEditor(AuxiliaryFrame):
self.stNotice.SetLabel("Patterns exported to clipboard")
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -81,9 +81,7 @@ class PreferenceDialog(wx.Dialog):
self.Close()
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -89,9 +89,7 @@ class AttributeEditor(AuxiliaryFrame):
self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent)
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -185,9 +185,7 @@ class ImplantSetEditor(AuxiliaryFrame):
return
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -369,9 +369,7 @@ class TargetProfileEditor(AuxiliaryFrame):
self.stNotice.SetLabel("Profiles exported to clipboard")
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

BIN
imgs/renders/73@1x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
imgs/renders/73@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -152,7 +152,7 @@ ig.categoryID = ic.categoryID'
QUERY_TYPEID_GROUPID = 'SELECT groupID FROM invtypes WHERE typeID = ? LIMIT 1'
QUERY_GROUPID_CATEGORYID = 'SELECT categoryID FROM invgroups WHERE \
groupID = ? LIMIT 1'
QUERY_TYPEID_PARENTTYPEID = 'SELECT parentTypeID FROM invmetatypes WHERE \
QUERY_TYPEID_PARENTTYPEID = 'SELECT variationParentTypeID FROM invtypes WHERE \
typeID = ? LIMIT 1'
QUERY_TYPEID_MARKETGROUPID = 'SELECT marketGroupID FROM invtypes WHERE \
typeID = ? LIMIT 1'

View File

@@ -56,15 +56,14 @@ def main(db, json_path):
# Config dict
tables = {
'clonegrades': ('fsd_lite', eos.gamedata.AlphaCloneSkill),
'dgmattribs': ('bulkdata', eos.gamedata.AttributeInfo),
'dgmeffects': ('bulkdata', eos.gamedata.Effect),
'dgmtypeattribs': ('bulkdata', eos.gamedata.Attribute),
'dgmtypeeffects': ('bulkdata', eos.gamedata.ItemEffect),
'dgmunits': ('bulkdata', eos.gamedata.Unit),
'dogmaattributes': ('bulkdata', eos.gamedata.AttributeInfo),
'dogmaeffects': ('bulkdata', eos.gamedata.Effect),
'dogmatypeattributes': ('bulkdata', eos.gamedata.Attribute),
'dogmatypeeffects': ('bulkdata', eos.gamedata.ItemEffect),
'dogmaunits': ('bulkdata', eos.gamedata.Unit),
'evecategories': ('fsd_lite', eos.gamedata.Category),
'evegroups': ('fsd_lite', eos.gamedata.Group),
'invmetagroups': ('bulkdata', eos.gamedata.MetaGroup),
'invmetatypes': ('bulkdata', eos.gamedata.MetaType),
'metagroups': ('fsd_binary', eos.gamedata.MetaGroup),
'evetypes': ('fsd_lite', eos.gamedata.Item),
'traits': ('phobos', eos.gamedata.Traits),
'metadata': ('phobos', eos.gamedata.MetaData),
@@ -73,13 +72,16 @@ def main(db, json_path):
fieldMapping = {
'marketgroups': {
'id': 'marketGroupID',
'name': 'marketGroupName'}}
'name': 'marketGroupName'},
'metagroups': {
'id': 'metaGroupID'}}
rowsInValues = (
'evetypes',
'evegroups',
'evecategories',
'marketgroups')
'marketgroups',
'metagroups')
def convertIcons(data):
new = []
@@ -176,13 +178,13 @@ def main(db, json_path):
# Get data on item effects
# Format: {type ID: set(effect, IDs)}
typesEffects = {}
for row in tables['dgmtypeeffects']:
for row in tables['dogmatypeeffects']:
typesEffects.setdefault(row['typeID'], set()).add(row['effectID'])
# Get data on type attributes
# Format: {type ID: {attribute ID: attribute value}}
typesNormalAttribs = {}
typesSkillAttribs = {}
for row in tables['dgmtypeattribs']:
for row in tables['dogmatypeattributes']:
attributeID = row['attributeID']
if attributeID in skillReqAttribsFlat:
typeSkillAttribs = typesSkillAttribs.setdefault(row['typeID'], {})
@@ -304,7 +306,7 @@ def main(db, json_path):
# group Ship Modifiers, for items like tactical t3 ship modes
row['groupID'] == 1306 or
# Civilian weapons
row['typeName'].startswith('Civilian') or
(row['typeName'].startswith('Civilian') and "Shuttle" not in row['typeName']) or
# Micro Bombs (Fighters)
row['typeID'] in (41549, 41548, 41551, 41550) or
# Abyssal weather (environment)
@@ -321,7 +323,7 @@ def main(db, json_path):
# ignore checker
def isIgnored(file, row):
if file in ('evetypes', 'dgmtypeeffects', 'dgmtypeattribs', 'invmetatypes') and row['typeID'] not in eveTypes:
if file in ('evetypes', 'dogmatypeeffects', 'dogmatypeattributes') and row['typeID'] not in eveTypes:
return True
return False
@@ -338,7 +340,7 @@ def main(db, json_path):
if (
jsonName == 'evetypes' and (
# Apparently people really want Civilian modules available
row['typeName'].startswith('Civilian') or
(row['typeName'].startswith('Civilian') and "Shuttle" not in row['typeName']) or
row['typeName'] in ('Capsule', 'Dark Blood Tracking Disruptor'))
):
row['published'] = True

View File

@@ -20,6 +20,7 @@
import queue
import threading
from collections import OrderedDict
from itertools import chain
# noinspection PyPackageRequirements
import wx
@@ -29,7 +30,7 @@ from sqlalchemy.sql import or_
import config
import eos.db
from eos.gamedata import Category as types_Category, Group as types_Group, Item as types_Item, MarketGroup as types_MarketGroup, \
MetaGroup as types_MetaGroup, MetaType as types_MetaType
MetaGroup as types_MetaGroup
from service import conversions
from service.jargon import JargonLoader
from service.settings import SettingsProvider
@@ -118,13 +119,13 @@ class SearchWorkerThread(threading.Thread):
if len(request) >= config.minItemSearchLength:
results = eos.db.searchItems(request, where=filter_,
join=(types_Item.group, types_Group.category),
eager=("group.category", "metaGroup", "metaGroup.parent"))
eager=("group.category", "metaGroup"))
jargon_results = []
if len(jargon_request) >= config.minItemSearchLength:
jargon_results = eos.db.searchItems(jargon_request, where=filter_,
join=(types_Item.group, types_Group.category),
eager=("group.category", "metaGroup", "metaGroup.parent"))
eager=("group.category", "metaGroup"))
items = set()
# Return only published items, consult with Market service this time
@@ -217,7 +218,8 @@ class Market:
}
self.ITEMS_FORCEGROUP_R = self.__makeRevDict(self.ITEMS_FORCEGROUP)
self.les_grp.addItems = list(self.getItem(itmn) for itmn in self.ITEMS_FORCEGROUP_R[self.les_grp])
for grp, itemNames in self.ITEMS_FORCEGROUP_R.items():
grp.addItems = list(self.getItem(i) for i in itemNames)
self.customGroups.add(self.les_grp)
# List of items which are forcibly published or hidden
@@ -313,10 +315,12 @@ class Market:
# Misc definitions
# 0 is for items w/o meta group
self.META_MAP = OrderedDict([("normal", frozenset((0, 1, 2, 14))),
("faction", frozenset((4, 3))),
self.META_MAP = OrderedDict([("faction", frozenset((4, 3, 52))),
("complex", frozenset((6,))),
("officer", frozenset((5,)))])
nonNormalMetas = set(chain(*self.META_MAP.values()))
self.META_MAP["normal"] = frozenset((0, *(mg.ID for mg in eos.db.getMetaGroups() if mg.ID not in nonNormalMetas)))
self.META_MAP.move_to_end("normal", last=False)
self.META_MAP_REVERSE = {sv: k for k, v in self.META_MAP.items() for sv in v}
self.SEARCH_CATEGORIES = (
"Drone",
@@ -461,19 +465,8 @@ class Market:
"""Get meta group by item"""
# Check if item is in forced metagroup map
if item.name in self.ITEMS_FORCEDMETAGROUP:
# Create meta group from scratch
metaGroup = types_MetaType()
# Get meta group info object based on meta group name
metaGroupInfo = self.getMetaGroup(self.ITEMS_FORCEDMETAGROUP[item.name][0])
# Get parent item based on its name
parent = self.getItem(self.ITEMS_FORCEDMETAGROUP[item.name][1])
# Assign all required for metaGroup variables
metaGroup.info = metaGroupInfo
metaGroup.items = item
metaGroup.parent = parent
metaGroup.metaGroupID = metaGroupInfo.ID
metaGroup.parentTypeID = parent.ID
metaGroup.typeID = item.ID
metaGroupName = self.ITEMS_FORCEDMETAGROUP[item.name][0]
metaGroup = eos.db.getMetaGroup(metaGroupName)
# If no forced meta group is provided, try to use item's
# meta group if any
else:
@@ -513,14 +506,15 @@ class Market:
def getParentItemByItem(self, item, selfparent=True):
"""Get parent item by item"""
mg = self.getMetaGroupByItem(item)
if mg:
parent = mg.parent
parent = None
if item.name in self.ITEMS_FORCEDMETAGROUP:
parentName = self.ITEMS_FORCEDMETAGROUP[item.name][1]
parent = self.getItem(parentName)
if parent is None:
parent = item.varParent
# Consider self as parent if item has no parent in database
elif selfparent is True:
if parent is None and selfparent is True:
parent = item
else:
parent = None
return parent
def getVariationsByItems(self, items, alreadyparent=False):
@@ -756,7 +750,7 @@ class Market:
filter_ = types_Category.name.in_(["Ship", "Structure"])
results = eos.db.searchItems(name, where=filter_,
join=(types_Item.group, types_Group.category),
eager=("group.category", "metaGroup", "metaGroup.parent"))
eager=("group.category", "metaGroup"))
ships = set()
for item in results:
if self.getPublicityByItem(item):

View File

@@ -460,13 +460,11 @@ class EfsPort:
def getT2ItemsWhere(additionalFilter, mustBeOffensive=False, category="Module"):
# Used to obtain a smaller subset of items while still containing examples of each group.
T2_META_LEVEL = 5
metaLevelAttrID = getAttributeInfo("metaLevel").attributeID
categoryID = getCategory(category).categoryID
result = gamedata_session.query(Item).join(ItemEffect, Group, Attribute).\
filter(
additionalFilter,
Attribute.attributeID == metaLevelAttrID,
Attribute.value == T2_META_LEVEL,
Item.metaLevel == T2_META_LEVEL,
Group.categoryID == categoryID,
).all()
if mustBeOffensive:
@@ -591,18 +589,18 @@ class EfsPort:
preTraitMultipliers = getCurrentMultipliers(tf)
for effect in fit.ship.item.effects.values():
if effect.isImplemented:
effect.handler(tf, tf.ship, [])
effect.handler(tf, tf.ship, [], None, effect=effect)
# Factor in mode effects for T3 Destroyers
if fit.mode is not None:
for effect in fit.mode.item.effects.values():
if effect.isImplemented:
effect.handler(tf, fit.mode, [])
effect.handler(tf, fit.mode, [], None, effect=effect)
if fit.ship.item.groupID == getGroup("Strategic Cruiser").ID:
subSystems = list(filter(lambda mod: mod.slot == FittingSlot.SUBSYSTEM and mod.item, fit.modules))
for sub in subSystems:
for effect in sub.item.effects.values():
if effect.isImplemented:
effect.handler(tf, sub, [])
effect.handler(tf, sub, [], None, effect=effect)
postTraitMultipliers = getCurrentMultipliers(tf)
getMaxRatio = lambda dictA, dictB, key: max(map(lambda a, b: b / a, dictA[key], dictB[key]))
multipliers["turret"] = round(getMaxRatio(preTraitMultipliers, postTraitMultipliers, "turrets"), 6)

View File

@@ -1 +1 @@
version: v2.11.1
version: v2.12.1