1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import wx
20
21 from timelinelib.wxgui.utils import BORDER
22 from timelinelib.wxgui.utils import _display_error_message
23 from timelinelib.wxgui.utils import time_picker_for
24 from timelinelib.utils import ex_msg
25
26
28
29 - def __init__(self, parent, config, time_type, time, title):
30 wx.Dialog.__init__(self, parent, title=title)
31 self.time_type = time_type
32 self.config = config
33 self._create_gui()
34 self.time_picker.set_value(time)
35 if self._should_display_show_time_checkbox():
36 self.time_picker.show_time(self.checkbox.IsChecked())
37 self.time_picker.SetFocus()
38
40 self._create_show_time_checkbox()
41 self._create_time_picker()
42 self._create_buttons()
43 self._layout_components()
44
46 if self._should_display_show_time_checkbox():
47 self.checkbox = wx.CheckBox(self, label=_("Show time"))
48 self.checkbox.SetValue(False)
49 self.Bind(wx.EVT_CHECKBOX, self._show_time_checkbox_on_checked, self.checkbox)
50
53
56
60
68
70 vbox = wx.BoxSizer(wx.VERTICAL)
71 if self._should_display_show_time_checkbox():
72 vbox.Add(self.checkbox, flag=wx.LEFT|wx.TOP|wx.RIGHT,
73 border=BORDER, proportion=1)
74 if self._should_display_show_time_checkbox():
75 flag = wx.EXPAND|wx.RIGHT|wx.BOTTOM|wx.LEFT
76 else:
77 flag = wx.EXPAND|wx.RIGHT|wx.TOP|wx.BOTTOM|wx.LEFT
78 vbox.Add(self.time_picker, flag=flag,
79 border=BORDER, proportion=1)
80 vbox.Add(self.button_box, flag=wx.ALL|wx.EXPAND, border=BORDER)
81 self.SetSizerAndFit(vbox)
82
85