new event wx.lib.agw.aui.EVT_AUI_PANE_CLOSED#1628
Conversation
Fire an event when a pane has been closed.
RobinD42
left a comment
There was a problem hiding this comment.
A minor issue and some questions.
| e = AuiManagerEvent(wxEVT_AUI_PANE_CLOSED) | ||
| e.SetPane(pane_info) | ||
| e.SetCanVeto(False) | ||
| e.SetId(wxEVT_AUI_PANE_CLOSED) |
There was a problem hiding this comment.
An Event's id attribute is normally used for the id of the widget sending the event, not the event type. For example, for a EVT_BUTTON event the id is the value of the button's GetId(), not wxEVT_BUTTON. Also, it looks like the other AUI events are not setting the id (not great, but okay) so it's probably better to follow the existing pattern here.
There was a problem hiding this comment.
I see why i set the id: to distingish from other events. But now i know i can use the event type instead.
| e.SetPane(pane_info) | ||
| e.SetCanVeto(False) | ||
| e.SetId(wxEVT_AUI_PANE_CLOSED) | ||
| wx.CallAfter(self.ProcessMgrEvent, e) |
There was a problem hiding this comment.
Is wx.CallAfter necessary here?
There was a problem hiding this comment.
Also, would it make sense to just use the FireEvent method to create and send the event instead of doing it all here?
There was a problem hiding this comment.
Not 100% sure, but i think i thought to have the closing event be finished before fireing the closed event. Anyway, i switch to FireEvent which in also uses wx.CallLater.
|
@RobinD42 what is preferred: just adding a commit with changes or squashing the commits and force-push? |
|
Just adding the new commits is fine. It makes it easy to see what's changed. If a PR gets messy enough that a squash would be better, then I can do that when merging. |
|
This pull request has been mentioned on Discuss wxPython. There might be relevant details there: https://discuss.wxpython.org/t/wxpython-4-1-1-released/35043/1 |
I needed an event when a pane was closed, but the existing
wx.lib.agw.aui.EVT_AUI_PANE_CLOSEis fired when a pane is about to be closed and that sometimes led to timing issues.I added an extra event that is fired when the pane is really closed.
I was thinking about to rename EVT_AUI_PANE_CLOSE to EVT_AUI_PANE_CLOSING (which better fits), but that could break older code. So i just changed the docstring.