Skip to content

Commit

Permalink
Formatting and layout changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ebag333 committed Feb 9, 2017
1 parent 9a137bb commit 7263382
Show file tree
Hide file tree
Showing 56 changed files with 168 additions and 173 deletions.
4 changes: 4 additions & 0 deletions eos/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ class ReadOnlyException(Exception):
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.
Expand Down
4 changes: 2 additions & 2 deletions eos/db/gamedata/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
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"),
Expand Down
3 changes: 1 addition & 2 deletions eos/db/saveddata/databaseRepair.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ def OrphanedFitDamagePatterns(saveddata_engine):
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)

Expand Down
12 changes: 6 additions & 6 deletions eos/db/saveddata/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ def __repr__(self):
"_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(
Module,
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"),
Expand All @@ -164,13 +164,13 @@ def __repr__(self):
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,
Expand All @@ -182,13 +182,13 @@ def __repr__(self):
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,
Expand Down
2 changes: 1 addition & 1 deletion eos/graph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, name, dataString, step=None):

def parseString(self, dataString):
if not isinstance(dataString, basestring):
return (Constant(dataString),)
return Constant(dataString),

dataList = []
for data in dataString.split(";"):
Expand Down
2 changes: 1 addition & 1 deletion eos/graph/fitDps.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ def calculateModuleMultiplier(self, mod, data):
turretFalloff = mod.falloff
rangeEq = ((max(0, distance - turretOptimal)) / turretFalloff) ** 2

return 0.5 ** (rangeEq)
return 0.5 ** rangeEq
4 changes: 2 additions & 2 deletions gui/PFListPane.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ def ScrollChildIntoView(self, child):
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
Expand Down
9 changes: 5 additions & 4 deletions gui/PFSearchBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ def HitTest(self, target, position, area):
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):
Expand Down
4 changes: 2 additions & 2 deletions gui/boosterView.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ def __init__(self, parent):
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])))
Expand Down
2 changes: 1 addition & 1 deletion gui/builtinPreferenceViews/pyfaUpdatePreferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def populatePanel(self, panel):

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(
Expand Down
3 changes: 1 addition & 2 deletions gui/builtinStatsViews/priceViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ def refreshPanel(self, fit):
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:
Expand Down
12 changes: 4 additions & 8 deletions gui/builtinStatsViews/targetingMiscViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,14 @@ def refreshPanel(self, fit):
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]))
Expand All @@ -232,17 +230,15 @@ def refreshPanel(self, fit):
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":
if fit:
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]))
Expand Down
2 changes: 1 addition & 1 deletion gui/builtinViewColumns/attributeDisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def getText(self, mod):
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)):
Expand Down
2 changes: 1 addition & 1 deletion gui/builtinViewColumns/maxRange.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def getImageId(self, mod):
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"
Expand Down
2 changes: 1 addition & 1 deletion gui/builtinViewColumns/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def getImageId(self, mod):
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
Expand Down
2 changes: 1 addition & 1 deletion gui/builtinViewColumns/propertyDisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, fittingView, params):
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 ""

Expand Down
28 changes: 14 additions & 14 deletions gui/builtinViews/fittingView.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ def OnMouseMove(self, event):
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]))
Expand Down Expand Up @@ -262,11 +262,11 @@ def kbEvent(self, event):
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():
Expand Down Expand Up @@ -358,7 +358,7 @@ def removeModule(self, module):
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:
Expand All @@ -371,7 +371,7 @@ def addModule(self, x, y, srcIdx):
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))
Expand All @@ -385,7 +385,7 @@ def swapCargo(self, x, y, srcIdx):
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)
Expand Down Expand Up @@ -414,12 +414,12 @@ def swapItems(self, x, y, srcIdx):
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)
Expand Down Expand Up @@ -539,13 +539,13 @@ def spawnMenu(self):
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
Expand Down Expand Up @@ -587,12 +587,12 @@ def slotColour(self, slot):
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)

Expand Down Expand Up @@ -745,7 +745,7 @@ def MakeSnapshot(self, maxColumns=1337):
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)

Expand Down
6 changes: 3 additions & 3 deletions gui/cargoView.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ def __init__(self, parent):
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]))
Expand Down Expand Up @@ -106,7 +106,7 @@ def kbEvent(self, event):
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))
Expand Down
Loading

0 comments on commit 7263382

Please sign in to comment.