You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4 KiB

  1. __author__ = 'Chris'
  2. import wx
  3. from gooey.gui.util import wx_util
  4. from gooey.gui.three_to_four import Classes, Constants
  5. class CalendarDlg(wx.Dialog):
  6. def __init__(self, parent):
  7. wx.Dialog.__init__(self, parent)
  8. self.SetBackgroundColour('#ffffff')
  9. self.ok_button = wx.Button(self, wx.ID_OK, label='Ok')
  10. self.datepicker = Classes.DatePickerCtrl(self, style=Constants.WX_DP_DROPDOWN)
  11. vertical_container = wx.BoxSizer(wx.VERTICAL)
  12. vertical_container.AddSpacer(10)
  13. vertical_container.Add(wx_util.h1(self, label='Select a Date'), 0, wx.LEFT | wx.RIGHT, 15)
  14. vertical_container.AddSpacer(10)
  15. vertical_container.Add(self.datepicker, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 15)
  16. vertical_container.AddSpacer(10)
  17. button_sizer = wx.BoxSizer(wx.HORIZONTAL)
  18. button_sizer.AddStretchSpacer(1)
  19. button_sizer.Add(self.ok_button, 0)
  20. vertical_container.Add(button_sizer, 0, wx.LEFT | wx.RIGHT, 15)
  21. vertical_container.AddSpacer(20)
  22. self.SetSizerAndFit(vertical_container)
  23. self.Bind(wx.EVT_BUTTON, self.OnOkButton, self.ok_button)
  24. def OnOkButton(self, event):
  25. self.EndModal(wx.ID_OK)
  26. event.Skip()
  27. def OnCancellButton(self, event):
  28. try:
  29. return None
  30. except:
  31. self.Close()
  32. def GetPath(self):
  33. return self.datepicker.GetValue().FormatISODate()