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