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._LBL_component = wx.StaticText(self, -1, _("Component"))
25 self._PRW_component = gmMedicationWidgets.cDrugComponentPhraseWheel(self, -1, "", style=wx.NO_BORDER)
26 self._BTN_database_brand = wx.Button(self, -1, _("+"), style=wx.BU_EXACTFIT)
27 self._LBL_or = wx.StaticText(self, -1, _("... or ..."))
28 self._TCTRL_brand_ingredients = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY)
29 self._LBL_substance = wx.StaticText(self, -1, _("Substance"))
30 self._PRW_substance = gmMedicationWidgets.cSubstancePhraseWheel(self, -1, "", style=wx.NO_BORDER)
31 self._BTN_database_substance = wx.Button(self, -1, _("+"), style=wx.BU_EXACTFIT)
32 self._LBL_preparation = wx.StaticText(self, -1, _("Preparation"))
33 self._PRW_preparation = gmMedicationWidgets.cSubstancePreparationPhraseWheel(self, -1, "", style=wx.NO_BORDER)
34 self._DP_started = gmDateTimeInput.cDateInputCtrl2(self, -1, "", style=wx.NO_BORDER)
35 self._CHBOX_approved = wx.CheckBox(self, -1, _("Approved of"))
36 self._DP_discontinued = gmDateTimeInput.cDateInputCtrl2(self, -1, "", style=wx.NO_BORDER)
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_manage_brands_button_pressed, self._BTN_database_brand)
52 self.Bind(wx.EVT_BUTTON, self._on_manage_substances_button_pressed, self._BTN_database_substance)
53 self.Bind(wx.EVT_BUTTON, self._on_discontinued_as_planned_button_pressed, self._BTN_discontinued_as_planned)
54 self.Bind(wx.EVT_CHECKBOX, self._on_chbox_is_allergy_checked, self._CHBOX_is_allergy)
55 self.Bind(wx.EVT_CHECKBOX, self._on_chbox_long_term_checked, self._CHBOX_long_term)
56
57
59
60 self.SetMinSize((610, 475))
61 self.SetScrollRate(10, 10)
62 self._LBL_component.SetForegroundColour(wx.Colour(255, 0, 0))
63 self._PRW_component.SetToolTipString(_("A component of a drug brand the patient is taking."))
64 self._BTN_database_brand.SetToolTipString(_("Manage drug brands."))
65 self._TCTRL_brand_ingredients.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
66 self._TCTRL_brand_ingredients.SetToolTipString(_("The active ingredients of this brand."))
67 self._LBL_substance.SetForegroundColour(wx.Colour(255, 0, 0))
68 self._BTN_database_substance.SetToolTipString(_("Manage consumable substances."))
69 self._PRW_preparation.SetToolTipString(_("The preparation the substance comes in."))
70 self._DP_started.SetToolTipString(_("When was this substance started to be consumed."))
71 self._CHBOX_approved.SetToolTipString(_("Whether this substance is taken by advice."))
72 self._CHBOX_approved.SetValue(1)
73 self._DP_discontinued.SetToolTipString(_("When was intake of this substance discontinued ?"))
74 self._BTN_discontinued_as_planned.SetToolTipString(_("Press if discontinuation was as planned."))
75 self._PRW_discontinue_reason.SetToolTipString(_("Reason for discontinuation."))
76 self._PRW_discontinue_reason.Enable(False)
77 self._CHBOX_is_allergy.SetToolTipString(_("Discontinuation due to allergy/intolerance ?"))
78 self._CHBOX_is_allergy.Enable(False)
79 self._PRW_schedule.SetToolTipString(_("The schedule for taking this substance."))
80 self._PRW_duration.SetToolTipString(_("How long is this substance supposed to be taken."))
81 self._CHBOX_long_term.SetToolTipString(_("Whether this substance is to be taken for the rest of the patient's life."))
82 self._PRW_episode.SetToolTipString(_("The episode this substance is taken under."))
83 self._PRW_aim.SetToolTipString(_("The aim of consuming this substance."))
84 self._PRW_notes.SetToolTipString(_("Any clinical notes, comments, or instructions on this substance intake."))
85
86
88
89 __szr_main = wx.BoxSizer(wx.VERTICAL)
90 _gszr_main = wx.FlexGridSizer(14, 2, 1, 3)
91 __szr_duration = wx.BoxSizer(wx.HORIZONTAL)
92 __szr_discontinued = wx.BoxSizer(wx.HORIZONTAL)
93 __szr_discontinued_date = wx.BoxSizer(wx.HORIZONTAL)
94 __szr_started = wx.BoxSizer(wx.HORIZONTAL)
95 __szr_substance = wx.BoxSizer(wx.HORIZONTAL)
96 __szr_component = wx.BoxSizer(wx.HORIZONTAL)
97 __szr_main.Add(self._LBL_allergies, 0, wx.BOTTOM|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 2)
98 __sline_top = wx.StaticLine(self, -1)
99 __szr_main.Add(__sline_top, 0, wx.BOTTOM|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 3)
100 _gszr_main.Add(self._LBL_component, 0, wx.ALIGN_CENTER_VERTICAL, 0)
101 __szr_component.Add(self._PRW_component, 1, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
102 __szr_component.Add(self._BTN_database_brand, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
103 _gszr_main.Add(__szr_component, 1, wx.EXPAND, 0)
104 _gszr_main.Add(self._LBL_or, 0, wx.ALIGN_BOTTOM, 0)
105 _gszr_main.Add(self._TCTRL_brand_ingredients, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
106 _gszr_main.Add(self._LBL_substance, 0, wx.ALIGN_CENTER_VERTICAL, 0)
107 __szr_substance.Add(self._PRW_substance, 1, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
108 __szr_substance.Add(self._BTN_database_substance, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
109 _gszr_main.Add(__szr_substance, 1, wx.EXPAND, 0)
110 _gszr_main.Add(self._LBL_preparation, 0, wx.ALIGN_CENTER_VERTICAL, 5)
111 _gszr_main.Add(self._PRW_preparation, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10)
112 _gszr_main.Add((20, 20), 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
113 __line_top = wx.StaticLine(self, -1)
114 _gszr_main.Add(__line_top, 0, wx.TOP|wx.BOTTOM|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 3)
115 __lbl_started = wx.StaticText(self, -1, _("Started"))
116 __lbl_started.SetForegroundColour(wx.Colour(255, 0, 0))
117 _gszr_main.Add(__lbl_started, 0, wx.ALIGN_CENTER_VERTICAL, 0)
118 __szr_started.Add(self._DP_started, 4, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10)
119 __szr_started.Add(self._CHBOX_approved, 1, wx.ALIGN_CENTER_VERTICAL, 0)
120 __szr_started.Add((20, 20), 1, wx.EXPAND, 0)
121 _gszr_main.Add(__szr_started, 1, wx.EXPAND, 0)
122 __lbl_discontinued = wx.StaticText(self, -1, _("Discontinued"))
123 _gszr_main.Add(__lbl_discontinued, 0, wx.ALIGN_CENTER_VERTICAL, 5)
124 __szr_discontinued_date.Add(self._DP_discontinued, 4, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 10)
125 __szr_discontinued_date.Add(self._BTN_discontinued_as_planned, 1, wx.ALIGN_CENTER_VERTICAL, 5)
126 __szr_discontinued_date.Add((20, 20), 1, wx.EXPAND, 0)
127 _gszr_main.Add(__szr_discontinued_date, 1, wx.EXPAND, 0)
128 _gszr_main.Add(self._LBL_reason, 0, wx.ALIGN_RIGHT|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.AddGrowableRow(1)
151 _gszr_main.AddGrowableCol(1)
152 __szr_main.Add(_gszr_main, 1, wx.EXPAND, 0)
153 self.SetSizer(__szr_main)
154 __szr_main.Fit(self)
155
156
158 print "Event handler `_on_chbox_long_term_checked' not implemented"
159 event.Skip()
160
162 print "Event handler `_on_discontinued_as_planned_button_pressed' not implemented"
163 event.Skip()
164
166 print "Event handler `_on_chbox_is_allergy_checked' not implemented"
167 event.Skip()
168
170 print "Event handler `_on_discontinued_date_changed' not implemented"
171 event.Skip()
172
174 print "Event handler `_on_manage_brands_button_pressed' not implemented"
175 event.Skip()
176
178 print "Event handler `_on_manage_substances_button_pressed' not implemented"
179 event.Skip()
180
181
182