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.canvas.drawing.utils import darken_color
22
23
24 WARNING_BG_COLOR = (251, 100, 100)
25 INFO_BG_COLOR = ((251, 203, 58))
26
27
29
30 """
31 This class is used to create (or hide) a message text displayed
32 at the top of the Timeline window.
33 A message comes in two flavors:
34 - Information message
35 - Warning message
36 What distinguishes the two flavors is the background color of the
37 message text area.
38 """
39
41 """The name parameter is needed for testing purposes."""
42 wx.Panel.__init__(self, parent, style=wx.BORDER_NONE)
43 self._create_gui()
44
47
50
54
56 self._inner_panel = wx.Panel(self)
57 self._label = wx.StaticText(self._inner_panel, style=wx.ALIGN_CENTRE_HORIZONTAL)
58 self._add_with_border(self, self._inner_panel, 2, style=wx.EXPAND)
59 self._add_with_border(self._inner_panel, self._label, 5, style=wx.ALIGN_CENTER)
60
62 sizer = wx.BoxSizer(wx.VERTICAL)
63 sizer.Add(child, proportion=1, flag=wx.ALL | style, border=border)
64 parent.SetSizer(sizer)
65
67 self._set_colour(color)
68 self._set_message(message)
69 self._repaint_window()
70
74
77
79 self.Refresh()
80 self.Show()
81 self.GetParent().Layout()
82