Remove some debug code and fixup Layout() calls in statviews

This commit is contained in:
cncfanatics
2010-09-11 14:53:27 +02:00
parent 2bb7abca11
commit 21e4ae2a52
11 changed files with 17 additions and 113 deletions

View File

@@ -236,6 +236,4 @@ class Market():
wx.CallAfter(callback, all)
wx.CallAfter(dbAdd)
print map(lambda p: p.typeID, fetch)
print map(lambda p: p.typeID, new)
self.workerThread.trigger(fetch, cb)

View File

@@ -36,25 +36,16 @@ class CapacitorViewFull(StatsView):
return width
def populatePanel(self, contentPanel, headerPanel):
contentSizer = contentPanel.GetSizer()
parent = contentPanel
parent = self.panel = 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)
@@ -68,7 +59,6 @@ class CapacitorViewFull(StatsView):
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)
@@ -139,5 +129,6 @@ class CapacitorViewFull(StatsView):
getattr(self, lblNameTime % panel).SetLabel(t)
getattr(self, lblNameState % panel).SetLabel(s)
self.panel.Layout()
builtinStatsViews.registerView(CapacitorViewFull)

View File

@@ -36,23 +36,16 @@ class FirepowerViewFull(StatsView):
return width
def populatePanel(self, contentPanel, headerPanel):
contentSizer = contentPanel.GetSizer()
parent = contentPanel
parent = self.panel = 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)
@@ -73,7 +66,6 @@ class FirepowerViewFull(StatsView):
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)
@@ -95,8 +87,6 @@ class FirepowerViewFull(StatsView):
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
@@ -112,5 +102,6 @@ class FirepowerViewFull(StatsView):
label.SetLabel(formatAmount(value, prec, lowest, highest))
label.SetToolTip(wx.ToolTip("%.1f" % value))
self.panel.Layout()
builtinStatsViews.registerView(FirepowerViewFull)

View File

@@ -39,8 +39,7 @@ class PriceViewFull(StatsView):
def populatePanel(self, contentPanel, headerPanel):
contentSizer = contentPanel.GetSizer()
parent = contentPanel
panel = "full"
self.panel = contentPanel
gridPrice = wx.GridSizer(1, 3)
contentSizer.Add( gridPrice, 0, wx.EXPAND | wx.ALL, 0)
for type in ("ship", "fittings", "total"):
@@ -65,7 +64,6 @@ class PriceViewFull(StatsView):
hbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, " m ISK"), 0, wx.ALIGN_LEFT)
def refreshPanel(self, fit):
print "r"
if fit is not None:
# Compose a list of all the data we need & request it
typeIDs = []
@@ -85,6 +83,7 @@ class PriceViewFull(StatsView):
self.labelPriceShip.SetLabel("0.0")
self.labelPriceFittings.SetLabel("0.0")
self.labelPriceTotal.SetLabel("0.0")
self.panel.Layout()
def processPrices(self, prices):
shipPrice = prices[0].price
@@ -92,5 +91,6 @@ class PriceViewFull(StatsView):
self.labelPriceShip.SetLabel(formatAmount(shipPrice, 3, 3, 9))
self.labelPriceFittings.SetLabel(formatAmount(modPrice, 3, 3, 9))
self.labelPriceTotal.SetLabel(formatAmount(shipPrice + modPrice, 3, 3, 9))
self.panel.Layout()
builtinStatsViews.registerView(PriceViewFull)

View File

@@ -36,18 +36,13 @@ class RechargeViewFull(StatsView):
return width
def populatePanel(self, contentPanel, headerPanel):
contentSizer = contentPanel.GetSizer()
parent = contentPanel
panel = "full"
self.panel = contentPanel
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.
@@ -103,7 +98,7 @@ class RechargeViewFull(StatsView):
label.SetLabel("0")
label.SetToolTip(wx.ToolTip("%.3f" % value))
self.panel.Layout()
builtinStatsViews.registerView(RechargeViewFull)

View File

@@ -37,16 +37,8 @@ class ResistancesViewFull(StatsView):
return width
def populatePanel(self, contentPanel, headerPanel):
contentSizer = contentPanel.GetSizer()
parent = contentPanel
panel = "full"
# Resistances
self.panel = contentPanel
# Custom header EHP
headerContentSizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -66,7 +58,6 @@ class ResistancesViewFull(StatsView):
headerContentSizer.Add( stCls )
# headerContentSizer.Add(wx.StaticLine(headerPanel, wx.ID_ANY), 1, wx.ALIGN_CENTER)
# Display table
col = 0
row = 0
@@ -76,8 +67,6 @@ class ResistancesViewFull(StatsView):
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
@@ -181,4 +170,6 @@ class ResistancesViewFull(StatsView):
else:
lbl.SetLabel("0.00")
self.panel.Layout()
builtinStatsViews.registerView(ResistancesViewFull)

View File

@@ -45,10 +45,9 @@ class ResourcesViewFull(StatsView):
sizerResources = wx.BoxSizer(wx.HORIZONTAL)
contentSizer.Add( sizerResources, 0, wx.EXPAND, 0)
parent = contentPanel
parent = self.panel = contentPanel
panel = "full"
sizer = wx.FlexGridSizer(3, 2)
sizer.SetMinSize(wx.Size(27 + self.getTextExtentW("400/400"), 0))
for i in xrange(3):
@@ -79,7 +78,6 @@ class ResourcesViewFull(StatsView):
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)
@@ -93,7 +91,6 @@ class ResourcesViewFull(StatsView):
absolute = wx.BoxSizer(wx.HORIZONTAL)
stats.Add(absolute, 0, wx.EXPAND)
b = wx.BoxSizer(wx.HORIZONTAL)
main.Add(b, 1, wx.ALIGN_CENTER)
@@ -101,7 +98,6 @@ class ResourcesViewFull(StatsView):
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)
@@ -125,7 +121,6 @@ class ResourcesViewFull(StatsView):
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
@@ -178,6 +173,6 @@ class ResourcesViewFull(StatsView):
gauge.SetValue(0)
i+=1
self.panel.Layout()
builtinStatsViews.registerView(ResourcesViewFull)

View File

@@ -35,12 +35,9 @@ class TargetingMiscViewFull(StatsView):
return width
def populatePanel(self, contentPanel, headerPanel):
contentSizer = contentPanel.GetSizer()
parent = contentPanel
panel = "full"
self.panel = contentPanel
gridTargetingMisc = wx.FlexGridSizer(1, 3)
contentSizer.Add( gridTargetingMisc, 0, wx.EXPAND | wx.ALL, 0)
gridTargetingMisc.AddGrowableCol(0)
@@ -117,4 +114,6 @@ class TargetingMiscViewFull(StatsView):
label.SetLabel(formatAmount(value, prec, lowest, highest))
label.SetToolTip(wx.ToolTip("%.1f" % value))
self.panel.Layout()
builtinStatsViews.registerView(TargetingMiscViewFull)

View File

@@ -1,52 +0,0 @@
#===============================================================================
# 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 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)

View File

@@ -45,7 +45,6 @@ class FittingView(d.Display):
#Gets called from the fitMultiSwitch when it decides its time
def changeFit(self, fitID):
print "c"
self.activeFitID = fitID
if fitID == None:
self.Hide()
@@ -55,7 +54,6 @@ class FittingView(d.Display):
wx.PostEvent(self.mainFrame, FitChanged(fitID=fitID))
def appendItem(self, itemID):
print "a"
fitID = self.activeFitID
if fitID != None:
cFit = controller.Fit.getInstance()
@@ -63,7 +61,6 @@ class FittingView(d.Display):
wx.PostEvent(self.mainFrame, FitChanged(fitID=fitID))
def removeItem(self, event):
print "i"
row, _ = self.HitTest(event.Position)
if row != -1:
cFit = controller.Fit.getInstance()

View File

@@ -32,7 +32,6 @@ class StatsPane(wx.Panel):
"capacitorViewFull", "targetingmiscViewFull", "priceViewFull"]
def fitChanged(self, event):
print "f"
cFit = controller.Fit.getInstance()
fit = cFit.getFit(event.fitID)
for view in self.views: