Text align fix + removal of early polish applied to statspane gauges

This commit is contained in:
HomeWorld
2010-08-28 18:56:20 +03:00
committed by cncfanatics
parent 4e385f334e
commit 6ac2e677ae
2 changed files with 7 additions and 10 deletions

View File

@@ -264,14 +264,14 @@ class PyGauge(wx.PyWindow):
dc.DrawRectangleRect(r)
dc.SetTextForeground(wx.Colour(255,255,255))
font1 = wx.Font(7, wx.SWISS, wx.NORMAL, wx.NORMAL)
font1 = wx.Font(9, wx.MODERN, wx.NORMAL, wx.NORMAL)
dc.SetFont(font1)
if self._skipDigits == True:
textWidth=len(str(int(self._value[0]*100/self._range)) + "%") * 7
dc.DrawText(str(int(self._value[0]*100/self._range)) + "%",rect.width/2-textWidth/2,(rect.height-8)/2)
textWidth=len(str(int(self._value[0]*100/self._range)) + "%") * 9
dc.DrawText(str(int(self._value[0]*100/self._range)) + "%",(rect.width-2)/2 - textWidth/4,(rect.height-11)/2)
else:
textWidth=len(str(round(float(self._value[0]*100/self._range),1))+ "%") * 7
dc.DrawText(str(round(float(self._value[0]*100/self._range),1)) + "%",rect.width/2-textWidth/2,(rect.height-8)/2)
textWidth=len(str(round(float(self._value[0]*100/self._range),1))+ "%")*9
dc.DrawText(str(round(float(self._value[0]*100/self._range),1)) + "%",(rect.width-2)/2-textWidth/4,(rect.height-11)/2)
def OnTimer(self,event):
"""

View File

@@ -104,7 +104,7 @@ class StatsPane(wx.Panel):
if self._showNormalGauges == True:
lbl.SetLabel("%.2f" % resonance)
else:
lbl.Update(resonance-lbl.GetValue(),250)
lbl.SetValue(resonance)
ehp = fit.ehp if fit is not None else None
for tankType in ("shield", "armor", "hull"):
@@ -278,8 +278,6 @@ class StatsPane(wx.Panel):
gauge = PG.PyGauge(parent, wx.ID_ANY, 100)
gauge.SetMinSize((80, 16))
gauge.SetSkipDigitsFlag(True)
gauge.SetValue(100)
gauge.Update(-100,250)
setattr(self, "gauge%s" % capitalizedType, gauge)
stats.Add(gauge, 0, wx.ALIGN_CENTER)
@@ -345,9 +343,8 @@ class StatsPane(wx.Panel):
lbl.SetBackgroundColour(wx.Colour(bc[0],bc[1],bc[2]))
lbl.SetBarColour(wx.Colour(fc[0],fc[1],fc[2]))
lbl.SetBarGradient()
lbl.SetValue(100)
lbl.SetSkipDigitsFlag(False)
lbl.Update(-100,250)
setattr(self, "labelResistance%s%s" % (tankType.capitalize(), damageType.capitalize()), lbl)
box.Add(lbl, 0, wx.ALIGN_CENTER)