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