Gnumed.timelinelib.wxgui.dialogs.eraeditor.view

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

# Source Code for Module Gnumed.timelinelib.wxgui.dialogs.eraeditor.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.eraeditor.controller import EraEditorDialogController
     20  from timelinelib.wxgui.framework import Dialog
     21
     22
     23 -class EraEditorDialog(Dialog):
     24
     25      """
     26      <BoxSizerVertical>
     27          <StaticBoxSizerVertical label="$(groupbox_text)" border="ALL" >
     28              <FlexGridSizer rows="0" columns="2" border="ALL">
     29                  <StaticText
     30                      label="$(when_text)"
     31                      align="ALIGN_CENTER_VERTICAL"
     32                  />
     33                  <PeriodPicker
     34                      time_type="$(time_type)"
     35                      config="$(config)"
     36                      name="period_picker"
     37                  />
     38                  <Spacer />
     39                  <BoxSizerHorizontal >
     40                      <CheckBox
     41                          align="ALIGN_CENTER_VERTICAL"
     42                          label="$(ends_today_text)"
     43                          name="cbx_ends_today"
     44                      />
     45                  </BoxSizerHorizontal>
     46                  <StaticText
     47                      label="$(name_text)"
     48                      align="ALIGN_CENTER_VERTICAL"
     49                  />
     50                  <TextCtrl name="txt_name" />
     51                  <StaticText
     52                      label="$(colour_text)"
     53                      align="ALIGN_CENTER_VERTICAL"
     54                  />
     55                  <ColourSelect
     56                      name="colorpicker"
     57                      align="ALIGN_CENTER_VERTICAL"
     58                      width="60"
     59                      height="30"
     60                  />
     61              </FlexGridSizer>
     62          </StaticBoxSizerVertical>
     63          <DialogButtonsOkCancelSizer
     64              border="LEFT|RIGHT|BOTTOM"
     65              event_EVT_BUTTON__ID_OK="on_ok"
     66          />
     67      </BoxSizerVertical>
     68      """
     69
     70 -    def __init__(self, parent, title, time_type, config, era):
     71          Dialog.__init__(self, EraEditorDialogController, parent, {
     72              "groupbox_text": _("Era Properties"),
     73              "name_text": _("Name:"),
     74              "colour_text": _("Colour:"),
     75              "when_text": _("When:"),
     76              "time_type": time_type,
     77              "config": config,
     78              "ends_today_text":  _("Ends today"),
     79          }, title=title)
     80          self.controller.on_init(era)
     81          self.period_picker.SetFocus()
     82
     83 -    def GetPeriod(self):
     84          return self.period_picker.GetValue()
     85
     86 -    def SetPeriod(self, time_period):
     87          self.period_picker.SetValue(time_period)
     88
     89 -    def GetEndsToday(self):
     90          return self.cbx_ends_today.IsChecked()
     91
     92 -    def SetEndsToday(self, value):
     93          self.cbx_ends_today.SetValue(value)
     94
     95 -    def GetName(self):
     96          return self.txt_name.GetValue()
     97
     98 -    def SetName(self, name):
     99          self.txt_name.SetValue(name)
    100
    101 -    def GetColor(self):
    102          return self.colorpicker.GetValue()
    103
    104 -    def SetColor(self, new_color):
    105          self.colorpicker.SetValue(new_color)
    106
    107 -    def DisplayInvalidPeriod(self, message):
    108          self.DisplayErrorMessage(message, focus_widget=self.period_picker)
    109
    110 -    def DisplayInvalidName(self, message):
    111          self.DisplayErrorMessage(message, focus_widget=self.txt_name)
    112
    113 -    def DisplayInvalidColor(self, message):
    114          self.DisplayErrorMessage(message, focus_widget=self.colorpicker)
    115