Merge branch 'master' of evefit.org:pyfa

This commit is contained in:
cncfanatics
2010-11-25 17:51:10 +01:00
3 changed files with 60 additions and 3 deletions

View File

@@ -151,16 +151,55 @@ class ResourcesViewFull(StatsView):
("label%sTotalDroneBay", lambda: fit.ship.getModifiedItemAttr("droneCapacity"), 3, 0, 9),
("label%sTotalDroneBandwidth", lambda: fit.ship.getModifiedItemAttr("droneBandwidth"), 3, 0, 9))
panel = "Full"
usedTurretHardpoints = 0
totalTurretHardpoints = 0
usedLauncherHardpoints = 0
totalLauncherHardPoints = 0
for labelName, value, prec, lowest, highest in stats:
label = getattr(self, labelName % panel)
value = value() if fit is not None else 0
value = value if value is not None else 0
if labelName % panel == "label%sUsedTurretHardpoints" % panel:
usedTurretHardpoints = value
labelUTH = label
if labelName % panel == "label%sTotalTurretHardpoints" % panel:
totalTurretHardpoints = value
labelTTH = label
if labelName % panel == "label%sUsedLauncherHardpoints" % panel:
usedLauncherHardpoints = value
labelULH = label
if labelName % panel == "label%sTotalLauncherHardpoints" % panel:
totalLauncherHardPoints = value
labelTLH = label
if isinstance(value, basestring):
label.SetLabel(value)
label.SetToolTip(wx.ToolTip(value))
else:
label.SetLabel(formatAmount(value, prec, lowest, highest))
label.SetToolTip(wx.ToolTip("%.1f" % value))
colorWarn = wx.Colour(204, 51, 51)
colorNormal = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)
if usedTurretHardpoints > totalTurretHardpoints:
colorT = colorWarn
else:
colorT = colorNormal
if usedLauncherHardpoints > totalLauncherHardPoints:
colorL = colorWarn
else:
colorL = colorNormal
labelUTH.SetForegroundColour(colorT)
labelTTH.SetForegroundColour(colorT)
labelULH.SetForegroundColour(colorL)
labelTLH.SetForegroundColour(colorL)
if fit is not None:
resMax = (lambda: fit.ship.getModifiedItemAttr("cpuOutput"),
lambda: fit.ship.getModifiedItemAttr("powerOutput"),

View File

@@ -1202,8 +1202,21 @@ class PFNotebookPagePreview(wx.Frame):
self.timerSleep = None
self.timerSleepId = wx.NewId()
self.direction = 1
self.padding = 15
self.transp = 0
self.SetSize((bitmap.GetWidth(),bitmap.GetHeight()+16))
hfont = wx.FontFromPixelSize((0,14), wx.SWISS, wx.NORMAL,wx.NORMAL, False)
self.SetFont(hfont)
tx, ty = self.GetTextExtent(self.title)
tx += self.padding * 2
if bitmap.GetWidth() < tx:
width = tx
else:
width = bitmap.GetWidth()
self.SetSize((width, bitmap.GetHeight()+16))
self.SetTransparent(0)
self.Refresh()
@@ -1251,7 +1264,7 @@ class PFNotebookPagePreview(wx.Frame):
canvas = wx.EmptyBitmap(rect.width, rect.height)
mdc = wx.BufferedPaintDC(self)
mdc.SelectObject(canvas)
color = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)
color = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)
mdc.SetBackground(wx.Brush(color))
mdc.Clear()
@@ -1260,6 +1273,9 @@ class PFNotebookPagePreview(wx.Frame):
x,y = mdc.GetTextExtent(self.title)
mdc.SetBrush(wx.Brush(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)))
mdc.DrawRectangle(0,0,rect.width,16)
mdc.SetTextForeground(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
mdc.DrawText(self.title, (rect.width - x)/2, (16 -y)/2)

View File

@@ -92,7 +92,9 @@ class FleetBrowser(wx.Panel):
def AddItem (self, ID, name, count):
self.fleetItemContainer.AddWidget(FleetItem(self, ID, name, count))
self.fleetItemContainer.RefreshList()
widget = self.fleetItemContainer.GetWidgetByFleetID(ID)
self.fleetItemContainer.RefreshList(True)
self.fleetItemContainer.ScrollChildIntoView(widget)
def PopulateFleetList(self):
self.Freeze()