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