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.

48 lines
1.3 KiB

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