1
2
3
4
5 import wx
6 import wx.grid
7
8
9
10
11
12
15
16 from Gnumed.wxpython import gmMedicationWidgets
17
18
19 kwds["style"] = wx.NO_BORDER | wx.TAB_TRAVERSAL
20 wx.ScrolledWindow.__init__(self, *args, **kwds)
21 self._TCTRL_lab = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_RICH2 | wx.NO_BORDER)
22 self._RBTN_issue = wx.RadioButton(self, wx.ID_ANY, _("Health issue"))
23 self._RBTN_brand = wx.RadioButton(self, wx.ID_ANY, _("Brand"))
24 self._RBTN_episode = wx.RadioButton(self, wx.ID_ANY, _("Episode"))
25 self._CHBOX_show_inactive = wx.CheckBox(self, wx.ID_ANY, _("Inactive"))
26 self._CHBOX_show_unapproved = wx.CheckBox(self, wx.ID_ANY, _("Unapproved"))
27 self._grid_substances = gmMedicationWidgets.cCurrentSubstancesGrid(self, wx.ID_ANY, size=(1, 1))
28 self._BTN_add = wx.Button(self, wx.ID_ADD, "", style=wx.BU_EXACTFIT)
29 self._BTN_edit = wx.Button(self, wx.ID_ANY, _("&Edit"), style=wx.BU_EXACTFIT)
30 self._BTN_delete = wx.Button(self, wx.ID_DELETE, "", style=wx.BU_EXACTFIT)
31 self._BTN_allergy = wx.Button(self, wx.ID_ANY, _("Allergy"), style=wx.BU_EXACTFIT)
32 self._BTN_info = wx.Button(self, wx.ID_ANY, _("Info"), style=wx.BU_EXACTFIT)
33 self._BTN_heart = wx.Button(self, wx.ID_ANY, _(u"\u2665"), style=wx.BU_EXACTFIT)
34 self._BTN_kidneys = wx.Button(self, wx.ID_ANY, _("Kidney"), style=wx.BU_EXACTFIT)
35 self._LBL_gfr = wx.StaticText(self, wx.ID_ANY, _("GFR: ?"))
36 self._BTN_interactions = wx.Button(self, wx.ID_ANY, _("&Interactions?"), style=wx.BU_EXACTFIT)
37 self._BTN_rx = wx.Button(self, wx.ID_ANY, _(u"\u211e"), style=wx.BU_EXACTFIT)
38 self._BTN_adr = wx.Button(self, wx.ID_ANY, _("ADR"), style=wx.BU_EXACTFIT)
39 self._BTN_print = wx.Button(self, wx.ID_PRINT, "", style=wx.BU_EXACTFIT)
40
41 self.__set_properties()
42 self.__do_layout()
43
44 self.Bind(wx.EVT_RADIOBUTTON, self._on_issue_grouping_selected, self._RBTN_issue)
45 self.Bind(wx.EVT_RADIOBUTTON, self._on_brand_grouping_selected, self._RBTN_brand)
46 self.Bind(wx.EVT_RADIOBUTTON, self._on_episode_grouping_selected, self._RBTN_episode)
47 self.Bind(wx.EVT_CHECKBOX, self._on_show_inactive_checked, self._CHBOX_show_inactive)
48 self.Bind(wx.EVT_CHECKBOX, self._on_show_unapproved_checked, self._CHBOX_show_unapproved)
49 self.Bind(wx.EVT_BUTTON, self._on_add_button_pressed, self._BTN_add)
50 self.Bind(wx.EVT_BUTTON, self._on_edit_button_pressed, self._BTN_edit)
51 self.Bind(wx.EVT_BUTTON, self._on_delete_button_pressed, self._BTN_delete)
52 self.Bind(wx.EVT_BUTTON, self._on_allergy_button_pressed, self._BTN_allergy)
53 self.Bind(wx.EVT_BUTTON, self._on_info_button_pressed, self._BTN_info)
54 self.Bind(wx.EVT_BUTTON, self._on_button_heart_pressed, self._BTN_heart)
55 self.Bind(wx.EVT_BUTTON, self._on_button_kidneys_pressed, self._BTN_kidneys)
56 self.Bind(wx.EVT_BUTTON, self._on_interactions_button_pressed, self._BTN_interactions)
57 self.Bind(wx.EVT_BUTTON, self._on_rx_button_pressed, self._BTN_rx)
58 self.Bind(wx.EVT_BUTTON, self._on_adr_button_pressed, self._BTN_adr)
59 self.Bind(wx.EVT_BUTTON, self._on_print_button_pressed, self._BTN_print)
60
61
63
64 self.SetScrollRate(10, 10)
65 self._TCTRL_lab.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
66 self._TCTRL_lab.Hide()
67 self._RBTN_issue.SetToolTipString(_("Sort entries by the \"health issue\" for which they are taken, then \"substance\", then \"started\"."))
68 self._RBTN_issue.SetValue(1)
69 self._RBTN_brand.SetToolTipString(_("Sort entries by \"brand\", then \"substance\", then \"started\".\n\nThus each substance will only appear once unless it is really taken in more than one preparation."))
70 self._RBTN_episode.SetToolTipString(_("Sort entries by \"health issue\" and \"episode\" for which they are taken, then \"substance\", then \"started\"."))
71 self._CHBOX_show_inactive.SetToolTipString(_("Whether to show inactive substances, too, or only those which are assumed to currently be active."))
72 self._CHBOX_show_inactive.SetValue(1)
73 self._CHBOX_show_unapproved.SetToolTipString(_("Whether to show all substances or only those the intake of which is approved of."))
74 self._CHBOX_show_unapproved.SetValue(1)
75 self._BTN_add.SetToolTipString(_("Add a substance."))
76 self._BTN_edit.SetToolTipString(_("Edit the selected substance intake entry."))
77 self._BTN_delete.SetToolTipString(_("Remove a substance from the list."))
78 self._BTN_allergy.SetToolTipString(_("Discontinue selected entry due to an allergy or intolerance."))
79 self._BTN_info.SetToolTipString(_("Show in-depth information on the selected substance if available."))
80 self._BTN_heart.SetFont(wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
81 self._BTN_heart.SetToolTipString(_("Show <www.qtdrugs.org> information on handling of drugs / the selected drug in the presence of long Qt duration."))
82 self._BTN_kidneys.SetToolTipString(_("Show <www.dosing.de> information on handling of drugs / the selected drug in the presence of renal insufficiency."))
83 self._BTN_interactions.SetToolTipString(_("Check for interactions between selected drugs.\n\nIncludes all drugs if none selected."))
84 self._BTN_rx.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
85 self._BTN_rx.SetToolTipString(_("Write a prescription based on either of\n\n- the selected lines\n- a copy of the most recent prescription"))
86 self._BTN_adr.SetToolTipString(_("Report an Adverse Drug Reaction."))
87 self._BTN_print.SetToolTipString(_("Print the medication list."))
88
89
91
92 __szr_main = wx.BoxSizer(wx.VERTICAL)
93 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
94 __szr_grid = wx.BoxSizer(wx.HORIZONTAL)
95 __szr_grouping = wx.BoxSizer(wx.HORIZONTAL)
96 __szr_main.Add(self._TCTRL_lab, 0, wx.BOTTOM | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 3)
97 __lbl_group = wx.StaticText(self, wx.ID_ANY, _("Sort by:"))
98 __szr_grouping.Add(__lbl_group, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
99 __szr_grouping.Add(self._RBTN_issue, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
100 __szr_grouping.Add(self._RBTN_brand, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
101 __szr_grouping.Add(self._RBTN_episode, 0, wx.ALIGN_CENTER_VERTICAL, 5)
102 __SLINE_grouping = wx.StaticLine(self, wx.ID_ANY, style=wx.LI_VERTICAL)
103 __szr_grouping.Add(__SLINE_grouping, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
104 __lbl_filter = wx.StaticText(self, wx.ID_ANY, _("Include:"))
105 __szr_grouping.Add(__lbl_filter, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
106 __szr_grouping.Add(self._CHBOX_show_inactive, 0, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
107 __szr_grouping.Add(self._CHBOX_show_unapproved, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
108 __szr_grouping.Add((20, 20), 1, wx.EXPAND, 0)
109 __szr_main.Add(__szr_grouping, 0, wx.EXPAND, 0)
110 __szr_grid.Add(self._grid_substances, 1, wx.TOP | wx.EXPAND, 5)
111 __szr_main.Add(__szr_grid, 1, wx.EXPAND, 0)
112 __szr_buttons.Add((20, 20), 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
113 __szr_buttons.Add(self._BTN_add, 0, wx.RIGHT | wx.EXPAND, 5)
114 __szr_buttons.Add(self._BTN_edit, 0, wx.RIGHT | wx.EXPAND, 5)
115 __szr_buttons.Add(self._BTN_delete, 0, wx.RIGHT | wx.EXPAND, 5)
116 __szr_buttons.Add(self._BTN_allergy, 0, wx.RIGHT | wx.EXPAND, 5)
117 __szr_buttons.Add(self._BTN_info, 0, wx.EXPAND, 5)
118 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
119 __szr_buttons.Add(self._BTN_heart, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
120 __szr_buttons.Add(self._BTN_kidneys, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
121 __szr_buttons.Add(self._LBL_gfr, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
122 __szr_buttons.Add(self._BTN_interactions, 0, wx.ALIGN_CENTER_VERTICAL, 5)
123 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
124 __szr_buttons.Add(self._BTN_rx, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
125 __szr_buttons.Add(self._BTN_adr, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
126 __szr_buttons.Add(self._BTN_print, 0, wx.ALIGN_CENTER_VERTICAL, 0)
127 __szr_buttons.Add((20, 20), 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
128 __szr_main.Add(__szr_buttons, 0, wx.TOP | wx.EXPAND, 5)
129 self.SetSizer(__szr_main)
130 __szr_main.Fit(self)
131
132
134 print "Event handler `_on_add_button_pressed' not implemented"
135 event.Skip()
136
138 print "Event handler `_on_delete_button_pressed' not implemented"
139 event.Skip()
140
142 print "Event handler `_on_print_button_pressed' not implemented"
143 event.Skip()
144
146 print "Event handler `_on_episode_grouping_selected' not implemented"
147 event.Skip()
148
150 print "Event handler `_on_brand_grouping_selected' not implemented"
151 event.Skip()
152
154 print "Event handler `_on_show_unapproved_checked' not implemented"
155 event.Skip()
156
158 print "Event handler `_on_show_inactive_checked' not implemented"
159 event.Skip()
160
162 print "Event handler `_on_interactions_button_pressed' not implemented"
163 event.Skip()
164
166 print "Event handler `_on_edit_button_pressed' not implemented"
167 event.Skip()
168
170 print "Event handler `_on_info_button_pressed' not implemented"
171 event.Skip()
172
174 print "Event handler `_on_allergy_button_pressed' not implemented"
175 event.Skip()
176
178 print "Event handler `_on_button_kidneys_pressed' not implemented"
179 event.Skip()
180
182 print "Event handler `_on_adr_button_pressed' not implemented"
183 event.Skip()
184
186 print "Event handler `_on_rx_button_pressed' not implemented"
187 event.Skip()
188
190 print "Event handler `_on_issue_grouping_selected' not implemented"
191 event.Skip()
192
194 print "Event handler `_on_button_heart_pressed' not implemented"
195 event.Skip()
196
197
198