#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.6.8
#

import wx
import wx.calendar

# begin wxGlade: dependencies
import gettext
# end wxGlade

# begin wxGlade: extracode
from Gnumed.wxpython.gmDateTimeInput import cDateInputPhraseWheel
# end wxGlade


class wxgEdcCalculatorDlg(wx.Dialog):
	def __init__(self, *args, **kwds):
		# begin wxGlade: wxgEdcCalculatorDlg.__init__
		kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.THICK_FRAME
		wx.Dialog.__init__(self, *args, **kwds)
		self._PRW_lmp = cDateInputPhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
		self._CHBOX_first_pregnancy = wx.CheckBox(self, wx.ID_ANY, _("&First pregnancy"))
		self._PRW_edc = cDateInputPhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
		self._TCTRL_details = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_WORDWRAP)
		self._CALCTRL = wx.calendar.CalendarCtrl(self, wx.ID_ANY, style=wx.calendar.CAL_SHOW_SURROUNDING_WEEKS)
		self._TCTRL_algo = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_WORDWRAP | wx.NO_BORDER)
		self._BTN_save = wx.Button(self, wx.ID_SAVE, "", style=wx.BU_EXACTFIT)
		self._BTN_cancel = wx.Button(self, wx.ID_CANCEL, "", style=wx.BU_EXACTFIT)

		self.__set_properties()
		self.__do_layout()

		self.Bind(wx.EVT_CHECKBOX, self._on_first_pregnancy_toggled, self._CHBOX_first_pregnancy)
		self.Bind(wx.calendar.EVT_CALENDAR, self._on_lmp_picked_in_calendar, self._CALCTRL)
		self.Bind(wx.EVT_BUTTON, self._on_save_button_pressed, self._BTN_save)
		# end wxGlade

	def __set_properties(self):
		# begin wxGlade: wxgEdcCalculatorDlg.__set_properties
		self.SetTitle(_("Due Date Calculator"))
		self.SetSize(wx.DLG_SZE(self, (400, 200)))
		self._PRW_lmp.SetToolTipString(_("Required: Enter the 1st day of the Last Menstrual Period."))
		self._CHBOX_first_pregnancy.SetToolTipString(_("Check here if this is the first pregnancy."))
		self._CHBOX_first_pregnancy.SetValue(1)
		self._PRW_edc.SetToolTipString(_("Expected Date of Confinement.\n\nYou can also just enter a date here if one is known from external sources."))
		self._TCTRL_details.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
		self._TCTRL_algo.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
		self._BTN_save.SetToolTipString(_("Save the Expected Due Date."))
		self._BTN_cancel.SetToolTipString(_("Close without saving."))
		# end wxGlade

	def __do_layout(self):
		# begin wxGlade: wxgEdcCalculatorDlg.__do_layout
		__szr_main = wx.BoxSizer(wx.VERTICAL)
		__szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
		__szr_middle = wx.BoxSizer(wx.HORIZONTAL)
		__szr_right = wx.BoxSizer(wx.VERTICAL)
		__szr_left = wx.BoxSizer(wx.VERTICAL)
		__fgszr_input_fields = wx.FlexGridSizer(3, 2, 1, 3)
		__lbl_lmp = wx.StaticText(self, wx.ID_ANY, _("LMP (1st)"))
		__lbl_lmp.SetForegroundColour(wx.Colour(255, 0, 0))
		__fgszr_input_fields.Add(__lbl_lmp, 0, wx.ALIGN_CENTER_VERTICAL, 0)
		__fgszr_input_fields.Add(self._PRW_lmp, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
		__fgszr_input_fields.Add((20, 20), 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
		__fgszr_input_fields.Add(self._CHBOX_first_pregnancy, 1, wx.ALIGN_CENTER_VERTICAL, 0)
		__lbl_due_date = wx.StaticText(self, wx.ID_ANY, _("EDC"))
		__fgszr_input_fields.Add(__lbl_due_date, 0, wx.ALIGN_CENTER_VERTICAL, 0)
		__fgszr_input_fields.Add(self._PRW_edc, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
		__fgszr_input_fields.AddGrowableCol(1)
		__szr_left.Add(__fgszr_input_fields, 0, wx.EXPAND, 1)
		__szr_left.Add(self._TCTRL_details, 1, wx.TOP | wx.EXPAND, 4)
		__szr_middle.Add(__szr_left, 1, wx.EXPAND, 1)
		__lbl_select_lmp = wx.StaticText(self, wx.ID_ANY, _("or pick 1st day of LMP:"))
		__szr_right.Add(__lbl_select_lmp, 0, wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5)
		__szr_right.Add(self._CALCTRL, 0, 0, 10)
		__szr_right.Add(self._TCTRL_algo, 1, wx.TOP | wx.EXPAND, 5)
		__szr_middle.Add(__szr_right, 0, wx.LEFT | wx.EXPAND, 10)
		__szr_main.Add(__szr_middle, 1, wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND, 3)
		__szr_buttons.Add((20, 20), 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
		__szr_buttons.Add(self._BTN_save, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
		__szr_buttons.Add(self._BTN_cancel, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
		__szr_buttons.Add((20, 20), 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
		__szr_main.Add(__szr_buttons, 0, wx.ALL | wx.EXPAND, 3)
		self.SetSizer(__szr_main)
		self.Layout()
		# end wxGlade

	def _on_first_pregnancy_toggled(self, event):  # wxGlade: wxgEdcCalculatorDlg.<event_handler>
		print "Event handler '_on_first_pregnancy_toggled' not implemented!"
		event.Skip()

	def _on_lmp_picked_in_calendar(self, event):  # wxGlade: wxgEdcCalculatorDlg.<event_handler>
		print "Event handler '_on_lmp_picked_in_calendar' not implemented!"
		event.Skip()

	def _on_save_button_pressed(self, event):  # wxGlade: wxgEdcCalculatorDlg.<event_handler>
		print "Event handler '_on_save_button_pressed' not implemented!"
		event.Skip()

# end of class wxgEdcCalculatorDlg
if __name__ == "__main__":
	gettext.install("app") # replace with the appropriate catalog name

	app = wx.PySimpleApp(0)
	wx.InitAllImageHandlers()
	dialog_1 = wxgEdcCalculatorDlg(None, wx.ID_ANY, "")
	app.SetTopWindow(dialog_1)
	dialog_1.Show()
	app.MainLoop()