Skip to content

Commit

Permalink
Merge branch 'main' into fix-typing-and-cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinse authored Apr 9, 2024
2 parents c1f3cad + 9044c00 commit 83170df
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/objdictgen/ui/subindextable.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,14 @@ def SetValue(self, row, col, value):
value = "None"
self.data[row][colname] = value

def ResetView(self, grid: wx.grid.Grid):
def setCellTheme(self, row, col, grid):
system_appearance = wx.SystemSettings.GetAppearance()
background_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
text_colour = wx.WHITE if system_appearance.IsDark() else wx.BLACK
grid.SetCellBackgroundColour(row, col, background_colour)
grid.SetCellTextColour(row, col, text_colour)

def ResetView(self, grid):
"""
(wx.grid.Grid) -> Reset the grid view. Call this to
update the grid if rows and columns have been added or deleted
Expand Down Expand Up @@ -289,8 +296,7 @@ def _updateColAttrs(self, grid: wx.grid.Grid):

grid.SetCellEditor(row, col, editor)
grid.SetCellRenderer(row, col, renderer)

grid.SetCellBackgroundColour(row, col, wx.WHITE)
self.setCellTheme(row, col, grid)

def SetData(self, data):
self.data = data
Expand Down

0 comments on commit 83170df

Please sign in to comment.