From 7682c46a62b3058590ed0a34a595cc768f1c4fba Mon Sep 17 00:00:00 2001 From: HomeWorld Date: Thu, 25 Nov 2010 17:02:55 +0200 Subject: [PATCH 1/3] Fixed a graphic bug when adding a fleet item that is beyond visible area (and have the vertical scrollbar shown) doesnt properly resize(refresh all fleet items to take in account the scrollbar, also scroll the container to the added fleet item --- gui/fleetBrowser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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() From 1806b4bf969476568e45ff18b9af5ce521cac048 Mon Sep 17 00:00:00 2001 From: HomeWorld Date: Thu, 25 Nov 2010 17:22:54 +0200 Subject: [PATCH 2/3] Show turrets/hardpoints in resource view with a different color if used > allowed total as suggested in #311 --- gui/builtinStatsViews/resourcesViewFull.py | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) 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"), From 604c1e69234013e03f96cb7eb284c7127b6f642c Mon Sep 17 00:00:00 2001 From: HomeWorld Date: Thu, 25 Nov 2010 17:50:44 +0200 Subject: [PATCH 3/3] Properly size fit preview to accommodate fit name --- gui/chromeTabs.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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)