X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b881fc787d2823bdd8a415080b82feee90804a17..68fc5c8025e38b9d827383fbfe7ce509ae331c1f:/wxPython/wx/lib/mixins/grid.py diff --git a/wxPython/wx/lib/mixins/grid.py b/wxPython/wx/lib/mixins/grid.py index a6d40673d5..586d24eee5 100644 --- a/wxPython/wx/lib/mixins/grid.py +++ b/wxPython/wx/lib/mixins/grid.py @@ -1,6 +1,6 @@ #---------------------------------------------------------------------------- -# Name: wxPython.lib.mixins.grid -# Purpose: Helpful mix-in classes for wxGrid +# Name: wx.lib.mixins.grid +# Purpose: Helpful mix-in classes for wx.Grid # # Author: Robin Dunn # @@ -14,6 +14,10 @@ # o 2.5 compatability update. # o Untested # +# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net) +# +# o wxGridAutoEditMixin -> GridAutoEditMixin +# import wx import wx.grid @@ -21,7 +25,7 @@ import wx.grid #---------------------------------------------------------------------------- -class wxGridAutoEditMixin: +class GridAutoEditMixin: """A mix-in class that automatically enables the grid edit control when a cell is selected. @@ -30,20 +34,15 @@ class wxGridAutoEditMixin: """ def __init__(self): - self.__enableEdit = 0 - self.Bind(wx.EVT_IDLE, self.__OnIdle) self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.__OnSelectCell) - def __OnIdle(self, evt): - if self.__enableEdit: - if self.CanEnableCellControl(): - self.EnableCellEditControl() - self.__enableEdit = 0 - evt.Skip() + def __DoEnableEdit(self): + if self.CanEnableCellControl(): + self.EnableCellEditControl() def __OnSelectCell(self, evt): - self.__enableEdit = 1 + wx.CallAfter(self.__DoEnableEdit) evt.Skip()