Formatting and layout changes
This commit is contained in:
@@ -66,11 +66,15 @@ else:
|
||||
sd_lock = threading.Lock()
|
||||
|
||||
# Import all the definitions for all our database stuff
|
||||
# noinspection PyPep8
|
||||
from eos.db.gamedata import alphaClones, attribute, category, effect, group, icon, item, marketGroup, metaData, metaGroup, queries, traits, unit
|
||||
# noinspection PyPep8
|
||||
from eos.db.saveddata import booster, cargo, character, crest, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, loadDefaultDatabaseValues, miscData, module, override, price, queries, skill, targetResists, user
|
||||
|
||||
# Import queries
|
||||
# noinspection PyPep8
|
||||
from eos.db.gamedata.queries import *
|
||||
# noinspection PyPep8
|
||||
from eos.db.saveddata.queries import *
|
||||
|
||||
# If using in memory saveddata, you'll want to reflect it so the data structure is good.
|
||||
|
||||
@@ -39,8 +39,8 @@ items_table = Table("invtypes", gamedata_meta,
|
||||
Column("iconID", Integer, ForeignKey("icons.iconID")),
|
||||
Column("groupID", Integer, ForeignKey("invgroups.groupID"), index=True))
|
||||
|
||||
from .metaGroup import metatypes_table # noqa
|
||||
from .traits import traits_table # noqa
|
||||
from .metaGroup import metatypes_table # noqa
|
||||
from .traits import traits_table # noqa
|
||||
|
||||
mapper(Item, items_table,
|
||||
properties={"group": relation(Group, backref="items"),
|
||||
|
||||
@@ -86,8 +86,7 @@ class DatabaseCleanup(object):
|
||||
else:
|
||||
uniform_damage_pattern_id = rows[0]['ID']
|
||||
update_query = "UPDATE 'fits' SET 'damagePatternID' = {} " \
|
||||
"WHERE damagePatternID NOT IN (SELECT ID FROM damagePatterns) OR damagePatternID IS NULL".format(
|
||||
uniform_damage_pattern_id)
|
||||
"WHERE damagePatternID NOT IN (SELECT ID FROM damagePatterns) OR damagePatternID IS NULL".format(uniform_damage_pattern_id)
|
||||
update_results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, update_query)
|
||||
logger.error("Database corruption found. Cleaning up %d records.", update_results.rowcount)
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ mapper(es_Fit, fits_table,
|
||||
"_Fit__modules": relation(
|
||||
Module,
|
||||
collection_class=HandledModuleList,
|
||||
primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == False), # noqa
|
||||
primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == False), # noqa
|
||||
order_by=modules_table.c.position,
|
||||
cascade='all, delete, delete-orphan'),
|
||||
"_Fit__projectedModules": relation(
|
||||
@@ -148,7 +148,7 @@ mapper(es_Fit, fits_table,
|
||||
collection_class=HandledProjectedModList,
|
||||
cascade='all, delete, delete-orphan',
|
||||
single_parent=True,
|
||||
primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == True)), # noqa
|
||||
primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == True)), # noqa
|
||||
"owner": relation(
|
||||
User,
|
||||
backref="fits"),
|
||||
@@ -164,13 +164,13 @@ mapper(es_Fit, fits_table,
|
||||
collection_class=HandledDroneCargoList,
|
||||
cascade='all, delete, delete-orphan',
|
||||
single_parent=True,
|
||||
primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == False)), # noqa
|
||||
primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == False)), # noqa
|
||||
"_Fit__fighters": relation(
|
||||
Fighter,
|
||||
collection_class=HandledDroneCargoList,
|
||||
cascade='all, delete, delete-orphan',
|
||||
single_parent=True,
|
||||
primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == False)), # noqa
|
||||
primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == False)), # noqa
|
||||
"_Fit__cargo": relation(
|
||||
Cargo,
|
||||
collection_class=HandledDroneCargoList,
|
||||
@@ -182,13 +182,13 @@ mapper(es_Fit, fits_table,
|
||||
collection_class=HandledProjectedDroneList,
|
||||
cascade='all, delete, delete-orphan',
|
||||
single_parent=True,
|
||||
primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == True)), # noqa
|
||||
primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == True)), # noqa
|
||||
"_Fit__projectedFighters": relation(
|
||||
Fighter,
|
||||
collection_class=HandledProjectedDroneList,
|
||||
cascade='all, delete, delete-orphan',
|
||||
single_parent=True,
|
||||
primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == True)), # noqa
|
||||
primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == True)), # noqa
|
||||
"_Fit__implants": relation(
|
||||
Implant,
|
||||
collection_class=HandledImplantBoosterList,
|
||||
|
||||
@@ -62,7 +62,7 @@ class Data(object):
|
||||
|
||||
def parseString(self, dataString):
|
||||
if not isinstance(dataString, basestring):
|
||||
return (Constant(dataString),)
|
||||
return Constant(dataString),
|
||||
|
||||
dataList = []
|
||||
for data in dataString.split(";"):
|
||||
|
||||
@@ -179,4 +179,4 @@ class FitDpsGraph(Graph):
|
||||
turretFalloff = mod.falloff
|
||||
rangeEq = ((max(0, distance - turretOptimal)) / turretFalloff) ** 2
|
||||
|
||||
return 0.5 ** (rangeEq)
|
||||
return 0.5 ** rangeEq
|
||||
|
||||
@@ -80,11 +80,11 @@ class PFListPane(wx.ScrolledWindow):
|
||||
new_vs_x, new_vs_y = -1, -1
|
||||
|
||||
# is it before the left edge?
|
||||
if cr.x < 0 and sppu_x > 0:
|
||||
if cr.x < 0 < sppu_x:
|
||||
new_vs_x = vs_x + (cr.x / sppu_x)
|
||||
|
||||
# is it above the top?
|
||||
if cr.y < 0 and sppu_y > 0:
|
||||
if cr.y < 0 < sppu_y:
|
||||
new_vs_y = vs_y + (cr.y / sppu_y)
|
||||
|
||||
# For the right and bottom edges, scroll enough to show the
|
||||
|
||||
@@ -103,14 +103,15 @@ class PFSearchBox(wx.Window):
|
||||
x, y = target
|
||||
px, py = position
|
||||
aX, aY = area
|
||||
if (px > x and px < x + aX) and (py > y and py < y + aY):
|
||||
if (x < px < x + aX) and (y < py < y + aY):
|
||||
return True
|
||||
return False
|
||||
|
||||
def GetButtonsPos(self):
|
||||
btnpos = []
|
||||
btnpos.append((self.searchButtonX, self.searchButtonY))
|
||||
btnpos.append((self.cancelButtonX, self.cancelButtonY))
|
||||
btnpos = [
|
||||
(self.searchButtonX, self.searchButtonY),
|
||||
(self.cancelButtonX, self.cancelButtonY)
|
||||
]
|
||||
return btnpos
|
||||
|
||||
def GetButtonsSize(self):
|
||||
|
||||
@@ -68,13 +68,13 @@ class BoosterView(d.Display):
|
||||
self.Bind(wx.EVT_RIGHT_DOWN, self.scheduleMenu)
|
||||
|
||||
def handleListDrag(self, x, y, data):
|
||||
'''
|
||||
"""
|
||||
Handles dragging of items from various pyfa displays which support it
|
||||
|
||||
data is list with two indices:
|
||||
data[0] is hard-coded str of originating source
|
||||
data[1] is typeID or index of data we want to manipulate
|
||||
'''
|
||||
"""
|
||||
|
||||
if data[0] == "market":
|
||||
wx.PostEvent(self.mainFrame, mb.ItemSelected(itemID=int(data[1])))
|
||||
|
||||
@@ -40,7 +40,7 @@ class PFUpdatePref(PreferenceView):
|
||||
|
||||
mainSizer.Add(self.suppressPrerelease, 0, wx.ALL | wx.EXPAND, 5)
|
||||
|
||||
if (self.UpdateSettings.get('version')):
|
||||
if self.UpdateSettings.get('version'):
|
||||
self.versionSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
self.versionTitle = wx.StaticText(panel, wx.ID_ANY, "Suppressing {0} Notifications".format(
|
||||
|
||||
@@ -75,8 +75,7 @@ class PriceViewFull(StatsView):
|
||||
if fit is not None:
|
||||
self.fit = fit
|
||||
# Compose a list of all the data we need & request it
|
||||
typeIDs = []
|
||||
typeIDs.append(fit.ship.item.ID)
|
||||
typeIDs = [fit.ship.item.ID]
|
||||
|
||||
for mod in fit.modules:
|
||||
if not mod.isEmpty:
|
||||
|
||||
@@ -203,16 +203,14 @@ class TargetingMiscViewFull(StatsView):
|
||||
label.SetToolTip(
|
||||
wx.ToolTip("Type: %s\n%.1f%% Chance of Jam" % (fit.scanType, fit.jamChance)))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip("Type: %s" % (fit.scanType)))
|
||||
label.SetToolTip(wx.ToolTip("Type: %s" % fit.scanType))
|
||||
elif labelName == "labelFullAlignTime":
|
||||
alignTime = "Align:\t%.3fs" % mainValue
|
||||
mass = 'Mass:\t{:,.0f}kg'.format(fit.ship.getModifiedItemAttr("mass"))
|
||||
agility = "Agility:\t%.3fx" % (fit.ship.getModifiedItemAttr("agility") or 0)
|
||||
label.SetToolTip(wx.ToolTip("%s\n%s\n%s" % (alignTime, mass, agility)))
|
||||
elif labelName == "labelFullCargo":
|
||||
tipLines = []
|
||||
tipLines.append(
|
||||
u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"]))
|
||||
tipLines = [u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])]
|
||||
for attrName, tipAlias in cargoNamesOrder.items():
|
||||
if newValues[attrName] > 0:
|
||||
tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, newValues[attrName]))
|
||||
@@ -232,7 +230,7 @@ class TargetingMiscViewFull(StatsView):
|
||||
if fit.jamChance > 0:
|
||||
label.SetToolTip(wx.ToolTip("Type: %s\n%.1f%% Chance of Jam" % (fit.scanType, fit.jamChance)))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip("Type: %s" % (fit.scanType)))
|
||||
label.SetToolTip(wx.ToolTip("Type: %s" % fit.scanType))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip(""))
|
||||
elif labelName == "labelFullCargo":
|
||||
@@ -240,9 +238,7 @@ class TargetingMiscViewFull(StatsView):
|
||||
cachedCargo = self._cachedValues[counter]
|
||||
# if you add stuff to cargo, the capacity doesn't change and thus it is still cached
|
||||
# This assures us that we force refresh of cargo tooltip
|
||||
tipLines = []
|
||||
tipLines.append(
|
||||
u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"]))
|
||||
tipLines = [u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])]
|
||||
for attrName, tipAlias in cargoNamesOrder.items():
|
||||
if cachedCargo[attrName] > 0:
|
||||
tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, cachedCargo[attrName]))
|
||||
|
||||
@@ -83,7 +83,7 @@ class AttributeDisplay(ViewColumn):
|
||||
if self.info.name == "volume":
|
||||
str_ = (formatAmount(attr, 3, 0, 3))
|
||||
if hasattr(mod, "amount"):
|
||||
str_ = str_ + u"m\u00B3 (%s m\u00B3)" % (formatAmount(attr * mod.amount, 3, 0, 3))
|
||||
str_ += u"m\u00B3 (%s m\u00B3)" % (formatAmount(attr * mod.amount, 3, 0, 3))
|
||||
attr = str_
|
||||
|
||||
if isinstance(attr, (float, int)):
|
||||
|
||||
@@ -74,7 +74,7 @@ class MaxRange(ViewColumn):
|
||||
return -1
|
||||
|
||||
def getParameters(self):
|
||||
return (("displayName", bool, False), ("showIcon", bool, True))
|
||||
return ("displayName", bool, False), ("showIcon", bool, True)
|
||||
|
||||
def getToolTip(self, mod):
|
||||
return "Optimal + Falloff"
|
||||
|
||||
@@ -59,7 +59,7 @@ class Miscellanea(ViewColumn):
|
||||
return -1
|
||||
|
||||
def getParameters(self):
|
||||
return (("displayName", bool, False), ("showIcon", bool, True))
|
||||
return ("displayName", bool, False), ("showIcon", bool, True)
|
||||
|
||||
def __getData(self, stuff):
|
||||
item = stuff.item
|
||||
|
||||
@@ -56,7 +56,7 @@ class PropertyDisplay(ViewColumn):
|
||||
def getText(self, stuff):
|
||||
attr = getattr(stuff, self.propertyName, None)
|
||||
if attr:
|
||||
return (formatAmount(attr, 3, 0, 3))
|
||||
return formatAmount(attr, 3, 0, 3)
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
@@ -188,13 +188,13 @@ class FittingView(d.Display):
|
||||
event.Skip()
|
||||
|
||||
def handleListDrag(self, x, y, data):
|
||||
'''
|
||||
"""
|
||||
Handles dragging of items from various pyfa displays which support it
|
||||
|
||||
data is list with two items:
|
||||
data[0] is hard-coded str of originating source
|
||||
data[1] is typeID or index of data we want to manipulate
|
||||
'''
|
||||
"""
|
||||
|
||||
if data[0] == "fitting":
|
||||
self.swapItems(x, y, int(data[1]))
|
||||
@@ -262,11 +262,11 @@ class FittingView(d.Display):
|
||||
event.Skip()
|
||||
|
||||
def fitRemoved(self, event):
|
||||
'''
|
||||
"""
|
||||
If fit is removed and active, the page is deleted.
|
||||
We also refresh the fit of the new current page in case
|
||||
delete fit caused change in stats (projected)
|
||||
'''
|
||||
"""
|
||||
fitID = event.fitID
|
||||
|
||||
if fitID == self.getActiveFit():
|
||||
@@ -358,7 +358,7 @@ class FittingView(d.Display):
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.activeFitID))
|
||||
|
||||
def addModule(self, x, y, srcIdx):
|
||||
'''Add a module from the market browser'''
|
||||
"""Add a module from the market browser"""
|
||||
|
||||
dstRow, _ = self.HitTest((x, y))
|
||||
if dstRow != -1 and dstRow not in self.blanks:
|
||||
@@ -371,7 +371,7 @@ class FittingView(d.Display):
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit()))
|
||||
|
||||
def swapCargo(self, x, y, srcIdx):
|
||||
'''Swap a module from cargo to fitting window'''
|
||||
"""Swap a module from cargo to fitting window"""
|
||||
mstate = wx.GetMouseState()
|
||||
|
||||
dstRow, _ = self.HitTest((x, y))
|
||||
@@ -385,7 +385,7 @@ class FittingView(d.Display):
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit()))
|
||||
|
||||
def swapItems(self, x, y, srcIdx):
|
||||
'''Swap two modules in fitting window'''
|
||||
"""Swap two modules in fitting window"""
|
||||
mstate = wx.GetMouseState()
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.activeFitID)
|
||||
@@ -414,12 +414,12 @@ class FittingView(d.Display):
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit()))
|
||||
|
||||
def generateMods(self):
|
||||
'''
|
||||
"""
|
||||
Generate module list.
|
||||
|
||||
This also injects dummy modules to visually separate racks. These modules are only
|
||||
known to the display, and not the backend, so it's safe.
|
||||
'''
|
||||
"""
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.activeFitID)
|
||||
@@ -539,13 +539,13 @@ class FittingView(d.Display):
|
||||
self.PopupMenu(menu)
|
||||
|
||||
def click(self, event):
|
||||
'''
|
||||
"""
|
||||
Handle click event on modules.
|
||||
|
||||
This is only useful for the State column. If multiple items are selected,
|
||||
and we have clicked the State column, iterate through the selections and
|
||||
change State
|
||||
'''
|
||||
"""
|
||||
row, _, col = self.HitTestSubItem(event.Position)
|
||||
|
||||
# only do State column and ignore invalid rows
|
||||
@@ -587,12 +587,12 @@ class FittingView(d.Display):
|
||||
return self.slotColourMap.get(slot) or self.GetBackgroundColour()
|
||||
|
||||
def refresh(self, stuff):
|
||||
'''
|
||||
"""
|
||||
Displays fitting
|
||||
|
||||
Sends data to d.Display.refresh where the rows and columns are set up, then does a
|
||||
bit of post-processing (colors)
|
||||
'''
|
||||
"""
|
||||
self.Freeze()
|
||||
d.Display.refresh(self, stuff)
|
||||
|
||||
@@ -745,7 +745,7 @@ class FittingView(d.Display):
|
||||
maxWidth += columnsWidths[i]
|
||||
|
||||
mdc = wx.MemoryDC()
|
||||
mbmp = wx.EmptyBitmap(maxWidth, (maxRowHeight) * rows + padding * 4 + headerSize)
|
||||
mbmp = wx.EmptyBitmap(maxWidth, maxRowHeight * rows + padding * 4 + headerSize)
|
||||
|
||||
mdc.SelectObject(mbmp)
|
||||
|
||||
|
||||
@@ -68,13 +68,13 @@ class CargoView(d.Display):
|
||||
self.Bind(wx.EVT_RIGHT_DOWN, self.scheduleMenu)
|
||||
|
||||
def handleListDrag(self, x, y, data):
|
||||
'''
|
||||
"""
|
||||
Handles dragging of items from various pyfa displays which support it
|
||||
|
||||
data is list with two indices:
|
||||
data[0] is hard-coded str of originating source
|
||||
data[1] is typeID or index of data we want to manipulate
|
||||
'''
|
||||
"""
|
||||
|
||||
if data[0] == "fitting":
|
||||
self.swapModule(x, y, int(data[1]))
|
||||
@@ -106,7 +106,7 @@ class CargoView(d.Display):
|
||||
event.Skip()
|
||||
|
||||
def swapModule(self, x, y, modIdx):
|
||||
'''Swap a module from fitting window with cargo'''
|
||||
"""Swap a module from fitting window with cargo"""
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.mainFrame.getActiveFit())
|
||||
dstRow, _ = self.HitTest((x, y))
|
||||
|
||||
@@ -81,13 +81,13 @@ class CommandView(d.Display):
|
||||
self.SetDropTarget(CommandViewDrop(self.handleListDrag))
|
||||
|
||||
def handleListDrag(self, x, y, data):
|
||||
'''
|
||||
"""
|
||||
Handles dragging of items from various pyfa displays which support it
|
||||
|
||||
data is list with two indices:
|
||||
data[0] is hard-coded str of originating source
|
||||
data[1] is typeID or index of data we want to manipulate
|
||||
'''
|
||||
"""
|
||||
pass
|
||||
|
||||
def kbEvent(self, event):
|
||||
@@ -153,7 +153,7 @@ class CommandView(d.Display):
|
||||
self.deselectItems()
|
||||
|
||||
# todo: verify
|
||||
if stuff == []:
|
||||
if not stuff:
|
||||
stuff = [DummyEntry("Drag a fit to this area")]
|
||||
|
||||
self.update(stuff)
|
||||
@@ -161,7 +161,7 @@ class CommandView(d.Display):
|
||||
def get(self, row):
|
||||
numFits = len(self.fits)
|
||||
|
||||
if (numFits) == 0:
|
||||
if numFits == 0:
|
||||
return None
|
||||
|
||||
return self.fits[row]
|
||||
@@ -193,7 +193,7 @@ class CommandView(d.Display):
|
||||
fitSrcContext = "commandFit"
|
||||
fitItemContext = item.name
|
||||
context = ((fitSrcContext, fitItemContext),)
|
||||
context = context + (("command",),)
|
||||
context += ("command",),
|
||||
menu = ContextMenu.getMenu((item,), *context)
|
||||
elif sel == -1:
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
|
||||
@@ -120,7 +120,7 @@ class ContextMenu(object):
|
||||
rootMenu.AppendSeparator()
|
||||
|
||||
debug_end = len(cls._ids)
|
||||
if (debug_end - debug_start):
|
||||
if debug_end - debug_start:
|
||||
logger.debug("%d new IDs created for this menu" % (debug_end - debug_start))
|
||||
|
||||
return rootMenu if empty is False else None
|
||||
|
||||
@@ -54,7 +54,7 @@ class CopySelectDialog(wx.Dialog):
|
||||
mainSizer.Add(selector, 0, wx.EXPAND | wx.ALL, 5)
|
||||
|
||||
buttonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
|
||||
if (buttonSizer):
|
||||
if buttonSizer:
|
||||
mainSizer.Add(buttonSizer, 0, wx.EXPAND | wx.ALL, 5)
|
||||
|
||||
self.SetSizer(mainSizer)
|
||||
|
||||
@@ -149,7 +149,6 @@ class CrestFittings(wx.Frame):
|
||||
except requests.exceptions.ConnectionError:
|
||||
self.statusbar.SetStatusText("Connection error, please check your internet connection")
|
||||
|
||||
|
||||
def importFitting(self, event):
|
||||
selection = self.fitView.fitSelection
|
||||
if not selection:
|
||||
|
||||
@@ -89,11 +89,11 @@ class Display(wx.ListCtrl):
|
||||
|
||||
# Did the point hit any item?
|
||||
if (flags & wx.LIST_HITTEST_ONITEM) == 0:
|
||||
return (-1, 0, -1)
|
||||
return -1, 0, -1
|
||||
|
||||
# If it did hit an item and we are not in report mode, it must be the primary cell
|
||||
if not self.InReportView():
|
||||
return (rowIndex, wx.LIST_HITTEST_ONITEM, 0)
|
||||
return rowIndex, wx.LIST_HITTEST_ONITEM, 0
|
||||
|
||||
# Find which subitem is hit
|
||||
right = 0
|
||||
@@ -106,9 +106,9 @@ class Display(wx.ListCtrl):
|
||||
flag = wx.LIST_HITTEST_ONITEMICON
|
||||
else:
|
||||
flag = wx.LIST_HITTEST_ONITEMLABEL
|
||||
return (rowIndex, flag, i)
|
||||
return rowIndex, flag, i
|
||||
|
||||
return (rowIndex, 0, -1)
|
||||
return rowIndex, 0, -1
|
||||
|
||||
def OnEraseBk(self, event):
|
||||
if self.GetItemCount() > 0:
|
||||
@@ -219,7 +219,7 @@ class Display(wx.ListCtrl):
|
||||
self.InsertStringItem(sys.maxint, "")
|
||||
|
||||
if listItemCount > stuffItemCount:
|
||||
if listItemCount - stuffItemCount > 20 and stuffItemCount < 20:
|
||||
if listItemCount - stuffItemCount > 20 > stuffItemCount:
|
||||
self.DeleteAllItems()
|
||||
for i in range(stuffItemCount):
|
||||
self.InsertStringItem(sys.maxint, "")
|
||||
|
||||
@@ -130,13 +130,13 @@ class DroneView(Display):
|
||||
dropSource.DoDragDrop()
|
||||
|
||||
def handleDragDrop(self, x, y, data):
|
||||
'''
|
||||
"""
|
||||
Handles dragging of items from various pyfa displays which support it
|
||||
|
||||
data is list with two indices:
|
||||
data[0] is hard-coded str of originating source
|
||||
data[1] is typeID or index of data we want to manipulate
|
||||
'''
|
||||
"""
|
||||
if data[0] == "drone": # we want to merge drones
|
||||
srcRow = int(data[1])
|
||||
dstRow, _ = self.HitTest((x, y))
|
||||
|
||||
@@ -192,13 +192,13 @@ class FighterDisplay(d.Display):
|
||||
dropSource.DoDragDrop()
|
||||
|
||||
def handleDragDrop(self, x, y, data):
|
||||
'''
|
||||
"""
|
||||
Handles dragging of items from various pyfa displays which support it
|
||||
|
||||
data is list with two indices:
|
||||
data[0] is hard-coded str of originating source
|
||||
data[1] is typeID or index of data we want to manipulate
|
||||
'''
|
||||
"""
|
||||
if data[0] == "fighter": # we want to merge fighters
|
||||
srcRow = int(data[1])
|
||||
dstRow, _ = self.HitTest((x, y))
|
||||
|
||||
@@ -794,7 +794,7 @@ class MainFrame(wx.Frame):
|
||||
"All Files (*)|*"),
|
||||
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE
|
||||
)
|
||||
if (dlg.ShowModal() == wx.ID_OK):
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
self.progressDialog = wx.ProgressDialog(
|
||||
"Importing fits",
|
||||
" " * 100, # set some arbitrary spacing to create width in window
|
||||
|
||||
@@ -400,7 +400,7 @@ class ItemView(Display):
|
||||
metagrpid = sMkt.getMetaGroupIdByItem(item)
|
||||
metatab = self.metaMap.get(metagrpid)
|
||||
metalvl = self.metalvls.get(item.ID, 0)
|
||||
return (catname, mktgrpid, parentname, metatab, metalvl, item.name)
|
||||
return catname, mktgrpid, parentname, metatab, metalvl, item.name
|
||||
|
||||
def contextMenu(self, event):
|
||||
# Check if something is selected, if so, spawn the menu for it
|
||||
|
||||
@@ -39,7 +39,7 @@ class PreferenceView(object):
|
||||
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from gui.builtinPreferenceViews import (# noqa: E402, F401
|
||||
from gui.builtinPreferenceViews import ( # noqa: E402, F401
|
||||
pyfaGeneralPreferences,
|
||||
pyfaNetworkPreferences,
|
||||
pyfaHTMLExportPreferences,
|
||||
|
||||
@@ -87,13 +87,13 @@ class ProjectedView(d.Display):
|
||||
self.SetDropTarget(ProjectedViewDrop(self.handleListDrag))
|
||||
|
||||
def handleListDrag(self, x, y, data):
|
||||
'''
|
||||
"""
|
||||
Handles dragging of items from various pyfa displays which support it
|
||||
|
||||
data is list with two indices:
|
||||
data[0] is hard-coded str of originating source
|
||||
data[1] is typeID or index of data we want to manipulate
|
||||
'''
|
||||
"""
|
||||
|
||||
if data[0] == "projected":
|
||||
# if source is coming from projected, we are trying to combine drones.
|
||||
@@ -205,7 +205,7 @@ class ProjectedView(d.Display):
|
||||
|
||||
self.deselectItems()
|
||||
|
||||
if stuff == []:
|
||||
if not stuff:
|
||||
stuff = [DummyEntry("Drag an item or fit, or use right-click menu for system effects")]
|
||||
|
||||
self.update(stuff)
|
||||
@@ -278,7 +278,7 @@ class ProjectedView(d.Display):
|
||||
fitSrcContext = "projectedFit"
|
||||
fitItemContext = item.name
|
||||
context = ((fitSrcContext, fitItemContext),)
|
||||
context = context + (("projected",),)
|
||||
context += ("projected",),
|
||||
menu = ContextMenu.getMenu((item,), *context)
|
||||
elif sel == -1:
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
|
||||
@@ -100,7 +100,7 @@ class AttributeEditor(wx.Frame):
|
||||
dlg = wx.FileDialog(self, "Import pyfa override file",
|
||||
wildcard="pyfa override file (*.csv)|*.csv",
|
||||
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
||||
if (dlg.ShowModal() == wx.ID_OK):
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
path = dlg.GetPath()
|
||||
with open(path, 'rb') as csvfile:
|
||||
spamreader = csv.reader(csvfile)
|
||||
|
||||
@@ -146,7 +146,7 @@ class TogglePanel(wx.Panel):
|
||||
"""
|
||||
Handles the status changes (collapsing/expanding).
|
||||
|
||||
:param `sz`: an instance of `wx.Size`.
|
||||
:param sz: an instance of `wx.Size`.
|
||||
"""
|
||||
|
||||
# minimal size has priority over the best size so set here our min size
|
||||
|
||||
@@ -144,7 +144,7 @@ class PyGauge(wx.PyWindow):
|
||||
"""
|
||||
Sets the bar gradient. This overrides the BarColour.
|
||||
|
||||
:param `gradient`: a tuple containing the gradient start and end colours.
|
||||
:param gradient: a tuple containing the gradient start and end colours.
|
||||
"""
|
||||
if gradient is None:
|
||||
self._barGradient = None
|
||||
@@ -163,7 +163,7 @@ class PyGauge(wx.PyWindow):
|
||||
"""
|
||||
Sets the border padding.
|
||||
|
||||
:param `padding`: pixels between the border and the progress bar.
|
||||
:param padding: pixels between the border and the progress bar.
|
||||
"""
|
||||
|
||||
self._border_padding = padding
|
||||
@@ -189,7 +189,8 @@ class PyGauge(wx.PyWindow):
|
||||
Sets the range of the gauge. The gauge length is its
|
||||
value as a proportion of the range.
|
||||
|
||||
:param `range`: The maximum value of the gauge.
|
||||
:param reinit:
|
||||
:param range: The maximum value of the gauge.
|
||||
"""
|
||||
|
||||
if self._range == range:
|
||||
@@ -267,7 +268,7 @@ class PyGauge(wx.PyWindow):
|
||||
"""
|
||||
Handles the ``wx.EVT_ERASE_BACKGROUND`` event for L{PyGauge}.
|
||||
|
||||
:param `event`: a `wx.EraseEvent` event to be processed.
|
||||
:param event: a `wx.EraseEvent` event to be processed.
|
||||
|
||||
:note: This method is intentionally empty to reduce flicker.
|
||||
"""
|
||||
@@ -278,7 +279,7 @@ class PyGauge(wx.PyWindow):
|
||||
"""
|
||||
Handles the ``wx.EVT_PAINT`` event for L{PyGauge}.
|
||||
|
||||
:param `event`: a `wx.PaintEvent` event to be processed.
|
||||
:param event: a `wx.PaintEvent` event to be processed.
|
||||
"""
|
||||
|
||||
dc = wx.BufferedPaintDC(self)
|
||||
@@ -409,7 +410,7 @@ class PyGauge(wx.PyWindow):
|
||||
"""
|
||||
Handles the ``wx.EVT_TIMER`` event for L{PyfaGauge}.
|
||||
|
||||
:param `event`: a timer event
|
||||
:param event: a timer event
|
||||
"""
|
||||
oldValue = self._oldPercentage
|
||||
value = self._percentage
|
||||
|
||||
@@ -189,12 +189,12 @@ class ResistsEditorDlg(wx.Dialog):
|
||||
self.Destroy()
|
||||
|
||||
def ValuesUpdated(self, event=None):
|
||||
'''
|
||||
"""
|
||||
Event that is fired when resists values change. Iterates through all
|
||||
resist edit fields. If blank, sets it to 0.0. If it is not a proper
|
||||
decimal value, sets text color to red and refuses to save changes until
|
||||
issue is resolved
|
||||
'''
|
||||
"""
|
||||
if self.block:
|
||||
return
|
||||
|
||||
@@ -238,7 +238,7 @@ class ResistsEditorDlg(wx.Dialog):
|
||||
self.Refresh()
|
||||
|
||||
def patternChanged(self, event=None):
|
||||
"Event fired when user selects pattern. Can also be called from script"
|
||||
"""Event fired when user selects pattern. Can also be called from script"""
|
||||
|
||||
if not self.entityEditor.checkEntitiesExist():
|
||||
self.Destroy()
|
||||
@@ -262,7 +262,7 @@ class ResistsEditorDlg(wx.Dialog):
|
||||
pass
|
||||
|
||||
def importPatterns(self, event):
|
||||
"Event fired when import from clipboard button is clicked"
|
||||
"""Event fired when import from clipboard button is clicked"""
|
||||
|
||||
text = fromClipboard()
|
||||
if text:
|
||||
@@ -280,7 +280,7 @@ class ResistsEditorDlg(wx.Dialog):
|
||||
self.stNotice.SetLabel("Could not import from clipboard")
|
||||
|
||||
def exportPatterns(self, event):
|
||||
"Event fired when export to clipboard button is clicked"
|
||||
"""Event fired when export to clipboard button is clicked"""
|
||||
sTR = TargetResists.getInstance()
|
||||
toClipboard(sTR.exportPatterns())
|
||||
self.stNotice.SetLabel("Patterns exported to clipboard")
|
||||
|
||||
@@ -188,7 +188,7 @@ class ImplantSetEditorDlg(wx.Dialog):
|
||||
pass
|
||||
|
||||
def importPatterns(self, event):
|
||||
"Event fired when import from clipboard button is clicked"
|
||||
"""Event fired when import from clipboard button is clicked"""
|
||||
|
||||
text = fromClipboard()
|
||||
if text:
|
||||
@@ -208,7 +208,7 @@ class ImplantSetEditorDlg(wx.Dialog):
|
||||
self.stNotice.SetLabel("Could not import from clipboard")
|
||||
|
||||
def exportPatterns(self, event):
|
||||
"Event fired when export to clipboard button is clicked"
|
||||
"""Event fired when export to clipboard button is clicked"""
|
||||
|
||||
sIS = ImplantSets.getInstance()
|
||||
toClipboard(sIS.exportSets())
|
||||
|
||||
@@ -58,7 +58,7 @@ class PFBaseButton(object):
|
||||
def GetSize(self):
|
||||
w = self.normalBmp.GetWidth()
|
||||
h = self.normalBmp.GetHeight()
|
||||
return (w, h)
|
||||
return w, h
|
||||
|
||||
def GetBitmap(self):
|
||||
return self.normalBmp
|
||||
@@ -201,7 +201,7 @@ class PFToolbar(object):
|
||||
x, y = target
|
||||
px, py = position
|
||||
aX, aY = area
|
||||
if (px > x and px < x + aX) and (py > y and py < y + aY):
|
||||
if (x < px < x + aX) and (y < py < y + aY):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ class RaceSelector(wx.Window):
|
||||
padding = self.buttonsPadding
|
||||
|
||||
for bmp in self.raceBmps:
|
||||
if (mx > x and mx < x + bmp.GetWidth()) and (my > y and my < y + bmp.GetHeight()):
|
||||
if (x < mx < x + bmp.GetWidth()) and (y < my < y + bmp.GetHeight()):
|
||||
return self.raceBmps.index(bmp)
|
||||
if self.layout == wx.VERTICAL:
|
||||
y += bmp.GetHeight() + padding
|
||||
@@ -1191,8 +1191,7 @@ class ShipItem(SFItem.SFBrowserItem):
|
||||
def OnShowPopup(self, event):
|
||||
pos = event.GetPosition()
|
||||
pos = self.ScreenToClient(pos)
|
||||
contexts = []
|
||||
contexts.append(("baseShip", "Ship Basic"))
|
||||
contexts = [("baseShip", "Ship Basic")]
|
||||
menu = ContextMenu.getMenu(self.baseItem, *contexts)
|
||||
self.PopupMenu(menu, pos)
|
||||
|
||||
@@ -1271,17 +1270,17 @@ class ShipItem(SFItem.SFBrowserItem):
|
||||
self.toolbarx = rect.width - self.toolbar.GetWidth() - self.padding
|
||||
self.toolbary = (rect.height - self.toolbar.GetHeight()) / 2
|
||||
|
||||
self.toolbarx = self.toolbarx + self.animCount
|
||||
self.toolbarx += self.animCount
|
||||
|
||||
self.shipEffx = self.padding + (rect.height - self.shipEffBk.GetWidth()) / 2
|
||||
self.shipEffy = (rect.height - self.shipEffBk.GetHeight()) / 2
|
||||
|
||||
self.shipEffx = self.shipEffx - self.animCount
|
||||
self.shipEffx -= self.animCount
|
||||
|
||||
self.shipBmpx = self.padding + (rect.height - self.shipBmp.GetWidth()) / 2
|
||||
self.shipBmpy = (rect.height - self.shipBmp.GetHeight()) / 2
|
||||
|
||||
self.shipBmpx = self.shipBmpx - self.animCount
|
||||
self.shipBmpx -= self.animCount
|
||||
|
||||
self.raceBmpx = self.shipEffx + self.shipEffBk.GetWidth() + self.padding
|
||||
self.raceBmpy = (rect.height - self.raceBmp.GetHeight()) / 2
|
||||
@@ -1575,7 +1574,7 @@ class FitItem(SFItem.SFBrowserItem):
|
||||
self.mainFrame.additionsPane.select("Command")
|
||||
|
||||
def OnMouseCaptureLost(self, event):
|
||||
''' Destroy drag information (GH issue #479)'''
|
||||
""" Destroy drag information (GH issue #479)"""
|
||||
if self.dragging and self.dragged:
|
||||
self.dragging = False
|
||||
self.dragged = False
|
||||
@@ -1585,7 +1584,7 @@ class FitItem(SFItem.SFBrowserItem):
|
||||
self.dragWindow = None
|
||||
|
||||
def OnContextMenu(self, event):
|
||||
''' Handles context menu for fit. Dragging is handled by MouseLeftUp() '''
|
||||
""" Handles context menu for fit. Dragging is handled by MouseLeftUp() """
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.mainFrame.getActiveFit())
|
||||
|
||||
@@ -1815,17 +1814,17 @@ class FitItem(SFItem.SFBrowserItem):
|
||||
self.toolbarx = rect.width - self.toolbar.GetWidth() - self.padding
|
||||
self.toolbary = (rect.height - self.toolbar.GetHeight()) / 2
|
||||
|
||||
self.toolbarx = self.toolbarx + self.animCount
|
||||
self.toolbarx += self.animCount
|
||||
|
||||
self.shipEffx = self.padding + (rect.height - self.shipEffBk.GetWidth()) / 2
|
||||
self.shipEffy = (rect.height - self.shipEffBk.GetHeight()) / 2
|
||||
|
||||
self.shipEffx = self.shipEffx - self.animCount
|
||||
self.shipEffx -= self.animCount
|
||||
|
||||
self.shipBmpx = self.padding + (rect.height - self.shipBmp.GetWidth()) / 2
|
||||
self.shipBmpy = (rect.height - self.shipBmp.GetHeight()) / 2
|
||||
|
||||
self.shipBmpx = self.shipBmpx - self.animCount
|
||||
self.shipBmpx -= self.animCount
|
||||
|
||||
self.textStartx = self.shipEffx + self.shipEffBk.GetWidth() + self.padding
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class UpdateDialog(wx.Dialog):
|
||||
|
||||
versionSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
if (self.releaseInfo['prerelease']):
|
||||
if self.releaseInfo['prerelease']:
|
||||
self.releaseText = wx.StaticText(self, wx.ID_ANY, "Pre-release", wx.DefaultPosition, wx.DefaultSize,
|
||||
wx.ALIGN_RIGHT)
|
||||
self.releaseText.SetFont(wx.Font(12, 74, 90, 92, False))
|
||||
@@ -120,7 +120,7 @@ class UpdateDialog(wx.Dialog):
|
||||
self.Close()
|
||||
|
||||
def SuppressChange(self, e):
|
||||
if (self.supressCheckbox.IsChecked()):
|
||||
if self.supressCheckbox.IsChecked():
|
||||
self.UpdateSettings.set('version', self.releaseInfo['tag_name'])
|
||||
else:
|
||||
self.UpdateSettings.set('version', None)
|
||||
|
||||
@@ -42,7 +42,7 @@ def IN_CUBIC(t, b, c, d):
|
||||
c = float(c)
|
||||
d = float(d)
|
||||
|
||||
t = t / d
|
||||
t /= d
|
||||
|
||||
return c * t * t * t + b
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class LoadAnimation(wx.Window):
|
||||
barColor = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)
|
||||
shadeColor = colorUtils.GetSuitableColor(barColor, 0.75)
|
||||
|
||||
barWidth = (rect.width) / self.bars
|
||||
barWidth = rect.width / self.bars
|
||||
barHeight = rect.height - self.padding * 2
|
||||
|
||||
x = self.padding
|
||||
|
||||
@@ -43,7 +43,7 @@ def GetBrightnessO1(color):
|
||||
# Calculates the brightness of a color, different options
|
||||
|
||||
r, g, b = color
|
||||
return (0.299 * r + 0.587 * g + 0.114 * b)
|
||||
return 0.299 * r + 0.587 * g + 0.114 * b
|
||||
|
||||
|
||||
def GetBrightnessO2(color):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'''
|
||||
"""
|
||||
Font file to handle the differences in font calculations between
|
||||
different wxPython versions
|
||||
'''
|
||||
"""
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
@@ -67,7 +67,7 @@ def formatAmount(val, prec=3, lowest=0, highest=0, currency=False, forceSign=Fal
|
||||
except IndexError:
|
||||
nextKey = 0
|
||||
# Check if mantissa with next suffix is in range [1, 1000)
|
||||
if abs(val) < 10 ** (nextKey) and key >= lowest:
|
||||
if abs(val) < 10 ** nextKey and key >= lowest:
|
||||
mantissa, suffix = val / float(10 ** key), negSuffixMap[key]
|
||||
# Do additional step to eliminate results like 0.9999 => 1000m
|
||||
# Check if the key we're potentially switching to is greater than our
|
||||
|
||||
@@ -22,11 +22,11 @@ import wx
|
||||
|
||||
|
||||
class ViewColumn(object):
|
||||
'''
|
||||
"""
|
||||
Abstract class that columns can inherit from.
|
||||
Once the missing methods are correctly implemented,
|
||||
they can be used as columns in a view.
|
||||
'''
|
||||
"""
|
||||
columns = {}
|
||||
|
||||
def __init__(self, fittingView):
|
||||
|
||||
@@ -270,7 +270,7 @@ class Character(object):
|
||||
|
||||
def getSkillLevel(self, charID, skillID):
|
||||
skill = eos.db.getCharacter(charID).getSkill(skillID)
|
||||
return (skill.level if skill.learned else "Not learned", skill.isDirty)
|
||||
return skill.level if skill.learned else "Not learned", skill.isDirty
|
||||
|
||||
def getDirtySkills(self, charID):
|
||||
return eos.db.getCharacter(charID).dirtySkills
|
||||
@@ -304,7 +304,7 @@ class Character(object):
|
||||
chars = json.loads(char.chars)
|
||||
else:
|
||||
chars = None
|
||||
return (char.apiID or "", char.apiKey or "", char.defaultChar or "", chars or [])
|
||||
return char.apiID or "", char.apiKey or "", char.defaultChar or "", chars or []
|
||||
|
||||
def apiEnabled(self, charID):
|
||||
id_, key, default, _ = self.getApiDetails(charID)
|
||||
|
||||
@@ -860,10 +860,10 @@ class Rowset(object):
|
||||
self._rows.sort(*args, **kw)
|
||||
|
||||
def __str__(self):
|
||||
return ("Rowset(columns=[%s], rows=%d)" % (','.join(self._cols), len(self)))
|
||||
return "Rowset(columns=[%s], rows=%d)" % (','.join(self._cols), len(self))
|
||||
|
||||
def __getstate__(self):
|
||||
return (self._cols, self._rows)
|
||||
return self._cols, self._rows
|
||||
|
||||
def __setstate__(self, state):
|
||||
self._cols, self._rows = state
|
||||
@@ -922,7 +922,7 @@ class IndexRowset(Rowset):
|
||||
self._items[row[self._ki]] = row
|
||||
|
||||
def __getstate__(self):
|
||||
return (Rowset.__getstate__(self), self._items, self._ki)
|
||||
return Rowset.__getstate__(self), self._items, self._ki
|
||||
|
||||
def __setstate__(self, state):
|
||||
state, self._items, self._ki = state
|
||||
@@ -990,7 +990,7 @@ class FilterRowset(object):
|
||||
return Rowset(self._cols, self._items[i])
|
||||
|
||||
def __getstate__(self):
|
||||
return (self._cols, self._rows, self._items, self.key, self.key2)
|
||||
return self._cols, self._rows, self._items, self.key, self.key2
|
||||
|
||||
def __setstate__(self, state):
|
||||
self._cols, self._rows, self._items, self.key, self.key2 = state
|
||||
|
||||
@@ -640,7 +640,7 @@ class Fit(object):
|
||||
total = fit.getNumSlots(fighter.slot)
|
||||
standardAttackActive = False
|
||||
for ability in fighter.abilities:
|
||||
if (ability.effect.isImplemented and ability.effect.handlerName == u'fighterabilityattackm'):
|
||||
if ability.effect.isImplemented and ability.effect.handlerName == u'fighterabilityattackm':
|
||||
# Activate "standard attack" if available
|
||||
ability.active = True
|
||||
standardAttackActive = True
|
||||
|
||||
@@ -322,7 +322,7 @@ class Market(object):
|
||||
"Advanced Cerebral Accelerator" : 977, # Implants & Boosters > Booster
|
||||
"Civilian Damage Control" : 615, # Ship Equipment > Hull & Armor > Damage Controls
|
||||
"Civilian EM Ward Field" : 1695,
|
||||
# Ship Equipment > Shield > Shield Hardeners > EM Shield Hardeners
|
||||
# Ship Equipment > Shield > Shield Hardeners > EM Shield Hardeners
|
||||
"Civilian Explosive Deflection Field" : 1694,
|
||||
# Ship Equipment > Shield > Shield Hardeners > Explosive Shield Hardeners
|
||||
"Civilian Hobgoblin" : 837, # Drones > Combat Drones > Light Scout Drones
|
||||
@@ -588,8 +588,8 @@ class Market(object):
|
||||
parents.add(parent)
|
||||
# Check for overrides and add them if any
|
||||
if parent.name in self.ITEMS_FORCEDMETAGROUP_R:
|
||||
for item in self.ITEMS_FORCEDMETAGROUP_R[parent.name]:
|
||||
i = self.getItem(item)
|
||||
for _item in self.ITEMS_FORCEDMETAGROUP_R[parent.name]:
|
||||
i = self.getItem(_item)
|
||||
if i:
|
||||
variations.add(i)
|
||||
# Add all parents to variations set
|
||||
@@ -766,7 +766,7 @@ class Market(object):
|
||||
overrides = eos.db.getAllOverrides()
|
||||
items = set()
|
||||
for x in overrides:
|
||||
if (x.item is None):
|
||||
if x.item is None:
|
||||
eos.db.saveddata_session.delete(x)
|
||||
eos.db.commit()
|
||||
else:
|
||||
|
||||
@@ -51,7 +51,7 @@ class TimeoutError(StandardError):
|
||||
pass
|
||||
|
||||
|
||||
class Network(object):
|
||||
class Network:
|
||||
# Request constants - every request must supply this, as it is checked if
|
||||
# enabled or not via settings
|
||||
ENABLED = 1
|
||||
|
||||
@@ -543,7 +543,7 @@ class Port(object):
|
||||
elif item.category.name == "Fighter":
|
||||
extraAmount = int(extraAmount) if extraAmount is not None else 1
|
||||
fighterItem = Fighter(item)
|
||||
if (extraAmount > fighterItem.fighterSquadronMaxSize): # Amount bigger then max fightergroup size
|
||||
if extraAmount > fighterItem.fighterSquadronMaxSize: # Amount bigger then max fightergroup size
|
||||
extraAmount = fighterItem.fighterSquadronMaxSize
|
||||
if fighterItem.fits(fit):
|
||||
fit.fighters.append(fighterItem)
|
||||
@@ -1092,7 +1092,7 @@ class Port(object):
|
||||
|
||||
@staticmethod
|
||||
def exportMultiBuy(fit):
|
||||
export = "%s\n" % (fit.ship.item.name)
|
||||
export = "%s\n" % fit.ship.item.name
|
||||
stuff = {}
|
||||
sFit = svcFit.getInstance()
|
||||
for module in fit.modules:
|
||||
|
||||
@@ -109,7 +109,7 @@ class WeakCiphersHTTPSConnectionPool(urllib3.connectionpool.HTTPSConnectionPool)
|
||||
class WeakCiphersPoolManager(urllib3.poolmanager.PoolManager):
|
||||
def _new_pool(self, scheme, host, port):
|
||||
if scheme == 'https':
|
||||
return WeakCiphersHTTPSConnectionPool(host, port, **(self.connection_pool_kw))
|
||||
return WeakCiphersHTTPSConnectionPool(host, port, **self.connection_pool_kw)
|
||||
return super(WeakCiphersPoolManager, self)._new_pool(scheme, host, port)
|
||||
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ class StoppableHTTPServer(BaseHTTPServer.HTTPServer):
|
||||
try:
|
||||
sock, addr = self.socket.accept()
|
||||
sock.settimeout(None)
|
||||
return (sock, addr)
|
||||
return sock, addr
|
||||
except socket.timeout:
|
||||
pass
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ class NetworkSettings(object):
|
||||
if self.getMode() == self.PROXY_MODE_AUTODETECT:
|
||||
return self.autodetect()
|
||||
if self.getMode() == self.PROXY_MODE_MANUAL:
|
||||
return (self.getAddress(), int(self.getPort()))
|
||||
return self.getAddress(), int(self.getPort())
|
||||
|
||||
def getProxyAuthDetails(self):
|
||||
if self.getMode() == self.PROXY_MODE_NONE:
|
||||
@@ -225,7 +225,7 @@ class NetworkSettings(object):
|
||||
if (self.serviceNetworkSettings["login"] is None) or (self.serviceNetworkSettings["password"] is None):
|
||||
return None
|
||||
# in all other cases, return tuple of (login, password)
|
||||
return (self.serviceNetworkSettings["login"], self.serviceNetworkSettings["password"])
|
||||
return self.serviceNetworkSettings["login"], self.serviceNetworkSettings["password"]
|
||||
|
||||
def setProxyAuthDetails(self, login, password):
|
||||
if (login is None) or (password is None):
|
||||
|
||||
@@ -52,7 +52,7 @@ class CheckUpdateThread(threading.Thread):
|
||||
|
||||
for release in jsonResponse:
|
||||
# Suppress pre releases
|
||||
if (release['prerelease'] and self.settings.get('prerelease')):
|
||||
if release['prerelease'] and self.settings.get('prerelease'):
|
||||
continue
|
||||
|
||||
# Handle use-case of updating to suppressed version
|
||||
@@ -60,7 +60,7 @@ class CheckUpdateThread(threading.Thread):
|
||||
self.settings.set('version', None)
|
||||
|
||||
# Suppress version
|
||||
if (release['tag_name'] == self.settings.get('version')):
|
||||
if release['tag_name'] == self.settings.get('version'):
|
||||
break
|
||||
|
||||
# Set the release version that we will be comparing with.
|
||||
|
||||
9
setup.py
9
setup.py
@@ -9,7 +9,7 @@ import requests.certs
|
||||
# The modules that contain the bulk of teh source
|
||||
packages = ['eos', 'gui', 'service', 'utils']
|
||||
# Extra files that will be copied into the root directory
|
||||
include_files = ['eve.db', 'LICENSE', 'README.md', (requests.certs.where(),'cacert.pem')]
|
||||
include_files = ['eve.db', 'LICENSE', 'README.md', (requests.certs.where(), 'cacert.pem')]
|
||||
# this is read by dist.py to package the icons
|
||||
icon_dirs = ['gui', 'icons', 'renders']
|
||||
|
||||
@@ -26,7 +26,6 @@ if __name__ == "__main__":
|
||||
from cx_Freeze import setup, Executable
|
||||
import config
|
||||
|
||||
|
||||
app_name = 'pyfa'
|
||||
app_version = '{}'.format(config.version)
|
||||
app_description = 'Python fitting assistant'
|
||||
@@ -48,7 +47,6 @@ if __name__ == "__main__":
|
||||
'initial_target_dir': r'[ProgramFilesFolder]\{}'.format(app_name),
|
||||
}
|
||||
|
||||
|
||||
# Mac-specific options (untested)
|
||||
build_options_macapp = {
|
||||
'iconfile': 'dist_assets/mac/pyfa.icns',
|
||||
@@ -60,13 +58,12 @@ if __name__ == "__main__":
|
||||
'applications-shortcut': True,
|
||||
}
|
||||
|
||||
|
||||
# Generic executable options
|
||||
executable_options = {
|
||||
'script': 'pyfa.py',
|
||||
# Following are windows-specific options, they are stored
|
||||
# on a per-executable basis
|
||||
'base': 'Win32GUI' if sys.platform=='win32' else None,
|
||||
'base': 'Win32GUI' if sys.platform == 'win32' else None,
|
||||
'icon': 'dist_assets/win/pyfa.ico',
|
||||
'shortcutDir': 'DesktopFolder',
|
||||
'shortcutName': app_name,
|
||||
@@ -76,7 +73,7 @@ if __name__ == "__main__":
|
||||
name=app_name,
|
||||
version=app_version,
|
||||
description=app_description,
|
||||
options = {
|
||||
options={
|
||||
'build_exe': build_options_winexe,
|
||||
'bdist_msi': build_options_winmsi,
|
||||
'bdist_mac': build_options_macapp,
|
||||
|
||||
2
tox.ini
2
tox.ini
@@ -13,4 +13,4 @@ commands = py.test -vv --cov Pyfa tests/
|
||||
[testenv:pep8]
|
||||
deps = flake8
|
||||
# TODO: Remove E731 and convert lambdas to defs
|
||||
commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E126,E127,E128,E731 service gui eos utils config.py pyfa.py --max-line-length=165
|
||||
commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E126,E127,E128,E203,E731 service gui eos utils config.py pyfa.py --max-line-length=165
|
||||
|
||||
@@ -13,7 +13,7 @@ except ImportError:
|
||||
|
||||
|
||||
class OrderedDict(dict):
|
||||
'Dictionary that remembers insertion order'
|
||||
"""Dictionary that remembers insertion order"""
|
||||
# An inherited dict maps keys to values.
|
||||
# The inherited dict provides __getitem__, __len__, __contains__, and get.
|
||||
# The remaining methods are order-aware.
|
||||
@@ -25,11 +25,11 @@ class OrderedDict(dict):
|
||||
# Each link is stored as a list of length three: [PREV, NEXT, KEY].
|
||||
|
||||
def __init__(self, *args, **kwds):
|
||||
'''Initialize an ordered dictionary. Signature is the same as for
|
||||
"""Initialize an ordered dictionary. Signature is the same as for
|
||||
regular dictionaries, but keyword arguments are not recommended
|
||||
because their insertion order is arbitrary.
|
||||
|
||||
'''
|
||||
"""
|
||||
super(OrderedDict, self).__init__(**kwds)
|
||||
if len(args) > 1:
|
||||
raise TypeError('expected at most 1 arguments, got %d' % len(args))
|
||||
@@ -42,7 +42,7 @@ class OrderedDict(dict):
|
||||
self.__update(*args, **kwds)
|
||||
|
||||
def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
|
||||
'od.__setitem__(i, y) <==> od[i]=y'
|
||||
"""od.__setitem__(i, y) <==> od[i]=y"""
|
||||
# Setting a new item creates a new link which goes at the end of the linked
|
||||
# list, and the inherited dictionary is updated with the new key/value pair.
|
||||
if key not in self:
|
||||
@@ -52,7 +52,7 @@ class OrderedDict(dict):
|
||||
dict_setitem(self, key, value)
|
||||
|
||||
def __delitem__(self, key, dict_delitem=dict.__delitem__):
|
||||
'od.__delitem__(y) <==> del od[y]'
|
||||
"""od.__delitem__(y) <==> del od[y]"""
|
||||
# Deleting an existing item uses self.__map to find the link which is
|
||||
# then removed by updating the links in the predecessor and successor nodes.
|
||||
dict_delitem(self, key)
|
||||
@@ -61,7 +61,7 @@ class OrderedDict(dict):
|
||||
link_next[0] = link_prev
|
||||
|
||||
def __iter__(self):
|
||||
'od.__iter__() <==> iter(od)'
|
||||
"""od.__iter__() <==> iter(od)"""
|
||||
root = self.__root
|
||||
curr = root[1]
|
||||
while curr is not root:
|
||||
@@ -69,7 +69,7 @@ class OrderedDict(dict):
|
||||
curr = curr[1]
|
||||
|
||||
def __reversed__(self):
|
||||
'od.__reversed__() <==> reversed(od)'
|
||||
"""od.__reversed__() <==> reversed(od)"""
|
||||
root = self.__root
|
||||
curr = root[0]
|
||||
while curr is not root:
|
||||
@@ -77,7 +77,7 @@ class OrderedDict(dict):
|
||||
curr = curr[0]
|
||||
|
||||
def clear(self):
|
||||
'od.clear() -> None. Remove all items from od.'
|
||||
"""od.clear() -> None. Remove all items from od."""
|
||||
try:
|
||||
for node in self.__map.itervalues():
|
||||
del node[:]
|
||||
@@ -89,10 +89,10 @@ class OrderedDict(dict):
|
||||
dict.clear(self)
|
||||
|
||||
def popitem(self, last=True):
|
||||
'''od.popitem() -> (k, v), return and remove a (key, value) pair.
|
||||
"""od.popitem() -> (k, v), return and remove a (key, value) pair.
|
||||
Pairs are returned in LIFO order if last is true or FIFO order if false.
|
||||
|
||||
'''
|
||||
"""
|
||||
if not self:
|
||||
raise KeyError('dictionary is empty')
|
||||
root = self.__root
|
||||
@@ -114,40 +114,40 @@ class OrderedDict(dict):
|
||||
# -- the following methods do not depend on the internal structure --
|
||||
|
||||
def keys(self):
|
||||
'od.keys() -> list of keys in od'
|
||||
"""od.keys() -> list of keys in od"""
|
||||
return list(self)
|
||||
|
||||
def values(self):
|
||||
'od.values() -> list of values in od'
|
||||
"""od.values() -> list of values in od"""
|
||||
return [self[key] for key in self]
|
||||
|
||||
def items(self):
|
||||
'od.items() -> list of (key, value) pairs in od'
|
||||
"""od.items() -> list of (key, value) pairs in od"""
|
||||
return [(key, self[key]) for key in self]
|
||||
|
||||
def iterkeys(self):
|
||||
'od.iterkeys() -> an iterator over the keys in od'
|
||||
"""od.iterkeys() -> an iterator over the keys in od"""
|
||||
return iter(self)
|
||||
|
||||
def itervalues(self):
|
||||
'od.itervalues -> an iterator over the values in od'
|
||||
"""od.itervalues -> an iterator over the values in od"""
|
||||
for k in self:
|
||||
yield self[k]
|
||||
|
||||
def iteritems(self):
|
||||
'od.iteritems -> an iterator over the (key, value) items in od'
|
||||
"""od.iteritems -> an iterator over the (key, value) items in od"""
|
||||
for k in self:
|
||||
yield (k, self[k])
|
||||
|
||||
def update(*args, **kwds):
|
||||
'''od.update(E, **F) -> None. Update od from dict/iterable E and F.
|
||||
"""od.update(E, **F) -> None. Update od from dict/iterable E and F.
|
||||
|
||||
If E is a dict instance, does: for k in E: od[k] = E[k]
|
||||
If E has a .keys() method, does: for k in E.keys(): od[k] = E[k]
|
||||
Or if E is an iterable of items, does: for k, v in E: od[k] = v
|
||||
In either case, this is followed by: for k, v in F.items(): od[k] = v
|
||||
|
||||
'''
|
||||
"""
|
||||
if len(args) > 2:
|
||||
raise TypeError('update() takes at most 2 positional '
|
||||
'arguments (%d given)' % (len(args),))
|
||||
@@ -175,10 +175,10 @@ class OrderedDict(dict):
|
||||
__marker = object()
|
||||
|
||||
def pop(self, key, default=__marker):
|
||||
'''od.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
||||
"""od.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
||||
If key is not found, d is returned if given, otherwise KeyError is raised.
|
||||
|
||||
'''
|
||||
"""
|
||||
if key in self:
|
||||
result = self[key]
|
||||
del self[key]
|
||||
@@ -188,14 +188,14 @@ class OrderedDict(dict):
|
||||
return default
|
||||
|
||||
def setdefault(self, key, default=None):
|
||||
'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'
|
||||
"""od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od"""
|
||||
if key in self:
|
||||
return self[key]
|
||||
self[key] = default
|
||||
return default
|
||||
|
||||
def __repr__(self, _repr_running=None):
|
||||
'od.__repr__() <==> repr(od)'
|
||||
"""od.__repr__() <==> repr(od)"""
|
||||
if _repr_running is None:
|
||||
_repr_running = {}
|
||||
call_key = id(self), _get_ident()
|
||||
@@ -210,35 +210,35 @@ class OrderedDict(dict):
|
||||
del _repr_running[call_key]
|
||||
|
||||
def __reduce__(self):
|
||||
'Return state information for pickling'
|
||||
"""Return state information for pickling"""
|
||||
items = [[k, self[k]] for k in self]
|
||||
inst_dict = vars(self).copy()
|
||||
for k in vars(OrderedDict()):
|
||||
inst_dict.pop(k, None)
|
||||
if inst_dict:
|
||||
return (self.__class__, (items,), inst_dict)
|
||||
return self.__class__, (items,), inst_dict
|
||||
return self.__class__, (items,)
|
||||
|
||||
def copy(self):
|
||||
'od.copy() -> a shallow copy of od'
|
||||
"""od.copy() -> a shallow copy of od"""
|
||||
return self.__class__(self)
|
||||
|
||||
@classmethod
|
||||
def fromkeys(cls, iterable, value=None):
|
||||
'''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S
|
||||
"""OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S
|
||||
and values equal to v (which defaults to None).
|
||||
|
||||
'''
|
||||
"""
|
||||
d = cls()
|
||||
for key in iterable:
|
||||
d[key] = value
|
||||
return d
|
||||
|
||||
def __eq__(self, other):
|
||||
'''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive
|
||||
"""od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive
|
||||
while comparison to a regular mapping is order-insensitive.
|
||||
|
||||
'''
|
||||
"""
|
||||
if isinstance(other, OrderedDict):
|
||||
return len(self) == len(other) and self.items() == other.items()
|
||||
return dict.__eq__(self, other)
|
||||
@@ -249,21 +249,21 @@ class OrderedDict(dict):
|
||||
# -- the following methods are only used in Python 2.7 --
|
||||
|
||||
def viewkeys(self):
|
||||
"od.viewkeys() -> a set-like object providing a view on od's keys"
|
||||
"""od.viewkeys() -> a set-like object providing a view on od's keys"""
|
||||
if KeysView:
|
||||
return KeysView(self)
|
||||
else:
|
||||
return None
|
||||
|
||||
def viewvalues(self):
|
||||
"od.viewvalues() -> an object providing a view on od's values"
|
||||
"""od.viewvalues() -> an object providing a view on od's values"""
|
||||
if ValuesView:
|
||||
return ValuesView(self)
|
||||
else:
|
||||
return None
|
||||
|
||||
def viewitems(self):
|
||||
"od.viewitems() -> a set-like object providing a view on od's items"
|
||||
"""od.viewitems() -> a set-like object providing a view on od's items"""
|
||||
if ItemsView:
|
||||
return ItemsView(self)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user