DialogConfirm.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. """
  2. This file is part of RuneOptimizer.
  3. RuneOptimizer is free software: you can redistribute it and/or modify it
  4. under the terms of the GNU General Public License as published by the Free
  5. Software Foundation, either version 3 of the License, or (at your option)
  6. any later version.
  7. RuneOptimizer is distributed in the hope that it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. RuneOptimizer. If not, see <https://www.gnu.org/licenses/>.
  13. """
  14. class DialogConfirm(wx.Dialog):
  15. """
  16. Dialog for confirmations.
  17. """
  18. def __init__(self, parent, id=wx.ID_ANY, message="Proceed?"):
  19. """Initializes the dialog.
  20. Sets upt all the widgets.
  21. Parameters
  22. ----------
  23. parent : wx.*
  24. Dialog parent.
  25. id : int, optional
  26. ID for the dialig (default wx.ID_ANY).
  27. message : string
  28. Message for the dialog.
  29. """
  30. # Parent constructor
  31. wx.Dialog.__init__(
  32. self, parent=parent, id=id, pos=(50, 50), size=(240, 180),
  33. title="Confirm action", style=wx.DEFAULT_DIALOG_STYLE
  34. )
  35. wx.StaticText(
  36. parent=self, id=wx.ID_ANY, label=message,
  37. pos=(10, 10), size=(220, 80), style=wx.ALIGN_CENTRE_HORIZONTAL
  38. )
  39. btYes = wx.Button(
  40. parent=self, id=wx.ID_OK, pos=(26, 100),
  41. size=(80, 40), style=wx.LC_REPORT, label="Yes"
  42. )
  43. btNo = wx.Button(
  44. parent=self, id=wx.ID_CANCEL, pos=(132, 100),
  45. size=(80, 40), style=wx.LC_REPORT, label="No"
  46. )