diff --git a/gui/builtinStatsViews/resourcesViewFull.py b/gui/builtinStatsViews/resourcesViewFull.py index 7934a7c5f..eccbac060 100644 --- a/gui/builtinStatsViews/resourcesViewFull.py +++ b/gui/builtinStatsViews/resourcesViewFull.py @@ -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"), diff --git a/gui/chromeTabs.py b/gui/chromeTabs.py index 14e37ff7b..87722c9fe 100644 --- a/gui/chromeTabs.py +++ b/gui/chromeTabs.py @@ -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) diff --git a/gui/fleetBrowser.py b/gui/fleetBrowser.py index 30991baf8..ecbd8bc87 100644 --- a/gui/fleetBrowser.py +++ b/gui/fleetBrowser.py @@ -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()