1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 import wx
28
29 import gmGuiElement_HeadingCaptionPanel
30 import gmGuiElement_DividerCaptionPanel
31 import gmGuiElement_AlertCaptionPanel
32 import gmEditArea
33 import gmPlugin_Patient
34 from gmPatientHolder import PatientHolder
35
36
37
38 ID_SCRIPTICON = wxNewId ()
39 ID_SCRIPTLIST = wxNewId()
40 ID_SCRIPTMENU = wxNewId ()
41 ID_POPUP1 = wxNewId()
42
43 gmSECTION_SCRIPT = 8
44
45 ID_AuthInd = wxNewId()
46 ID_Interactions = wxNewId()
47 ID_PregInfo = wxNewId()
48 ID_Restrictions = wxNewId()
49 ID_EditItem = wxNewId()
50 ID_DelItem = wxNewId()
51 ID_DelAll = wxNewId()
52 ID_MakeItemReg24 = wxNewId()
53 ID_DrugInfoBrief = wxNewId()
54 ID_DrugInfoFull = wxNewId()
55 ID_PrintItem = wxNewId()
56 ID_PrintAll = wxNewId()
57 ID_ReprintItem = wxNewId()
58 ID_ReprintAll = wxNewId()
59 ID_JustSaveItem = wxNewId()
60 ID_JustSaveAll = wxNewId()
61 ID_ChangeFont = wxNewId()
62 ID_SaveListLayout = wxNewId()
63 ID_Help = wxNewId()
64 ID_Exit = wxNewId()
65
66
67
68 scriptdata = {
69 1 : ("Fluvax","0.5ml", "to be injected by the doctor","flu immunisation"),
70 2 : ("Tenormin","50mg","1 daily", "hypertension"),
71 3 : ( "Ceclor CD","375mg","1 twice daily","sinusitis"),
72 }
73
74 scriptprompts = {
75 1:("Prescribe For"),
76 2:("Class"),
77 3:("Generic"),
78 4:("Product"),
79 5:("Strength"),
80 6:("Directions"),
81 7:("For"),
82 8:("Progress Notes"),
83 9:(""),
84 }
85
86
89
90 wxPanel.__init__(self, parent, id, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER)
91 PatientHolder.__init__(self)
92
93
94
95 self.scriptpanelheading = gmGuiElement_HeadingCaptionPanel.HeadingCaptionPanel(self,-1," SCRIPTS ")
96
97
98
99
100 self.sizer_authority = wxGridSizer(1,0,0,0)
101 self.sizer1 = wxBoxSizer(wxHORIZONTAL)
102 self.txt_scriptDate = wxTextCtrl(self,-1,"12/06/2002",wxDefaultPosition,wxDefaultSize)
103 self.spacer = wxWindow(self,-1, wxDefaultPosition,wxDefaultSize,0)
104 self.spacer.SetBackgroundColour(wxColor(222,222,222))
105
106
107
108
109
110 self.sizer1.Add(1,0,20)
111 self.sizer1.Add(self.txt_scriptDate,3,wxEXPAND|wxALL,3)
112
113 self.sizer_authority.Add(self.sizer1,0,wxEXPAND)
114
115
116
117
118 self.editarea = gmEditArea.gmPrescriptionEditArea(self,-1)
119
120
121
122
123 self.interactiontext_subheading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Drug Interactions"))
124 self.sizer_divider_interaction_text = wxBoxSizer(wxHORIZONTAL)
125 self.sizer_divider_interaction_text.Add(self.interactiontext_subheading,1, wxEXPAND)
126 self.interactiontxt = wxTextCtrl(self,-1,
127 "Mini-Drug interaction text goes here (click this for full description)\n \n"
128 "Also, try clicking on the list below with the right mouse button to see a pop up menu",
129 style=wxTE_MULTILINE)
130 self.interactiontxt.SetFont(wxFont(10,wxSWISS,wxNORMAL,wxNORMAL,False,''))
131
132
133
134 self.itemsprescribedheading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Items prescribed this consultation"))
135 self.sizer_itemsprescribed = wxBoxSizer(wxHORIZONTAL)
136 self.sizer_itemsprescribed.Add(self.itemsprescribedheading,1, wxEXPAND)
137
138
139
140
141
142
143
144
145
146 self.list_script = wxListCtrl(self, -1, wxDefaultPosition, wxDefaultSize,wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER)
147 self.list_script.SetFont(wxFont(10,wxSWISS, wxNORMAL, wxNORMAL, False, ''))
148 EVT_RIGHT_UP(self.list_script, self.OnRightClickUp)
149
150
151 self.list_script.InsertColumn(0, _("Drug"))
152 self.list_script.InsertColumn(1, _("Strength"))
153 self.list_script.InsertColumn(2, _("Directions"))
154 self.list_script.InsertColumn(3, _("For"))
155
156
157
158
159
160 items = scriptdata.items()
161 for x in range(len(items)):
162 key, data = items[x]
163 self.list_script.InsertItem(x, data[0])
164 self.list_script.SetItem(x, 1, data[1])
165 self.list_script.SetItem(x, 2, data[2])
166 self.list_script.SetItem(x, 3, data[3])
167 self.list_script.SetItemData(x, key)
168
169 self.list_script.SetColumnWidth(0, wxLIST_AUTOSIZE)
170 self.list_script.SetColumnWidth(1, wxLIST_AUTOSIZE)
171 self.list_script.SetColumnWidth(2, wxLIST_AUTOSIZE)
172 self.list_script.SetColumnWidth(3, wxLIST_AUTOSIZE)
173
174
175
176 self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel(self,-1," Alerts ")
177
178
179
180 self.mainsizer = wxBoxSizer(wxVERTICAL)
181 self.mainsizer.Add(self.scriptpanelheading,0,wxEXPAND)
182 self.mainsizer.Add(self.sizer_authority,1,wxEXPAND)
183 self.mainsizer.Add(self.editarea,15,wxEXPAND)
184 self.mainsizer.Add(self.sizer_divider_interaction_text,0,wxEXPAND)
185 self.mainsizer.Add(self.interactiontxt,4,wxEXPAND)
186 self.mainsizer.Add(self.itemsprescribedheading,0,wxEXPAND)
187 self.mainsizer.Add(self.list_script,4,wxEXPAND)
188 self.mainsizer.Add(self.alertpanel,0,wxEXPAND)
189 self.SetSizer(self.mainsizer)
190 self.SetAutoLayout(True)
191 self.Show(True)
192
194 """A right mouse click triggers a popup menu for the list script"""
195
196
197 aMenu = wxMenu()
198
199
200 aMenu.Append(ID_AuthInd, _("Authority Indications"))
201 aMenu.Append(ID_Interactions, _("Interactions"))
202 aMenu.Append(ID_PregInfo, _("Pregnancy Information"))
203 aMenu.Append(ID_Restrictions, _("Restricted Use Information"))
204 aMenu.AppendSeparator()
205 aMenu.Append(ID_EditItem, _("Edit Item"))
206 aMenu.Append(ID_DelItem, _("Delete Item"))
207 aMenu.Append(ID_DelAll, _("Delete all Items"))
208
209 aMenu.Append(ID_MakeItemReg24, _("Make Item Reg 24"))
210 aMenu.AppendSeparator()
211 aMenu.Append(ID_DrugInfoBrief, _("Brief Product Information"))
212 aMenu.Append(ID_DrugInfoFull, _("Full Product Information"))
213 aMenu.AppendSeparator()
214 aMenu.Append(ID_PrintItem, _("Print Single Item"))
215 aMenu.Append(ID_PrintAll, _("Print All Items"))
216 aMenu.AppendSeparator()
217 aMenu.Append(ID_ReprintItem, _("Reprint Item"))
218 aMenu.Append(ID_ReprintAll, _("Reprint All Items"))
219 aMenu.AppendSeparator()
220 aMenu.Append(ID_JustSaveItem, _("Save Item no print"))
221 aMenu.Append(ID_JustSaveAll, _("Save All Items no print"))
222 aMenu.AppendSeparator()
223 aMenu.Append(ID_ChangeFont, _("Change Font"))
224 aMenu.Append(ID_SaveListLayout, _("Save list layout"))
225 aMenu.AppendSeparator()
226 aMenu.Append(ID_Help, _("Help"))
227 aMenu.AppendSeparator()
228 aMenu.Append(ID_Exit, _("Exit"))
229
230
231 EVT_MENU(self, ID_POPUP1, self.OnExitMenu)
232 EVT_MENU(self, ID_PregInfo, gmLog.gmDefLog.Log(gmLog.lErr, "This should display Pregnancy Information !"))
233
234
235
236 self.PopupMenu(aMenu, event.GetPosition())
237
238
239
240
241
242
243 aMenu.Destroy()
244
245
246 event.Skip()
247
250
252 """
253 Plugin to encapsulate the prescriptions window
254 """
255
256 __icons = {
257 """icon_Rx_symbol""": 'x\xda\xd3\xc8)0\xe4\nV74S\x00"c\x05Cu\xae\xc4`u=\x85d\x05e\x03 p\xb3\x00\
258 \xf3#@|\x0b\x03\x10\x04\xf3\x15\x80|\xbf\xfc\xbcT(\x07\x15\xe0\x15\xd4\x83\
259 \x00t\xc1\x08 \x80\x8a"\t\xc2I\xb2\x04\xc1 "\x82R\x8b\x80\x08UP\x01b,\xdc\
260 \x9b\x10+\x14\xc0\xa6\xa2\xf9\x1d\xa8\x0eI;\x02DD\xe0\x0c%=\x00D|Hk'
261 }
262
264 return 'Prescription writer'
265
267 return ('view', '&Script')
268
270 if anIconID == None:
271 return self.__icons[_("""icon_Rx_symbol""")]
272 else:
273 if anIconID in self.__icons:
274 return self.__icons[anIconID]
275 else:
276 return self.__icons[_("""icon_Rx_symbol""")]
277
281
282 if __name__ == '__main__':
283 app = wxPyWidgetTester(size = (600, 600))
284 app.SetWidget(PrescriptionPanel, -1)
285 app.MainLoop()
286