From 13996d777076149d50c8d6ca01959741151c56b1 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 15 Feb 2017 18:50:35 -0800 Subject: [PATCH] Stupid change list making me miss files. --- gui/builtinStatsViews/outgoingViewFull.py | 121 +++++++--------------- 1 file changed, 37 insertions(+), 84 deletions(-) diff --git a/gui/builtinStatsViews/outgoingViewFull.py b/gui/builtinStatsViews/outgoingViewFull.py index 75734e24e..5a693aae9 100644 --- a/gui/builtinStatsViews/outgoingViewFull.py +++ b/gui/builtinStatsViews/outgoingViewFull.py @@ -1,4 +1,4 @@ -#=============================================================================== +# =============================================================================== # Copyright (C) 2014 Alexandros Kosiaris # # This file is part of pyfa. @@ -15,26 +15,28 @@ # # You should have received a copy of the GNU General Public License # along with pyfa. If not, see . -#=============================================================================== +# =============================================================================== +# noinspection PyPackageRequirements import wx -import service -import gui.mainFrame from gui.statsView import StatsView -from gui import bitmapLoader +from gui.bitmapLoader import BitmapLoader from gui.utils.numberFormatter import formatAmount + class OutgoingViewFull(StatsView): name = "outgoingViewFull" + def __init__(self, parent): StatsView.__init__(self) self.parent = parent self._cachedValues = [] + def getHeaderText(self, fit): - return "Outgoing" + return "Remote Reps" def getTextExtentW(self, text): - width, height = self.parent.GetTextExtent( text ) + width, height = self.parent.GetTextExtent(text) return width def populatePanel(self, contentPanel, headerPanel): @@ -44,96 +46,46 @@ class OutgoingViewFull(StatsView): panel = "full" - sizerOutgoing = wx.FlexGridSizer(1, 6) - sizerOutgoing.AddGrowableCol(1) + sizerOutgoing = wx.GridSizer(1, 4) - contentSizer.Add( sizerOutgoing, 0, wx.EXPAND, 0) + contentSizer.Add(sizerOutgoing, 0, wx.EXPAND, 0) counter = 0 - for outgoingType, label, image in (("remoteArmor","Armor RR","armorActive") , ("remoteShield","Shield RR","shieldActive")): - baseBox = wx.BoxSizer(wx.HORIZONTAL) - sizerOutgoing.Add(baseBox, 1, wx.ALIGN_LEFT if counter == 0 else wx.ALIGN_CENTER_HORIZONTAL) + rr_list = [ + ("RemoteArmor", "Armor RR", "armorActive"), + ("RemoteShield", "Shield RR", "shieldActive"), + ("RemoteHull", "Hull RR", "hullActive"), + ("RemoteCapacitor", "Capacitor RR", "capacitorInfo"), + ] - baseBox.Add(bitmapLoader.getStaticBitmap("%s_big" % image, parent, "icons"), 0, wx.ALIGN_CENTER) + for outgoingType, label, image in rr_list: + baseBox = wx.BoxSizer(wx.VERTICAL) - box = wx.BoxSizer(wx.VERTICAL) - baseBox.Add(box, 0, wx.ALIGN_CENTER) + baseBox.Add(BitmapLoader.getStaticBitmap("%s_big" % image, parent, "gui"), 0, wx.ALIGN_CENTER) - box.Add(wx.StaticText(parent, wx.ID_ANY, label), 0, wx.ALIGN_LEFT) + if "Capacitor" in label: + lbl = wx.StaticText(parent, wx.ID_ANY, u"0 GJ/s") + else: + lbl = wx.StaticText(parent, wx.ID_ANY, u"0 HP/s") - hbox = wx.BoxSizer(wx.HORIZONTAL) - box.Add(hbox, 1, wx.ALIGN_CENTER) + setattr(self, "label%s" % outgoingType, lbl) - lbl = wx.StaticText(parent, wx.ID_ANY, u"0.0 HP/s") - setattr(self, "label%soutgoing%s" % (panel.capitalize() ,outgoingType.capitalize()), lbl) - - hbox.Add(lbl, 0, wx.ALIGN_CENTER) + baseBox.Add(lbl, 0, wx.ALIGN_CENTER) self._cachedValues.append(0) counter += 1 - targetSizer = sizerOutgoing - - baseBox = wx.BoxSizer(wx.HORIZONTAL) - targetSizer.Add(baseBox, 0, wx.ALIGN_RIGHT) - - baseBox.Add(bitmapLoader.getStaticBitmap("capacitorInfo_big", parent, "icons"), 0, wx.ALIGN_CENTER) - - gridS = wx.GridSizer(2,2,0,0) - - baseBox.Add(gridS, 0) - - lbl = wx.StaticText(parent, wx.ID_ANY, "0.0 GJ/s") - setattr(self, "label%soutgoingRemotecapacitor" % panel.capitalize(), lbl) - gridS.Add(wx.StaticText(parent, wx.ID_ANY, " +CAP: "), 0, wx.ALL | wx.ALIGN_RIGHT) - gridS.Add(lbl, 0, wx.ALIGN_LEFT) - - self._cachedValues.append(0) - - lbl = wx.StaticText(parent, wx.ID_ANY, "0.0 GJ/s") - setattr(self, "label%soutgoingNeuting" % panel.capitalize(), lbl) - gridS.Add(wx.StaticText(parent, wx.ID_ANY, " Neut: "), 0, wx.ALL | wx.ALIGN_RIGHT) - - self._cachedValues.append(0) - - gridS.Add(lbl, 0, wx.ALIGN_LEFT) - - image = bitmapLoader.getBitmap("turret_small", "icons") - firepower = wx.BitmapButton(contentPanel, -1, image) - firepower.SetToolTip(wx.ToolTip("Click to toggle to Firepower View")) - firepower.Bind(wx.EVT_BUTTON, self.switchToFirepowerView) - sizerOutgoing.Add(firepower, 0, wx.ALIGN_LEFT) - - self._cachedValues.append(0) - - def switchToFirepowerView(self, event): - # Getting the active fit - mainFrame = gui.mainFrame.MainFrame.getInstance() - sFit = service.Fit.getInstance() - fit = sFit.getFit(mainFrame.getActiveFit()) - # Remove ourselves from statsPane's view list - self.parent.views.remove(self) - self._cachedValues = [] - # And no longer display us - self.panel.GetSizer().Clear(True) - self.panel.GetSizer().Layout() - # Get the new view - view = StatsView.getView("firepowerViewFull")(self.parent) - view.populatePanel(self.panel, self.headerPanel) - # Populate us in statsPane's view list - self.parent.views.append(view) - # Get the TogglePanel - tp = self.panel.GetParent() - tp.SetLabel(view.getHeaderText(fit)) - view.refreshPanel(fit) + sizerOutgoing.Add(baseBox, 1, 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 + # If we did anything intresting, we'd update our labels to reflect the new fit's stats here - stats = (("labelFulloutgoingRemotearmor", lambda: fit.armorRR, 3, 0, 0, u"%s HP/s", None), - ("labelFulloutgoingRemoteshield", lambda: fit.shieldRR, 3, 0, 0, u"%s HP/s", None), - ("labelFulloutgoingRemotecapacitor", lambda: fit.captransfer, 3, 0, 0, u"%s GJ/s",None), - ("labelFulloutgoingNeuting", lambda: fit.neut, 3, 0, 0, u"%s GJ/s", None)) + stats = [ + ("labelRemoteArmor", lambda: fit.remoteReps["Armor"], 3, 0, 0, u"%s HP/s", None), + ("labelRemoteShield", lambda: fit.remoteReps["Shield"], 3, 0, 0, u"%s HP/s", None), + ("labelRemoteHull", lambda: fit.remoteReps["Hull"], 3, 0, 0, u"%s HP/s", None), + ("labelRemoteCapacitor", lambda: fit.remoteReps["Capacitor"], 3, 0, 0, u"%s GJ/s", None), + ] counter = 0 for labelName, value, prec, lowest, highest, valueFormat, altFormat in stats: @@ -146,8 +98,9 @@ class OutgoingViewFull(StatsView): tipStr = valueFormat % valueStr if altFormat is None else altFormat % value label.SetToolTip(wx.ToolTip(tipStr)) self._cachedValues[counter] = value - counter +=1 + counter += 1 self.panel.Layout() self.headerPanel.Layout() - + + OutgoingViewFull.register()