Rework how we handle all modal dialogs
This commit is contained in:
@@ -2,9 +2,8 @@ import wx
|
||||
|
||||
|
||||
def YesNoDialog(question='Are you sure you want to do this?', caption='Yes or no?'):
|
||||
dlg = wx.MessageDialog(None, question, caption, wx.YES_NO | wx.ICON_QUESTION)
|
||||
result = dlg.ShowModal() == wx.ID_YES
|
||||
dlg.Destroy()
|
||||
with wx.MessageDialog(None, question, caption, wx.YES_NO | wx.ICON_QUESTION) as dlg:
|
||||
result = dlg.ShowModal() == wx.ID_YES
|
||||
return result
|
||||
|
||||
|
||||
@@ -25,4 +24,4 @@ def HandleCtrlBackspace(textControl):
|
||||
elif foundChar:
|
||||
break
|
||||
textControl.Remove(startIndex, curPos)
|
||||
textControl.SetInsertionPoint(startIndex)
|
||||
textControl.SetInsertionPoint(startIndex)
|
||||
|
||||
Reference in New Issue
Block a user