tox fixes
This commit is contained in:
@@ -38,8 +38,7 @@ dynamicAttributes_table = Table("mutaplasmidAttributes", gamedata_meta,
|
||||
|
||||
dynamicApplicable_table = Table("mutaplasmidItems", gamedata_meta,
|
||||
Column("typeID", ForeignKey("mutaplasmids.typeID"), primary_key=True),
|
||||
Column("applicableTypeID", ForeignKey("invtypes.typeID"), primary_key=True),
|
||||
)
|
||||
Column("applicableTypeID", ForeignKey("invtypes.typeID"), primary_key=True),)
|
||||
|
||||
mapper(DynamicItem, dynamic_table, properties={
|
||||
"attributes": relation(DynamicItemAttribute),
|
||||
|
||||
@@ -63,8 +63,7 @@ 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")
|
||||
|
||||
@@ -127,6 +127,7 @@ def getItemWithBaseItemAttribute(lookfor, baseItemID, eager=None):
|
||||
gamedata_session.expunge(item)
|
||||
return item
|
||||
|
||||
|
||||
@cachedQuery(1, "lookfor")
|
||||
def getItems(lookfor, eager=None):
|
||||
"""
|
||||
|
||||
@@ -29,7 +29,6 @@ mutator_table = Table("mutators", saveddata_meta,
|
||||
Column("attrID", Integer, primary_key=True, index=True),
|
||||
Column("value", Float, nullable=False),
|
||||
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
|
||||
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now)
|
||||
)
|
||||
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now))
|
||||
|
||||
mapper(Mutator, mutator_table)
|
||||
|
||||
@@ -3,5 +3,8 @@
|
||||
# Used by:
|
||||
# Ship: Claw
|
||||
type = "passive"
|
||||
|
||||
|
||||
def handler(fit, src, context):
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Small Projectile Turret"), "speed", src.getModifiedItemAttr("shipBonusMF"), stackingPenalties=True, skill="Minmatar Frigate")
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Small Projectile Turret"), "speed",
|
||||
src.getModifiedItemAttr("shipBonusMF"), stackingPenalties=True, skill="Minmatar Frigate")
|
||||
|
||||
@@ -536,6 +536,7 @@ class DynamicItemAttribute(EqBase):
|
||||
class DynamicItemItem(EqBase):
|
||||
pass
|
||||
|
||||
|
||||
class MarketGroup(EqBase):
|
||||
def __repr__(self):
|
||||
return "MarketGroup(ID={}, name={}, parent={}) at {}".format(
|
||||
|
||||
@@ -42,6 +42,7 @@ class ItemAttrShortcut(object):
|
||||
|
||||
return return_value or default
|
||||
|
||||
|
||||
class ChargeAttrShortcut(object):
|
||||
def getModifiedChargeAttr(self, key, default=0):
|
||||
return_value = self.chargeModifiedAttributes.get(key)
|
||||
|
||||
@@ -177,7 +177,6 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
self.__chargeModifiedAttributes.original = self.__charge.attributes
|
||||
self.__chargeModifiedAttributes.overrides = self.__charge.overrides
|
||||
|
||||
|
||||
@classmethod
|
||||
def buildEmpty(cls, slot):
|
||||
empty = Module(None)
|
||||
@@ -209,7 +208,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
return self.__item is None or \
|
||||
(self.__item.category.name not in ("Module", "Subsystem", "Structure Module") and
|
||||
self.__item.group.name not in self.SYSTEM_GROUPS) or \
|
||||
(self.item.isAbyssal and (not self.baseItemID or not self.mutaplasmidID) )
|
||||
(self.item.isAbyssal and (not self.baseItemID or not self.mutaplasmidID))
|
||||
|
||||
@property
|
||||
def isMutated(self):
|
||||
|
||||
@@ -79,7 +79,7 @@ class Mutator(EqBase):
|
||||
@validates("value")
|
||||
def validator(self, key, val):
|
||||
""" Validates values as properly falling within the range of the modules' Mutaplasmid """
|
||||
mod = val/self.baseValue
|
||||
mod = val / self.baseValue
|
||||
|
||||
if self.minMod <= mod <= self.maxMod:
|
||||
# sweet, all good
|
||||
@@ -129,5 +129,3 @@ class Mutator(EqBase):
|
||||
@property
|
||||
def attribute(self):
|
||||
return self.__attr
|
||||
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ class AttributeGauge(wx.Window):
|
||||
def SetValue(self, value, animate=True):
|
||||
""" Sets the current position of the gauge. """
|
||||
|
||||
print ("="*20, self._percentage)
|
||||
print("=" * 20, self._percentage)
|
||||
if self._value == value:
|
||||
return
|
||||
|
||||
@@ -248,14 +248,15 @@ class AttributeGauge(wx.Window):
|
||||
w = min(w, half) # Ensure that we don't overshoot our drawing area
|
||||
w = math.ceil(w) # round up to nearest pixel, this ensures that we don't lose representation for sub pixels
|
||||
|
||||
# print("Percentage: {}\t\t\t\t\tValue: {}\t\t\t\t\tWidth: {}\t\t\t\t\tHalf: {}\t\t\t\t\tRect Width: {}".format(round(self._percentage, 3), round(value,3), w, half, rect.width))
|
||||
# print("Percentage: {}\t\t\t\t\tValue: {}\t\t\t\t\tWidth: {}\t\t\t\t\tHalf: {}\t\t\t\t\tRect Width: {}".format(
|
||||
# round(self._percentage, 3), round(value,3), w, half, rect.width))
|
||||
|
||||
# set guide_lines every 10 pixels of the main gauge (not including borders)
|
||||
if self.guide_lines:
|
||||
for x in range(1, 20):
|
||||
dc.SetBrush(wx.Brush(wx.LIGHT_GREY))
|
||||
dc.SetPen(wx.Pen(wx.LIGHT_GREY))
|
||||
dc.DrawRectangle(x*10, 1, 1, rect.height)
|
||||
dc.DrawRectangle(x * 10, 1, 1, rect.height)
|
||||
|
||||
dc.SetBrush(wx.Brush(colour))
|
||||
dc.SetPen(wx.Pen(colour))
|
||||
@@ -264,10 +265,10 @@ class AttributeGauge(wx.Window):
|
||||
# However, if there is an odd width, the middle pixel is shared between the left and right gauge
|
||||
|
||||
if value >= 0:
|
||||
padding = (half if is_even else math.ceil(half-1)) + 1
|
||||
padding = (half if is_even else math.ceil(half - 1)) + 1
|
||||
dc.DrawRectangle(padding, 1, w, rect.height)
|
||||
else:
|
||||
padding = half - w + 1 if is_even else math.ceil(half)-(w-1)
|
||||
padding = half - w + 1 if is_even else math.ceil(half) - (w - 1)
|
||||
dc.DrawRectangle(padding, 1, w, rect.height)
|
||||
|
||||
if self.leading_edge and (self.edge_on_neutral or value != 0):
|
||||
@@ -277,7 +278,7 @@ class AttributeGauge(wx.Window):
|
||||
if value > 0:
|
||||
dc.DrawRectangle(min(padding + w, rect.width), 1, 1, rect.height)
|
||||
else:
|
||||
dc.DrawRectangle(max(padding-1, 1), 1, 1, rect.height)
|
||||
dc.DrawRectangle(max(padding - 1, 1), 1, 1, rect.height)
|
||||
|
||||
def OnTimer(self, event):
|
||||
old_value = self._old_percentage
|
||||
@@ -332,14 +333,12 @@ if __name__ == "__main__":
|
||||
wx.Panel.__init__(self, parent, size=size)
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
font = wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL, False)
|
||||
|
||||
self.gauge = gauge = AttributeGauge(self, size=(204, 4))
|
||||
gauge.SetBackgroundColour(wx.Colour(52, 86, 98))
|
||||
gauge.SetBarColour(wx.Colour(255, 128, 0))
|
||||
gauge.SetValue(100)
|
||||
gauge.SetFractionDigits(1)
|
||||
box.Add(gauge, 0, wx.ALL|wx.CENTER, 10)
|
||||
box.Add(gauge, 0, wx.ALL | wx.CENTER, 10)
|
||||
|
||||
self.gauge11 = gauge = AttributeGauge(self, size=(204, 6))
|
||||
gauge.SetBackgroundColour(wx.Colour(52, 86, 98))
|
||||
@@ -473,16 +472,16 @@ if __name__ == "__main__":
|
||||
def UpdateValue2(self, event):
|
||||
num = self.spinCtrl2.GetValue()
|
||||
self.gauge2.SetValue(num)
|
||||
self.gauge3.SetValue(num*-1)
|
||||
self.gauge3.SetValue(num * -1)
|
||||
self.gauge4.SetValue(num)
|
||||
self.gauge5.SetValue(num*-1)
|
||||
self.gauge5.SetValue(num * -1)
|
||||
self.gauge6.SetValue(num)
|
||||
self.gauge7.SetValue(num*-1)
|
||||
self.gauge7.SetValue(num * -1)
|
||||
self.gauge8.SetValue(num)
|
||||
self.gauge9.SetValue(num*-1)
|
||||
self.gauge9.SetValue(num * -1)
|
||||
|
||||
def OnTimer(self, evt):
|
||||
num = random.randint(-100,100)
|
||||
num = random.randint(-100, 100)
|
||||
self.gauge.SetValue(num)
|
||||
self.gauge11.SetValue(num)
|
||||
self.gauge12.SetValue(num)
|
||||
|
||||
@@ -100,10 +100,10 @@ class AttributeSlider(wx.Panel):
|
||||
slider_percentage = 0
|
||||
if mod < 1:
|
||||
modEnd = self.UserMinValue
|
||||
slider_percentage = (1-mod)/(1 - modEnd) * -100
|
||||
slider_percentage = (1 - mod) / (1 - modEnd) * -100
|
||||
elif mod > 1:
|
||||
modEnd = self.UserMaxValue
|
||||
slider_percentage = ((mod-1)/(modEnd-1)) * 100
|
||||
slider_percentage = ((mod - 1) / (modEnd - 1)) * 100
|
||||
# print(slider_percentage)
|
||||
if self.inverse:
|
||||
slider_percentage *= -1
|
||||
@@ -111,6 +111,7 @@ class AttributeSlider(wx.Panel):
|
||||
if post_event:
|
||||
wx.PostEvent(self, ValueChanged(self, None, value, None, slider_percentage))
|
||||
|
||||
|
||||
class TestAttributeSlider(wx.Frame):
|
||||
|
||||
def __init__(self, parent, id):
|
||||
@@ -245,4 +246,3 @@ if __name__ == "__main__":
|
||||
# else:
|
||||
# self.statxt2.SetLabel("{0:.3f} ({1:+.3f})".format(newValue, newValue - self.base_value, ))
|
||||
# self.statxt2.SetToolTip("{0:+f}%".format(new_mod*100))
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ from gui.contextMenu import ContextMenu
|
||||
from .itemAttributes import ItemParams
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
import random
|
||||
|
||||
from logbook import Logger
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class ItemMutator(wx.Panel):
|
||||
|
||||
def __init__(self, parent, stuff, item):
|
||||
@@ -77,7 +77,6 @@ class ItemMutator(wx.Panel):
|
||||
|
||||
headingSizer.Add(displayName, 3, wx.ALL | wx.EXPAND, 0)
|
||||
|
||||
|
||||
range_low = wx.StaticText(self, wx.ID_ANY, ItemParams.FormatValue(*m.attribute.unit.TranslateValue(worse_range[0])))
|
||||
range_low.SetForegroundColour(self.goodColor if worse_range[2] else self.badColor)
|
||||
|
||||
@@ -168,4 +167,3 @@ class ItemMutator(wx.Panel):
|
||||
|
||||
# Send signal to GUI to update stats with current active fit
|
||||
wx.PostEvent(mainFrame, GE.FitChanged(fitID=activeFit))
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ class PyGauge(wx.Window):
|
||||
return self._max_range
|
||||
|
||||
def Animate(self):
|
||||
#sFit = Fit.getInstance()
|
||||
# sFit = Fit.getInstance()
|
||||
if True:
|
||||
if not self._timer:
|
||||
self._timer = wx.Timer(self, self._timer_id)
|
||||
|
||||
@@ -238,8 +238,8 @@ class exportHtmlThread(threading.Thread):
|
||||
HTML += (
|
||||
' <li data-role="collapsible" data-iconpos="right" data-shadow="false" data-corners="false">\n'
|
||||
' <h2>' + group.groupName + ' <span class="ui-li-count">' + str(groupFits) + '</span></h2>\n'
|
||||
' <ul data-role="listview" data-shadow="false" data-inset="true" data-corners="false">\n'
|
||||
+ HTMLgroup +
|
||||
' <ul data-role="listview" data-shadow="false" data-inset="true" data-corners="false">\n' +
|
||||
HTMLgroup +
|
||||
' </ul>\n'
|
||||
' </li>'
|
||||
)
|
||||
|
||||
@@ -96,7 +96,12 @@ class Fit(object):
|
||||
fits = eos.db.getFitsWithShip(shipID)
|
||||
names = []
|
||||
for fit in fits:
|
||||
names.append((fit.ID, fit.name, fit.booster, fit.modified or fit.created or datetime.datetime.fromtimestamp(fit.timestamp), fit.notes, fit.ship.item.graphicID))
|
||||
names.append((fit.ID,
|
||||
fit.name,
|
||||
fit.booster,
|
||||
fit.modified or fit.created or datetime.datetime.fromtimestamp(fit.timestamp),
|
||||
fit.notes,
|
||||
fit.ship.item.graphicID))
|
||||
|
||||
return names
|
||||
|
||||
@@ -712,11 +717,11 @@ class Fit(object):
|
||||
|
||||
if not module.isEmpty: # if module is placeholder, we don't want to convert/add it
|
||||
moduleItem = module.item if not module.item.isAbyssal else module.baseItem
|
||||
for x in fit.cargo.find(moduleItem ):
|
||||
for x in fit.cargo.find(moduleItem):
|
||||
x.amount += 1
|
||||
break
|
||||
else:
|
||||
moduleP = es_Cargo(moduleItem )
|
||||
moduleP = es_Cargo(moduleItem)
|
||||
moduleP.amount = 1
|
||||
fit.cargo.insert(cargoIdx, moduleP)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user