Here is the first one:
In the beginning all configuration dialogs only had an "OK" and "Cancel" button. A pair of month ago I added an "Apply" button to them, but the implementation wasn't very good. EG simply called your Configure() method again if the user pressed the apply-button and eg.ConfigurationDialog() returned the same dialog again (after clearing all controls). To avoid screen flicker it simply disabled screen refreshes till AffirmedShowModal() was called. This approach did its job, but wasn't very efficient of course. And now the latest update of wxPython will not allow to disable the screen refreshes completely, so the dialogs will start to flicker on apply.
So it was time to rework the mechanism. Lets look at a typical Configure() method as it was before and after the new implementation.
The old one:
Code: Select all
def Configure(self, myString=""):
dialog = eg.ConfigurationDialog(self)
textControl = wx.TextCtrl(dialog, -1, myString)
dialog.sizer.Add(textControl)
if dialog.AffirmedShowModal():
return (textControl.GetValue(), )
Code: Select all
def Configure(self, myString=""):
panel = eg.ConfigPanel(self)
textControl = wx.TextCtrl(panel, -1, myString)
panel.sizer.Add(textControl)
while panel.Affirmed():
panel.SetResult(textControl.GetValue())
1. You don't call eg.ConfigurationDialog(self) anymore, but eg.ConfigPanel(self) instead. The returned object is a wx.Panel instance and not a wx.Dialog instance.
2. You create your controls with the panel as parent and add it to the panel.sizer. This is actually no real change, as the panel has the same methods and attributes as the old dialog.
3. Instead of doing a "if dialog.AffirmedShowModal(): return (...)" you now have to create a while loop with "panel.Affirmed()" as condition and return the results of your controls through "panel.SetResult(...)". This way your Configure() method can be kept alive till the user presses "OK" or "Cancel".
I already have updated all your plugins in the latest beta.
So you don't need to rewrite anything yourself. But if you have uncommitted changes, be aware of the new implementation and update them accordingly. The new betas will print a small error message if you use the old eg.ConfigurationDialog() but will work as before. In some time I will remove the old implementation completely.
I accordingly have updated the documentation also:
http://www.eventghost.org/docs/writing_plugins