After upgrade wx from 2.8.7.1 to 2.8.9.1, I have strange issues with grid.
If i run directly 'GridCustEditor.py' from demo directory, enter text on any cell and close the Frame *while are editing the cell* python crash.
Note that if run these module from main demo package works fine. The crash is only when run directly: python GridCustEditor.py
I try it in anohter pc with wx-2.8.7.1 msw-unicode and works fine.
Platform details:
Windows XP SP2
Python 2.5.4
wx-2.8.9.1 (msw-unicode)
NOTES:
I downgrade my pc to 2.8.8.1: The same issue, Python crash.
Downgrade to 2.8.7.1: Works fine
Are there any grid update between 2.8.7.1 and 2.8.8.1 that makes the crash?
Thanks.
···
--
*****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.
El medio ambiente está en nuestra mano.
After upgrade wx from 2.8.7.1 to 2.8.9.1, I have strange issues with grid.
If i run directly 'GridCustEditor.py' from demo directory, enter text on any cell and close the Frame *while are editing the cell* python crash.
Note that if run these module from main demo package works fine. The crash is only when run directly: python GridCustEditor.py
I try it in anohter pc with wx-2.8.7.1 msw-unicode and works fine.
Platform details:
Windows XP SP2
Python 2.5.4
wx-2.8.9.1 (msw-unicode)
NOTES:
I downgrade my pc to 2.8.8.1: The same issue, Python crash.
Downgrade to 2.8.7.1: Works fine
Are there any grid update between 2.8.7.1 and 2.8.8.1 that makes the crash?
Thanks.
I confirm the crash on Windows XP SP3, wxPython 2.8.9.1 (unicode), Python 2.5.2. The "recent changes" page on the website doesn't mention any changes to the grid widget or editors since 2.8.7.1...there are some non-specific references to bug fixes, so I suppose that it may be one of those...
I ran BeyondCompare on my the wx-2.8-msw-unicode folders of both and grid.py is exactly the same. However, _grid.pyd is not (although it is the same size). Unfortunately, pyd files are not human readable, so I cannot tell if that's where the problem lies. Hopefully Robin will be able to shed some light on this.
Are there any grid update between 2.8.7.1 and 2.8.8.1 that makes the crash?
Thanks.
I confirm the crash on Windows XP SP3, wxPython 2.8.9.1 (unicode), Python 2.5.2. The “recent changes” page on the website doesn’t mention any changes to the grid widget or editors since 2.8.7.1…there are some non-specific references to bug fixes, so I suppose that it may be one of those…
I ran BeyondCompare on my the wx-2.8-msw-unicode folders of both and grid.py is exactly the same. However, _grid.pyd is not (although it is the same size). Unfortunately, pyd files are not human readable, so I cannot tell if that’s where the problem lies. Hopefully Robin will be able to shed some light on this.
I downgrade to 2.8.7.1 and i can't try tour tip now with 2.8.9.1, perhaps Mike can do it?
Regards.
···
--
*****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.
El medio ambiente está en nuestra mano.
After upgrade wx from 2.8.7.1 to 2.8.9.1, I have strange issues with grid.
If i run directly 'GridCustEditor.py' from demo directory, enter text on any cell and close the Frame *while are editing the cell* python crash.
This is a known issue and is being looked into. The workaround suggested by raffaelo is the right thing to do.
After some test, the problem seem related with GridTable. If I use GridTable there no crash even if do not use the workaround.
Regards.
···
--
*****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.
El medio ambiente está en nuestra mano.
Sorry, but in the aftermath I found out that my workaround was correct, but only up to a certain point.
If the grid with its open EditControl is NOT in the TopWindow, the application crashes again, most probably because the parent does not Close but instead Destroys its children, and so does not fire wx.EVT_CLOSE. So the workaround has to become more complex.
add a variable to the TopWindow (self.IncExit = 0)
In the init method of each child, increase of one that variable (self.Parent.IncExit +=1), and Enable(False) each and any command in the Parent (menu, button, etc.) that manages its closure
In the OnClose method of each child, decrease the variable (self.Parent.IncExit -= 1), and ONLY if self.Parent.IncExit == 0 re-enable(True) the Parent’s closing widgets.
Sorry, but in the aftermath I found out that my workaround was correct, but
only up to a certain point.
If the grid with its open EditControl is NOT in the TopWindow, the
application crashes again, most probably because the parent does not Close
but instead Destroys its children, and so does not fire wx.EVT_CLOSE. So the
workaround has to become more complex.
add a variable to the TopWindow (self.IncExit = 0)
In the __init__ method of each child, increase of one that variable
(self.Parent.IncExit +=1), and Enable(False) each and any command in the
Parent (menu, button, etc.) that manages its closure
In the OnClose method of each child, decrease the variable
(self.Parent.IncExit -= 1), and ONLY if self.Parent.IncExit == 0
re-enable(True) the Parent's closing widgets.
Instead of adding a new variable (attribute) to your parent, you may
also simply check with:
Where, Andrea? My problem is that the parent does not send the wx.EVT_CLOSE event to the children frames, it merely destroys them. So the method OnClose is not touched.
Where, Andrea? My problem is that the parent does not send the wx.EVT_CLOSE event to the children frames, it merely destroys them. So the method OnClose is not touched.
How about binding to EVT_QUERY_END_SESSION or EVT_END_SESSION? I'm not sure if that will work, but you can try it...
Mike
···
2009/2/12 Andrea Gavana <andrea.gavana@gmail.com <mailto:andrea.gavana@gmail.com>>
Hi Raffaello,
On Wed, Feb 11, 2009 at 9:32 PM, raffaello wrote:
> Sorry, but in the aftermath I found out that my workaround was
correct, but
> only up to a certain point.
> If the grid with its open EditControl is NOT in the TopWindow, the
> application crashes again, most probably because the parent does
not Close
> but instead Destroys its children, and so does not fire
wx.EVT_CLOSE. So the
> workaround has to become more complex.
>
> add a variable to the TopWindow (self.IncExit = 0)
> In the __init__ method of each child, increase of one that variable
> (self.Parent.IncExit +=1), and Enable(False) each and any
command in the
> Parent (menu, button, etc.) that manages its closure
> In the OnClose method of each child, decrease the variable
> (self.Parent.IncExit -= 1), and ONLY if self.Parent.IncExit == 0
> re-enable(True) the Parent's closing widgets.
Instead of adding a new variable (attribute) to your parent, you may
also simply check with:
These two events, Mike, according to the documentation apply to wx.App only, so they should fall into the same trap.
I devised a different approach. My new version of the method OnClose of the ToWindowFrame is:
def OnClose(self, e):
self.grid.
SaveEditControlValue()
children = self.GetChildren()
for i in range(len(children)):
if isinstance(children[i], wx.Frame):
if hasattr(children[i], ‘grid’):
children[i].grid.SaveEditControlValue()
self.Destroy()
Rather clumsy, but it seems to work. Anything better will be welcome.
Where, Andrea? My problem is that the parent does not send the wx.EVT_CLOSE event to the children frames, it merely destroys them. So the method OnClose is not touched.
How about binding to EVT_QUERY_END_SESSION or EVT_END_SESSION? I’m not sure if that will work, but you can try it…
Hi Raffaello,
On Wed, Feb 11, 2009 at 9:32 PM, raffaello wrote:
> Sorry, but in the aftermath I found out that my workaround was
correct, but
> only up to a certain point.
> If the grid with its open EditControl is NOT in the TopWindow, the
> application crashes again, most probably because the parent does
not Close
> but instead Destroys its children, and so does not fire
wx.EVT_CLOSE. So the
> workaround has to become more complex.
>
> add a variable to the TopWindow (self.IncExit = 0)
> In the __init__ method of each child, increase of one that variable
> (self.Parent.IncExit +=1), and Enable(False) each and any
command in the
> Parent (menu, button, etc.) that manages its closure
> In the OnClose method of each child, decrease the variable
> (self.Parent.IncExit -= 1), and ONLY if self.Parent.IncExit == 0
> re-enable(True) the Parent's closing widgets.
Instead of adding a new variable (attribute) to your parent, you may
also simply check with:
if self.IsBeingDeleted()
to see if the parent is being destroyed.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
[http://xoomer.alice.it/infinity77/](http://xoomer.alice.it/infinity77/)
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
Sorry, but in the aftermath I found out that my workaround was correct, but only up to a certain point.
If the grid with its open EditControl is NOT in the TopWindow, the application crashes again, most probably because the parent does not Close but instead Destroys its children, and so does not fire wx.EVT_CLOSE. So the workaround has to become more complex.
...
You can bind the frame close event inside the derived grid class:
class MyGrid(gridlib.Grid):
def __init__(self, ......
......
# Capture Frame Close Event
self.GetTopLevelParent().Bind(wx.EVT_CLOSE, self.OnFrameClose)
--
*****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.
El medio ambiente está en nuestra mano.
If the grid is not in the TopWindow, wherever the wx.EVT_CLOSE event is bound doesn’t matter, because the TopWindow calls Destroy() and so does not call the event at all. Look at my former post for a solution.
Sorry, but in the aftermath I found out that my workaround was correct, but only up to a certain point.
If the grid with its open EditControl is NOT in the TopWindow, the application crashes again, most probably because the parent does not Close but instead Destroys its children, and so does not fire wx.EVT_CLOSE. So the workaround has to become more complex.
…
You can bind the frame close event inside the derived grid class:
If the grid is not in the TopWindow, wherever the wx.EVT_CLOSE event is bound doesn't matter, because the TopWindow calls Destroy() and so does not call the event at all. Look at my former post for a solution.
Yes, EVT_CLOSE is never raised for grid window.
If you see the code, the grid is capturing the *Frame close event* instead the grid close event, and it works.
Sorry, but in the aftermath I found out that my workaround was
correct, but only up to a certain point.
If the grid with its open EditControl is NOT in the TopWindow,
the application crashes again, most probably because the parent
does not Close but instead Destroys its children, and so does
not fire wx.EVT_CLOSE. So the workaround has to become more complex.
...
You can bind the frame close event inside the derived grid class:
class MyGrid(gridlib.Grid):
def __init__(self, ......
......
# Capture Frame Close Event
self.GetTopLevelParent().Bind(wx.EVT_CLOSE, self.OnFrameClose)
-- *****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.
El medio ambiente está en nuestra mano.
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
<mailto:wxpython-users@lists.wxwidgets.org> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
--
*****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.
El medio ambiente está en nuestra mano.
Oswaldo, could you please copy the code you are speaking of? I do not understand what is exactly the “Frame close event”, and where it is possible to intercept it. Thanks.
If the grid is not in the TopWindow, wherever the wx.EVT_CLOSE event is bound doesn’t matter, because the TopWindow calls Destroy() and so does not call the event at all. Look at my former post for a solution.
Yes, EVT_CLOSE is never raised for grid window.
If you see the code, the grid is capturing the Frame close event instead the grid close event, and it works.
raffaello escribió:
Sorry, but in the aftermath I found out that my workaround was
correct, but only up to a certain point.
If the grid with its open EditControl is NOT in the TopWindow,
the application crashes again, most probably because the parent
does not Close but instead Destroys its children, and so does
not fire wx.EVT_CLOSE. So the workaround has to become more complex.
...
You can bind the frame close event inside the derived grid class:
class MyGrid(gridlib.Grid):
def __init__(self, ......
......
# Capture Frame Close Event
self.GetTopLevelParent().Bind(wx.EVT_CLOSE, self.OnFrameClose)
def OnFrameClose(self, evt):
self.SaveEditControlValue()
evt.Skip()
Regards
-- *****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.
El medio ambiente está en nuestra mano.
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
Oswaldo, could you please copy the code you are speaking of? I do not understand what is exactly the "Frame close event", and where it is possible to intercept it. Thanks.
...
You can bind the frame close event inside the derived grid class:
class MyGrid(gridlib.Grid):
def __init__(self, ......
......
# Capture Frame Close Event
# Get the Top Window:
# TopWindow = self.GetTopLevelParent()
···
#
# Bind TopWindow close event to your grid function
# TopWindow.Bind(wx.EVT_CLOSE, self.OnFrameClose)
# in one line:
self.GetTopLevelParent().Bind(wx.EVT_CLOSE, self.OnFrameClose)
def OnFrameClose(self, evt):
self.SaveEditControlValue()
# -> Important evt may be skipped
evt.Skip()
Regards
--
*****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.
El medio ambiente está en nuestra mano.
Oswaldo, could you please copy the code you are speaking of? I do not understand what is exactly the “Frame close event”, and where it is possible to intercept it. Thanks.
…
You can bind the frame close event inside the derived grid class:
class MyGrid(gridlib.Grid):
def __init__(self, ......
......
# Capture Frame Close Event
Get the Top Window:
# TopWindow = self.GetTopLevelParent()
#
# Bind TopWindow close event to your grid function
# TopWindow.Bind(wx.EVT_CLOSE, self.OnFrameClose)
# in one line:
self.GetTopLevelParent().Bind(wx.EVT_CLOSE, self.OnFrameClose)
def OnFrameClose(self, evt):
self.SaveEditControlValue()
→ Important evt may be skipped
evt.Skip()
Regards
–
Oswaldo Hernández
oswaldo (@) soft-com (.) es
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.