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.

52 lines
1.4 KiB

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