def buildDialog(filePath, resourceName, mayCancel, **defaults):
"""Return a configured wx.Dialog.
Assumes that the OK and Cancel buttons are named ID_OK & ID_CANCEL.
"""
res = loadXrc(filePath)
insureWxApp()
dlg = res.LoadDialog(None, resourceName)
assert isinstance(dlg, wx.Dialog)
dlg.Fit()
fetchWidget = dlg.FindWindowByName
bOk = dlg.FindWindowByName('ID_OK')
bCancel = dlg.FindWindowByName('ID_CANCEL')
bOk.SetId(wx.ID_OK)
bCancel.SetId(wx.ID_CANCEL)
if not mayCancel:
bCancel.Disable()
bCancel.Hide()
for name, value in defaults.items():
dlg.FindWindowByName(name).SetValue(value)
if not mayCancel:
dlg.Bind(wx.EVT_CHAR_HOOK, escapeSuppressor)
return dlg
评论列表
文章目录