Package Gnumed :: Package timelinelib :: Package wxgui :: Package dialogs :: Package changenowdate :: Module view |
[frames] | no frames]

# Source Code for Module Gnumed.timelinelib.wxgui.dialogs.changenowdate.view

     1  # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018  Rickard Lindberg, Roger Lindberg
     2  #
     3  # This file is part of Timeline.
     4  #
     5  # Timeline is free software: you can redistribute it and/or modify
     6  # it under the terms of the GNU General Public License as published by
     7  # the Free Software Foundation, either version 3 of the License, or
     8  # (at your option) any later version.
     9  #
    10  # Timeline is distributed in the hope that it will be useful,
    11  # but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  # GNU General Public License for more details.
    14  #
    15  # You should have received a copy of the GNU General Public License
    16  # along with Timeline.  If not, see <http://www.gnu.org/licenses/>.
    17
    18
    19  from timelinelib.wxgui.dialogs.changenowdate.controller import ChangeNowDateDialogController
    20  from timelinelib.wxgui.framework import Dialog
    21
    22
    23 -class ChangeNowDateDialog(Dialog):
    24
    25      """
    26      <BoxSizerVertical>
    27          <CheckBox
    28              name="show_time_checkbox"
    29              label="$(show_time_text)"
    30              event_EVT_CHECKBOX="on_show_time_changed"
    31              border="LEFT|TOP|RIGHT"
    32          />
    33          <TimePicker
    34              name="time_picker"
    35              time_type="$(time_type)"
    36              config="$(config)"
    37              on_change="$(time_picker_on_change)"
    38              border="LEFT|BOTTOM|RIGHT"
    39          />
    40          <DialogButtonsCloseSizer
    41              border="LEFT|BOTTOM|RIGHT"
    42          />
    43      </BoxSizerVertical>
    44      """
    45
    46 -    def __init__(self, parent, config, db, handle_new_time_fn, title):
    47          Dialog.__init__(self, ChangeNowDateDialogController, parent, {
    48              "show_time_text": _("Show time"),
    49              "time_type": db.get_time_type(),
    50              "config": config,
    51              "time_picker_on_change": self._time_picker_on_change,
    52          }, title=title)
    53          self.controller.on_init(db, handle_new_time_fn)
    54
    55 -    def GetNowValue(self):
    56          return self.time_picker.get_value()
    57
    58 -    def SetNowValue(self, value):
    59          self.time_picker.set_value(value)
    60
    61 -    def ShowTime(self, value):
    62          self.time_picker.show_time(value)
    63
    64 -    def IsShowTimeChecked(self):
    65          return self.show_time_checkbox.GetValue()
    66
    67 -    def FocusTimePicker(self):
    68          self.time_picker.SetFocus()
    69
    70 -    def _time_picker_on_change(self):
    71          self.controller.on_time_changed()
    72