Wow! The option dialogs look really cool.
Two questions:
1. I haven't understood the need of the "label" option. Does it only modify the appearance of the action in the tree? If so, isn't it enough the user can rename it directly in the tree?
2. If I have so many options in a particular action/plugin, I prefer to use a dictionary to store them, because it is easier to introduce new options or to drop unneeded options and I don't lose compatibility with older settings if I change something. It is also more readable, since it is hard to remember what option the "[12]" means. So I write it like:
Code:
class DictionaryTest(eg.ActionClass):
defaults = {
"aValue": True,
"bValue": "The value of b",
"cValue": "The value of c",
}
def __call__(self, kwargs):
options = self.defaults.copy()
options.update(kwargs)
print options
def Configure(self, kwargs={}):
options = self.defaults.copy()
options.update(kwargs)
dialog = eg.ConfigurationDialog(self)
aValueCtrl = wx.CheckBox(dialog, -1, "aValue")
aValueCtrl.SetValue(options["aValue"])
bValueCtrl = wx.TextCtrl(dialog)
bValueCtrl.SetValue(options["bValue"])
cValueCtrl = wx.TextCtrl(dialog)
cValueCtrl.SetValue(options["cValue"])
dialog.sizer.Add(aValueCtrl)
dialog.sizer.Add(bValueCtrl)
dialog.sizer.Add(cValueCtrl)
if dialog.AffirmedShowModal():
kwargs = {}
kwargs["aValue"] = aValueCtrl.GetValue()
kwargs["bValue"] = bValueCtrl.GetValue()
kwargs["cValue"] = cValueCtrl.GetValue()
return (kwargs, )