Moar fixes in eve-like gauges ctrls

This commit is contained in:
HomeWorld
2010-08-28 18:02:09 +03:00
committed by cncfanatics
parent 66d60892fb
commit 5b18702a3b
2 changed files with 9 additions and 8 deletions

View File

@@ -204,9 +204,9 @@ class PyGauge(wx.PyWindow):
self._value = list(value)
self.SortForDisplay()
self.Refresh()
for v in self._value:
if v <= 0 or v > self._range:
if v < 0 or v > self._range:
raise Exception("ERROR:\n Gauge value must be between 0 and it's range. ")
@@ -312,6 +312,7 @@ class PyGauge(wx.PyWindow):
"""
time=abs(value)*50
if time>500: time=500
if time == 0: time=500
if type(value) != type([]):
value = [value]

View File

@@ -99,9 +99,12 @@ class StatsPane(wx.Panel):
resonance = (1 - fit.ship.getModifiedItemAttr(resonance)) * 100
else:
resonance = 0
lbl = getattr(self, "labelResistance%s%s" % (tankType.capitalize(), damageType.capitalize()))
lbl.SetLabel("%.2f" % resonance)
if self._showNormalGauges == True:
lbl.SetLabel("%.2f" % resonance)
else:
lbl.Update(resonance-lbl.GetValue(),250)
ehp = fit.ehp if fit is not None else None
for tankType in ("shield", "armor", "hull"):
@@ -119,7 +122,6 @@ class StatsPane(wx.Panel):
else:
lbl.SetLabel("0.00")
for stability in ("reinforced", "sustained"):
if stability == "reinforced" and fit != None:
tank = fit.sustainableTank
@@ -272,8 +274,6 @@ class StatsPane(wx.Panel):
if self._showNormalGauges == True:
gauge = wx.Gauge(parent, wx.ID_ANY, 100)
gauge.SetMinSize((80, 20))
setattr(self, "gauge%s" % capitalizedType, gauge)
stats.Add(gauge, 0, wx.ALIGN_CENTER)
else:
gauge = PG.PyGauge(parent, wx.ID_ANY, 100)
gauge.SetMinSize((80, 16))
@@ -340,7 +340,7 @@ class StatsPane(wx.Panel):
lbl = wx.StaticText(self.fullPanel, wx.ID_ANY, "0.00")
else:
lbl = PG.PyGauge(self.fullPanel, wx.ID_ANY, 100)
lbl.SetMinSize((40, 16))
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()