Major statspane rework -- (ministats panel isnt available for now)
This commit is contained in:
10
builtinStatsViews/__init__.py
Normal file
10
builtinStatsViews/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
__all__ = ["resourcesViewFull", "resistancesViewFull",
|
||||
"rechargeViewFull", "firepowerViewFull", "capacitorViewFull",
|
||||
"targetingmiscViewFull", "priceViewFull"]
|
||||
|
||||
columns = {}
|
||||
def registerView(column):
|
||||
columns[column.name] = column
|
||||
|
||||
def getView(name):
|
||||
return columns[name]
|
||||
149
builtinStatsViews/capacitorViewFull.py
Normal file
149
builtinStatsViews/capacitorViewFull.py
Normal file
@@ -0,0 +1,149 @@
|
||||
#===============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
import wx
|
||||
from gui.statsView import StatsView
|
||||
from gui import builtinStatsViews
|
||||
|
||||
from gui.pyfatogglepanel import TogglePanel
|
||||
from gui import bitmapLoader
|
||||
from gui import pygauge as PG
|
||||
|
||||
from eos.types import Slot, Hardpoint
|
||||
|
||||
from util import formatAmount
|
||||
|
||||
class CapacitorViewFull(StatsView):
|
||||
name = "capacitorViewFull"
|
||||
def __init__(self, parent):
|
||||
StatsView.__init__(self)
|
||||
self.parent = parent
|
||||
def getHeaderText(self, fit):
|
||||
return "Capacitor"
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent( text )
|
||||
return width
|
||||
|
||||
def populatePanel(self, contentPanel, headerPanel):
|
||||
|
||||
contentSizer = contentPanel.GetSizer()
|
||||
|
||||
|
||||
parent = contentPanel
|
||||
panel = "full"
|
||||
|
||||
sizerCapacitor = wx.GridSizer(1, 2)
|
||||
contentSizer.Add(sizerCapacitor, 0, wx.EXPAND, 0)
|
||||
|
||||
|
||||
|
||||
# Capacitor capacity and time
|
||||
baseBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
sizerCapacitor.Add(baseBox, 0, wx.ALIGN_LEFT)
|
||||
|
||||
|
||||
|
||||
baseBox.Add(bitmapLoader.getStaticBitmap("capacitorInfo_big", parent, "icons"), 0, wx.ALIGN_CENTER)
|
||||
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
baseBox.Add(box, 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(hbox, 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox.Add(wx.StaticText(parent, wx.ID_ANY, "Total: "), 0, wx.ALIGN_LEFT | wx.LEFT, 3)
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
|
||||
setattr(self, "label%sCapacitorCapacity" % panel.capitalize(), lbl)
|
||||
hbox.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
|
||||
hbox.Add(wx.StaticText(parent, wx.ID_ANY, " GJ"), 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(hbox, 0, wx.ALIGN_LEFT)
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "Lasts ")
|
||||
hbox.Add(lbl, 0, wx.ALIGN_LEFT | wx.LEFT, 3)
|
||||
setattr(self, "label%sCapacitorState" % panel.capitalize(), lbl)
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0s")
|
||||
setattr(self, "label%sCapacitorTime" % panel.capitalize(), lbl)
|
||||
hbox.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
# Capacitor balance
|
||||
baseBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
sizerCapacitor.Add(baseBox, 0, wx.ALIGN_CENTER_HORIZONTAL)
|
||||
|
||||
baseBox.Add(bitmapLoader.getStaticBitmap("capacitorRecharge_big", parent, "icons"), 0, wx.ALIGN_CENTER)
|
||||
|
||||
# Recharge
|
||||
chargeSizer = wx.FlexGridSizer(2, 3)
|
||||
baseBox.Add(chargeSizer, 0, wx.ALIGN_CENTER)
|
||||
|
||||
chargeSizer.Add(wx.StaticText(parent, wx.ID_ANY, "+ "), 0, wx.ALIGN_CENTER)
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
|
||||
setattr(self, "label%sCapacitorRecharge" % panel.capitalize(), lbl)
|
||||
chargeSizer.Add(lbl, 0, wx.ALIGN_CENTER)
|
||||
chargeSizer.Add(wx.StaticText(parent, wx.ID_ANY, " GJ/s"), 0, wx.ALIGN_CENTER)
|
||||
|
||||
# Discharge
|
||||
chargeSizer.Add(wx.StaticText(parent, wx.ID_ANY, "- "), 0, wx.ALIGN_CENTER)
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
|
||||
setattr(self, "label%sCapacitorDischarge" % panel.capitalize(), lbl)
|
||||
chargeSizer.Add(lbl, 0, wx.ALIGN_CENTER)
|
||||
chargeSizer.Add(wx.StaticText(parent, wx.ID_ANY, " GJ/s"), 0, wx.ALIGN_CENTER)
|
||||
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
#If we did anything intresting, we'd update our labels to reflect the new fit's stats here
|
||||
stats= (("label%sCapacitorCapacity", lambda: fit.ship.getModifiedItemAttr("capacitorCapacity"), 3, 0, 9),
|
||||
("label%sCapacitorRecharge", lambda: fit.capRecharge, 3, 0, 0),
|
||||
("label%sCapacitorDischarge", lambda: fit.capUsed, 3, 0, 0))
|
||||
|
||||
panel = "Full"
|
||||
for labelName, value, prec, lowest, highest in stats:
|
||||
label = getattr(self, labelName % panel)
|
||||
value = value() if fit is not None else 0
|
||||
value = value if value is not None else 0
|
||||
if isinstance(value, basestring):
|
||||
label.SetLabel(value)
|
||||
label.SetToolTip(wx.ToolTip(value))
|
||||
else:
|
||||
label.SetLabel(formatAmount(value, prec, lowest, highest))
|
||||
label.SetToolTip(wx.ToolTip("%.1f" % value))
|
||||
|
||||
capState = fit.capState if fit is not None else 0
|
||||
capStable = fit.capStable if fit is not None else False
|
||||
lblNameTime = "label%sCapacitorTime"
|
||||
lblNameState = "label%sCapacitorState"
|
||||
if isinstance(capState, tuple):
|
||||
t = "%.1f%%-%.1f%%" % capState
|
||||
s = ""
|
||||
else:
|
||||
t = ("%ds" if not capStable else "%.1f%%") % capState
|
||||
s = "Stable: " if capStable else "Lasts "
|
||||
|
||||
getattr(self, lblNameTime % panel).SetLabel(t)
|
||||
getattr(self, lblNameState % panel).SetLabel(s)
|
||||
|
||||
|
||||
builtinStatsViews.registerView(CapacitorViewFull)
|
||||
43
builtinStatsViews/exampleView.py
Normal file
43
builtinStatsViews/exampleView.py
Normal file
@@ -0,0 +1,43 @@
|
||||
#===============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
import wx
|
||||
from gui.statsView import StatsView
|
||||
from gui import builtinStatsViews
|
||||
|
||||
class ExampleView(StatsView):
|
||||
name = "exampleView"
|
||||
def __init__(self):
|
||||
StatsView.__init__(self)
|
||||
|
||||
def populatePanel(self, panel):
|
||||
self.panel = panel
|
||||
self.mainSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
panel.SetSizer(self.mainSizer)
|
||||
|
||||
self.mainSizer.Add(wx.StaticText(panel, wx.ID_ANY, "Hello world!"))
|
||||
|
||||
def getHeaderText(self, fit):
|
||||
return "MOO"
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
#If we did anything intresting, we'd update our labels to reflect the new fit's stats here
|
||||
pass
|
||||
|
||||
builtinStatsViews.registerView(ExampleView)
|
||||
122
builtinStatsViews/firepowerViewFull.py
Normal file
122
builtinStatsViews/firepowerViewFull.py
Normal file
@@ -0,0 +1,122 @@
|
||||
#===============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
import wx
|
||||
from gui.statsView import StatsView
|
||||
from gui import builtinStatsViews
|
||||
|
||||
from gui.pyfatogglepanel import TogglePanel
|
||||
from gui import bitmapLoader
|
||||
from gui import pygauge as PG
|
||||
|
||||
from eos.types import Slot, Hardpoint
|
||||
|
||||
from util import formatAmount
|
||||
|
||||
class FirepowerViewFull(StatsView):
|
||||
name = "firepowerViewFull"
|
||||
def __init__(self, parent):
|
||||
StatsView.__init__(self)
|
||||
self.parent = parent
|
||||
def getHeaderText(self, fit):
|
||||
return "Firepower"
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent( text )
|
||||
return width
|
||||
|
||||
def populatePanel(self, contentPanel, headerPanel):
|
||||
|
||||
contentSizer = contentPanel.GetSizer()
|
||||
|
||||
|
||||
parent = contentPanel
|
||||
panel = "full"
|
||||
|
||||
|
||||
sizerFirepower = wx.FlexGridSizer(1, 3)
|
||||
for i in xrange(3):
|
||||
sizerFirepower.AddGrowableCol(i)
|
||||
|
||||
|
||||
contentSizer.Add( sizerFirepower, 0, wx.EXPAND, 0)
|
||||
|
||||
|
||||
|
||||
for damageType, image in (("weapon", "turret") , ("drone", "droneBay")):
|
||||
baseBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
sizerFirepower.Add(baseBox, 0, wx.ALIGN_LEFT)
|
||||
|
||||
baseBox.Add(bitmapLoader.getStaticBitmap("%s_big" % image, parent, "icons"), 0, wx.ALIGN_CENTER)
|
||||
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
baseBox.Add(box, 0, wx.ALIGN_CENTER)
|
||||
|
||||
box.Add(wx.StaticText(parent, wx.ID_ANY, damageType.capitalize()), 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(hbox, 1, wx.ALIGN_CENTER)
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
|
||||
setattr(self, "label%sDps%s" % (panel.capitalize() ,damageType.capitalize()), lbl)
|
||||
|
||||
hbox.Add(lbl, 0, wx.ALIGN_CENTER)
|
||||
hbox.Add(wx.StaticText(parent, wx.ID_ANY, " DPS"), 0, wx.ALIGN_CENTER)
|
||||
|
||||
|
||||
targetSizer = sizerFirepower
|
||||
|
||||
baseBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
targetSizer.Add(baseBox, 0, wx.ALIGN_LEFT)
|
||||
|
||||
baseBox.Add(bitmapLoader.getStaticBitmap("volley_big", parent, "icons"), 0, wx.ALIGN_CENTER)
|
||||
|
||||
gridS = wx.GridSizer(2,2,0,0)
|
||||
|
||||
baseBox.Add(gridS, 0, wx.ALIGN_LEFT)
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
|
||||
setattr(self, "label%sVolleyTotal" % panel.capitalize(), lbl)
|
||||
gridS.Add(wx.StaticText(parent, wx.ID_ANY, " Volley: "), 0, wx.ALL | wx.ALIGN_RIGHT)
|
||||
gridS.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
|
||||
setattr(self, "label%sDpsTotal" % panel.capitalize(), lbl)
|
||||
gridS.Add(wx.StaticText(parent, wx.ID_ANY, " DPS: "), 0, wx.ALL | wx.ALIGN_RIGHT)
|
||||
gridS.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
#If we did anything intresting, we'd update our labels to reflect the new fit's stats here
|
||||
|
||||
stats = (("labelFullDpsWeapon", lambda: fit.weaponDPS, 3, 0, 9),
|
||||
("labelFullDpsDrone", lambda: fit.droneDPS, 3, 0, 9),
|
||||
("labelFullVolleyTotal", lambda: fit.weaponVolley, 3, 0, 9),
|
||||
("labelFullDpsTotal", lambda: fit.totalDPS, 3, 0, 9))
|
||||
|
||||
for labelName, value, prec, lowest, highest in stats:
|
||||
label = getattr(self, labelName)
|
||||
value = value() if fit is not None else 0
|
||||
value = value if value is not None else 0
|
||||
label.SetLabel(formatAmount(value, prec, lowest, highest))
|
||||
label.SetToolTip(wx.ToolTip("%.1f" % value))
|
||||
|
||||
|
||||
builtinStatsViews.registerView(FirepowerViewFull)
|
||||
87
builtinStatsViews/priceViewFull.py
Normal file
87
builtinStatsViews/priceViewFull.py
Normal file
@@ -0,0 +1,87 @@
|
||||
#===============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
import wx
|
||||
from gui.statsView import StatsView
|
||||
from gui import builtinStatsViews
|
||||
|
||||
from gui.pyfatogglepanel import TogglePanel
|
||||
from gui import bitmapLoader
|
||||
from gui import pygauge as PG
|
||||
|
||||
from eos.types import Slot, Hardpoint
|
||||
|
||||
from util import formatAmount
|
||||
|
||||
class PriceViewFull(StatsView):
|
||||
name = "priceViewFull"
|
||||
def __init__(self, parent):
|
||||
StatsView.__init__(self)
|
||||
self.parent = parent
|
||||
def getHeaderText(self, fit):
|
||||
return "Price"
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent( text )
|
||||
return width
|
||||
|
||||
def populatePanel(self, contentPanel, headerPanel):
|
||||
|
||||
contentSizer = contentPanel.GetSizer()
|
||||
|
||||
|
||||
parent = contentPanel
|
||||
panel = "full"
|
||||
|
||||
|
||||
gridPrice = wx.GridSizer(1, 3)
|
||||
|
||||
contentSizer.Add( gridPrice, 0, wx.EXPAND | wx.ALL, 0)
|
||||
|
||||
|
||||
for type in ("ship", "fittings", "total"):
|
||||
image = "%sPrice_big" % type if type != "ship" else "ship_big"
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
gridPrice.Add(box, 0, wx.ALIGN_CENTER)
|
||||
|
||||
box.Add(bitmapLoader.getStaticBitmap(image, contentPanel, "icons"), 0, wx.ALIGN_CENTER)
|
||||
|
||||
vbox = wx.BoxSizer(wx.VERTICAL)
|
||||
box.Add(vbox, 1, wx.EXPAND)
|
||||
|
||||
vbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, type.capitalize()), 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
vbox.Add(hbox)
|
||||
|
||||
lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0.00")
|
||||
setattr(self, "labelPrice%s" % type, lbl)
|
||||
hbox.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, " m ISK"), 0, wx.ALIGN_LEFT)
|
||||
|
||||
|
||||
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
#If we did anything intresting, we'd update our labels to reflect the new fit's stats here
|
||||
#No data available yet
|
||||
pass
|
||||
|
||||
builtinStatsViews.registerView(PriceViewFull)
|
||||
115
builtinStatsViews/rechargeViewFull.py
Normal file
115
builtinStatsViews/rechargeViewFull.py
Normal file
@@ -0,0 +1,115 @@
|
||||
#===============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
import wx
|
||||
from gui.statsView import StatsView
|
||||
from gui import builtinStatsViews
|
||||
|
||||
from gui.pyfatogglepanel import TogglePanel
|
||||
from gui import bitmapLoader
|
||||
from gui import pygauge as PG
|
||||
|
||||
from eos.types import Slot, Hardpoint
|
||||
|
||||
from util import formatAmount
|
||||
|
||||
class RechargeViewFull(StatsView):
|
||||
name = "rechargeViewFull"
|
||||
def __init__(self, parent):
|
||||
StatsView.__init__(self)
|
||||
self.parent = parent
|
||||
def getHeaderText(self, fit):
|
||||
return "Recharge rates"
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent( text )
|
||||
return width
|
||||
|
||||
def populatePanel(self, contentPanel, headerPanel):
|
||||
|
||||
contentSizer = contentPanel.GetSizer()
|
||||
|
||||
|
||||
parent = contentPanel
|
||||
panel = "full"
|
||||
|
||||
sizerTankStats = wx.FlexGridSizer(3, 5)
|
||||
for i in xrange(4):
|
||||
sizerTankStats.AddGrowableCol(i + 1)
|
||||
|
||||
|
||||
contentSizer.Add(sizerTankStats, 0, wx.EXPAND, 0)
|
||||
|
||||
#Add an empty label first for correct alignment.
|
||||
sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, ""), 0)
|
||||
for tankType in ("shieldPassive", "shieldActive", "armorActive", "hullActive"):
|
||||
sizerTankStats.Add(bitmapLoader.getStaticBitmap("%s_big" % tankType, contentPanel, "icons"), 0, wx.ALIGN_CENTER)
|
||||
|
||||
for stability in ("reinforced", "sustained"):
|
||||
sizerTankStats.Add(bitmapLoader.getStaticBitmap("regen%s_big" % stability.capitalize(), contentPanel, "icons"), 0, wx.ALIGN_CENTER)
|
||||
for tankType in ("shieldPassive", "shieldActive", "armorActive", "hullActive"):
|
||||
if stability == "reinforced" and tankType == "shieldPassive":
|
||||
sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, ""))
|
||||
continue
|
||||
|
||||
tankTypeCap = tankType[0].capitalize() + tankType[1:]
|
||||
lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0.0", style = wx.ALIGN_RIGHT)
|
||||
setattr(self, "labelTank%s%s" % (stability.capitalize(), tankTypeCap), lbl)
|
||||
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(lbl, 1, wx.EXPAND)
|
||||
box.Add(wx.StaticText(contentPanel, wx.ID_ANY, " HP/s"), 1, wx.EXPAND)
|
||||
|
||||
sizerTankStats.Add(box, 0, wx.ALIGN_CENTRE)
|
||||
|
||||
contentPanel.Layout()
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
#If we did anything intresting, we'd update our labels to reflect the new fit's stats here
|
||||
|
||||
for stability in ("reinforced", "sustained"):
|
||||
if stability == "reinforced" and fit != None:
|
||||
tank = fit.effectiveTank
|
||||
elif stability == "sustained" and fit != None:
|
||||
tank = fit.effectiveSustainableTank
|
||||
else:
|
||||
tank = None
|
||||
|
||||
|
||||
for name in ("shield", "armor", "hull"):
|
||||
lbl = getattr(self, "labelTank%s%sActive" % (stability.capitalize(), name.capitalize()))
|
||||
if tank is not None:
|
||||
lbl.SetLabel("%.1f" % tank["%sRepair" % name])
|
||||
else:
|
||||
lbl.SetLabel("0.0")
|
||||
if fit is not None:
|
||||
label = getattr(self, "labelTankSustainedShieldPassive")
|
||||
value = fit.calculateShieldRecharge()
|
||||
label.SetLabel(formatAmount(value, 3, 0, 9))
|
||||
|
||||
else:
|
||||
value = 0
|
||||
label = getattr(self, "labelTankSustainedShieldPassive")
|
||||
label.SetLabel("0")
|
||||
|
||||
label.SetToolTip(wx.ToolTip("%.3f" % value))
|
||||
|
||||
|
||||
|
||||
builtinStatsViews.registerView(RechargeViewFull)
|
||||
189
builtinStatsViews/resistancesViewFull.py
Normal file
189
builtinStatsViews/resistancesViewFull.py
Normal file
@@ -0,0 +1,189 @@
|
||||
#===============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
import wx
|
||||
from gui.statsView import StatsView
|
||||
from gui import builtinStatsViews
|
||||
|
||||
from gui.pyfatogglepanel import TogglePanel
|
||||
from gui import bitmapLoader
|
||||
from gui import pygauge as PG
|
||||
|
||||
from eos.types import Slot, Hardpoint
|
||||
|
||||
from util import formatAmount
|
||||
|
||||
class ResistancesViewFull(StatsView):
|
||||
name = "resistancesViewFull"
|
||||
def __init__(self, parent):
|
||||
StatsView.__init__(self)
|
||||
self.parent = parent
|
||||
def getHeaderText(self, fit):
|
||||
return "Resistances"
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent( text )
|
||||
return width
|
||||
|
||||
def populatePanel(self, contentPanel, headerPanel):
|
||||
|
||||
contentSizer = contentPanel.GetSizer()
|
||||
|
||||
|
||||
parent = contentPanel
|
||||
panel = "full"
|
||||
|
||||
# Resistances
|
||||
|
||||
|
||||
|
||||
# Custom header EHP
|
||||
headerContentSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
hsizer = headerPanel.GetSizer()
|
||||
hsizer.Add(headerContentSizer,0,0,0)
|
||||
stEff = wx.StaticText(headerPanel, wx.ID_ANY, "( Effective HP: ")
|
||||
headerContentSizer.Add(stEff)
|
||||
headerPanel.GetParent().AddToggleItem(stEff)
|
||||
|
||||
self.labelEhp = wx.StaticText(headerPanel, wx.ID_ANY, "0")
|
||||
headerContentSizer.Add(self.labelEhp, 0)
|
||||
headerPanel.GetParent().AddToggleItem(self.labelEhp)
|
||||
|
||||
stCls = wx.StaticText(headerPanel, wx.ID_ANY, " )")
|
||||
|
||||
headerPanel.GetParent().AddToggleItem( stCls )
|
||||
headerContentSizer.Add( stCls )
|
||||
# headerContentSizer.Add(wx.StaticLine(headerPanel, wx.ID_ANY), 1, wx.ALIGN_CENTER)
|
||||
|
||||
|
||||
# Display table
|
||||
col = 0
|
||||
row = 0
|
||||
sizerResistances = wx.GridBagSizer(4, 6)
|
||||
contentSizer.Add( sizerResistances, 0, wx.EXPAND , 0)
|
||||
|
||||
for i in xrange(6):
|
||||
sizerResistances.AddGrowableCol(i + 1)
|
||||
|
||||
|
||||
|
||||
# Add an empty label, then the rest.
|
||||
sizerResistances.Add(wx.StaticText(contentPanel, wx.ID_ANY), wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ))
|
||||
col+=1
|
||||
for damageType in ("em", "thermal", "kinetic", "explosive"):
|
||||
sizerResistances.Add(bitmapLoader.getStaticBitmap("%s_big" % damageType, contentPanel, "icons"), wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER)
|
||||
col+=1
|
||||
|
||||
sizerResistances.Add(wx.StaticText(contentPanel, wx.ID_ANY, "EHP"), wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER)
|
||||
col=0
|
||||
row+=1
|
||||
|
||||
gaugeColours=( ((38,133,198),(52,86,98)), ((198,38,38),(83,65,67)), ((163,163,163),(74,90,93)), ((198,133,38),(81,83,67)) )
|
||||
|
||||
for tankType in ("shield", "armor", "hull", "separator", "damagePattern"):
|
||||
if tankType != "separator":
|
||||
sizerResistances.Add(bitmapLoader.getStaticBitmap("%s_big" % tankType, contentPanel, "icons"), wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER)
|
||||
col+=1
|
||||
|
||||
else:
|
||||
sizerResistances.Add(wx.StaticLine(contentPanel, wx.ID_ANY), wx.GBPosition( row, col ), wx.GBSpan( 1, 6 ), wx.EXPAND|wx.ALIGN_CENTER)
|
||||
row+=1
|
||||
col=0
|
||||
|
||||
continue
|
||||
currGColour=0
|
||||
|
||||
for damageType in ("em", "thermal", "kinetic", "explosive"):
|
||||
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
sizerResistances.Add(box, wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER)
|
||||
|
||||
|
||||
#Fancy gauges addon
|
||||
|
||||
pgColour= gaugeColours[currGColour]
|
||||
fc = pgColour[0]
|
||||
bc = pgColour[1]
|
||||
currGColour+=1
|
||||
|
||||
lbl = PG.PyGauge(contentPanel, wx.ID_ANY, 100)
|
||||
lbl.SetMinSize((48, 16))
|
||||
lbl.SetBackgroundColour(wx.Colour(bc[0],bc[1],bc[2]))
|
||||
lbl.SetBarColour(wx.Colour(fc[0],fc[1],fc[2]))
|
||||
lbl.SetBarGradient()
|
||||
lbl.SetFractionDigits(1)
|
||||
|
||||
setattr(self, "labelResistance%s%s" % (tankType.capitalize(), damageType.capitalize()), lbl)
|
||||
box.Add(lbl, 0, wx.ALIGN_CENTER)
|
||||
|
||||
col+=1
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
box.SetMinSize(wx.Size(self.getTextExtentW("WWWWk"), -1))
|
||||
|
||||
lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0" if tankType != "damagePattern" else "")
|
||||
box.Add(lbl, 0, wx.ALIGN_CENTER)
|
||||
|
||||
setattr(self, "labelResistance%sEhp" % tankType.capitalize(), lbl)
|
||||
sizerResistances.Add(box, wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER)
|
||||
row+=1
|
||||
col=0
|
||||
|
||||
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
#If we did anything intresting, we'd update our labels to reflect the new fit's stats here
|
||||
|
||||
for tankType in ("shield", "armor", "hull"):
|
||||
for damageType in ("em", "thermal", "kinetic", "explosive"):
|
||||
if fit is not None:
|
||||
resonanceType = tankType if tankType != "hull" else ""
|
||||
resonance = "%s%sDamageResonance" % (resonanceType, damageType.capitalize())
|
||||
resonance = resonance[0].lower() + resonance[1:]
|
||||
resonance = (1 - fit.ship.getModifiedItemAttr(resonance)) * 100
|
||||
else:
|
||||
resonance = 0
|
||||
|
||||
lbl = getattr(self, "labelResistance%s%s" % (tankType.capitalize(), damageType.capitalize()))
|
||||
|
||||
lbl.SetValue(resonance)
|
||||
|
||||
ehp = fit.ehp if fit is not None else None
|
||||
total = 0
|
||||
for tankType in ("shield", "armor", "hull"):
|
||||
lbl = getattr(self, "labelResistance%sEhp" % tankType.capitalize())
|
||||
if ehp is not None:
|
||||
total += ehp[tankType]
|
||||
lbl.SetLabel(formatAmount(ehp[tankType], 3, 0, 9))
|
||||
lbl.SetToolTip(wx.ToolTip("%s: %d" % (tankType.capitalize(), ehp[tankType])))
|
||||
else:
|
||||
lbl.SetLabel("0")
|
||||
|
||||
|
||||
self.labelEhp.SetLabel("%s" % formatAmount(total, 3, 0, 9))
|
||||
self.labelEhp.SetToolTip(wx.ToolTip("Effective: %d" % total))
|
||||
|
||||
damagePattern = fit.damagePattern if fit is not None else None
|
||||
for damageType in ("em", "thermal", "kinetic", "explosive"):
|
||||
lbl = getattr(self, "labelResistanceDamagepattern%s" % damageType.capitalize())
|
||||
if damagePattern:
|
||||
lbl.SetLabel("%.2f" % getattr(damagePattern, "%sAmount" % damageType))
|
||||
else:
|
||||
lbl.SetLabel("0.00")
|
||||
|
||||
builtinStatsViews.registerView(ResistancesViewFull)
|
||||
185
builtinStatsViews/resourcesViewFull.py
Normal file
185
builtinStatsViews/resourcesViewFull.py
Normal file
@@ -0,0 +1,185 @@
|
||||
#===============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
import wx
|
||||
from gui.statsView import StatsView
|
||||
from gui import builtinStatsViews
|
||||
|
||||
from gui.pyfatogglepanel import TogglePanel
|
||||
from gui import bitmapLoader
|
||||
from gui import pygauge as PG
|
||||
|
||||
from eos.types import Slot, Hardpoint
|
||||
|
||||
from util import formatAmount
|
||||
|
||||
class ResourcesViewFull(StatsView):
|
||||
name = "resourcesViewFull"
|
||||
def __init__(self, parent):
|
||||
StatsView.__init__(self)
|
||||
self.parent = parent
|
||||
def getHeaderText(self, fit):
|
||||
return "Resources"
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent( text )
|
||||
return width
|
||||
|
||||
def populatePanel(self, contentPanel, headerPanel):
|
||||
|
||||
contentSizer = contentPanel.GetSizer()
|
||||
sizerResources = wx.BoxSizer(wx.HORIZONTAL)
|
||||
contentSizer.Add( sizerResources, 0, wx.EXPAND, 0)
|
||||
|
||||
parent = contentPanel
|
||||
panel = "full"
|
||||
|
||||
|
||||
sizer = wx.FlexGridSizer(3, 2)
|
||||
sizer.SetMinSize(wx.Size(27 + self.getTextExtentW("400/400"), 0))
|
||||
for i in xrange(3):
|
||||
sizer.AddGrowableCol(i + 1)
|
||||
|
||||
base = sizerResources
|
||||
base.Add(sizer, 0, wx.ALIGN_CENTER)
|
||||
|
||||
#Turrets & launcher hardslots display
|
||||
for type in ("turret", "launcher", "calibration"):
|
||||
bitmap = bitmapLoader.getStaticBitmap("%s_big" % type, parent, "icons")
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
sizer.Add(bitmap, 0, wx.ALIGN_CENTER)
|
||||
sizer.Add(box, 0, wx.ALIGN_CENTER_VERTICAL)
|
||||
|
||||
suffix = "Points" if type == "calibration" else "Hardpoints"
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
||||
setattr(self, "label%sUsed%s%s" % (panel.capitalize(), type.capitalize(), suffix.capitalize()), lbl)
|
||||
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
box.Add(wx.StaticText(parent, wx.ID_ANY, "/"), 0, wx.ALIGN_LEFT)
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
||||
setattr(self, "label%sTotal%s%s" % (panel.capitalize(), type.capitalize(), suffix.capitalize()), lbl)
|
||||
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
st = wx.VERTICAL
|
||||
base.Add(wx.StaticLine(parent, wx.ID_ANY, style=st), 0, wx.EXPAND | wx.LEFT, 3 if panel == "full" else 0)
|
||||
|
||||
|
||||
#PG, Cpu & drone stuff
|
||||
for i, group in enumerate((("cpu", "pg"), ("droneBay", "droneBandwidth"))):
|
||||
main = wx.BoxSizer(wx.VERTICAL)
|
||||
base.Add(main, 1 , wx.ALIGN_CENTER)
|
||||
|
||||
for type in group:
|
||||
capitalizedType = type[0].capitalize() + type[1:]
|
||||
bitmap = bitmapLoader.getStaticBitmap(type + "_big", parent, "icons")
|
||||
|
||||
stats = wx.BoxSizer(wx.VERTICAL)
|
||||
absolute = wx.BoxSizer(wx.HORIZONTAL)
|
||||
stats.Add(absolute, 0, wx.EXPAND)
|
||||
|
||||
|
||||
b = wx.BoxSizer(wx.HORIZONTAL)
|
||||
main.Add(b, 1, wx.ALIGN_CENTER)
|
||||
|
||||
b.Add(bitmap, 0, wx.ALIGN_BOTTOM)
|
||||
|
||||
b.Add(stats, 1, wx.EXPAND)
|
||||
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
||||
setattr(self, "label%sUsed%s" % (panel.capitalize(), capitalizedType), lbl)
|
||||
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
absolute.Add(wx.StaticText(parent, wx.ID_ANY, "/"), 0, wx.ALIGN_LEFT)
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
||||
setattr(self, "label%sTotal%s" % (panel.capitalize(), capitalizedType), lbl)
|
||||
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
units = {"cpu":" tf", "pg":" MW", "droneBandwidth":" mbit/s", "droneBay":u" m\u00B3"}
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "%s" % units[type])
|
||||
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
# Gauges modif. - Darriele
|
||||
|
||||
gauge = PG.PyGauge(parent, wx.ID_ANY, 100)
|
||||
gauge.SetMinSize((self.getTextExtentW("999.9k/1.3M GJ"), 23))
|
||||
gauge.SetFractionDigits(2)
|
||||
|
||||
setattr(self, "gauge%s%s" % (panel.capitalize(),capitalizedType), gauge)
|
||||
stats.Add(gauge, 0, wx.ALIGN_CENTER)
|
||||
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
#If we did anything intresting, we'd update our labels to reflect the new fit's stats here
|
||||
|
||||
stats = (("label%sUsedTurretHardpoints", lambda: fit.getHardpointsUsed(Hardpoint.TURRET), 0, 0, 0),
|
||||
("label%sTotalTurretHardpoints", lambda: fit.ship.getModifiedItemAttr('turretSlotsLeft'), 0, 0, 0),
|
||||
("label%sUsedLauncherHardpoints", lambda: fit.getHardpointsUsed(Hardpoint.MISSILE), 0, 0, 0),
|
||||
("label%sTotalLauncherHardpoints", lambda: fit.ship.getModifiedItemAttr('launcherSlotsLeft'), 0, 0, 0),
|
||||
("label%sUsedCalibrationPoints", lambda: fit.calibrationUsed, 0, 0, 0),
|
||||
("label%sTotalCalibrationPoints", lambda: fit.ship.getModifiedItemAttr('upgradeCapacity'), 0, 0, 0),
|
||||
("label%sUsedPg", lambda: fit.pgUsed, 4, 0, 9),
|
||||
("label%sUsedCpu", lambda: fit.cpuUsed, 4, 0, 9),
|
||||
("label%sTotalPg", lambda: fit.ship.getModifiedItemAttr("powerOutput"), 4, 0, 9),
|
||||
("label%sTotalCpu", lambda: fit.ship.getModifiedItemAttr("cpuOutput"), 4, 0, 9))
|
||||
|
||||
panel = "Full"
|
||||
for labelName, value, prec, lowest, highest in stats:
|
||||
label = getattr(self, labelName % panel)
|
||||
value = value() if fit is not None else 0
|
||||
value = value if value is not None else 0
|
||||
if isinstance(value, basestring):
|
||||
label.SetLabel(value)
|
||||
label.SetToolTip(wx.ToolTip(value))
|
||||
else:
|
||||
label.SetLabel(formatAmount(value, prec, lowest, highest))
|
||||
label.SetToolTip(wx.ToolTip("%.1f" % value))
|
||||
if fit is not None:
|
||||
resMax = (lambda: fit.ship.getModifiedItemAttr("cpuOutput"),
|
||||
lambda: fit.ship.getModifiedItemAttr("powerOutput"),
|
||||
lambda: fit.ship.getModifiedItemAttr("droneCapacity"),
|
||||
lambda: fit.ship.getModifiedItemAttr("droneBandwidth"))
|
||||
|
||||
i = 0
|
||||
for resourceType in ("cpu", "pg", "droneBay", "droneBandwidth"):
|
||||
if fit is not None:
|
||||
capitalizedType = resourceType[0].capitalize() + resourceType[1:]
|
||||
|
||||
gauge = getattr(self, "gauge%s%s" % (panel, capitalizedType))
|
||||
resUsed = getattr(fit,"%sUsed" % resourceType)
|
||||
|
||||
if resMax[i]() > 0:
|
||||
gauge.SetRange(resMax[i]())
|
||||
gauge.SetValue(resUsed)
|
||||
i+=1
|
||||
else:
|
||||
capitalizedType = resourceType[0].capitalize() + resourceType[1:]
|
||||
|
||||
gauge = getattr(self, "gauge%s%s" % (panel, capitalizedType))
|
||||
|
||||
gauge.SetRange(100)
|
||||
gauge.SetValue(0)
|
||||
i+=1
|
||||
|
||||
|
||||
|
||||
builtinStatsViews.registerView(ResourcesViewFull)
|
||||
127
builtinStatsViews/targetingmiscViewFull.py
Normal file
127
builtinStatsViews/targetingmiscViewFull.py
Normal file
@@ -0,0 +1,127 @@
|
||||
#===============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
import wx
|
||||
from gui.statsView import StatsView
|
||||
from gui import builtinStatsViews
|
||||
|
||||
from gui.pyfatogglepanel import TogglePanel
|
||||
from gui import bitmapLoader
|
||||
from gui import pygauge as PG
|
||||
|
||||
from eos.types import Slot, Hardpoint
|
||||
|
||||
from util import formatAmount
|
||||
|
||||
class TargetingMiscViewFull(StatsView):
|
||||
name = "targetingmiscViewFull"
|
||||
def __init__(self, parent):
|
||||
StatsView.__init__(self)
|
||||
self.parent = parent
|
||||
def getHeaderText(self, fit):
|
||||
return "Targeting && Misc"
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent( text )
|
||||
return width
|
||||
|
||||
def populatePanel(self, contentPanel, headerPanel):
|
||||
|
||||
contentSizer = contentPanel.GetSizer()
|
||||
|
||||
|
||||
parent = contentPanel
|
||||
panel = "full"
|
||||
gridTargetingMisc = wx.FlexGridSizer(1, 3)
|
||||
contentSizer.Add( gridTargetingMisc, 0, wx.EXPAND | wx.ALL, 0)
|
||||
gridTargetingMisc.AddGrowableCol(0)
|
||||
gridTargetingMisc.AddGrowableCol(2)
|
||||
# Targeting
|
||||
|
||||
gridTargeting = wx.FlexGridSizer(4, 2)
|
||||
gridTargeting.AddGrowableCol(1)
|
||||
|
||||
gridTargetingMisc.Add(gridTargeting, 0, wx.ALIGN_LEFT | wx.ALL, 5)
|
||||
|
||||
labels = (("Targets", "Targets", ""),
|
||||
("Range", "Range", "km"),
|
||||
("Scan res.", "ScanRes", "mm"),
|
||||
("Sensor str.", "SensorStr", ""))
|
||||
|
||||
for header, labelShort, unit in labels:
|
||||
gridTargeting.Add(wx.StaticText(contentPanel, wx.ID_ANY, "%s: " % header), 0, wx.ALIGN_LEFT)
|
||||
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
gridTargeting.Add(box, 0, wx.ALIGN_LEFT)
|
||||
|
||||
lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0")
|
||||
setattr(self, "label%s" % labelShort, lbl)
|
||||
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
lblUnit = wx.StaticText(contentPanel, wx.ID_ANY, " %s" % unit)
|
||||
setattr(self, "labelUnit%s" % labelShort, lblUnit)
|
||||
box.Add(lblUnit, 0, wx.ALIGN_LEFT)
|
||||
|
||||
# Misc
|
||||
gridTargetingMisc.Add( wx.StaticLine( contentPanel, wx.ID_ANY, style = wx.VERTICAL),0, wx.EXPAND, 3 )
|
||||
gridMisc = wx.FlexGridSizer(4, 2)
|
||||
gridMisc.AddGrowableCol(1)
|
||||
gridTargetingMisc.Add(gridMisc,0 , wx.ALIGN_LEFT | wx.ALL, 5)
|
||||
|
||||
labels = (("Speed", "Speed", "m/s"),
|
||||
("Align time", "AlignTime", "s"),
|
||||
("Cargo", "Cargo", u"m\u00B3"),
|
||||
("Signature", "SigRadius", "m"))
|
||||
|
||||
for header, labelShort, unit in labels:
|
||||
gridMisc.Add(wx.StaticText(contentPanel, wx.ID_ANY, "%s: " % header), 0, wx.ALIGN_LEFT)
|
||||
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
gridMisc.Add(box, 0, wx.ALIGN_LEFT)
|
||||
|
||||
lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0")
|
||||
setattr(self, "labelFull%s" % labelShort, lbl)
|
||||
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
lblUnit = wx.StaticText(contentPanel, wx.ID_ANY, " %s" % unit)
|
||||
setattr(self, "labelFullUnit%s" % labelShort, lblUnit)
|
||||
box.Add(lblUnit, 0, wx.ALIGN_LEFT)
|
||||
|
||||
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
#If we did anything intresting, we'd update our labels to reflect the new fit's stats here
|
||||
|
||||
stats = (("labelTargets", lambda: fit.maxTargets, 3, 0, 0),
|
||||
("labelRange", lambda: fit.ship.getModifiedItemAttr('maxTargetRange') / 1000, 3, 0, 0),
|
||||
("labelScanRes", lambda: fit.ship.getModifiedItemAttr('scanResolution'), 3, 0, 0),
|
||||
("labelSensorStr", lambda: fit.scanStrength, 3, 0, 0),
|
||||
("labelFullCargo", lambda: fit.extraAttributes["capacity"], 3, 0, 9),
|
||||
("labelFullSigRadius", lambda: fit.ship.getModifiedItemAttr("signatureRadius"), 3, 0, 9),
|
||||
("labelFullSpeed", lambda: fit.ship.getModifiedItemAttr("maxVelocity"), 3, 0, 0),
|
||||
("labelFullAlignTime", lambda: fit.alignTime, 3, 0, 0))
|
||||
|
||||
for labelName, value, prec, lowest, highest in stats:
|
||||
label = getattr(self, labelName)
|
||||
value = value() if fit is not None else 0
|
||||
value = value if value is not None else 0
|
||||
label.SetLabel(formatAmount(value, prec, lowest, highest))
|
||||
label.SetToolTip(wx.ToolTip("%.1f" % value))
|
||||
|
||||
builtinStatsViews.registerView(TargetingMiscViewFull)
|
||||
60
builtinStatsViews/templateViewFull.py
Normal file
60
builtinStatsViews/templateViewFull.py
Normal file
@@ -0,0 +1,60 @@
|
||||
#===============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
import wx
|
||||
from gui.statsView import StatsView
|
||||
from gui import builtinStatsViews
|
||||
|
||||
from gui.pyfatogglepanel import TogglePanel
|
||||
from gui import bitmapLoader
|
||||
from gui import pygauge as PG
|
||||
|
||||
from eos.types import Slot, Hardpoint
|
||||
|
||||
from util import formatAmount
|
||||
|
||||
class FirepowerViewFull(StatsView):
|
||||
name = "firepowerViewFull"
|
||||
def __init__(self, parent):
|
||||
StatsView.__init__(self)
|
||||
self.parent = parent
|
||||
def getHeaderText(self, fit):
|
||||
return "Firepower"
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent( text )
|
||||
return width
|
||||
|
||||
def populatePanel(self, contentPanel):
|
||||
|
||||
contentSizer = contentPanel.GetSizer()
|
||||
|
||||
|
||||
parent = contentPanel
|
||||
panel = "full"
|
||||
contentSizer.Add( sizerResources, 0, wx.EXPAND | wx.ALL, 0)
|
||||
|
||||
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
#If we did anything intresting, we'd update our labels to reflect the new fit's stats here
|
||||
|
||||
pass
|
||||
|
||||
builtinStatsViews.registerView(FirepowerViewFull)
|
||||
Reference in New Issue
Block a user