Skip to content

Commit 83170df

Browse files
authored
Merge branch 'main' into fix-typing-and-cleanups
2 parents c1f3cad + 9044c00 commit 83170df

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/objdictgen/ui/subindextable.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,14 @@ def SetValue(self, row, col, value):
174174
value = "None"
175175
self.data[row][colname] = value
176176

177-
def ResetView(self, grid: wx.grid.Grid):
177+
def setCellTheme(self, row, col, grid):
178+
system_appearance = wx.SystemSettings.GetAppearance()
179+
background_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
180+
text_colour = wx.WHITE if system_appearance.IsDark() else wx.BLACK
181+
grid.SetCellBackgroundColour(row, col, background_colour)
182+
grid.SetCellTextColour(row, col, text_colour)
183+
184+
def ResetView(self, grid):
178185
"""
179186
(wx.grid.Grid) -> Reset the grid view. Call this to
180187
update the grid if rows and columns have been added or deleted
@@ -289,8 +296,7 @@ def _updateColAttrs(self, grid: wx.grid.Grid):
289296

290297
grid.SetCellEditor(row, col, editor)
291298
grid.SetCellRenderer(row, col, renderer)
292-
293-
grid.SetCellBackgroundColour(row, col, wx.WHITE)
299+
self.setCellTheme(row, col, grid)
294300

295301
def SetData(self, data):
296302
self.data = data

0 commit comments

Comments
 (0)