Skip to content

Commit c3c05e5

Browse files
committed
feat(theme): apply dark mode to panels and views
Convert MarketBrowser, ShipBrowser, StatsPane, CharacterSelection to ThemedPanel. Apply Colors to ship browser items, item stats views, chrome tabs, display. Update toggle panel, fitting view, implant editor with theme colors.
1 parent 5ef529c commit c3c05e5

27 files changed

+96
-50
lines changed

gui/builtinAdditionPanes/fighterView.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from gui.builtinViewColumns.state import State
3030
from gui.contextMenu import ContextMenu
3131
from gui.fitCommands.helpers import getSimilarFighters
32+
from gui.utils.colors import Colors
3233
from gui.utils.staticHelpers import DragDropHelper
3334
from service.fit import Fit
3435
from service.market import Market
@@ -115,8 +116,7 @@ def fitChanged(self, event):
115116
slot = getattr(FittingSlot, "F_{}".format(x.upper()))
116117
used = fit.getSlotsUsed(slot)
117118
total = fit.getNumSlots(slot)
118-
color = wx.Colour(204, 51, 51) if used > total else wx.SystemSettings.GetColour(
119-
wx.SYS_COLOUR_WINDOWTEXT)
119+
color = wx.Colour(204, 51, 51) if used > total else Colors.text()
120120

121121
lbl = getattr(self, "label%sUsed" % x.capitalize())
122122
lbl.SetLabel(str(int(used)))

gui/builtinItemStatsViews/itemAffectedBy.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import gui.mainFrame
1717
from gui.contextMenu import ContextMenu
1818
from gui.bitmap_loader import BitmapLoader
19+
from gui.utils.colors import Colors
1920

2021
_t = wx.GetTranslation
2122

@@ -41,7 +42,7 @@ class ItemAffectedBy(wx.Panel):
4142

4243
def __init__(self, parent, stuff, item):
4344
wx.Panel.__init__(self, parent)
44-
self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
45+
self.SetBackgroundColour(Colors.buttonFace())
4546
self.stuff = stuff
4647
self.item = item
4748

@@ -56,7 +57,7 @@ def __init__(self, parent, stuff, item):
5657
mainSizer = wx.BoxSizer(wx.VERTICAL)
5758

5859
self.affectedBy = wx.TreeCtrl(self, style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT | wx.NO_BORDER)
59-
self.affectedBy.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))
60+
self.affectedBy.SetBackgroundColour(Colors.windowBackground())
6061
mainSizer.Add(self.affectedBy, 1, wx.ALL | wx.EXPAND, 0)
6162

6263
self.m_staticline = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)

gui/builtinItemStatsViews/itemAttributes.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from gui import globalEvents as GE
1111
from gui.bitmap_loader import BitmapLoader
1212
from gui.builtinItemStatsViews.attributeGrouping import *
13+
from gui.utils.colors import Colors
1314
from gui.utils.numberFormatter import formatAmount, roundDec
1415
from service.const import GuiAttrGroup
1516

@@ -26,15 +27,16 @@ class ItemParams(wx.Panel):
2627
def __init__(self, parent, stuff, item, context=None):
2728
# Had to manually set the size here, otherwise column widths couldn't be calculated correctly. See #1878
2829
wx.Panel.__init__(self, parent, size=(1000, 1000))
29-
self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
30+
self.SetBackgroundColour(Colors.buttonFace())
31+
self.SetForegroundColour(Colors.text())
3032

3133
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
3234

3335
mainSizer = wx.BoxSizer(wx.VERTICAL)
3436

3537
self.paramList = wx.lib.agw.hypertreelist.HyperTreeList(self, wx.ID_ANY,
3638
agwStyle=wx.TR_HIDE_ROOT | wx.TR_NO_LINES | wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_HAS_BUTTONS)
37-
self.paramList.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))
39+
self.paramList.SetBackgroundColour(Colors.windowBackground())
3840

3941
mainSizer.Add(self.paramList, 1, wx.ALL | wx.EXPAND, 0)
4042
self.SetSizer(mainSizer)
@@ -209,7 +211,7 @@ def AddAttribute(self, parent, attr):
209211

210212
attrIcon, attrName, currentVal, baseVal = data
211213
attr_item = self.paramList.AppendItem(parent, attrName)
212-
self.paramList.SetItemTextColour(attr_item, wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
214+
self.paramList.SetItemTextColour(attr_item, Colors.text())
213215

214216
self.paramList.SetItemText(attr_item, currentVal, 1)
215217
if self.stuff is not None:
@@ -238,7 +240,7 @@ def PopulateList(self):
238240
heading = data.get("label")
239241

240242
header_item = self.paramList.AppendItem(root, heading)
241-
self.paramList.SetItemTextColour(header_item, wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
243+
self.paramList.SetItemTextColour(header_item, Colors.text())
242244
for attr in data.get("attributes", []):
243245
# Attribute is a "grouped" attr (eg: damage, sensor strengths, etc). Automatically group these into a child item
244246
if attr in GroupedAttributes:
@@ -249,7 +251,7 @@ def PopulateList(self):
249251

250252
# create a child item with the groups label
251253
item = self.paramList.AppendItem(header_item, grouping[1])
252-
self.paramList.SetItemTextColour(item, wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
254+
self.paramList.SetItemTextColour(item, Colors.text())
253255
for attr2 in grouping[0]:
254256
# add each attribute in the group
255257
self.AddAttribute(item, attr2)
@@ -274,7 +276,7 @@ def PopulateList(self):
274276

275277
# get all attributes in group
276278
item = self.paramList.AppendItem(root, grouping[1])
277-
self.paramList.SetItemTextColour(item, wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
279+
self.paramList.SetItemTextColour(item, Colors.text())
278280
for attr2 in grouping[0]:
279281
self.AddAttribute(item, attr2)
280282

gui/builtinItemStatsViews/itemCompare.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import wx
33

44
from .helpers import AutoListCtrl
5+
from gui.utils.colors import Colors
56
from service.price import Price as ServicePrice
67
from service.market import Market
78
from service.attribute import Attribute
@@ -21,7 +22,8 @@ def __init__(self, parent, stuff, item, items, context=None):
2122
sPrice.getPrices(items, self.UpdateList, fetchTimeout=90)
2223

2324
wx.Panel.__init__(self, parent)
24-
self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
25+
self.SetBackgroundColour(Colors.buttonFace())
26+
self.SetForegroundColour(Colors.text())
2527
mainSizer = wx.BoxSizer(wx.VERTICAL)
2628

2729
self.paramList = AutoListCtrl(self, wx.ID_ANY,

gui/builtinItemStatsViews/itemDescription.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import wx.html
55
import re
66

7+
from gui.utils.colors import Colors
8+
79
_t = wx.GetTranslation
810

911

@@ -13,8 +15,8 @@ def __init__(self, parent, stuff, item):
1315
mainSizer = wx.BoxSizer(wx.VERTICAL)
1416
self.SetSizer(mainSizer)
1517

16-
bgcolor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
17-
fgcolor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)
18+
bgcolor = Colors.windowBackground()
19+
fgcolor = Colors.text()
1820

1921
self.description = wx.html.HtmlWindow(self)
2022
if not item.description:

gui/builtinItemStatsViews/itemMutator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import gui.globalEvents as GE
99
import gui.mainFrame
1010
from gui.bitmap_loader import BitmapLoader
11+
from gui.utils.colors import Colors
1112
from service.fit import Fit
1213
from .attributeSlider import AttributeSlider, EVT_VALUE_CHANGED
1314
from .itemAttributes import ItemParams
@@ -21,7 +22,8 @@ class ItemMutatorPanel(wx.Panel):
2122
def __init__(self, parent, stuff):
2223
wx.Panel.__init__(self, parent)
2324
self.stuff = stuff
24-
self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
25+
self.SetBackgroundColour(Colors.buttonFace())
26+
self.SetForegroundColour(Colors.text())
2527

2628
mainSizer = wx.BoxSizer(wx.VERTICAL)
2729

@@ -72,7 +74,8 @@ def __init__(self, parent, stuff):
7274
self.SetScrollRate(0, 15)
7375
self.carryingFitID = gui.mainFrame.MainFrame.getInstance().getActiveFit()
7476
self.initialMutations = {}
75-
self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))
77+
self.SetBackgroundColour(Colors.windowBackground())
78+
self.SetForegroundColour(Colors.text())
7679
self.stuff = stuff
7780
self.timer = None
7881
self.isModified = False

gui/builtinItemStatsViews/itemTraits.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# noinspection PyPackageRequirements
44
import wx.html
55

6+
from gui.utils.colors import Colors
7+
68
_t = wx.GetTranslation
79

810

@@ -14,8 +16,8 @@ def __init__(self, parent, stuff, item):
1416

1517
self.traits = wx.html.HtmlWindow(self)
1618

17-
bgcolor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
18-
fgcolor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)
19+
bgcolor = Colors.windowBackground()
20+
fgcolor = Colors.text()
1921
self.traits.SetPage("<body bgcolor='{}' text='{}'>{}</body>".format(
2022
bgcolor.GetAsString(wx.C2S_HTML_SYNTAX),
2123
fgcolor.GetAsString(wx.C2S_HTML_SYNTAX), item.traits.display))

gui/builtinShipBrowser/categoryItem.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import gui.utils.draw as drawUtils
99
import gui.utils.fonts as fonts
1010
from gui.bitmap_loader import BitmapLoader
11+
from gui.utils.colors import Colors
1112
from .events import Stage2Selected
1213

1314
pyfalog = Logger(__name__)
@@ -100,7 +101,7 @@ def DrawItem(self, mdc):
100101
# rect = self.GetRect()
101102
self.UpdateElementsPos(mdc)
102103

103-
windowColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
104+
windowColor = Colors.windowBackground()
104105
textColor = colorUtils.GetSuitable(windowColor, 1)
105106

106107
mdc.SetTextForeground(textColor)

gui/builtinShipBrowser/fitItem.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import gui.utils.draw as drawUtils
1616
import gui.utils.fonts as fonts
1717
from gui.bitmap_loader import BitmapLoader
18+
from gui.utils.colors import Colors
1819
from gui.builtinShipBrowser.pfBitmapFrame import PFBitmapFrame
1920
from service.fit import Fit
2021
from .events import BoosterListUpdated, FitSelected, ImportSelected, SearchSelected, Stage3Selected
@@ -421,7 +422,7 @@ def MouseMove(self, event):
421422
bmpWidth = self.toolbarx if self.toolbarx < 200 else 200
422423
self.dragTLFBmp = wx.Bitmap(round(bmpWidth), round(self.GetRect().height))
423424
tdc.SelectObject(self.dragTLFBmp)
424-
tdc.SetBrush(wx.Brush(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)))
425+
tdc.SetBrush(wx.Brush(Colors.windowBackground()))
425426
tdc.DrawRectangle(0, 0, bmpWidth, self.GetRect().height)
426427
self.DrawItem(tdc)
427428
tdc.SelectObject(wx.NullBitmap)
@@ -488,7 +489,7 @@ def UpdateElementsPos(self, mdc):
488489
def DrawItem(self, mdc):
489490
rect = self.GetRect()
490491

491-
windowColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
492+
windowColor = Colors.windowBackground()
492493
textColor = colorUtils.GetSuitable(windowColor, 1)
493494

494495
mdc.SetTextForeground(textColor)
@@ -572,7 +573,7 @@ def Refresh(self):
572573
def RenderBackground(self):
573574
rect = self.GetRect()
574575

575-
windowColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
576+
windowColor = Colors.windowBackground()
576577

577578
# activeFitID = self.mainFrame.getActiveFit()
578579
state = self.GetState()

gui/builtinShipBrowser/navigationPanel.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import gui.utils.draw as drawUtils
1010
import gui.utils.fonts as fonts
1111
from gui.bitmap_loader import BitmapLoader
12+
from gui.utils.colors import Colors
1213
from gui.utils.helpers_wxPython import HandleCtrlBackspace
1314
from service.fit import Fit
1415
from utils.cjk import isStringCjk
@@ -219,7 +220,7 @@ def UpdateElementsPos(self, mdc):
219220
def DrawItem(self, mdc):
220221
rect = self.GetRect()
221222

222-
windowColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
223+
windowColor = Colors.windowBackground()
223224
textColor = colorUtils.GetSuitable(windowColor, 1)
224225
sepColor = colorUtils.GetSuitable(windowColor, 0.2)
225226

@@ -238,7 +239,7 @@ def DrawItem(self, mdc):
238239
def RenderBackground(self):
239240
rect = self.GetRect()
240241

241-
windowColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
242+
windowColor = Colors.windowBackground()
242243

243244
sFactor = 0.1
244245

0 commit comments

Comments
 (0)