1
2
3
4
5 import wx
6
9
10 from Gnumed.wxpython import gmListWidgets, gmAllergyWidgets
11
12
13 kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.THICK_FRAME
14 wx.Dialog.__init__(self, *args, **kwds)
15 self._TXT_current_state = wx.StaticText(self, -1, _("<current allergy state>"))
16 self._TXT_last_confirmed = wx.StaticText(self, -1, _("<last confirmed>"))
17 self._RBTN_unknown = wx.RadioButton(self, -1, _("Unknown"))
18 self._RBTN_none = wx.RadioButton(self, -1, _("No known allergies"))
19 self._RBTN_some = wx.RadioButton(self, -1, _("Has allergies"))
20 self._TCTRL_state_comment = wx.TextCtrl(self, -1, "", style=wx.NO_BORDER)
21 self._BTN_confirm = wx.Button(self, -1, _("&Update / Con&firm"))
22 self.__szr_state_staticbox = wx.StaticBox(self, -1, _("Allergy state"))
23 self._LCTRL_allergies = gmListWidgets.cReportListCtrl(self, -1, style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.NO_BORDER)
24 self._LBL_message = wx.StaticText(self, -1, _("Input new allergy, or select from among existing allergy items to edit them:"))
25 self._PNL_edit_area = gmAllergyWidgets.cAllergyEditAreaPnl(self, -1, style=wx.NO_BORDER | wx.TAB_TRAVERSAL)
26 self._BTN_save_details = wx.Button(self, wx.ID_SAVE, "", style=wx.BU_EXACTFIT)
27 self._BTN_clear = wx.Button(self, wx.ID_CLEAR, "", style=wx.BU_EXACTFIT)
28 self._BTN_delete = wx.Button(self, wx.ID_DELETE, "", style=wx.BU_EXACTFIT)
29 self.__szr_details_staticbox = wx.StaticBox(self, -1, _("Allergy details"))
30 self.__hline_bottom = wx.StaticLine(self, -1)
31 self._BTN_dismiss = wx.Button(self, wx.ID_CLOSE, "")
32
33 self.__set_properties()
34 self.__do_layout()
35
36 self.Bind(wx.EVT_BUTTON, self._on_confirm_button_pressed, self._BTN_confirm)
37 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._on_list_item_selected, self._LCTRL_allergies)
38 self.Bind(wx.EVT_BUTTON, self._on_save_details_button_pressed, self._BTN_save_details)
39 self.Bind(wx.EVT_BUTTON, self._on_clear_button_pressed, self._BTN_clear)
40 self.Bind(wx.EVT_BUTTON, self._on_delete_button_pressed, self._BTN_delete)
41 self.Bind(wx.EVT_BUTTON, self._on_dismiss_button_pressed, self._BTN_dismiss)
42
43
45
46 self.SetTitle(_("Allergy Manager"))
47 self.SetSize((650, 500))
48 self._TXT_current_state.SetToolTipString(_("This displays the current allergy state as saved in the database."))
49 self._TXT_last_confirmed.SetToolTipString(_("When was the allergy state last confirmed."))
50 self._RBTN_unknown.SetToolTipString(_("Select this if there is no information available on whether the patient has any allergies or not."))
51 self._RBTN_none.SetToolTipString(_("Select this if the patient has no known allergies."))
52 self._RBTN_some.SetToolTipString(_("Select this if the patient has known allergies."))
53 self._TCTRL_state_comment.SetToolTipString(_("A comment on the allergy state."))
54 self._BTN_confirm.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
55 self._BTN_confirm.SetToolTipString(_("Save and confirm the allergy state."))
56 self._LCTRL_allergies.SetToolTipString(_("Lists the allergies known for this patient if any."))
57 self._BTN_save_details.SetToolTipString(_("Save the allergy details in the edit area as either a new allergy or as an update to the existing allergy selected above."))
58 self._BTN_clear.SetToolTipString(_("Clear the fields of the edit area. Will discard unsaved data."))
59 self._BTN_delete.SetToolTipString(_("Delete the allergy selected in the list from the database."))
60 self._BTN_delete.Enable(False)
61 self._BTN_dismiss.SetToolTipString(_("Close the dialag. Will discard unsaved data."))
62 self._BTN_dismiss.SetDefault()
63
64
66
67 __szr_main = wx.BoxSizer(wx.VERTICAL)
68 __szr_bottom = wx.BoxSizer(wx.HORIZONTAL)
69 self.__szr_details_staticbox.Lower()
70 __szr_details = wx.StaticBoxSizer(self.__szr_details_staticbox, wx.VERTICAL)
71 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
72 self.__szr_state_staticbox.Lower()
73 __szr_state = wx.StaticBoxSizer(self.__szr_state_staticbox, wx.VERTICAL)
74 __szr_state_button = wx.BoxSizer(wx.HORIZONTAL)
75 __gszr_state = wx.FlexGridSizer(4, 2, 2, 10)
76 __szr_new_state = wx.BoxSizer(wx.HORIZONTAL)
77 __szr_current_state = wx.BoxSizer(wx.HORIZONTAL)
78 __LBL_state = wx.StaticText(self, -1, _("Currently:"))
79 __gszr_state.Add(__LBL_state, 0, wx.ALIGN_CENTER_VERTICAL, 0)
80 __szr_current_state.Add(self._TXT_current_state, 1, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 15)
81 __LBL_confirmed = wx.StaticText(self, -1, _("Last confirmed:"))
82 __szr_current_state.Add(__LBL_confirmed, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
83 __szr_current_state.Add(self._TXT_last_confirmed, 1, wx.ALIGN_CENTER_VERTICAL, 0)
84 __gszr_state.Add(__szr_current_state, 1, wx.EXPAND, 0)
85 __LBL_set_state = wx.StaticText(self, -1, _("Set to:"))
86 __gszr_state.Add(__LBL_set_state, 0, wx.ALIGN_CENTER_VERTICAL, 15)
87 __szr_new_state.Add(self._RBTN_unknown, 0, wx.RIGHT | wx.EXPAND, 10)
88 __szr_new_state.Add(self._RBTN_none, 0, wx.RIGHT | wx.EXPAND, 10)
89 __szr_new_state.Add(self._RBTN_some, 0, wx.EXPAND, 10)
90 __gszr_state.Add(__szr_new_state, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
91 __LBL_comment = wx.StaticText(self, -1, _("Comment:"))
92 __gszr_state.Add(__LBL_comment, 0, wx.ALIGN_CENTER_VERTICAL, 0)
93 __gszr_state.Add(self._TCTRL_state_comment, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
94 __gszr_state.AddGrowableCol(1)
95 __szr_state.Add(__gszr_state, 1, wx.BOTTOM | wx.EXPAND, 5)
96 __szr_state_button.Add((20, 20), 1, wx.EXPAND, 0)
97 __szr_state_button.Add(self._BTN_confirm, 0, wx.EXPAND, 0)
98 __szr_state_button.Add((20, 20), 1, wx.EXPAND, 0)
99 __szr_state.Add(__szr_state_button, 0, wx.EXPAND, 0)
100 __szr_main.Add(__szr_state, 0, wx.ALL | wx.EXPAND, 5)
101 __szr_details.Add(self._LCTRL_allergies, 2, wx.BOTTOM | wx.EXPAND, 10)
102 __szr_details.Add(self._LBL_message, 0, wx.BOTTOM | wx.ALIGN_CENTER_VERTICAL, 3)
103 __szr_details.Add(self._PNL_edit_area, 2, wx.BOTTOM | wx.EXPAND, 5)
104 __szr_buttons.Add(self._BTN_save_details, 0, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
105 __szr_buttons.Add(self._BTN_clear, 0, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
106 __szr_buttons.Add(self._BTN_delete, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
107 __szr_buttons.Add((20, 20), 2, wx.EXPAND, 0)
108 __szr_details.Add(__szr_buttons, 0, wx.EXPAND, 5)
109 __szr_main.Add(__szr_details, 1, wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 5)
110 __szr_main.Add(self.__hline_bottom, 0, wx.LEFT | wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 2)
111 __szr_bottom.Add((20, 20), 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
112 __szr_bottom.Add(self._BTN_dismiss, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
113 __szr_bottom.Add((20, 20), 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
114 __szr_main.Add(__szr_bottom, 0, wx.TOP | wx.EXPAND, 5)
115 self.SetSizer(__szr_main)
116 self.Layout()
117 self.Centre()
118
119
121 print "Event handler `_on_save_button_pressed' not implemented!"
122 event.Skip()
123
125 print "Event handler `_on_clear_button_pressed' not implemented!"
126 event.Skip()
127
129 print "Event handler `_on_delete_button_pressed' not implemented"
130 event.Skip()
131
133 print "Event handler `_on_list_item_deselected' not implemented"
134 event.Skip()
135
137 print "Event handler `_on_list_item_selected' not implemented"
138 event.Skip()
139
141 print "Event handler `_on_list_item_activated' not implemented"
142 event.Skip()
143
145 print "Event handler `_on_list_item_focused' not implemented"
146 event.Skip()
147
149 print "Event handler `_on_dismiss_button_pressed' not implemented"
150 event.Skip()
151
153 print "Event handler `_on_reconfirm_button_pressed' not implemented"
154 event.Skip()
155
157 print "Event handler `_on_save_state_button_pressed' not implemented"
158 event.Skip()
159
161 print "Event handler `_on_save_details_button_pressed' not implemented"
162 event.Skip()
163
165 print "Event handler `_on_confirm_button_pressed' not implemented"
166 event.Skip()
167
168
169