1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import os.path
20
21 import wx
22
23 from timelinelib.config.paths import ICONS_DIR
24 from timelinelib.wxgui.dialogs.eventlist.view import EventListDialog
25
26
28
30 self.icon_size = (16, 16)
31 self._create_close_button()
32 self._create_search_box()
33 self._create_prev_button()
34 self._create_next_button()
35 self._create_list_button()
36 self._create_no_match_label()
37 self._create_single_match_label()
38 self.Realize()
39
42
44 self.search = wx.SearchCtrl(self, size=(150, -1),
45 style=wx.TE_PROCESS_ENTER)
46 self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN,
47 self._search_on_search_btn, self.search)
48 self.Bind(wx.EVT_TEXT_ENTER, self._search_on_text_enter, self.search)
49 self.AddControl(self.search)
50
58
64
69
74
76 self.lbl_no_match = wx.StaticText(self, label=_("No match"))
77 self.lbl_no_match.Show(False)
78 self.AddControl(self.lbl_no_match)
79
81 self.lbl_single_match = wx.StaticText(self, label=_("Only one match"))
82 self.lbl_single_match.Show(False)
83 self.AddControl(self.lbl_single_match)
84
86 self.Show(False)
87 self.GetParent().Layout()
88
91
94
97
100
103
104
106
108 self.view = view
109 self.result = []
110 self.result_index = 0
111 self.last_search = None
112
114 self.timeline_canvas = timeline_canvas
115 self.view.Enable(timeline_canvas is not None)
116
132
138
144
152
158
160 return bool(self.result and self.result_index > 0)
161
163 return bool(self.result and self.result_index < (len(self.result) - 1))
164
166 return bool(len(self.result) > 0)
167
169 return self.result > 0 and self.result_index == 0
170
172 return self.result > 0 and self.result_index == (len(self.result) - 1)
173
174
176
182
185
188
190 self.lbl_no_match.Show(nomatch)
191
193 self.lbl_single_match.Show(singlematch)
194
199