| Home | Trees | Indices | Help |
|
|---|
|
|
1 # -*- coding: utf-8 -*-
2 #!/usr/bin/python
3 #############################################################################
4 #
5 # gmPrescription:
6 # ----------------------------------
7 #
8 # This panel will hold all the prescrition, and allow entry
9 # of those details via the editing area (gmEditArea.py - currently a
10 # vapour module
11 #
12 # If you don't like it - change this code see @TODO!
13 #
14 # @author: Dr. Richard Terry
15 # @copyright: author
16 # @license: GPL v2 or later (details at http://www.gnu.org)
17 # @dependencies: wxPython (>= version 2.3.1)
18 # @change log:
19 # 10.06.2002 rterry initial implementation, untested
20 #
21 # @TODO:
22 # - write cmEditArea.py
23 # - decide on type of list and text control to use
24 # - someone smart to fix the code (simplify for same result)
25 #
26 ############################################################################
27 import wx
28
29 import gmGuiElement_HeadingCaptionPanel #panel class to display top headings
30 import gmGuiElement_DividerCaptionPanel #panel class to display sub-headings or divider headings
31 import gmGuiElement_AlertCaptionPanel #panel to hold flashing alert messages
32 import gmEditArea #panel class holding editing
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 # script popup
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 #Dummy data to simulate script items
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 #wxPanel.__init__(self,parent, id)
90 wxPanel.__init__(self, parent, id, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER)
91 PatientHolder.__init__(self)
92 #--------------------
93 #add the main heading
94 #--------------------
95 self.scriptpanelheading = gmGuiElement_HeadingCaptionPanel.HeadingCaptionPanel(self,-1," SCRIPTS ")
96 #--------------------------------------------
97 #sizer to hold either just date, or the
98 #authority details, aia, authority number
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 #self.lbl_authorityindication = gmEditArea.EditAreaPromptLabel(self,-1,"Indication")
106 #self.lbl_authoritynumber = gmEditArea.EditAreaPromptLabel(self,-1,"Auth No.")
107 #self.txt_authorityindication = wxTextCtrl(self,-1,"",wxDefaultPosition,wxDefaultSize)
108 #self.txt_authorityindication.Hide()
109 #self.sizer_authority.Add(self.spacer,1,wxEXPAND)
110 self.sizer1.Add(1,0,20)
111 self.sizer1.Add(self.txt_scriptDate,3,wxEXPAND|wxALL,3)
112 #self.sizer1.Add(1,0,1)
113 self.sizer_authority.Add(self.sizer1,0,wxEXPAND)
114 #-------------------------------------------------
115 #now create the editarea specific for prescribing
116 #-------------------------------------------------
117 #self.editarea = gmEditArea.EditArea(self,-1,scriptprompts,gmSECTION_SCRIPT)
118 self.editarea = gmEditArea.gmPrescriptionEditArea(self,-1)
119 #---------------------------------------------------------------------
120 #add the divider headings below the editing area for drug interactions
121 #and add text control to show mini-drug interactions
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 #add the divider headings below the drug interactions as heading for items prescribed
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 #add the list to contain the drugs person is allergic to
139 #
140 # c++ Default Constructor:
141 # wxListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
142 # const wxSize& size = wxDefaultSize, long style = wxLC_ICON,
143 # const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl")
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 # add some dummy data to the allergy list
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 #loop through the scriptdata array and add to the list control
157 #note the different syntax for the first coloum of each row
158 #i.e. here > self.list_script.InsertItem(x, data[0])!!
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 #add an alert caption panel to the bottom
175 #----------------------------------------
176 self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel(self,-1," Alerts ")
177 #---------------------------------------------
178 #add all elements to the main background sizer
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 # create a temporary local popup menu
197 aMenu = wxMenu()
198 # Auth Ind: Australia: some drugs will only be subsidised given certain indications and explicit approval by authorities
199 # like German "Positivliste"
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 # Reg 24: Australia: dispense all repeats at once
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 ##connect the events to event handler functions
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 #EVT_MENU(self, ID_, gmLog.gmDefLog.Log(gmLog.lErr, "This should ... !")
234
235 # show the menu
236 self.PopupMenu(aMenu, event.GetPosition())
237 #self.list_script.PopupMenu(aMenu,event.GetPosition())
238 # whatever the user selected in the menu will have
239 # been handled already virtue of the MENU events
240 # created above
241
242 # free resources
243 aMenu.DestroyLater()
244
245 # anybody else needs to intercept right click events?
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
265
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
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Sat Feb 29 02:55:27 2020 | http://epydoc.sourceforge.net |