1
2
3
4
5
6 import wx
7
8
9 import gettext
10
11
12
13 from Gnumed.wxpython.gmPhraseWheel import cPhraseWheel
14 from Gnumed.wxpython.gmDateTimeInput import cDateInputPhraseWheel
15 from Gnumed.wxpython.gmDateTimeInput import cIntervalPhraseWheel
16 from Gnumed.wxpython.gmMedicationWidgets import cSubstanceAimPhraseWheel
17 from Gnumed.wxpython.gmMedicationWidgets import cSubstanceSchedulePhraseWheel
18 from Gnumed.wxpython.gmEMRStructWidgets import cEpisodeSelectionPhraseWheel
19 from Gnumed.wxpython.gmMedicationWidgets import cSubstanceIntakeObjectPhraseWheel
20
21
22
25
26 kwds["style"] = kwds.get("style", 0) | wx.BORDER_NONE | wx.TAB_TRAVERSAL
27 wx.ScrolledWindow.__init__(self, *args, **kwds)
28 self._LBL_allergies = wx.StaticText(self, wx.ID_ANY, "")
29 self._PRW_drug = cSubstanceIntakeObjectPhraseWheel(self, wx.ID_ANY, "")
30 self._LBL_drug_details = wx.StaticText(self, wx.ID_ANY, "")
31 self._BTN_heart = wx.Button(self, wx.ID_ANY, _(u"\u2665"), style=wx.BU_EXACTFIT)
32 self._BTN_kidneys = wx.Button(self, wx.ID_ANY, _("Kidneys"), style=wx.BU_EXACTFIT)
33 self._BTN_manage_products = wx.Button(self, wx.ID_ANY, _("Drugs"), style=wx.BU_EXACTFIT)
34 self._BTN_manage_component = wx.Button(self, wx.ID_ANY, _("Components"), style=wx.BU_EXACTFIT)
35 self._BTN_manage_doses = wx.Button(self, wx.ID_ANY, _("Doses"), style=wx.BU_EXACTFIT)
36 self._BTN_manage_substance = wx.Button(self, wx.ID_ANY, _("Substances"), style=wx.BU_EXACTFIT)
37 self._CHBOX_start_unknown = wx.CheckBox(self, wx.ID_ANY, _("&Unknown - or Date:"))
38 self._DP_started = cDateInputPhraseWheel(self, wx.ID_ANY, "")
39 self._PRW_start_certainty = cPhraseWheel(self, wx.ID_ANY, "")
40 self._CHBOX_approved = wx.CheckBox(self, wx.ID_ANY, _("Approved of"))
41 self._PRW_episode = cEpisodeSelectionPhraseWheel(self, wx.ID_ANY, "")
42 self._PRW_schedule = cSubstanceSchedulePhraseWheel(self, wx.ID_ANY, "")
43 self._PRW_duration = cIntervalPhraseWheel(self, wx.ID_ANY, "")
44 self._CHBOX_long_term = wx.CheckBox(self, wx.ID_ANY, _("Long-term"))
45 self._PRW_aim = cSubstanceAimPhraseWheel(self, wx.ID_ANY, "")
46 self._PRW_notes = cPhraseWheel(self, wx.ID_ANY, "")
47 self._DP_discontinued = cDateInputPhraseWheel(self, wx.ID_ANY, "")
48 self._BTN_discontinued_as_planned = wx.Button(self, wx.ID_ANY, _("Per plan"), style=wx.BU_EXACTFIT)
49 self._LBL_reason = wx.StaticText(self, wx.ID_ANY, _("... Reason"))
50 self._PRW_discontinue_reason = cPhraseWheel(self, wx.ID_ANY, "")
51
52 self.__set_properties()
53 self.__do_layout()
54
55 self.Bind(wx.EVT_BUTTON, self._on_heart_button_pressed, self._BTN_heart)
56 self.Bind(wx.EVT_BUTTON, self._on_kidneys_button_pressed, self._BTN_kidneys)
57 self.Bind(wx.EVT_BUTTON, self._on_manage_drug_products_button_pressed, self._BTN_manage_products)
58 self.Bind(wx.EVT_BUTTON, self._on_manage_components_button_pressed, self._BTN_manage_component)
59 self.Bind(wx.EVT_BUTTON, self._on_manage_doses_button_pressed, self._BTN_manage_doses)
60 self.Bind(wx.EVT_BUTTON, self._on_manage_substances_button_pressed, self._BTN_manage_substance)
61 self.Bind(wx.EVT_CHECKBOX, self._on_start_unknown_checked, self._CHBOX_start_unknown)
62 self.Bind(wx.EVT_CHECKBOX, self._on_chbox_long_term_checked, self._CHBOX_long_term)
63 self.Bind(wx.EVT_BUTTON, self._on_discontinued_as_planned_button_pressed, self._BTN_discontinued_as_planned)
64
65
67
68 self.SetScrollRate(10, 10)
69 self._PRW_drug.SetToolTip(_("A drug the patient is taking.\n\nLookup and select a (real or generic) drug product by either of\n- a generic substance name\n- a drug product name\n- an active ingredient of a drug\n\nNote that all components of multi-component drugs will be displayed and automatically added to the patient's list."))
70 self._BTN_heart.SetToolTip(_("Show cardiac information relevant to substance selection."))
71 self._BTN_kidneys.SetToolTip(_("Show renal insufficiency information related to substance selection."))
72 self._BTN_manage_products.SetToolTip(_("Manage drug products.\n\nNote that this will not select a component for you. What it does is to let you manage (add/edit/delete) the drug products known to GNUmed from which you can select a component."))
73 self._BTN_manage_component.SetToolTip(_("Manage drug components."))
74 self._BTN_manage_doses.SetToolTip(_("Manage substance doses."))
75 self._BTN_manage_substance.SetToolTip(_("Manage substances."))
76 self._CHBOX_start_unknown.SetToolTip(_("Check here if the start date simply isn't known."))
77 self._CHBOX_start_unknown.SetValue(1)
78 self._DP_started.SetToolTip(_("When was this substance started to be consumed or - if not known - the earliest it is known to have been be consumed."))
79 self._DP_started.Enable(False)
80 self._PRW_start_certainty.SetToolTip(_("A coment on the certainty of the start date, such as \"+/- 3 weeks\", \"spring of 2002\", \"shortly after Easter 1996\", ...."))
81 self._PRW_start_certainty.Enable(False)
82 self._CHBOX_approved.SetToolTip(_("Whether this substance is taken by advice."))
83 self._CHBOX_approved.SetValue(1)
84 self._PRW_episode.SetToolTip(_("Select, or enter for creation, the episode to which this substance will relate."))
85 self._PRW_schedule.SetToolTip(_("The schedule for taking this substance."))
86 self._PRW_duration.SetToolTip(_("How long is this substance supposed to be taken."))
87 self._CHBOX_long_term.SetToolTip(_("Whether this substance is to be taken for the rest of the patient's life."))
88 self._PRW_aim.SetToolTip(_("The aim of consuming this substance."))
89 self._PRW_notes.SetToolTip(_("Any clinical notes, comments, or instructions on this substance intake."))
90 self._DP_discontinued.SetToolTip(_("When was intake of this substance discontinued ?"))
91 self._BTN_discontinued_as_planned.SetToolTip(_("Discontinued as planned (start + duration)."))
92 self._PRW_discontinue_reason.SetToolTip(_("Reason for discontinuation."))
93 self._PRW_discontinue_reason.Enable(False)
94
95
97
98 __szr_main = wx.BoxSizer(wx.VERTICAL)
99 __gszr_main = wx.FlexGridSizer(12, 2, 1, 3)
100 __szr_discontinued_date = wx.BoxSizer(wx.HORIZONTAL)
101 __szr_duration = wx.BoxSizer(wx.HORIZONTAL)
102 __szr_started = wx.BoxSizer(wx.HORIZONTAL)
103 __szr_mgmt_buttons = wx.BoxSizer(wx.HORIZONTAL)
104 __szr_main.Add(self._LBL_allergies, 0, wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.EXPAND, 2)
105 __sline_top = wx.StaticLine(self, wx.ID_ANY)
106 __szr_main.Add(__sline_top, 0, wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.EXPAND, 3)
107 _LBL_drug = wx.StaticText(self, wx.ID_ANY, _("Drug"))
108 _LBL_drug.SetForegroundColour(wx.Colour(255, 0, 0))
109 __gszr_main.Add(_LBL_drug, 0, wx.ALIGN_CENTER_VERTICAL, 0)
110 __gszr_main.Add(self._PRW_drug, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
111 __gszr_main.Add((20, 20), 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
112 __gszr_main.Add(self._LBL_drug_details, 1, wx.EXPAND, 0)
113 __gszr_main.Add((20, 20), 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
114 __lbl_research = wx.StaticText(self, wx.ID_ANY, _("Research:"))
115 __szr_mgmt_buttons.Add(__lbl_research, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
116 __szr_mgmt_buttons.Add(self._BTN_heart, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 3)
117 __szr_mgmt_buttons.Add(self._BTN_kidneys, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
118 __szr_mgmt_buttons.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
119 __lbl_manage = wx.StaticText(self, wx.ID_ANY, _("Manage:"))
120 __szr_mgmt_buttons.Add(__lbl_manage, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
121 __szr_mgmt_buttons.Add(self._BTN_manage_products, 0, wx.ALIGN_CENTER | wx.RIGHT, 3)
122 __szr_mgmt_buttons.Add(self._BTN_manage_component, 0, wx.ALIGN_CENTER | wx.RIGHT, 3)
123 __szr_mgmt_buttons.Add(self._BTN_manage_doses, 0, wx.ALIGN_CENTER | wx.RIGHT, 3)
124 __szr_mgmt_buttons.Add(self._BTN_manage_substance, 0, wx.ALIGN_CENTER, 3)
125 __gszr_main.Add(__szr_mgmt_buttons, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
126 __gszr_main.Add((20, 20), 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
127 __line_top = wx.StaticLine(self, wx.ID_ANY)
128 __gszr_main.Add(__line_top, 0, wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.EXPAND | wx.TOP, 3)
129 __lbl_started = wx.StaticText(self, wx.ID_ANY, _("Started"))
130 __lbl_started.SetForegroundColour(wx.Colour(255, 0, 0))
131 __gszr_main.Add(__lbl_started, 0, wx.ALIGN_CENTER_VERTICAL, 0)
132 __szr_started.Add(self._CHBOX_start_unknown, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 3)
133 __szr_started.Add(self._DP_started, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 5)
134 __LBL_start_certainty = wx.StaticText(self, wx.ID_ANY, _("Certainty:"))
135 __szr_started.Add(__LBL_start_certainty, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
136 __szr_started.Add(self._PRW_start_certainty, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 5)
137 __szr_started.Add(self._CHBOX_approved, 0, wx.ALIGN_CENTER_VERTICAL, 0)
138 __gszr_main.Add(__szr_started, 1, wx.EXPAND, 0)
139 __lbl_episode = wx.StaticText(self, wx.ID_ANY, _("Episode"))
140 __lbl_episode.SetForegroundColour(wx.Colour(255, 127, 0))
141 __gszr_main.Add(__lbl_episode, 0, wx.ALIGN_CENTER_VERTICAL, 0)
142 __gszr_main.Add(self._PRW_episode, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
143 __lbl_schedule = wx.StaticText(self, wx.ID_ANY, _("Schedule"))
144 __gszr_main.Add(__lbl_schedule, 0, wx.ALIGN_CENTER_VERTICAL, 0)
145 __gszr_main.Add(self._PRW_schedule, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
146 __lbl_duration = wx.StaticText(self, wx.ID_ANY, _("Duration"))
147 __gszr_main.Add(__lbl_duration, 0, wx.ALIGN_CENTER_VERTICAL, 0)
148 __szr_duration.Add(self._PRW_duration, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 10)
149 __szr_duration.Add(self._CHBOX_long_term, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 2)
150 __gszr_main.Add(__szr_duration, 1, wx.EXPAND, 0)
151 __lbl_aim = wx.StaticText(self, wx.ID_ANY, _("Aim"))
152 __gszr_main.Add(__lbl_aim, 0, wx.ALIGN_CENTER_VERTICAL, 0)
153 __gszr_main.Add(self._PRW_aim, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
154 __lbl_notes = wx.StaticText(self, wx.ID_ANY, _("Advice"))
155 __gszr_main.Add(__lbl_notes, 0, wx.ALIGN_CENTER_VERTICAL, 0)
156 __gszr_main.Add(self._PRW_notes, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
157 __lbl_discontinued = wx.StaticText(self, wx.ID_ANY, _("Discontinued"))
158 __gszr_main.Add(__lbl_discontinued, 0, wx.ALIGN_CENTER_VERTICAL, 5)
159 __szr_discontinued_date.Add(self._DP_discontinued, 4, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 3)
160 __szr_discontinued_date.Add(self._BTN_discontinued_as_planned, 1, wx.ALIGN_CENTER_VERTICAL, 3)
161 __szr_discontinued_date.Add((20, 20), 1, wx.EXPAND, 0)
162 __gszr_main.Add(__szr_discontinued_date, 1, wx.EXPAND, 0)
163 __gszr_main.Add(self._LBL_reason, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, 5)
164 __gszr_main.Add(self._PRW_discontinue_reason, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
165 __gszr_main.AddGrowableCol(1)
166 __szr_main.Add(__gszr_main, 1, wx.EXPAND, 0)
167 self.SetSizer(__szr_main)
168 __szr_main.Fit(self)
169 self.Layout()
170
171
173 print("Event handler '_on_heart_button_pressed' not implemented!")
174 event.Skip()
175
177 print("Event handler '_on_kidneys_button_pressed' not implemented!")
178 event.Skip()
179
181 print("Event handler '_on_manage_drug_products_button_pressed' not implemented!")
182 event.Skip()
183
185 print("Event handler '_on_manage_components_button_pressed' not implemented!")
186 event.Skip()
187
189 print("Event handler '_on_manage_doses_button_pressed' not implemented!")
190 event.Skip()
191
193 print("Event handler '_on_manage_substances_button_pressed' not implemented!")
194 event.Skip()
195
197 print("Event handler '_on_start_unknown_checked' not implemented!")
198 event.Skip()
199
201 print("Event handler '_on_chbox_long_term_checked' not implemented!")
202 event.Skip()
203
205 print("Event handler '_on_discontinued_as_planned_button_pressed' not implemented!")
206 event.Skip()
207
208
209