Fix tooltips

This commit is contained in:
blitzmann
2014-05-04 17:13:11 -04:00
parent f7ef3705b5
commit ac144e51e0

View File

@@ -142,21 +142,25 @@ class TargetingMiscViewFull(StatsView):
else:
label.SetToolTip(wx.ToolTip(""))
self._cachedValues[counter] = value
elif labelName == "labelFullWarpSpeed" and fit:
elif labelName == "labelFullWarpSpeed":
if fit:
label.SetToolTip(wx.ToolTip("Max Warp Distance: %.1f AU" % fit.maxWarpDistance))
elif labelName == "labelFullCargo" and fit:
# if you add stuff to cargo, the capacity doesn't change and thus it is still cached
# This assures us that we force refresh of cargo tooltip
capacity = fit.ship.getModifiedItemAttr("capacity")
cargoSize = 0
for mod in fit.cargo:
cargoSize += mod.getModifiedItemAttr("volume") * mod.amount
a = capacity-cargoSize
tip = u"Capacity: %sm\u00B3\n"% capacity
tip += u"Available: %.1fm\u00B3" %a
label.SetToolTip(wx.ToolTip(tip))
else:
label.SetToolTip(wx.ToolTip(""))
else:
label.SetToolTip(wx.ToolTip(""))
elif labelName == "labelFullCargo":
if fit:
# if you add stuff to cargo, the capacity doesn't change and thus it is still cached
# This assures us that we force refresh of cargo tooltip
capacity = fit.ship.getModifiedItemAttr("capacity")
cargoSize = 0
for mod in fit.cargo:
cargoSize += mod.getModifiedItemAttr("volume") * mod.amount
a = capacity-cargoSize
tip = u"Capacity: %sm\u00B3\n"% capacity
tip += u"Available: %.1fm\u00B3" %a
label.SetToolTip(wx.ToolTip(tip))
else:
label.SetToolTip(wx.ToolTip(""))
counter += 1