Package Gnumed :: Package wxGladeWidgets :: Module wxgEdcCalculatorDlg |
[frames] | no frames]

# Source Code for Module Gnumed.wxGladeWidgets.wxgEdcCalculatorDlg

      1  # -*- coding: UTF-8 -*-
      2  #
      3  # generated by wxGlade
      4  #
      5
      6  import wx
      7  import wx.adv
      8
      9  # begin wxGlade: dependencies
     10  import gettext
     11  # end wxGlade
     12
     13  # begin wxGlade: extracode
     14  from Gnumed.wxpython.gmDateTimeInput import cDateInputPhraseWheel
     15  # end wxGlade
     16
     17
     18 -class wxgEdcCalculatorDlg(wx.Dialog):
     19 -        def __init__(self, *args, **kwds):
     20                  # begin wxGlade: wxgEdcCalculatorDlg.__init__
     21                  kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER
     22                  wx.Dialog.__init__(self, *args, **kwds)
     23                  self.SetSize(wx.DLG_UNIT(self, wx.Size(400, 200)))
     24                  self._PRW_lmp = cDateInputPhraseWheel(self, wx.ID_ANY, "")
     25                  self._CHBOX_first_pregnancy = wx.CheckBox(self, wx.ID_ANY, _("&First pregnancy"))
     26                  self._PRW_edc = cDateInputPhraseWheel(self, wx.ID_ANY, "")
     27                  self._TCTRL_details = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_WORDWRAP)
     28                  self._CALCTRL = wx.adv.CalendarCtrl(self, wx.ID_ANY, style=wx.adv.CAL_SHOW_SURROUNDING_WEEKS)
     29                  self._TCTRL_algo = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_WORDWRAP)
     30                  self._BTN_save = wx.Button(self, wx.ID_SAVE, "", style=wx.BU_EXACTFIT)
     31                  self._BTN_cancel = wx.Button(self, wx.ID_CANCEL, "", style=wx.BU_EXACTFIT)
     32
     33                  self.__set_properties()
     34                  self.__do_layout()
     35
     36                  self.Bind(wx.EVT_CHECKBOX, self._on_first_pregnancy_toggled, self._CHBOX_first_pregnancy)
     37                  self.Bind(wx.adv.EVT_CALENDAR, self._on_lmp_picked_in_calendar, self._CALCTRL)
     38                  self.Bind(wx.EVT_BUTTON, self._on_save_button_pressed, self._BTN_save)
     39                  # end wxGlade
     40
     41 -        def __set_properties(self):
     42                  # begin wxGlade: wxgEdcCalculatorDlg.__set_properties
     43                  self.SetTitle(_("Due Date Calculator"))
     44                  self.SetSize(wx.DLG_UNIT(self, wx.Size(400, 200)))
     45                  self._PRW_lmp.SetToolTip(_("Required: Enter the 1st day of the Last Menstrual Period."))
     46                  self._CHBOX_first_pregnancy.SetToolTip(_("Check here if this is the first pregnancy."))
     47                  self._CHBOX_first_pregnancy.SetValue(1)
     48                  self._PRW_edc.SetToolTip(_("Expected Date of Confinement.\n\nYou can also just enter a date here if one is known from external sources."))
     49                  self._TCTRL_details.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
     50                  self._TCTRL_algo.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
     51                  self._BTN_save.SetToolTip(_("Save the Expected Due Date."))
     52                  self._BTN_cancel.SetToolTip(_("Close without saving."))
     53                  # end wxGlade
     54
     55 -        def __do_layout(self):
     56                  # begin wxGlade: wxgEdcCalculatorDlg.__do_layout
     57                  __szr_main = wx.BoxSizer(wx.VERTICAL)
     58                  __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
     59                  __szr_middle = wx.BoxSizer(wx.HORIZONTAL)
     60                  __szr_right = wx.BoxSizer(wx.VERTICAL)
     61                  __szr_left = wx.BoxSizer(wx.VERTICAL)
     62                  __fgszr_input_fields = wx.FlexGridSizer(3, 2, 1, 3)
     63                  __lbl_lmp = wx.StaticText(self, wx.ID_ANY, _("LMP (1st)"))
     64                  __lbl_lmp.SetForegroundColour(wx.Colour(255, 0, 0))
     65                  __fgszr_input_fields.Add(__lbl_lmp, 0, wx.ALIGN_CENTER_VERTICAL, 0)
     66                  __fgszr_input_fields.Add(self._PRW_lmp, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     67                  __fgszr_input_fields.Add((20, 20), 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     68                  __fgszr_input_fields.Add(self._CHBOX_first_pregnancy, 1, wx.ALIGN_CENTER_VERTICAL, 0)
     69                  __lbl_due_date = wx.StaticText(self, wx.ID_ANY, _("EDC"))
     70                  __fgszr_input_fields.Add(__lbl_due_date, 0, wx.ALIGN_CENTER_VERTICAL, 0)
     71                  __fgszr_input_fields.Add(self._PRW_edc, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     72                  __fgszr_input_fields.AddGrowableCol(1)
     73                  __szr_left.Add(__fgszr_input_fields, 0, wx.EXPAND, 1)
     74                  __szr_left.Add(self._TCTRL_details, 1, wx.EXPAND | wx.TOP, 4)
     75                  __szr_middle.Add(__szr_left, 1, wx.EXPAND, 1)
     76                  __lbl_select_lmp = wx.StaticText(self, wx.ID_ANY, _("or pick 1st day of LMP:"))
     77                  __szr_right.Add(__lbl_select_lmp, 0, wx.ALIGN_CENTER | wx.BOTTOM, 5)
     78                  __szr_right.Add(self._CALCTRL, 0, 0, 10)
     79                  __szr_right.Add(self._TCTRL_algo, 1, wx.EXPAND | wx.TOP, 5)
     80                  __szr_middle.Add(__szr_right, 0, wx.EXPAND | wx.LEFT, 10)
     81                  __szr_main.Add(__szr_middle, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 3)
     82                  __szr_buttons.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     83                  __szr_buttons.Add(self._BTN_save, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
     84                  __szr_buttons.Add(self._BTN_cancel, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
     85                  __szr_buttons.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     86                  __szr_main.Add(__szr_buttons, 0, wx.ALL | wx.EXPAND, 3)
     87                  self.SetSizer(__szr_main)
     88                  self.Layout()
     89                  # end wxGlade
     90
     91 -        def _on_first_pregnancy_toggled(self, event):  # wxGlade: wxgEdcCalculatorDlg.<event_handler>
     92                  print("Event handler '_on_first_pregnancy_toggled' not implemented!")
     93                  event.Skip()
     94
     95 -        def _on_lmp_picked_in_calendar(self, event):  # wxGlade: wxgEdcCalculatorDlg.<event_handler>
     96                  print("Event handler '_on_lmp_picked_in_calendar' not implemented!")
     97                  event.Skip()
     98
     99 -        def _on_save_button_pressed(self, event):  # wxGlade: wxgEdcCalculatorDlg.<event_handler>
    100                  print("Event handler '_on_save_button_pressed' not implemented!")
    101                  event.Skip()
    102
    103  # end of class wxgEdcCalculatorDlg
    104