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_NEW, "")
20 self._BTN_edit = wx.Button(self, -1, _("&Edit"))
21 self._BTN_delete = wx.Button(self, -1, _("&Delete"))
22
23 self.__set_properties()
24 self.__do_layout()
25
26 self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self._on_list_item_deselected, self._LCTRL_items)
27 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._on_list_item_selected, self._LCTRL_items)
28 self.Bind(wx.EVT_BUTTON, self._on_new_button_pressed, self._BTN_new)
29 self.Bind(wx.EVT_BUTTON, self._on_edit_button_pressed, self._BTN_edit)
30 self.Bind(wx.EVT_BUTTON, self._on_delete_button_pressed, self._BTN_delete)
31
32
34
35 self.SetSize((640, 500))
36 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."))
37 self._LCTRL_items.SetFocus()
38 self._BTN_ok.SetToolTipString(_("Act on the items selected in the above list."))
39 self._BTN_ok.Enable(False)
40 self._BTN_cancel.SetToolTipString(_("Cancel this dialog."))
41 self._BTN_cancel.SetDefault()
42 self._BTN_new.SetToolTipString(_("Add a new item to the list above."))
43 self._BTN_new.Enable(False)
44 self._BTN_edit.SetToolTipString(_("Edit the (first or only) item selected in the list above."))
45 self._BTN_edit.Enable(False)
46 self._BTN_delete.SetToolTipString(_("Delete the (first or only) item selected in the list above."))
47 self._BTN_delete.Enable(False)
48
49
51
52 __szr_main = wx.BoxSizer(wx.VERTICAL)
53 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
54 __szr_main.Add(self._LBL_message, 0, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 3)
55 __szr_main.Add(self._LCTRL_items, 1, wx.ALL|wx.EXPAND, 3)
56 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
57 __szr_buttons.Add(self._BTN_ok, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
58 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
59 __szr_buttons.Add(self._BTN_cancel, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
60 __szr_buttons.Add((20, 20), 2, wx.EXPAND, 0)
61 __szr_buttons.Add(self._BTN_new, 0, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
62 __szr_buttons.Add(self._BTN_edit, 0, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
63 __szr_buttons.Add(self._BTN_delete, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
64 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
65 __szr_main.Add(__szr_buttons, 0, wx.ALL|wx.EXPAND, 3)
66 self.SetSizer(__szr_main)
67 self.Layout()
68 self.Centre()
69
70
72 print "Event handler `_on_list_item_deselected' not implemented!"
73 event.Skip()
74
76 print "Event handler `_on_list_item_selected' not implemented!"
77 event.Skip()
78
80 print "Event handler `_on_ok_button_pressed' not implemented!"
81 event.Skip()
82
84 print "Event handler `_on_edit_button_pressed' not implemented"
85 event.Skip()
86
88 print "Event handler `_on_new_button_pressed' not implemented"
89 event.Skip()
90
92 print "Event handler `_on_delete_button_pressed' not implemented"
93 event.Skip()
94
95
96
97
98 if __name__ == "__main__":
99 import gettext
100 gettext.install("app")
101
102 app = wx.PySimpleApp(0)
103 wx.InitAllImageHandlers()
104 dialog_1 = wxgGenericListSelectorDlg(None, -1, "")
105 app.SetTopWindow(dialog_1)
106 dialog_1.Show()
107 app.MainLoop()
108