1
2
3
4
5 import wx
6
7
8
9
10
11
14
15 from Gnumed.wxpython import gmPhraseWheel
16 from Gnumed.wxpython import gmEMRStructWidgets
17 from Gnumed.wxpython import gmMedicationWidgets
18 from Gnumed.wxpython import gmDateTimeInput
19
20
21 kwds["style"] = wx.NO_BORDER|wx.TAB_TRAVERSAL
22 wx.ScrolledWindow.__init__(self, *args, **kwds)
23 self._LBL_allergies = wx.StaticText(self, -1, "")
24 self._PRW_brand = gmMedicationWidgets.cBrandedDrugPhraseWheel(self, -1, "", style=wx.NO_BORDER)
25 self._BTN_database_brand = wx.Button(self, -1, _("+"), style=wx.BU_EXACTFIT)
26 self._TCTRL_brand_ingredients = wx.TextCtrl(self, -1, "", style=wx.NO_BORDER)
27 self._LBL_substance = wx.StaticText(self, -1, _("Substance"))
28 self._PRW_substance = gmMedicationWidgets.cSubstancePhraseWheel(self, -1, "", style=wx.NO_BORDER)
29 self._BTN_database_substance = wx.Button(self, -1, _("+"), style=wx.BU_EXACTFIT)
30 self._LBL_preparation = wx.StaticText(self, -1, _("Preparation"))
31 self._PRW_preparation = gmMedicationWidgets.cSubstancePreparationPhraseWheel(self, -1, "", style=wx.NO_BORDER)
32 self._LBL_strength = wx.StaticText(self, -1, _("Strength"))
33 self._PRW_strength = gmPhraseWheel.cPhraseWheel(self, -1, "", style=wx.NO_BORDER)
34 self._DP_started = gmDateTimeInput.cDateInputCtrl(self, -1, style=wx.DP_SHOWCENTURY)
35 self._CHBOX_approved = wx.CheckBox(self, -1, _("Approved of"))
36 self._DP_discontinued = gmDateTimeInput.cDateInputCtrl(self, -1, style=wx.DP_ALLOWNONE|wx.DP_SHOWCENTURY)
37 self._BTN_discontinued_as_planned = wx.Button(self, -1, _("Per plan"), style=wx.BU_EXACTFIT)
38 self._LBL_reason = wx.StaticText(self, -1, _("... Reason"))
39 self._PRW_discontinue_reason = gmPhraseWheel.cPhraseWheel(self, -1, "", style=wx.NO_BORDER)
40 self._CHBOX_is_allergy = wx.CheckBox(self, -1, _("Allergy"))
41 self._PRW_schedule = gmMedicationWidgets.cSubstanceSchedulePhraseWheel(self, -1, "", style=wx.NO_BORDER)
42 self._PRW_duration = gmPhraseWheel.cPhraseWheel(self, -1, "", style=wx.NO_BORDER)
43 self._CHBOX_long_term = wx.CheckBox(self, -1, _("Long-term"))
44 self._PRW_episode = gmEMRStructWidgets.cEpisodeSelectionPhraseWheel(self, -1, "", style=wx.NO_BORDER)
45 self._PRW_aim = gmPhraseWheel.cPhraseWheel(self, -1, "", style=wx.NO_BORDER)
46 self._PRW_notes = gmPhraseWheel.cPhraseWheel(self, -1, "", style=wx.NO_BORDER)
47
48 self.__set_properties()
49 self.__do_layout()
50
51 self.Bind(wx.EVT_BUTTON, self._on_get_brand_button_pressed, self._BTN_database_brand)
52 self.Bind(wx.EVT_BUTTON, self._on_get_substance_button_pressed, self._BTN_database_substance)
53 self.Bind(wx.EVT_DATE_CHANGED, self._on_discontinued_date_changed, self._DP_discontinued)
54 self.Bind(wx.EVT_BUTTON, self._on_discontinued_as_planned_button_pressed, self._BTN_discontinued_as_planned)
55 self.Bind(wx.EVT_CHECKBOX, self._on_chbox_is_allergy_checked, self._CHBOX_is_allergy)
56 self.Bind(wx.EVT_CHECKBOX, self._on_chbox_long_term_checked, self._CHBOX_long_term)
57
58
60
61 self.SetMinSize((610, 475))
62 self.SetScrollRate(10, 10)
63 self._PRW_brand.SetToolTipString(_("The brand name of the drug the patient is taking."))
64 self._BTN_database_brand.SetToolTipString(_("Get brand(s) from an external drug database.\n\nNote that if you select more than one only the first will be available for further editing right away."))
65 self._TCTRL_brand_ingredients.SetToolTipString(_("The active ingredients of this brand."))
66 self._TCTRL_brand_ingredients.Enable(False)
67 self._LBL_substance.SetForegroundColour(wx.Colour(255, 0, 0))
68 self._BTN_database_substance.SetToolTipString(_("Get substances from an external drug database.\n\nNote that if you select more than one substance only the first one will be available for further editing right away."))
69 self._LBL_preparation.SetForegroundColour(wx.Colour(255, 0, 0))
70 self._PRW_preparation.SetToolTipString(_("The preparation the substance comes in."))
71 self._PRW_strength.SetToolTipString(_("The amount of substance per dose."))
72 self._DP_started.SetToolTipString(_("When was this substance started to be consumed."))
73 self._CHBOX_approved.SetToolTipString(_("Whether this substance is taken by advice."))
74 self._CHBOX_approved.SetValue(1)
75 self._DP_discontinued.SetToolTipString(_("When was intake of this substance discontinued ?"))
76 self._BTN_discontinued_as_planned.SetToolTipString(_("Press if discontinuation was as planned."))
77 self._PRW_discontinue_reason.SetToolTipString(_("Reason for discontinuation."))
78 self._PRW_discontinue_reason.Enable(False)
79 self._CHBOX_is_allergy.SetToolTipString(_("Discontinuation due to allergy/intolerance ?"))
80 self._CHBOX_is_allergy.Enable(False)
81 self._PRW_schedule.SetToolTipString(_("The schedule for taking this substance."))
82 self._PRW_duration.SetToolTipString(_("How long is this substance supposed to be taken."))
83 self._CHBOX_long_term.SetToolTipString(_("Whether this substance is to be taken for the rest of the patient's life."))
84 self._PRW_episode.SetToolTipString(_("The episode this substance is taken under."))
85 self._PRW_aim.SetToolTipString(_("The aim of consuming this substance."))
86 self._PRW_notes.SetToolTipString(_("Any clinical notes, comments, or instructions on this substance intake."))
87
88
90
91 __szr_main = wx.BoxSizer(wx.VERTICAL)
92 _gszr_main = wx.FlexGridSizer(13, 2, 1, 3)
93 __szr_duration = wx.BoxSizer(wx.HORIZONTAL)
94 __szr_discontinued = wx.BoxSizer(wx.HORIZONTAL)
95 __szr_discontinued_date = wx.BoxSizer(wx.HORIZONTAL)
96 __szr_started = wx.BoxSizer(wx.HORIZONTAL)
97 __szr_specs = wx.BoxSizer(wx.HORIZONTAL)
98 __szr_substance = wx.BoxSizer(wx.HORIZONTAL)
99 __szr_brand = wx.BoxSizer(wx.HORIZONTAL)
100 __szr_main.Add(self._LBL_allergies, 0, wx.BOTTOM|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 2)
101 __sline_top = wx.StaticLine(self, -1)
102 __szr_main.Add(__sline_top, 0, wx.BOTTOM|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 3)
103 __lbl_brand = wx.StaticText(self, -1, _("Brand"))
104 _gszr_main.Add(__lbl_brand, 0, wx.ALIGN_CENTER_VERTICAL, 0)
105 __szr_brand.Add(self._PRW_brand, 1, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
106 __szr_brand.Add(self._BTN_database_brand, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
107 _gszr_main.Add(__szr_brand, 1, wx.EXPAND, 0)
108 __lbl_or = wx.StaticText(self, -1, _("... or ..."))
109 _gszr_main.Add(__lbl_or, 0, wx.ALIGN_CENTER_VERTICAL, 0)
110 _gszr_main.Add(self._TCTRL_brand_ingredients, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
111 _gszr_main.Add(self._LBL_substance, 0, wx.ALIGN_CENTER_VERTICAL, 0)
112 __szr_substance.Add(self._PRW_substance, 1, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
113 __szr_substance.Add(self._BTN_database_substance, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
114 _gszr_main.Add(__szr_substance, 1, wx.EXPAND, 0)
115 _gszr_main.Add(self._LBL_preparation, 0, wx.ALIGN_CENTER_VERTICAL, 5)
116 __szr_specs.Add(self._PRW_preparation, 1, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10)
117 __szr_specs.Add(self._LBL_strength, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 5)
118 __szr_specs.Add(self._PRW_strength, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10)
119 _gszr_main.Add(__szr_specs, 1, wx.EXPAND, 0)
120 _gszr_main.Add((20, 20), 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
121 __line_top = wx.StaticLine(self, -1)
122 _gszr_main.Add(__line_top, 0, wx.TOP|wx.BOTTOM|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 3)
123 __lbl_started = wx.StaticText(self, -1, _("Started"))
124 __lbl_started.SetForegroundColour(wx.Colour(255, 0, 0))
125 _gszr_main.Add(__lbl_started, 0, wx.ALIGN_CENTER_VERTICAL, 0)
126 __szr_started.Add(self._DP_started, 0, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10)
127 __szr_started.Add(self._CHBOX_approved, 0, wx.ALIGN_CENTER_VERTICAL, 0)
128 __szr_started.Add((20, 20), 1, wx.EXPAND, 0)
129 _gszr_main.Add(__szr_started, 1, wx.EXPAND, 0)
130 __lbl_discontinued = wx.StaticText(self, -1, _("Discontinued"))
131 _gszr_main.Add(__lbl_discontinued, 0, wx.ALIGN_CENTER_VERTICAL, 5)
132 __szr_discontinued_date.Add(self._DP_discontinued, 0, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10)
133 __szr_discontinued_date.Add(self._BTN_discontinued_as_planned, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
134 __szr_discontinued_date.Add((20, 20), 1, wx.EXPAND, 0)
135 _gszr_main.Add(__szr_discontinued_date, 1, wx.EXPAND, 0)
136 _gszr_main.Add(self._LBL_reason, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 5)
137 __szr_discontinued.Add(self._PRW_discontinue_reason, 1, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
138 __szr_discontinued.Add(self._CHBOX_is_allergy, 0, wx.ALIGN_CENTER_VERTICAL, 0)
139 _gszr_main.Add(__szr_discontinued, 1, wx.EXPAND, 0)
140 __lbl_schedule = wx.StaticText(self, -1, _("Schedule"))
141 _gszr_main.Add(__lbl_schedule, 0, wx.ALIGN_CENTER_VERTICAL, 0)
142 _gszr_main.Add(self._PRW_schedule, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
143 __lbl_duration = wx.StaticText(self, -1, _("Duration"))
144 _gszr_main.Add(__lbl_duration, 0, wx.ALIGN_CENTER_VERTICAL, 0)
145 __szr_duration.Add(self._PRW_duration, 1, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10)
146 __szr_duration.Add(self._CHBOX_long_term, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 2)
147 _gszr_main.Add(__szr_duration, 1, wx.EXPAND, 0)
148 __lbl_episode = wx.StaticText(self, -1, _("Episode"))
149 __lbl_episode.SetForegroundColour(wx.Colour(255, 127, 0))
150 _gszr_main.Add(__lbl_episode, 0, wx.ALIGN_CENTER_VERTICAL, 0)
151 _gszr_main.Add(self._PRW_episode, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
152 __lbl_aim = wx.StaticText(self, -1, _("Aim"))
153 _gszr_main.Add(__lbl_aim, 0, wx.ALIGN_CENTER_VERTICAL, 0)
154 _gszr_main.Add(self._PRW_aim, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
155 __lbl_notes = wx.StaticText(self, -1, _("Advice"))
156 _gszr_main.Add(__lbl_notes, 0, wx.ALIGN_CENTER_VERTICAL, 0)
157 _gszr_main.Add(self._PRW_notes, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
158 _gszr_main.AddGrowableCol(1)
159 __szr_main.Add(_gszr_main, 1, wx.EXPAND, 0)
160 self.SetSizer(__szr_main)
161 __szr_main.Fit(self)
162
163
165 print "Event handler `_on_chbox_long_term_checked' not implemented"
166 event.Skip()
167
169 print "Event handler `_on_get_brand_button_pressed' not implemented"
170 event.Skip()
171
173 print "Event handler `_on_get_substance_button_pressed' not implemented"
174 event.Skip()
175
177 print "Event handler `_on_discontinued_as_planned_button_pressed' not implemented"
178 event.Skip()
179
181 print "Event handler `_on_chbox_is_allergy_checked' not implemented"
182 event.Skip()
183
185 print "Event handler `_on_discontinued_date_changed' not implemented"
186 event.Skip()
187
188
189