Rework how we handle all modal dialogs

This commit is contained in:
DarkPhoenix
2019-08-10 01:56:43 +03:00
parent c315adf987
commit a028ebe198
8 changed files with 289 additions and 282 deletions

View File

@@ -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)