Formatting and layout changes
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user