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.config.preferences import PreferencesEditor
22 from timelinelib.wxgui.utils import BORDER
23
24
26
32
35
38
41
43 self.choice_week.SetSelection(index)
44
46 main_box = self._create_main_box()
47 self.SetSizerAndFit(main_box)
48
50 notebook = self._create_nootebook_control()
51 button_box = self._create_button_box()
52 main_box = wx.BoxSizer(wx.VERTICAL)
53 flag = wx.ALL|wx.EXPAND
54 main_box.Add(notebook, flag=flag, border=BORDER, proportion=1)
55 main_box.Add(button_box, flag=flag, border=BORDER)
56 return main_box
57
59 notebook = wx.Notebook(self, style=wx.BK_DEFAULT)
60 self._create_general_tab(notebook)
61 self._create_date_time_tab(notebook)
62 return notebook
63
70
72 panel = self._create_tab_panel(notebook, _("General"))
73 controls = self._create_general_tab_controls(panel)
74 self._size_tab_panel(panel, controls)
75
77 self.chb_open_recent = self._create_chb_open_recent(panel)
78 self.chb_inertial_scrolling = self._create_chb_inertial_scrolling(panel)
79 return (self.chb_open_recent, self.chb_inertial_scrolling)
80
82 panel = self._create_tab_panel(notebook, _("Date && Time"))
83 controls = self._create_date_time_tab_controls(panel)
84 self._size_tab_panel(panel, controls)
85
87 self.chb_wide_date_range = self._create_chb_wide_date_range(panel)
88 self.choice_week = self._create_choice_week(panel)
89 grid = wx.FlexGridSizer(1, 2, BORDER, BORDER)
90 grid.Add(wx.StaticText(panel, label=_("Week start on:")),
91 flag=wx.ALIGN_CENTER_VERTICAL)
92 grid.Add(self.choice_week, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
93 warning = _("This feature is experimental. If events are\ncreated in the extended range, you can not\ndisable this option and successfully load\nthe timeline again. A reload of the timeline\nis also needed for this to take effect.")
94 warning_text_control = wx.StaticText(panel, label=warning)
95 warning_text_control.SetForegroundColour((255, 0, 0))
96 return (grid, self.chb_wide_date_range, warning_text_control)
97
99 panel = wx.Panel(notebook)
100 notebook.AddPage(panel, label)
101 return panel
102
104 sizer = wx.BoxSizer(wx.VERTICAL)
105 for control in controls:
106 sizer.Add(control, flag=wx.ALL|wx.EXPAND, border=BORDER)
107 panel.SetSizer(sizer)
108
110 label = _("Open most recent timeline on startup")
111 handler = self._chb_open_recent_startup_on_checkbox
112 chb = self._create_chb(panel, label, handler)
113 return chb
114
120
122 label = _("Use extended date range (before 1 AD)")
123 handler = self._chb_use_wide_date_range_on_checkbox
124 chb = self._create_chb(panel, label, handler)
125 return chb
126
128 chb = wx.CheckBox(panel, label=label)
129 self.Bind(wx.EVT_CHECKBOX, handler, chb)
130 return chb
131
133 choice_week = wx.Choice(panel, choices=[_("Monday"), _("Sunday")])
134 self.Bind(wx.EVT_CHOICE, self._choice_week_on_choice, choice_week)
135 return choice_week
136
144
147
150
153
156
159