Re: Error closing dialog after editing grid
ioprst <[email protected]>
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <[email protected]> |
It solved my problem
class StateTable(CustomTable):
...
def _updateColAttrs(self, grid):
for row in range(self.GetNumberRows()):
for col in range(self.GetNumberCols()):
editor = None
renderer = None
colname = self.GetColLabelValue(col, False)
if col != 0:
grid.SetReadOnly(row, col, False)
if colname == 'Code':
editor = wx.grid.GridCellNumberEditor()
renderer = wx.grid.GridCellNumberRenderer()
elif colname == 'Text':
editor = wx.grid.GridCellTextEditor()
renderer = wx.grid.GridCellStringRenderer()
elif colname in ('Text colour', 'Background colour'):
editor = GridCellColourEditor()
renderer = GridCellColourRenderer()
elif colname == 'Skin ID':
editor = wx.grid.GridCellChoiceEditor(self.skinIds)
renderer = wx.grid.GridCellStringRenderer()
else:
grid.SetReadOnly(row, col, True)
# !!!!!! DECISION !!!!!!
currentEditor = grid.GetCellEditor(row, col)
currentEditor.DecRef()
grid.SetCellEditor(row, col, editor)
grid.SetCellRenderer(row, col, renderer)
self.ResizeRow(grid, row)
class StatePanel(wx.Panel):
def __init__(self, parent, states):
...
self.grid = CustomGrid(self, size=(-1, 120))
self.grid.Bind(wx.EVT_WINDOW_DESTROY, self.OnGridDestroy)
...
def OnGridDestroy(self, event):
self.table._updateColAttrs(self.grid)
event.Skip()
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/490d16bf-719f-470c-9226-b1e08c67f041%40googlegroups.com.