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
28
29
30
31 __version__ = "$Revision: 1.21 $"
32
33 try:
34 import wxversion
35 import wx
36 except ImportError:
37 from wxPython import wx
38
39
40
41 import keyword
42 import time
43 import images
44 import gmPlugin, gmShadow
45
46 import zlib, cPickle
47
48
49 scriptdata = {
50 1 : ("Adalat Oris", "30mg","1 mane","21/01/2002", "Hypertension","30 Rpt5","29/02/2000"),
51 2 : ("Nitrolingual Spray","", "1 spray when needed","24/08/2001", "Angina","1 Rpt2","01/06/2001"),
52 3 : ("Losec", "20mg","1 mane", "21/01/2002","Reflux Oesophagitis","30 Rpt5","16/11/2001"),
53 4 : ("Zoloft", "50mg","1 mane", "24/04/2002","Depression","30 Rpt0","24/04/2002"),
54 }
55
56
58 """ sets tooltips for notebook tab images """
59
60 tip_shown=0
62 wxNotebook.__init__(self,parent,id)
63
64
65 self.tip_area1=wxRect(2,2,30,30)
66 self.tip_area2=wxRect(32,2,31,30)
67 self.tip_area3=wxRect(63,2,31,30)
68 self.tip_area4=wxRect(94,2,31,30)
69 self.tip_area5=wxRect(125,2,31,30)
70 self.tip_area6=wxRect(156,2,31,30)
71
72 EVT_MOTION(self, self.OnMouseMotion)
73 EVT_LEFT_DOWN(self, self.OnLeftDown)
74
76 pt_local = self.GetPosition()
77
78 pt_global = self.ClientToScreen(pt_local)
79
80
81 x, y = evt.GetPosition()
82 if(self.tip_area1.Inside(wxPoint(x,y))):
83 if(self.tip_shown!=1):
84 tipwin1=wxTipWindow(self, _('Prescriptions'))
85 tipwin1.SetBoundingRect(wxRect(1+pt_global.x,1+pt_global.y,30,30))
86 pt=wxPoint((1+pt_global.x+4+5), (1+pt_global.y+32+4))
87 tipwin1.Move(pt)
88 self.tip_shown=1
89
90 elif(self.tip_area2.Inside(wxPoint(x,y))):
91 if(self.tip_shown!=2):
92 tipwin2=wxTipWindow(self, _('Requests'))
93 tipwin2.SetBoundingRect(wxRect(32+pt_global.x,1+pt_global.y,31,30))
94 pt=wxPoint((32+pt_global.x+4+5), (1+pt_global.y+32+4))
95 tipwin2.Move(pt)
96 self.tip_shown=2
97
98 elif(self.tip_area3.Inside(wxPoint(x,y))):
99 if(self.tip_shown!=3):
100 tipwin3=wxTipWindow(self, _('Measurements'))
101 tipwin3.SetBoundingRect(wxRect(63+pt_global.x,1+pt_global.y,31,30))
102 pt=wxPoint((63+pt_global.x+4+5), (1+pt_global.y+32+4))
103 tipwin3.Move(pt)
104 self.tip_shown=3
105
106 elif(self.tip_area4.Inside(wxPoint(x,y))):
107 if(self.tip_shown!=4):
108 tipwin4=wxTipWindow(self, _('Referrals'))
109 tipwin4.SetBoundingRect(wxRect(94+pt_global.x,1+pt_global.y,31,30))
110 pt=wxPoint((94+pt_global.x+4+5), (1+pt_global.y+32+4))
111 tipwin4.Move(pt)
112 self.tip_shown=4
113
114 elif(self.tip_area5.Inside(wxPoint(x,y))):
115 if(self.tip_shown!=5):
116 tipwin5=wxTipWindow(self, _('Recalls and Reviews'))
117 tipwin5.SetBoundingRect(wxRect(125+pt_global.x,1+pt_global.y,31,30))
118 pt=wxPoint((125+pt_global.x+4+5), (1+pt_global.y+32+4))
119 tipwin5.Move(pt)
120 self.tip_shown=5
121
122 elif(self.tip_area6.Inside(wxPoint(x,y))):
123 if(self.tip_shown!=6):
124 tipwin6=wxTipWindow(self, _('Inbox'))
125 tipwin6.SetBoundingRect(wxRect(156+pt_global.x,1+pt_global.y,31,30))
126 pt=wxPoint((156+pt_global.x+4+5), (1+pt_global.y+32+4))
127 tipwin6.Move(pt)
128 self.tip_shown=6
129 else:
130 self.tip_shown=0
131
133 pass
134
135
137 """ a panel to hold the tabbed list """
138 __icons_script = {"""icon_Rx_symbol""": 'x\xda\xd3\xc8)0\xe4\nV74S\x00"c\x05Cu\xae\xc4`u=\x85d\x05e\x03 p\xb3\x00\
139 \xf3#@|\x0b\x03\x10\x04\xf3\x15\x80|\xbf\xfc\xbcT(\x07\x15\xe0\x15\xd4\x83\
140 \x00t\xc1\x08 \x80\x8a"\t\xc2I\xb2\x04\xc1 "\x82R\x8b\x80\x08UP\x01b,\xdc\
141 \x9b\x10+\x14\xc0\xa6\xa2\xf9\x1d\xa8\x0eI;\x02DD\xe0\x0c%=\x00D|Hk'}
142
143 __icons_requests = {"""icon_blood_sample""": "x\xdau\x8f\xbd\n\xc3 \x10\x80\xf7<\xc5A\x94\x14\x04Qh\x89c0\xe0\x98\x1b\xb2\
144 \xb8\x96\xd2\xad\xf4\xfa\xfeS\x8d?\xe0\x05r\xdb\xf7\xdd\xff\xed\xf3\xb3\xc3>\
145 \xd9;\xd8\x07X\x03v\x1a\x9e\xfb$\xe1\x05cp&Ef<\xd8;\xbfz\x97y<xv\xf3Z\xf3K\
146 \xa9\x0f\x8d!\xf1F\xdfw\x06\xdd\x86\x85\xd2\x1cK\xb31sa\xd5\x9ak^\xb4|\x1dFm\
147 Y\xad\x07\x16'\xa5\xf5YE\x9d\x1cS\x84xR\x84JE\xa6R\r\x12\x1bO\xb8(b\x1b\x93\
148 \xc1\x91\x1dABJ\xc1\xee\xeaLU\xbd\xa9\xaa7M\tq\xf9\xe3\xb5\xd2\x7fZ\x8fVi"}
149
150 __icons_measurements = {"""icon_Set_Square""": 'x\xda\xd3\xc8)0\xe4\nV74S\x00"S\x05Cu\xae\xc4`\xf5|\x85d\x05\xa7\x9c\xc4\
151 \xe4l0O\x0f\xc8S6\xb70w60\x00\xf3#@|7\x0b7\x18_\x01\xc8\xf7\xcb\xcfK\x05s\
152 \xfca\x8a\xcd-\xa0\x92\n\nz\x11\x11z\nP\x80,\x98\x8fEP/\x9f\xb0\xca|4\x00qe\
153 \x04*\x84\n\xa2\x02\xdc\x82\xfe@\x90\xaf\xa7\x97\xef\x0f\x05\xd4p\'\xf5U\xea\
154 \x01\x00\xd2 _\x1b'}
155
156 __icons_referrals = {"""icon_writing_pen""": "x\xda\x8d\x901\x0b\xc3 \x10F\xf7\xfc\n\xa1\x83\x85\xc0\x87Y\xa2\xb3B\xc6:d\
157 \xb95\x84N\r\xb5\xff\x7f\xaa9-\xd4K\xa1\x11\x11\xde\xbb\xe7\xa0\xd7\xed5t\
158 \xb3\x1eF\x95w>t\xb7\xcc\x1ajU~[\xd6\x07S\x9f\xe9\xe2\x9d\x0f\xde1\xc7\x9d'7\
159 \x05c\x98U\xe6[z\xde\x19\xd2>\xb4\xce\x98:\xa4\xc26XW\xe3v\x9d\x93\x00\x0e\
160 \x92\x90\x12\xa4D\x04HHB\xa4\xc3u\xc4\x1e$d\t\x85,a+k\xd8\xca\x1aJ\xc9\xa1\
161 \x90\x80\xfa!\xbf\xde\x8e\xcf\xfa\xf3Kx\x03\x0b\xf8P\xa7"
162
163 , """icon_outgoing_letter""": "x\xda]\xcd;\x0e\x830\x10\x04\xd0\x9eSXJ\xe1T+\\$r\x9dH.\xe3\x82f[\x84R\x05e\
164 r\xff*\xbb\xb6\xf1\x87\x11B\xccc\x0c\xd7\xfd\xe7\xa6\xc5\xba\xbb\x91\xebf\
165 \x9c\x9d\xd6\xc5\xc2l\xe6\xb1\xaf\xdb'5\x92v\xf1\xb3&u#\xfd\x85\xef;\x15\xd6\
166 \x97\xc1\x87g\xf0\xa9G\xed\xf3\\\xbb\xc9!.\x0f\x1d\x12\x1d\xda\x90\xa8jE\xa2\
167 \xa6m\t!\x9c\x96`\xddaX\x82\x13f-(\x96Q\x94\x0b\x02\xb1`\x04*\xb2*\xabq\x87\
168 \x8c\x1c\x1e1-G\xcc6\x1eG\x8c\xf2Q\xb9\xf5?\xeas \x0fQ\xa4?:Rj{"}
169
170 __icons_recalls = {"""icon_talking_head""": 'x\xda\x8d\x8f1\x0b\xc3 \x10\x85\xf7\xfc\x8a\x83\x0e\x16\x041K\xe3\xac\xe0\
171 \xd8\x0cYn\r\xa1SC\xed\xff\x9fzw\x1a\x8b\xa6C\x1f"\xbc\xef\xde\xdd\xe9u\x7f\
172 \x8f\xc3\xa2\xc6\x1b\xd0\xa1K\r\xeb\xa2\x006\xf0\xfb\xba=\xc5%r\x17\xef|\xf0\
173 N\xbcf?\xb9)X+~foI1\xd7\r\xf9{z=\xc4 \x17\xa3\x8b\xa1\x14\xe1\x90\xc9ja\xc1=\
174 \x84\xbf b:Ad\xd8\xcd$\x86\xd0mg\x04-\xe4\x18\xcem;\x16\xfd\x86\t\xfa\xf6\
175 \xfc"\xad\xeb\xa2\xda\xad\xcfI\x8a\xd5$Oc\x81\x04\xbf\x8b\x8e\x8fS\x90\xa1\
176 \xf9\x00[x_\x8e'}
177
178 __icons_inbox = {"""icon_inbox""": "x\xda\x85\xd01\x0e\xc20\x0c\x05\xd0\xbd\xa7\x88\xc4\x10&+\x19\x80\xcc e\xac\
179 \x87.^\xab\x8a\x89\ns\xff\t\xc7Nh2\xf1UU\xfdOv#\xe5\xbc\x7f\xe2\xb4\xf8xu\
180 \xf2\\\\\xf4\xd3\xbaxv\x9b\xbb\xef\xeb\xf6\xd2\xe6\xa4\xcd\xfc~jA)\xa7\x10\
181 \xf2#'\xedTzN\xbf\x0e\xa5\xdfR\x90\xd4\xe5\x12\x00 \xfb\xfa\x83,\xc84\"S\x99\
182 4m\xc8\xa4hZQ\xe7\xa0\xcd\x1a\xca\x9c)\x11\x8aVd\xac\xeb\xc8\x07\x92\xaa\xce\
183 uHl\xa1\x11\xa9dD\xb3q\x9d\x11\xe5\xa7\xf2\xea\x0f\xea\xd3\x90\x86\xf4\xb7tD\
184 \x10\xbe\xb8\xbej\xdf"}
185
187 wxPanel.__init__(self, parent, id)
188 self.SetAutoLayout(True)
189 sizer = wxBoxSizer(wxHORIZONTAL)
190 self.SetBackgroundColour(wxColour(222,222,222))
191
192
193
194
195 self.ListsImageList= wxImageList(16,16)
196 self.small_arrow_up = self.ListsImageList.Add(images.getSmallUpArrowBitmap())
197 self.small_arrow_down = self.ListsImageList.Add(images.getSmallDnArrowBitmap())
198
199
200
201
202
203 self.notebook1 = Notebook(self, -1)
204
205
206
207 tabimage_Script = tabimage_Requests = tabimage_Requests = tabimage_Requests = tabimage_Requests = tabimage_Requests = -1
208 self.notebook1.il = wxImageList(16, 16)
209 tabimage_Script = self.notebook1.il.Add(self.getBitmap(self.__icons_script[_("""icon_Rx_symbol""")]))
210 tabimage_Requests = self.notebook1.il.Add( self.getBitmap(self.__icons_requests[_("""icon_blood_sample""")]))
211 tabimage_Measurements = self.notebook1.il.Add( self.getBitmap(self.__icons_measurements[_("""icon_Set_Square""")]))
212 tabimage_Referrals = self.notebook1.il.Add( self.getBitmap(self.__icons_referrals[_("""icon_writing_pen""")]))
213 tabimage_Recalls = self.notebook1.il.Add(self.getBitmap(self.__icons_recalls[_("""icon_talking_head""")]))
214 tabimage_Inbox = self.notebook1.il.Add(self.getBitmap(self.__icons_inbox[_("""icon_inbox""")]))
215 self.notebook1.SetImageList(self.notebook1.il)
216 szr_notebook = wxNotebookSizer(self.notebook1)
217
218
219
220 szr_script_page= wxBoxSizer(wxVERTICAL)
221 ListScript_ID = wxNewId()
222 self.List_Script = wxListCtrl(self.notebook1, ListScript_ID, wxDefaultPosition, wxDefaultSize,wxLC_REPORT|wxSUNKEN_BORDER)
223 szr_script_page.Add(self.List_Script,100,wxEXPAND)
224 self.List_Script.SetForegroundColour(wxColor(131,129,131))
225 self.List_Requests = wxListCtrl(self.notebook1, -1, wxDefaultPosition, wxDefaultSize,wxSUNKEN_BORDER)
226 self.List_Measurements = wxListCtrl(self.notebook1, -1, wxDefaultPosition, wxDefaultSize,wxSUNKEN_BORDER)
227 self.List_Referrals = wxListCtrl(self.notebook1, -1, wxDefaultPosition, wxDefaultSize,wxSUNKEN_BORDER)
228 self.List_Recalls = wxListCtrl(self.notebook1, -1, wxDefaultPosition, wxDefaultSize,wxSUNKEN_BORDER)
229 self.List_Inbox = wxListCtrl(self.notebook1, -1, wxDefaultPosition, wxDefaultSize,wxSUNKEN_BORDER)
230
231 self.notebook1.AddPage(self.List_Script, '', True, tabimage_Script)
232
233 self.notebook1.AddPage(self.List_Requests, '', True, tabimage_Requests)
234 self.notebook1.AddPage(self.List_Measurements, '', True, tabimage_Measurements)
235 self.notebook1.AddPage(self.List_Referrals, '', True, tabimage_Referrals)
236 self.notebook1.AddPage(self.List_Recalls, '', True, tabimage_Recalls)
237 self.notebook1.AddPage(self.List_Inbox, '', True, tabimage_Inbox)
238 self.notebook1.SetSelection(0)
239
240
241
242 self.List_Script.SetImageList(self.ListsImageList, wxIMAGE_LIST_SMALL)
243
244
245
246 info = wxListItem()
247 info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE | wxLIST_MASK_FORMAT
248 info.m_image = -1
249 info.m_format = 0
250 info.m_text = _("Drug")
251 self.List_Script.InsertColumnInfo(0, info)
252
253
254 info.m_format = wxLIST_FORMAT_LEFT
255 info.m_text = _("Dose")
256 self.List_Script.InsertColumnInfo(1, info)
257
258 info.m_format = wxLIST_FORMAT_RIGHT
259 info.m_text = _("Instructions")
260 self.List_Script.InsertColumnInfo(2, info)
261
262 info.m_format = wxLIST_FORMAT_RIGHT
263 info.m_text = _("Last Date")
264 self.List_Script.InsertColumnInfo(3, info)
265
266 info.m_format = wxLIST_FORMAT_RIGHT
267 info.m_text = _("Prescribed For")
268 self.List_Script.InsertColumnInfo(4, info)
269
270
271 info.m_format = wxLIST_FORMAT_RIGHT
272 info.m_text = _("Quantity")
273 self.List_Script.InsertColumnInfo(5, info)
274
275
276 info.m_format = 0
277 info.m_text = _("First Date")
278 self.List_Script.InsertColumnInfo(6, info)
279
280
281
282
283
284 items = scriptdata.items()
285 for x in range(len(items)):
286 key, data = items[x]
287
288 gmLog.gmDefLog.Log (gmLog.lData, items[x])
289
290
291 self.List_Script.InsertStringItem(x, data[0])
292 self.List_Script.SetStringItem(x, 1, data[1])
293 self.List_Script.SetStringItem(x, 2, data[2])
294 self.List_Script.SetStringItem(x, 3, data[3])
295 self.List_Script.SetStringItem(x, 4, data[4])
296 self.List_Script.SetStringItem(x, 5, data[5])
297 self.List_Script.SetStringItem(x, 6, data[6])
298 self.List_Script.SetItemData(x, key)
299
300
301
302
303 self.itemDataMap = scriptdata
304
305
306 self.List_Script.SetColumnWidth(0, wxLIST_AUTOSIZE)
307 self.List_Script.SetColumnWidth(1, wxLIST_AUTOSIZE)
308 self.List_Script.SetColumnWidth(2, wxLIST_AUTOSIZE)
309 self.List_Script.SetColumnWidth(3, wxLIST_AUTOSIZE)
310 self.List_Script.SetColumnWidth(4, wxLIST_AUTOSIZE)
311 self.List_Script.SetColumnWidth(5, wxLIST_AUTOSIZE)
312 self.List_Script.SetColumnWidth(6, 150)
313 sizer.AddSizer(szr_notebook,40,wxEXPAND)
314 self.SetSizer(sizer)
315 sizer.Fit(self)
316 self.SetAutoLayout(True)
317 self.Show(True)
318
320
321 return wxBitmapFromXPMData(cPickle.loads(zlib.decompress( __icon )))
322
323
325 """
326 Plugin to encapsulate the tabbed lists
327 """
329 return 'TabbedListsPlugin'
330
332 self.mwm = self.gb['clinical.manager']
333 self.mwm.RegisterRightSide ('tabbed_lists', TabbedLists
334 (self.mwm.righthalfpanel, -1), position=1)
335
337 self.mwm.Unregister ('tabbed_lists')
338
339 if __name__ == "__main__":
340 app = wxPyWidgetTester(size = (400, 300))
341 app.SetWidget(TabbedLists, -1)
342 app.MainLoop()
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398