1
2
3
4
5
6
7 import wx
8
9
10 import gettext
11
12
13
14 from Gnumed.wxpython.gmPhraseWheel import cPhraseWheel
15 from Gnumed.wxpython.gmEMRStructWidgets import cEpisodeSelectionPhraseWheel
16 from Gnumed.wxpython.gmDateTimeInput import cDateInputPhraseWheel
17 from Gnumed.wxpython.gmDateTimeInput import cIntervalPhraseWheel
18 from Gnumed.wxpython.gmMedicationWidgets import cDrugComponentPhraseWheel
19 from Gnumed.wxpython.gmMedicationWidgets import cSubstancePhraseWheel
20 from Gnumed.wxpython.gmMedicationWidgets import cSubstancePreparationPhraseWheel
21 from Gnumed.wxpython.gmMedicationWidgets import cSubstanceSchedulePhraseWheel
22 from Gnumed.wxpython.gmMedicationWidgets import cSubstanceAimPhraseWheel
23
24
25
28
29 kwds["style"] = wx.NO_BORDER | wx.TAB_TRAVERSAL
30 wx.ScrolledWindow.__init__(self, *args, **kwds)
31 self._LBL_allergies = wx.StaticText(self, wx.ID_ANY, "")
32 self._LBL_component = wx.StaticText(self, wx.ID_ANY, _("Brand by component"))
33 self._PRW_component = cDrugComponentPhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
34 self._BTN_database_brand = wx.Button(self, wx.ID_ANY, _("Brands"), style=wx.BU_EXACTFIT)
35 self._LBL_or = wx.StaticText(self, wx.ID_ANY, _("... or ..."))
36 self._TCTRL_brand_ingredients = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY | wx.NO_BORDER)
37 self._BTN_heart = wx.Button(self, wx.ID_ANY, _(u"♥"), style=wx.BU_EXACTFIT)
38 self._BTN_kidneys = wx.Button(self, wx.ID_ANY, _("Kidneys"), style=wx.BU_EXACTFIT)
39 self._LBL_substance = wx.StaticText(self, wx.ID_ANY, _("Unbranded substance"))
40 self._PRW_substance = cSubstancePhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
41 self._BTN_database_substance = wx.Button(self, wx.ID_ANY, _("Manage"), style=wx.BU_EXACTFIT)
42 self._LBL_preparation = wx.StaticText(self, wx.ID_ANY, _("Preparation"))
43 self._PRW_preparation = cSubstancePreparationPhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
44 self._DP_started = cDateInputPhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
45 self._CHBOX_approved = wx.CheckBox(self, wx.ID_ANY, _("Approved of"))
46 self._PRW_episode = cEpisodeSelectionPhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
47 self._PRW_schedule = cSubstanceSchedulePhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
48 self._PRW_duration = cIntervalPhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
49 self._CHBOX_long_term = wx.CheckBox(self, wx.ID_ANY, _("Long-term"))
50 self._PRW_aim = cSubstanceAimPhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
51 self._PRW_notes = cPhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
52 self._DP_discontinued = cDateInputPhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
53 self._BTN_discontinued_as_planned = wx.Button(self, wx.ID_ANY, _("Per plan"), style=wx.BU_EXACTFIT)
54 self._LBL_reason = wx.StaticText(self, wx.ID_ANY, _("... Reason"))
55 self._PRW_discontinue_reason = cPhraseWheel(self, wx.ID_ANY, "", style=wx.NO_BORDER)
56
57 self.__set_properties()
58 self.__do_layout()
59
60 self.Bind(wx.EVT_BUTTON, self._on_manage_brands_button_pressed, self._BTN_database_brand)
61 self.Bind(wx.EVT_BUTTON, self._on_heart_button_pressed, self._BTN_heart)
62 self.Bind(wx.EVT_BUTTON, self._on_kidneys_button_pressed, self._BTN_kidneys)
63 self.Bind(wx.EVT_BUTTON, self._on_manage_substances_button_pressed, self._BTN_database_substance)
64 self.Bind(wx.EVT_CHECKBOX, self._on_chbox_long_term_checked, self._CHBOX_long_term)
65 self.Bind(wx.EVT_BUTTON, self._on_discontinued_as_planned_button_pressed, self._BTN_discontinued_as_planned)
66
67
69
70 self.SetMinSize((660, 400))
71 self.SetScrollRate(10, 10)
72 self._LBL_component.SetForegroundColour(wx.Colour(255, 0, 0))
73 self._PRW_component.SetToolTipString(_("A component of a drug brand the patient is taking.\n\nLookup, and select, a single- (or multi-) component drug brand, by active ingredient name. All components of multi-component drugs will be displayed and automatically added to the patient's list."))
74 self._BTN_database_brand.SetToolTipString(_("Manage drug brands.\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/brands known to GNUmed from which you can select a component."))
75 self._TCTRL_brand_ingredients.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
76 self._TCTRL_brand_ingredients.SetToolTipString(_("The active ingredients of this brand."))
77 self._BTN_heart.SetToolTipString(_("Show cardiac information relevant to substance selection."))
78 self._BTN_kidneys.SetToolTipString(_("Show renal insufficiency information related to substance selection."))
79 self._LBL_substance.SetForegroundColour(wx.Colour(255, 0, 0))
80 self._PRW_substance.SetToolTipString(_("The non-branded medication or non-medication substance, with optional strength."))
81 self._BTN_database_substance.SetToolTipString(_("Manage consumable substances.\n\nThis will not select a substance for you. It will, however, enable you to manage (add/edit/delete) the consumable substances available for selection."))
82 self._PRW_preparation.SetToolTipString(_("The preparation or form of the substance."))
83 self._DP_started.SetToolTipString(_("When was this substance started to be consumed."))
84 self._CHBOX_approved.SetToolTipString(_("Whether this substance is taken by advice."))
85 self._CHBOX_approved.SetValue(1)
86 self._PRW_episode.SetToolTipString(_("Select, or enter for creation, the episode to which this substance will relate."))
87 self._PRW_schedule.SetToolTipString(_("The schedule for taking this substance."))
88 self._PRW_duration.SetToolTipString(_("How long is this substance supposed to be taken."))
89 self._CHBOX_long_term.SetToolTipString(_("Whether this substance is to be taken for the rest of the patient's life."))
90 self._PRW_aim.SetToolTipString(_("The aim of consuming this substance."))
91 self._PRW_notes.SetToolTipString(_("Any clinical notes, comments, or instructions on this substance intake."))
92 self._DP_discontinued.SetToolTipString(_("When was intake of this substance discontinued ?"))
93 self._BTN_discontinued_as_planned.SetToolTipString(_("Press if discontinuation was as planned."))
94 self._PRW_discontinue_reason.SetToolTipString(_("Reason for discontinuation."))
95 self._PRW_discontinue_reason.Enable(False)
96
97
99
100 __szr_main = wx.BoxSizer(wx.VERTICAL)
101 __gszr_main = wx.FlexGridSizer(13, 2, 1, 3)
102 __szr_discontinued_date = wx.BoxSizer(wx.HORIZONTAL)
103 __szr_duration = wx.BoxSizer(wx.HORIZONTAL)
104 __szr_started = wx.BoxSizer(wx.HORIZONTAL)
105 __szr_substance = wx.BoxSizer(wx.HORIZONTAL)
106 __szr_ingredient_details = wx.BoxSizer(wx.HORIZONTAL)
107 __szr_substance_buttons = wx.BoxSizer(wx.VERTICAL)
108 __szr_component = wx.BoxSizer(wx.HORIZONTAL)
109 __szr_main.Add(self._LBL_allergies, 0, wx.BOTTOM | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 2)
110 __sline_top = wx.StaticLine(self, wx.ID_ANY)
111 __szr_main.Add(__sline_top, 0, wx.BOTTOM | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 3)
112 __gszr_main.Add(self._LBL_component, 0, wx.ALIGN_CENTER_VERTICAL, 0)
113 __szr_component.Add(self._PRW_component, 1, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
114 __szr_component.Add(self._BTN_database_brand, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0)
115 __gszr_main.Add(__szr_component, 1, wx.EXPAND, 0)
116 __gszr_main.Add(self._LBL_or, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0)
117 __szr_ingredient_details.Add(self._TCTRL_brand_ingredients, 1, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
118 __szr_substance_buttons.Add(self._BTN_heart, 0, wx.BOTTOM | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 3)
119 __szr_substance_buttons.Add(self._BTN_kidneys, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
120 __szr_ingredient_details.Add(__szr_substance_buttons, 0, wx.EXPAND, 0)
121 __gszr_main.Add(__szr_ingredient_details, 1, wx.EXPAND, 0)
122 __gszr_main.Add(self._LBL_substance, 0, wx.ALIGN_CENTER_VERTICAL, 0)
123 __szr_substance.Add(self._PRW_substance, 1, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
124 __szr_substance.Add(self._BTN_database_substance, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0)
125 __gszr_main.Add(__szr_substance, 1, wx.EXPAND, 0)
126 __gszr_main.Add(self._LBL_preparation, 0, wx.ALIGN_CENTER_VERTICAL, 5)
127 __gszr_main.Add(self._PRW_preparation, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 10)
128 __gszr_main.Add((20, 20), 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
129 __line_top = wx.StaticLine(self, wx.ID_ANY)
130 __gszr_main.Add(__line_top, 0, wx.TOP | wx.BOTTOM | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 3)
131 __lbl_started = wx.StaticText(self, wx.ID_ANY, _("Started"))
132 __lbl_started.SetForegroundColour(wx.Colour(255, 0, 0))
133 __gszr_main.Add(__lbl_started, 0, wx.ALIGN_CENTER_VERTICAL, 0)
134 __szr_started.Add(self._DP_started, 4, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 10)
135 __szr_started.Add(self._CHBOX_approved, 1, wx.ALIGN_CENTER_VERTICAL, 0)
136 __szr_started.Add((20, 20), 1, wx.EXPAND, 0)
137 __gszr_main.Add(__szr_started, 1, wx.EXPAND, 0)
138 __lbl_episode = wx.StaticText(self, wx.ID_ANY, _("Episode"))
139 __lbl_episode.SetForegroundColour(wx.Colour(255, 127, 0))
140 __gszr_main.Add(__lbl_episode, 0, wx.ALIGN_CENTER_VERTICAL, 0)
141 __gszr_main.Add(self._PRW_episode, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
142 __lbl_schedule = wx.StaticText(self, wx.ID_ANY, _("Schedule"))
143 __gszr_main.Add(__lbl_schedule, 0, wx.ALIGN_CENTER_VERTICAL, 0)
144 __gszr_main.Add(self._PRW_schedule, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
145 __lbl_duration = wx.StaticText(self, wx.ID_ANY, _("Duration"))
146 __gszr_main.Add(__lbl_duration, 0, wx.ALIGN_CENTER_VERTICAL, 0)
147 __szr_duration.Add(self._PRW_duration, 1, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 10)
148 __szr_duration.Add(self._CHBOX_long_term, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 2)
149 __gszr_main.Add(__szr_duration, 1, wx.EXPAND, 0)
150 __lbl_aim = wx.StaticText(self, wx.ID_ANY, _("Aim"))
151 __gszr_main.Add(__lbl_aim, 0, wx.ALIGN_CENTER_VERTICAL, 0)
152 __gszr_main.Add(self._PRW_aim, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
153 __lbl_notes = wx.StaticText(self, wx.ID_ANY, _("Advice"))
154 __gszr_main.Add(__lbl_notes, 0, wx.ALIGN_CENTER_VERTICAL, 0)
155 __gszr_main.Add(self._PRW_notes, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
156 __lbl_discontinued = wx.StaticText(self, wx.ID_ANY, _("Discontinued"))
157 __gszr_main.Add(__lbl_discontinued, 0, wx.ALIGN_CENTER_VERTICAL, 5)
158 __szr_discontinued_date.Add(self._DP_discontinued, 4, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 10)
159 __szr_discontinued_date.Add(self._BTN_discontinued_as_planned, 1, wx.ALIGN_CENTER_VERTICAL, 5)
160 __szr_discontinued_date.Add((20, 20), 1, wx.EXPAND, 0)
161 __gszr_main.Add(__szr_discontinued_date, 1, wx.EXPAND, 0)
162 __gszr_main.Add(self._LBL_reason, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
163 __gszr_main.Add(self._PRW_discontinue_reason, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
164 __gszr_main.AddGrowableCol(1)
165 __szr_main.Add(__gszr_main, 1, wx.EXPAND, 0)
166 self.SetSizer(__szr_main)
167 __szr_main.Fit(self)
168
169
171 print "Event handler '_on_manage_brands_button_pressed' not implemented!"
172 event.Skip()
173
175 print "Event handler '_on_heart_button_pressed' not implemented!"
176 event.Skip()
177
179 print "Event handler '_on_kidneys_button_pressed' not implemented!"
180 event.Skip()
181
183 print "Event handler '_on_manage_substances_button_pressed' not implemented!"
184 event.Skip()
185
187 print "Event handler '_on_chbox_long_term_checked' not implemented!"
188 event.Skip()
189
191 print "Event handler '_on_discontinued_as_planned_button_pressed' not implemented!"
192 event.Skip()
193
194
195