@@ -87,7 +87,6 @@ class PyGauge(wx.PyWindow):
|
|||||||
self._timerId = wx.NewId()
|
self._timerId = wx.NewId()
|
||||||
self._timer = None
|
self._timer = None
|
||||||
|
|
||||||
self._overdrive=0
|
|
||||||
self.SetBarGradient((wx.Colour(153,153,153),wx.Colour(204,204,204)))
|
self.SetBarGradient((wx.Colour(153,153,153),wx.Colour(204,204,204)))
|
||||||
self.SetBackgroundColour(wx.Colour(102,102,102))
|
self.SetBackgroundColour(wx.Colour(102,102,102))
|
||||||
|
|
||||||
@@ -206,12 +205,6 @@ class PyGauge(wx.PyWindow):
|
|||||||
|
|
||||||
self.SortForDisplay()
|
self.SortForDisplay()
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
if value > self._range:
|
|
||||||
self._overdrive = value
|
|
||||||
self._value[0] = self._range
|
|
||||||
else:
|
|
||||||
self._overdrive = value
|
|
||||||
|
|
||||||
for v in self._value:
|
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. ")
|
raise Exception("ERROR:\n Gauge value must be between 0 and it's range. ")
|
||||||
@@ -256,11 +249,7 @@ class PyGauge(wx.PyWindow):
|
|||||||
|
|
||||||
if self.GetBarGradient():
|
if self.GetBarGradient():
|
||||||
for i, gradient in enumerate(self._barGradientSorted):
|
for i, gradient in enumerate(self._barGradientSorted):
|
||||||
if self._overdrive > self._range:
|
c1,c2 = gradient
|
||||||
c1 =wx.Colour(255,33,33)
|
|
||||||
c2 =wx.Colour(255,33,33)
|
|
||||||
else:
|
|
||||||
c1,c2 = gradient
|
|
||||||
w = rect.width * (float(self._valueSorted[i]) / self._range)
|
w = rect.width * (float(self._valueSorted[i]) / self._range)
|
||||||
r = copy.copy(rect)
|
r = copy.copy(rect)
|
||||||
r.width = w
|
r.width = w
|
||||||
@@ -277,15 +266,10 @@ class PyGauge(wx.PyWindow):
|
|||||||
dc.SetTextForeground(wx.Colour(255,255,255))
|
dc.SetTextForeground(wx.Colour(255,255,255))
|
||||||
font1 = wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL)
|
font1 = wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL)
|
||||||
dc.SetFont(font1)
|
dc.SetFont(font1)
|
||||||
if self._overdrive > self._range:
|
|
||||||
value = self._overdrive
|
|
||||||
else:
|
|
||||||
value = self._value[0]
|
|
||||||
|
|
||||||
if self._skipDigits == True:
|
if self._skipDigits == True:
|
||||||
dc.DrawLabel(str(int(value*100/self._range)) + "%", rect, wx.ALIGN_CENTER)
|
dc.DrawLabel(str(int(self._value[0]*100/self._range)) + "%", rect, wx.ALIGN_CENTER)
|
||||||
else:
|
else:
|
||||||
dc.DrawLabel(str(round(float(value*100/self._range)))+ "%",rect,wx.ALIGN_CENTER)
|
dc.DrawLabel(str(round(float(self._value[0]*100/self._range)))+ "%",rect,wx.ALIGN_CENTER)
|
||||||
|
|
||||||
def OnTimer(self,event):
|
def OnTimer(self,event):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -90,47 +90,6 @@ class StatsPane(wx.Panel):
|
|||||||
label = getattr(self, labelName)
|
label = getattr(self, labelName)
|
||||||
label.SetLabel(("%." + str(rounding) + "f") % (value() if fit is not None else 0))
|
label.SetLabel(("%." + str(rounding) + "f") % (value() if fit is not None else 0))
|
||||||
|
|
||||||
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"),
|
|
||||||
lambda: fit.ship.getModifiedItemAttr("cpuOutput"),
|
|
||||||
lambda: fit.ship.getModifiedItemAttr("powerOutput"))
|
|
||||||
|
|
||||||
for panel in ("Mini","Full"):
|
|
||||||
i=0
|
|
||||||
for resourceType in ("cpu", "pg", "droneBay", "droneBandwidth"):
|
|
||||||
if fit is not None:
|
|
||||||
if i>1 and panel == "Mini": break
|
|
||||||
|
|
||||||
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)
|
|
||||||
else:
|
|
||||||
gauge.SetRange(100)
|
|
||||||
gauge.SetValue(0)
|
|
||||||
i+=1
|
|
||||||
else:
|
|
||||||
if i>1 and panel == "Mini": break
|
|
||||||
|
|
||||||
capitalizedType = resourceType[0].capitalize() + resourceType[1:]
|
|
||||||
|
|
||||||
gauge = getattr(self, "gauge%s%s" % (panel, capitalizedType))
|
|
||||||
|
|
||||||
gauge.SetRange(100)
|
|
||||||
gauge.SetValue(0)
|
|
||||||
i+=1
|
|
||||||
|
|
||||||
for labelName, value, rounding in stats:
|
|
||||||
label = getattr(self, labelName)
|
|
||||||
label.SetLabel(("%." + str(rounding) + "f") % (value() if fit is not None else 0))
|
|
||||||
|
|
||||||
# resMax = (("cpuTotal", lambda: fit.ship.getModifiedItemAttr("cpuOutput")),
|
# resMax = (("cpuTotal", lambda: fit.ship.getModifiedItemAttr("cpuOutput")),
|
||||||
# ("pgTotal", lambda: fit.ship.getModifiedItemAttr("powerOutput")),
|
# ("pgTotal", lambda: fit.ship.getModifiedItemAttr("powerOutput")),
|
||||||
# ("droneBayTotal", lambda: fit.ship.getModifiedItemAttr("droneCapacity")),
|
# ("droneBayTotal", lambda: fit.ship.getModifiedItemAttr("droneCapacity")),
|
||||||
@@ -347,7 +306,7 @@ class StatsPane(wx.Panel):
|
|||||||
setattr(self, "label%sTotal%s" % (panel.capitalize(), capitalizedType), lbl)
|
setattr(self, "label%sTotal%s" % (panel.capitalize(), capitalizedType), lbl)
|
||||||
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
# Gauges modif. - Darriele
|
# Gauges modif. - Darriele
|
||||||
if self._showNormalGauges == True:
|
if self._showNormalGauges == True:
|
||||||
gauge = wx.Gauge(parent, wx.ID_ANY, 100)
|
gauge = wx.Gauge(parent, wx.ID_ANY, 100)
|
||||||
gauge.SetMinSize((80, 20))
|
gauge.SetMinSize((80, 20))
|
||||||
@@ -357,9 +316,7 @@ class StatsPane(wx.Panel):
|
|||||||
gauge.SetSkipDigitsFlag(True)
|
gauge.SetSkipDigitsFlag(True)
|
||||||
|
|
||||||
setattr(self, "gauge%s%s" % (panel.capitalize(),capitalizedType), gauge)
|
setattr(self, "gauge%s%s" % (panel.capitalize(),capitalizedType), gauge)
|
||||||
|
|
||||||
stats.Add(gauge, 0, wx.ALIGN_CENTER)
|
stats.Add(gauge, 0, wx.ALIGN_CENTER)
|
||||||
|
|
||||||
if panel == "mini":
|
if panel == "mini":
|
||||||
base.Add(wx.StaticLine(parent, wx.ID_ANY, style=wx.HORIZONTAL), 0, wx.EXPAND)
|
base.Add(wx.StaticLine(parent, wx.ID_ANY, style=wx.HORIZONTAL), 0, wx.EXPAND)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user