Merge pull request #2347 from chwons/master
fix text color when using a dark system theme
This commit is contained in:
@@ -194,6 +194,7 @@ class ItemParams(wx.Panel):
|
||||
|
||||
attrIcon, attrName, currentVal, baseVal = data
|
||||
attr_item = self.paramList.AppendItem(parent, attrName)
|
||||
self.paramList.SetItemTextColour(attr_item, wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
|
||||
|
||||
self.paramList.SetItemText(attr_item, currentVal, 1)
|
||||
if self.stuff is not None:
|
||||
@@ -222,6 +223,7 @@ class ItemParams(wx.Panel):
|
||||
heading = data.get("label")
|
||||
|
||||
header_item = self.paramList.AppendItem(root, heading)
|
||||
self.paramList.SetItemTextColour(header_item, wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
|
||||
for attr in data.get("attributes", []):
|
||||
# Attribute is a "grouped" attr (eg: damage, sensor strengths, etc). Automatically group these into a child item
|
||||
if attr in GroupedAttributes:
|
||||
@@ -232,6 +234,7 @@ class ItemParams(wx.Panel):
|
||||
|
||||
# create a child item with the groups label
|
||||
item = self.paramList.AppendItem(header_item, grouping[1])
|
||||
self.paramList.SetItemTextColour(item, wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
|
||||
for attr2 in grouping[0]:
|
||||
# add each attribute in the group
|
||||
self.AddAttribute(item, attr2)
|
||||
@@ -256,6 +259,7 @@ class ItemParams(wx.Panel):
|
||||
|
||||
# get all attributes in group
|
||||
item = self.paramList.AppendItem(root, grouping[1])
|
||||
self.paramList.SetItemTextColour(item, wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
|
||||
for attr2 in grouping[0]:
|
||||
self.AddAttribute(item, attr2)
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ class ItemDescription(wx.Panel):
|
||||
desc = re.sub("<( *)font( *)color( *)=(.*?)>(?P<inside>.*?)<( *)/( *)font( *)>", "\g<inside>", desc)
|
||||
# Strip URLs
|
||||
desc = re.sub("<( *)a(.*?)>(?P<inside>.*?)<( *)/( *)a( *)>", "\g<inside>", desc)
|
||||
desc = "<body style='background-color: {}; color: {}'>{}</body>".format(
|
||||
bgcolor.GetAsString(wx.C2S_CSS_SYNTAX),
|
||||
fgcolor.GetAsString(wx.C2S_CSS_SYNTAX),
|
||||
desc = "<body bgcolor='{}' text='{}'>{}</body>".format(
|
||||
bgcolor.GetAsString(wx.C2S_HTML_SYNTAX),
|
||||
fgcolor.GetAsString(wx.C2S_HTML_SYNTAX),
|
||||
desc
|
||||
)
|
||||
|
||||
|
||||
@@ -13,7 +13,12 @@ class ItemTraits(wx.Panel):
|
||||
self.SetSizer(mainSizer)
|
||||
|
||||
self.traits = wx.html.HtmlWindow(self)
|
||||
self.traits.SetPage(item.traits.display)
|
||||
|
||||
bgcolor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
|
||||
fgcolor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)
|
||||
self.traits.SetPage("<body bgcolor='{}' text='{}'>{}</body>".format(
|
||||
bgcolor.GetAsString(wx.C2S_HTML_SYNTAX),
|
||||
fgcolor.GetAsString(wx.C2S_HTML_SYNTAX), item.traits.display))
|
||||
|
||||
self.traits.Bind(wx.EVT_CONTEXT_MENU, self.onPopupMenu)
|
||||
self.traits.Bind(wx.EVT_KEY_UP, self.onKeyUp)
|
||||
|
||||
Reference in New Issue
Block a user