Moved Resources section into a togglepanel
This commit is contained in:
255
gui/statsPane.py
255
gui/statsPane.py
@@ -928,7 +928,8 @@ class StatsPane(wx.Panel):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.initResourcesPanel( self.mainparent)
|
self.initResourcesPanelFull( self.mainparent)
|
||||||
|
self.initResourcesPanelMini( self.mainparent)
|
||||||
|
|
||||||
self.initResistancesPanel( self.mainparent )
|
self.initResistancesPanel( self.mainparent )
|
||||||
|
|
||||||
@@ -962,113 +963,189 @@ class StatsPane(wx.Panel):
|
|||||||
self.miniPanel.SetMinSize( self.miniSize)
|
self.miniPanel.SetMinSize( self.miniSize)
|
||||||
|
|
||||||
|
|
||||||
def initResourcesPanel( self, parent):
|
def initResourcesPanelFull( self, parent):
|
||||||
|
|
||||||
sizerHeaderResources = wx.BoxSizer(wx.HORIZONTAL)
|
|
||||||
self.sizerBase.Add(sizerHeaderResources, 0, wx.EXPAND | wx.LEFT, 3)
|
|
||||||
|
|
||||||
# Resources stuff
|
# Resources stuff
|
||||||
|
rsrcTPanel = TogglePanel(self.fullPanel)
|
||||||
|
rsrcTPanel.SetLabel("Resources")
|
||||||
|
parent = rsrcTPanel.GetContentPane()
|
||||||
sizerResources = wx.BoxSizer(wx.HORIZONTAL)
|
sizerResources = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
self.sizerBase.Add(sizerResources, 0, wx.EXPAND | wx.LEFT, 3)
|
self.sizerBase.Add(rsrcTPanel, 0, wx.EXPAND | wx.LEFT, 3)
|
||||||
|
|
||||||
|
rsrcTPanel.AddSizer(sizerResources)
|
||||||
|
|
||||||
|
#Stuff that has to be done for both panels
|
||||||
|
panel = "full"
|
||||||
|
# parent = getattr(self, "%sPanel" % panel)
|
||||||
|
|
||||||
|
sizer = wx.FlexGridSizer(3, 2)
|
||||||
|
sizer.SetMinSize(wx.Size(27 + self.getTextExtentW("400/400"), 0))
|
||||||
|
for i in xrange(3):
|
||||||
|
sizer.AddGrowableCol(i + 1)
|
||||||
|
|
||||||
|
base = sizerResources
|
||||||
|
base.Add(sizer, 0, wx.ALIGN_CENTER)
|
||||||
|
|
||||||
|
#Turrets & launcher hardslots display
|
||||||
|
for type in ("turret", "launcher", "calibration"):
|
||||||
|
bitmap = bitmapLoader.getStaticBitmap("%s_big" % type, parent, "icons")
|
||||||
|
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
|
||||||
|
sizer.Add(bitmap, 0, wx.ALIGN_CENTER)
|
||||||
|
sizer.Add(box, 0, wx.ALIGN_CENTER_VERTICAL)
|
||||||
|
|
||||||
|
suffix = "Points" if type == "calibration" else "Hardpoints"
|
||||||
|
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
||||||
|
setattr(self, "label%sUsed%s%s" % (panel.capitalize(), type.capitalize(), suffix.capitalize()), lbl)
|
||||||
|
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
|
box.Add(wx.StaticText(parent, wx.ID_ANY, "/"), 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
|
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
||||||
|
setattr(self, "label%sTotal%s%s" % (panel.capitalize(), type.capitalize(), suffix.capitalize()), lbl)
|
||||||
|
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
|
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)
|
||||||
|
base.Add(main, 1 , wx.ALIGN_CENTER)
|
||||||
|
|
||||||
|
for type in group:
|
||||||
|
capitalizedType = type[0].capitalize() + type[1:]
|
||||||
|
bitmap = bitmapLoader.getStaticBitmap(type + "_big", parent, "icons")
|
||||||
|
|
||||||
|
stats = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
absolute = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
stats.Add(absolute, 0, wx.EXPAND)
|
||||||
|
|
||||||
|
|
||||||
|
b = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
main.Add(b, 1, wx.ALIGN_CENTER)
|
||||||
|
|
||||||
|
b.Add(bitmap, 0, wx.ALIGN_BOTTOM)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
absolute.Add(wx.StaticText(parent, wx.ID_ANY, "/"), 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
|
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
||||||
|
setattr(self, "label%sTotal%s" % (panel.capitalize(), capitalizedType), lbl)
|
||||||
|
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
|
units = {"cpu":" tf", "pg":" MW", "droneBandwidth":" mbit/s", "droneBay":u" m\u00B3"}
|
||||||
|
lbl = wx.StaticText(parent, wx.ID_ANY, "%s" % units[type])
|
||||||
|
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
|
# Gauges modif. - Darriele
|
||||||
|
if self._showNormalGauges == True:
|
||||||
|
gauge = wx.Gauge(parent, wx.ID_ANY, 100)
|
||||||
|
gauge.SetMinSize((80, 20))
|
||||||
|
else:
|
||||||
|
gauge = PG.PyGauge(parent, wx.ID_ANY, 100)
|
||||||
|
gauge.SetMinSize((self.getTextExtentW("999.9k/1.3M GJ"), 23))
|
||||||
|
gauge.SetFractionDigits(2)
|
||||||
|
|
||||||
|
setattr(self, "gauge%s%s" % (panel.capitalize(),capitalizedType), gauge)
|
||||||
|
stats.Add(gauge, 0, wx.ALIGN_CENTER)
|
||||||
|
|
||||||
|
def initResourcesPanelMini( self, parent):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Stuff that has to be done for both panels
|
#Stuff that has to be done for both panels
|
||||||
for panel in ("full", "mini"):
|
panel ="mini"
|
||||||
parent = getattr(self, "%sPanel" % panel)
|
parent = getattr(self, "%sPanel" % panel)
|
||||||
# Resources header
|
# Resources header
|
||||||
labelResources = wx.StaticText(parent, wx.ID_ANY, "Resources")
|
labelResources = wx.StaticText(parent, wx.ID_ANY, "Resources")
|
||||||
labelResources.SetFont(self.boldFont)
|
labelResources.SetFont(self.boldFont)
|
||||||
sizer = wx.FlexGridSizer(3, 2)
|
sizer = wx.FlexGridSizer(3, 2)
|
||||||
sizer.SetMinSize(wx.Size(27 + self.getTextExtentW("400/400"), 0))
|
sizer.SetMinSize(wx.Size(27 + self.getTextExtentW("400/400"), 0))
|
||||||
for i in xrange(3):
|
for i in xrange(3):
|
||||||
sizer.AddGrowableCol(i + 1)
|
sizer.AddGrowableCol(i + 1)
|
||||||
|
|
||||||
if panel == "mini":
|
|
||||||
base = self.minSizerBase
|
|
||||||
base.Add(labelResources, 0, wx.ALIGN_CENTER)
|
|
||||||
base.Add(sizer, 1, wx.ALIGN_LEFT)
|
|
||||||
else:
|
|
||||||
base = sizerResources
|
|
||||||
base.Add(sizer, 0, wx.ALIGN_CENTER)
|
|
||||||
|
|
||||||
sizerHeaderResources.Add(labelResources, 0, wx.ALIGN_CENTER)
|
|
||||||
sizerHeaderResources.Add(wx.StaticLine(self.fullPanel, wx.ID_ANY), 1, wx.ALIGN_CENTER)
|
|
||||||
|
|
||||||
#Turrets & launcher hardslots display
|
|
||||||
for type in ("turret", "launcher", "calibration"):
|
|
||||||
bitmap = bitmapLoader.getStaticBitmap("%s_big" % type, parent, "icons")
|
|
||||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
|
||||||
|
|
||||||
sizer.Add(bitmap, 0, wx.ALIGN_CENTER)
|
|
||||||
sizer.Add(box, 0, wx.ALIGN_CENTER_VERTICAL)
|
|
||||||
|
|
||||||
suffix = "Points" if type == "calibration" else "Hardpoints"
|
|
||||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
|
||||||
setattr(self, "label%sUsed%s%s" % (panel.capitalize(), type.capitalize(), suffix.capitalize()), lbl)
|
|
||||||
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
|
||||||
|
|
||||||
box.Add(wx.StaticText(parent, wx.ID_ANY, "/"), 0, wx.ALIGN_LEFT)
|
|
||||||
|
|
||||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
|
||||||
setattr(self, "label%sTotal%s%s" % (panel.capitalize(), type.capitalize(), suffix.capitalize()), lbl)
|
|
||||||
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
|
||||||
|
|
||||||
st = wx.VERTICAL if panel == "full" else wx.HORIZONTAL
|
|
||||||
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
|
base = self.minSizerBase
|
||||||
for i, group in enumerate((("cpu", "pg"), ("droneBay", "droneBandwidth"))):
|
base.Add(labelResources, 0, wx.ALIGN_CENTER)
|
||||||
main = wx.BoxSizer(wx.VERTICAL)
|
base.Add(sizer, 1, wx.ALIGN_LEFT)
|
||||||
base.Add(main, 1 if panel == "full" else 0, wx.ALIGN_CENTER)
|
|
||||||
if i == 0 or panel == "full":
|
|
||||||
for type in group:
|
|
||||||
capitalizedType = type[0].capitalize() + type[1:]
|
|
||||||
bitmap = bitmapLoader.getStaticBitmap(type + "_big", parent, "icons")
|
|
||||||
if panel == "mini":
|
|
||||||
main.Add(bitmap, 0, wx.ALIGN_CENTER)
|
|
||||||
|
|
||||||
stats = wx.BoxSizer(wx.VERTICAL)
|
#Turrets & launcher hardslots display
|
||||||
absolute = wx.BoxSizer(wx.HORIZONTAL)
|
for type in ("turret", "launcher", "calibration"):
|
||||||
stats.Add(absolute, 0, wx.EXPAND)
|
bitmap = bitmapLoader.getStaticBitmap("%s_big" % type, parent, "icons")
|
||||||
|
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
|
||||||
if panel == "full":
|
sizer.Add(bitmap, 0, wx.ALIGN_CENTER)
|
||||||
b = wx.BoxSizer(wx.HORIZONTAL)
|
sizer.Add(box, 0, wx.ALIGN_CENTER_VERTICAL)
|
||||||
main.Add(b, 1, wx.ALIGN_CENTER)
|
|
||||||
|
|
||||||
b.Add(bitmap, 0, wx.ALIGN_BOTTOM)
|
suffix = "Points" if type == "calibration" else "Hardpoints"
|
||||||
|
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
||||||
|
setattr(self, "label%sUsed%s%s" % (panel.capitalize(), type.capitalize(), suffix.capitalize()), lbl)
|
||||||
|
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
b.Add(stats, 1, wx.EXPAND)
|
box.Add(wx.StaticText(parent, wx.ID_ANY, "/"), 0, wx.ALIGN_LEFT)
|
||||||
else:
|
|
||||||
main.Add(stats, 0, wx.ALIGN_CENTER)
|
|
||||||
|
|
||||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
||||||
setattr(self, "label%sUsed%s" % (panel.capitalize(), capitalizedType), lbl)
|
setattr(self, "label%sTotal%s%s" % (panel.capitalize(), type.capitalize(), suffix.capitalize()), lbl)
|
||||||
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
absolute.Add(wx.StaticText(parent, wx.ID_ANY, "/"), 0, wx.ALIGN_LEFT)
|
st = wx.HORIZONTAL
|
||||||
|
base.Add(wx.StaticLine(parent, wx.ID_ANY, style=st), 0, wx.EXPAND | wx.LEFT, 3 if panel == "full" else 0)
|
||||||
|
|
||||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
|
||||||
setattr(self, "label%sTotal%s" % (panel.capitalize(), capitalizedType), lbl)
|
|
||||||
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
|
||||||
|
|
||||||
units = {"cpu":" tf", "pg":" MW", "droneBandwidth":" mbit/s", "droneBay":u" m\u00B3"}
|
#PG, Cpu & drone stuff
|
||||||
lbl = wx.StaticText(parent, wx.ID_ANY, "%s" % units[type])
|
for i, group in enumerate((("cpu", "pg"), ("droneBay", "droneBandwidth"))):
|
||||||
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
main = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
base.Add(main, 0, wx.ALIGN_CENTER)
|
||||||
|
if i == 0:
|
||||||
|
for type in group:
|
||||||
|
capitalizedType = type[0].capitalize() + type[1:]
|
||||||
|
bitmap = bitmapLoader.getStaticBitmap(type + "_big", parent, "icons")
|
||||||
|
|
||||||
# Gauges modif. - Darriele
|
main.Add(bitmap, 0, wx.ALIGN_CENTER)
|
||||||
if self._showNormalGauges == True:
|
|
||||||
gauge = wx.Gauge(parent, wx.ID_ANY, 100)
|
|
||||||
gauge.SetMinSize((80, 20))
|
|
||||||
else:
|
|
||||||
gauge = PG.PyGauge(parent, wx.ID_ANY, 100)
|
|
||||||
gauge.SetMinSize((self.getTextExtentW("999.9k/1.3M GJ"), 23))
|
|
||||||
gauge.SetFractionDigits(2)
|
|
||||||
|
|
||||||
setattr(self, "gauge%s%s" % (panel.capitalize(),capitalizedType), gauge)
|
stats = wx.BoxSizer(wx.VERTICAL)
|
||||||
stats.Add(gauge, 0, wx.ALIGN_CENTER)
|
absolute = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
if i >0 and panel == "mini":
|
stats.Add(absolute, 0, wx.EXPAND)
|
||||||
base.Add(wx.StaticLine(parent, wx.ID_ANY, style=wx.HORIZONTAL), 0, wx.EXPAND)
|
|
||||||
|
|
||||||
|
main.Add(stats, 0, wx.ALIGN_CENTER)
|
||||||
|
|
||||||
|
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
||||||
|
setattr(self, "label%sUsed%s" % (panel.capitalize(), capitalizedType), lbl)
|
||||||
|
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
|
absolute.Add(wx.StaticText(parent, wx.ID_ANY, "/"), 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
|
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
|
||||||
|
setattr(self, "label%sTotal%s" % (panel.capitalize(), capitalizedType), lbl)
|
||||||
|
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
|
units = {"cpu":" tf", "pg":" MW", "droneBandwidth":" mbit/s", "droneBay":u" m\u00B3"}
|
||||||
|
lbl = wx.StaticText(parent, wx.ID_ANY, "%s" % units[type])
|
||||||
|
absolute.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||||
|
|
||||||
|
# Gauges modif. - Darriele
|
||||||
|
if self._showNormalGauges == True:
|
||||||
|
gauge = wx.Gauge(parent, wx.ID_ANY, 100)
|
||||||
|
gauge.SetMinSize((80, 20))
|
||||||
|
else:
|
||||||
|
gauge = PG.PyGauge(parent, wx.ID_ANY, 100)
|
||||||
|
gauge.SetMinSize((self.getTextExtentW("999.9k/1.3M GJ"), 23))
|
||||||
|
gauge.SetFractionDigits(2)
|
||||||
|
|
||||||
|
setattr(self, "gauge%s%s" % (panel.capitalize(),capitalizedType), gauge)
|
||||||
|
stats.Add(gauge, 0, wx.ALIGN_CENTER)
|
||||||
|
# if i >0 and panel == "mini":
|
||||||
|
base.Add(wx.StaticLine(parent, wx.ID_ANY, style=wx.HORIZONTAL), 0, wx.EXPAND)
|
||||||
|
|
||||||
# if i == 0 and panel == "full":
|
# if i == 0 and panel == "full":
|
||||||
# base.Add(wx.StaticLine(parent, wx.ID_ANY, style=wx.VERTICAL), 0, wx.EXPAND)
|
# base.Add(wx.StaticLine(parent, wx.ID_ANY, style=wx.VERTICAL), 0, wx.EXPAND)
|
||||||
|
|||||||
Reference in New Issue
Block a user