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.components.textctrl import TextCtrl
22 from timelinelib.wxgui.components.textpatterncontrol.controller import TextPatternControlController
23
24
25 -class TextPatternControl(TextCtrl):
26
27 - def __init__(self, parent, name=None, fit_text=None):
28 TextCtrl.__init__(
29 self,
30 parent,
31 style=wx.TE_PROCESS_TAB,
32 fit_text=fit_text
33 )
34 self.controller = TextPatternControlController(self)
35 self._bind_events()
36 self.controller.on_init()
37
40
43
44 - def SetSeparators(self, separators):
46
47 - def SetParts(self, parts):
49
50 - def SetValidator(self, validator):
52
53 - def SetUpHandler(self, group, up_handler):
54 self.controller.set_up_handler(group, up_handler)
55
56 - def SetDownHandler(self, group, down_handler):
57 self.controller.set_down_handler(group, down_handler)
58
61
62 - def _bind_events(self):
63 self.Bind(wx.EVT_CHAR, self.controller.on_char)
64 self.Bind(wx.EVT_TEXT, self.controller.on_text)
65 self.Bind(wx.EVT_SET_FOCUS, self._on_set_focus)
66 self.Bind(wx.EVT_KILL_FOCUS, self.controller.on_kill_focus)
67
68 - def _on_set_focus(self, event):
69 wx.CallAfter(self.controller.on_after_set_focus)
70 event.Skip()
71