1
2
3
4
5
6 import wx
7
8
9 import gettext
10
11
12
13
14
15
18
19 kwds["style"] = kwds.get("style", 0) | wx.BORDER_NONE | wx.TAB_TRAVERSAL
20 wx.Panel.__init__(self, *args, **kwds)
21 self._LBL_message = wx.StaticText(self, wx.ID_ANY, "", style=wx.ALIGN_CENTER)
22 from Gnumed.wxpython.gmListWidgets import cReportListCtrl
23 self._LCTRL_items = cReportListCtrl(self, wx.ID_ANY, style=wx.BORDER_NONE | wx.LC_HRULES | wx.LC_REPORT)
24 self._BTN_add = wx.Button(self, wx.ID_ADD, "")
25 self._BTN_edit = wx.Button(self, -1, _("&Edit"))
26 self._BTN_remove = wx.Button(self, wx.ID_REMOVE, "")
27 self._BTN_extra_left = wx.Button(self, wx.ID_ANY, _("left extra"), style=wx.BU_EXACTFIT)
28 self._BTN_extra_middle = wx.Button(self, wx.ID_ANY, _("middle extra"), style=wx.BU_EXACTFIT)
29 self._BTN_extra_right = wx.Button(self, wx.ID_ANY, _("right extra"), style=wx.BU_EXACTFIT)
30
31 self.__set_properties()
32 self.__do_layout()
33
34 self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self._on_list_item_activated, self._LCTRL_items)
35 self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self._on_list_item_deselected, self._LCTRL_items)
36 self.Bind(wx.EVT_LIST_ITEM_FOCUSED, self._on_list_item_focused, self._LCTRL_items)
37 self.Bind(wx.EVT_BUTTON, self._on_add_button_pressed, self._BTN_add)
38 self.Bind(wx.EVT_BUTTON, self._on_edit_button_pressed, self._BTN_edit)
39 self.Bind(wx.EVT_BUTTON, self._on_remove_button_pressed, self._BTN_remove)
40 self.Bind(wx.EVT_BUTTON, self._on_left_extra_button_pressed, self._BTN_extra_left)
41 self.Bind(wx.EVT_BUTTON, self._on_middle_extra_button_pressed, self._BTN_extra_middle)
42 self.Bind(wx.EVT_BUTTON, self._on_right_extra_button_pressed, self._BTN_extra_right)
43
44
46
47 self._BTN_add.SetToolTip(_("Add a new item to the list."))
48 self._BTN_add.Enable(False)
49 self._BTN_edit.SetToolTip(_("Edit the selected item."))
50 self._BTN_edit.Enable(False)
51 self._BTN_remove.SetToolTip(_("Remove the selected item(s) from the list."))
52 self._BTN_remove.Enable(False)
53 self._BTN_extra_left.Enable(False)
54 self._BTN_extra_left.Hide()
55 self._BTN_extra_middle.Enable(False)
56 self._BTN_extra_middle.Hide()
57 self._BTN_extra_right.Enable(False)
58 self._BTN_extra_right.Hide()
59
60
62
63 __szr_main = wx.BoxSizer(wx.VERTICAL)
64 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
65 __szr_main.Add(self._LBL_message, 0, wx.BOTTOM | wx.EXPAND, 3)
66 __szr_main.Add(self._LCTRL_items, 1, wx.EXPAND, 0)
67 __szr_buttons.Add((20, 20), 2, wx.ALIGN_CENTER_VERTICAL, 0)
68 __szr_buttons.Add(self._BTN_add, 0, wx.ALIGN_CENTER_VERTICAL, 0)
69 __szr_buttons.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL, 0)
70 __szr_buttons.Add(self._BTN_edit, 0, wx.ALIGN_CENTER_VERTICAL, 0)
71 __szr_buttons.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL, 0)
72 __szr_buttons.Add(self._BTN_remove, 0, wx.ALIGN_CENTER_VERTICAL, 0)
73 __szr_buttons.Add((20, 20), 2, wx.ALIGN_CENTER_VERTICAL, 0)
74 __szr_buttons.Add(self._BTN_extra_left, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
75 __szr_buttons.Add(self._BTN_extra_middle, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
76 __szr_buttons.Add(self._BTN_extra_right, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
77 __szr_buttons.Add((20, 20), 2, wx.ALIGN_CENTER_VERTICAL, 0)
78 __szr_main.Add(__szr_buttons, 0, wx.EXPAND | wx.TOP, 3)
79 self.SetSizer(__szr_main)
80 __szr_main.Fit(self)
81 self.Layout()
82
83
85 print("Event handler '_on_list_item_activated' not implemented!")
86 event.Skip()
87
89 print("Event handler '_on_list_item_deselected' not implemented!")
90 event.Skip()
91
93 print("Event handler '_on_list_item_focused' not implemented!")
94 event.Skip()
95
97 print("Event handler '_on_add_button_pressed' not implemented!")
98 event.Skip()
99
101 print("Event handler '_on_edit_button_pressed' not implemented!")
102 event.Skip()
103
105 print("Event handler '_on_remove_button_pressed' not implemented!")
106 event.Skip()
107
109 print("Event handler '_on_left_extra_button_pressed' not implemented!")
110 event.Skip()
111
113 print("Event handler '_on_middle_extra_button_pressed' not implemented!")
114 event.Skip()
115
117 print("Event handler '_on_right_extra_button_pressed' not implemented!")
118 event.Skip()
119
120
121