1
2
3
4
5 import wx
6
9
10 from Gnumed.wxpython import gmListWidgets
11
12
13 kwds["style"] = wx.CAPTION|wx.RESIZE_BORDER|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX|wx.THICK_FRAME
14 wx.Dialog.__init__(self, *args, **kwds)
15 self._LBL_message = wx.StaticText(self, -1, "")
16 self._LCTRL_items = gmListWidgets.cReportListCtrl(self, -1, style=wx.LC_REPORT|wx.NO_BORDER)
17 self._BTN_ok = wx.Button(self, wx.ID_OK, "")
18 self._BTN_cancel = wx.Button(self, wx.ID_CANCEL, "")
19 self._BTN_new = wx.Button(self, wx.ID_ADD, "", style=wx.BU_EXACTFIT)
20 self._BTN_edit = wx.Button(self, -1, _("&Edit"), style=wx.BU_EXACTFIT)
21 self._BTN_delete = wx.Button(self, wx.ID_DELETE, "", style=wx.BU_EXACTFIT)
22 self._BTN_extra_left = wx.Button(self, -1, _("1"), style=wx.BU_EXACTFIT)
23 self._BTN_extra_middle = wx.Button(self, -1, _("2"), style=wx.BU_EXACTFIT)
24 self._BTN_extra_right = wx.Button(self, -1, _("3"), style=wx.BU_EXACTFIT)
25
26 self.__set_properties()
27 self.__do_layout()
28
29 self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self._on_list_item_deselected, self._LCTRL_items)
30 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._on_list_item_selected, self._LCTRL_items)
31 self.Bind(wx.EVT_BUTTON, self._on_new_button_pressed, self._BTN_new)
32 self.Bind(wx.EVT_BUTTON, self._on_edit_button_pressed, self._BTN_edit)
33 self.Bind(wx.EVT_BUTTON, self._on_delete_button_pressed, self._BTN_delete)
34 self.Bind(wx.EVT_BUTTON, self._on_left_extra_button_pressed, self._BTN_extra_left)
35 self.Bind(wx.EVT_BUTTON, self._on_middle_extra_button_pressed, self._BTN_extra_middle)
36 self.Bind(wx.EVT_BUTTON, self._on_right_extra_button_pressed, self._BTN_extra_right)
37
38
40
41 self.SetSize((640, 500))
42 self._LCTRL_items.SetToolTipString(_("Select the items you want to work on.\n\nA discontinuous selection may depend on your holding down a platform-dependent modifier key (<ctrl>, <alt>, etc) or key combination (eg. <ctrl-shift> or <ctrl-alt>) while clicking."))
43 self._LCTRL_items.SetFocus()
44 self._BTN_ok.SetToolTipString(_("Act on the items selected in the above list."))
45 self._BTN_ok.Enable(False)
46 self._BTN_cancel.SetToolTipString(_("Cancel this dialog."))
47 self._BTN_cancel.SetDefault()
48 self._BTN_new.SetToolTipString(_("Add a new item to the list above."))
49 self._BTN_new.Enable(False)
50 self._BTN_edit.SetToolTipString(_("Edit the (first or only) item selected in the list above."))
51 self._BTN_edit.Enable(False)
52 self._BTN_delete.SetToolTipString(_("Delete - if possible - the (first or only) item selected in the list above."))
53 self._BTN_delete.Enable(False)
54 self._BTN_extra_left.Enable(False)
55 self._BTN_extra_middle.Enable(False)
56 self._BTN_extra_right.Enable(False)
57
58
60
61 __szr_main = wx.BoxSizer(wx.VERTICAL)
62 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
63 __szr_main.Add(self._LBL_message, 0, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 3)
64 __szr_main.Add(self._LCTRL_items, 1, wx.ALL|wx.EXPAND, 3)
65 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
66 __szr_buttons.Add(self._BTN_ok, 0, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
67 __szr_buttons.Add(self._BTN_cancel, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
68 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
69 __szr_buttons.Add(self._BTN_new, 0, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
70 __szr_buttons.Add(self._BTN_edit, 0, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
71 __szr_buttons.Add(self._BTN_delete, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
72 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
73 __szr_buttons.Add(self._BTN_extra_left, 0, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
74 __szr_buttons.Add(self._BTN_extra_middle, 0, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
75 __szr_buttons.Add(self._BTN_extra_right, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
76 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
77 __szr_main.Add(__szr_buttons, 0, wx.ALL|wx.EXPAND, 3)
78 self.SetSizer(__szr_main)
79 self.Layout()
80 self.Centre()
81
82
84 print "Event handler `_on_list_item_deselected' not implemented!"
85 event.Skip()
86
88 print "Event handler `_on_list_item_selected' not implemented!"
89 event.Skip()
90
92 print "Event handler `_on_ok_button_pressed' not implemented!"
93 event.Skip()
94
96 print "Event handler `_on_edit_button_pressed' not implemented"
97 event.Skip()
98
100 print "Event handler `_on_new_button_pressed' not implemented"
101 event.Skip()
102
104 print "Event handler `_on_delete_button_pressed' not implemented"
105 event.Skip()
106
108 print "Event handler `_on_left_extra_button_pressed' not implemented"
109 event.Skip()
110
112 print "Event handler `_on_middle_extra_button_pressed' not implemented"
113 event.Skip()
114
116 print "Event handler `_on_right_extra_button_pressed' not implemented"
117 event.Skip()
118
119
120
121
122 if __name__ == "__main__":
123 import gettext
124 gettext.install("app")
125
126 app = wx.PySimpleApp(0)
127 wx.InitAllImageHandlers()
128 dialog_1 = wxgGenericListSelectorDlg(None, -1, "")
129 app.SetTopWindow(dialog_1)
130 dialog_1.Show()
131 app.MainLoop()
132