Package Gnumed :: Package wxpython :: Package patient :: Module gmGP_Requests
[frames] | no frames]

Source Code for Module Gnumed.wxpython.patient.gmGP_Requests

  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   
 28  import wx 
 29   
 30  import gmGuiElement_HeadingCaptionPanel         #panel class to display top headings 
 31  import gmGuiElement_DividerCaptionPanel         #panel class to display sub-headings or divider headings  
 32  import gmGuiElement_AlertCaptionPanel           #panel to hold flashing alert messages 
 33  import gmEditArea                               #panel class holding editing prompts and text boxes 
 34  import gmPlugin_Patient 
 35  from gmPatientHolder import PatientHolder 
 36   
 37  ID_REQUESTSLIST = wxNewId() 
 38  gmSECTION_REQUESTS = 9 
 39  #------------------------------------ 
 40  #Dummy data to simulate script items 
 41  #------------------------------------ 
 42  requestdata = { 
 43  1 : ("Pathology - Douglas Hanly Moir - FBC;UEC;LFT's; Notes:'General tiredness",""), 
 44  2 : ("Radiology - Newcastle Diagnostic Imaging - CT Abdomen; Notes:'LIF mass'", "") 
 45  } 
 46   
 47  requestprompts = { 
 48  1:("Request Type"), 
 49  2:("Company"), 
 50  3:("Street"), 
 51  4:("Suburb"), 
 52  5:("Request(s)"), 
 53  6:("Notes on Form"), 
 54  7:("Medications"), 
 55  8:("Copy to"), 
 56  9:("Progress Notes"), 
 57  10:("") 
 58          } 
 59   
 60   
61 -class RequestsPanel (wxPanel, PatientHolder):
62 - def __init__(self,parent, id):
63 wxPanel.__init__(self, parent, id,wxDefaultPosition,wxDefaultSize,wxRAISED_BORDER) 64 PatientHolder.__init__(self) 65 #-------------------- 66 #add the main heading 67 #-------------------- 68 self.requestspanelheading = gmGuiElement_HeadingCaptionPanel.HeadingCaptionPanel(self,-1," REQUESTS ") 69 #-------------------------------------------- 70 71 #-------------------------------------------- 72 self.sizer_top = wxBoxSizer(wxHORIZONTAL) 73 #FIXME remove the date text below 74 self.txt_requestDate = wxTextCtrl(self, -1, "12/06/2002",wxDefaultPosition,wxDefaultSize) 75 self.spacer = wxWindow(self,-1, wxDefaultPosition,wxDefaultSize,0) 76 self.spacer.SetBackgroundColour(wxColor(222,222,222)) 77 self.sizer_top.Add(self.spacer,6,wxEXPAND) 78 self.sizer_top.Add(self.txt_requestDate,1,wxEXPAND|wxALL,2) 79 self.sizer_top.Add(10,0,0) 80 #--------------------------------------------- 81 #now create the editarea specific for requests 82 #--------------------------------------------- 83 self.editarea = gmEditArea.gmRequestEditArea(self,-1) 84 #----------------------------------------------------------------- 85 #add the divider headings for requests generated this consultation 86 #----------------------------------------------------------------- 87 self.requestsgenerated_subheading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Requests generated this consultation")) 88 self.sizer_requestsgenerated = wxBoxSizer(wxHORIZONTAL) 89 self.sizer_requestsgenerated.Add(self.requestsgenerated_subheading,1, wxEXPAND) 90 #-------------------------------------------------------------------------------------- 91 #add the list to contain the requests the doctor has ordered for person this consult 92 # 93 # c++ Default Constructor: 94 # wxListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, 95 # const wxSize& size = wxDefaultSize, long style = wxLC_ICON, 96 # const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl") 97 # 98 #-------------------------------------------------------------------------------------- 99 self.list_requests = wxListCtrl(self, ID_REQUESTSLIST, wxDefaultPosition, wxDefaultSize,wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER) 100 self.list_requests.SetFont(wxFont(12,wxSWISS, wxNORMAL, wxNORMAL, False, '')) 101 #---------------------------------------- 102 # add some dummy data to the allergy list 103 self.list_requests.InsertColumn(0, _("Request summary")) 104 self.list_requests.InsertColumn(1, "") 105 #------------------------------------------------------------- 106 #loop through the requestdata array and add to the list control 107 #note the different syntax for the first coloum of each row 108 #i.e. here > self.list_requests.InsertItem(x, data[0])!! 109 #------------------------------------------------------------- 110 items = requestdata.items() 111 for x in range(len(items)): 112 key, data = items[x] 113 self.list_requests.InsertItem(x, data[0]) 114 self.list_requests.SetItem(x, 1, data[1]) 115 self.list_requests.SetItemData(x, key) 116 self.list_requests.SetColumnWidth(0, wxLIST_AUTOSIZE) 117 self.list_requests.SetColumnWidth(1, wxLIST_AUTOSIZE) 118 #---------------------------------------- 119 #add an alert caption panel to the bottom 120 #---------------------------------------- 121 self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel(self,-1," Alerts ") 122 #--------------------------------------------- 123 #add all elements to the main background sizer 124 #--------------------------------------------- 125 self.mainsizer = wxBoxSizer(wxVERTICAL) 126 127 self.mainsizer.Add(self.requestspanelheading,0,wxEXPAND) 128 self.mainsizer.Add(0,5,0) 129 self.mainsizer.Add(self.sizer_top,0,wxEXPAND) 130 self.mainsizer.Add(self.editarea,9,wxEXPAND) 131 self.mainsizer.Add(self.requestsgenerated_subheading,0,wxEXPAND) 132 self.mainsizer.Add(self.list_requests,7,wxEXPAND) 133 self.mainsizer.Add(self.alertpanel,0,wxEXPAND) 134 self.SetSizer(self.mainsizer) 135 self.SetAutoLayout(True) 136 self.Show(True)
137 138
139 -class gmGP_Requests (gmPlugin_Patient.wxPatientPlugin):
140 """ 141 Plugin to encapsulate the requests window 142 """ 143 __icons = { 144 """icon_blood_sample""": "x\xda}\x90=\x0b\xc3 \x10\x86\xf7\xfc\n\xc1\xc4\x14\x02r.\xd51\x18p\xacC\x96\ 145 [K\xe9Vj\xff\xff\xd4\x9e\x1f\xa5g!\xea\xf2<\xbe/'\x9e\x1e/3\xec\xb39\x0b:F\ 146 \x98y\xb8\xee\xf3*nBZg7\x80\xcc\x9a88\x80\xe02c\xbb\xb7\x85\xc7\xc2\x005\xbf\ 147 \x94|h\xfd\x89\xd8\x01\xed\xcc\xaa\xf07/>|I\xcf{\x86\xd8\xcau\x98l\xc3k8\x11\ 148 {\xe77\xefj\x99\xafNj\xfd/\xb5\xce\x96KL\xd92\x89)\xc6^\x92\xc3\xae\x8ei\x89\ 149 \xd8M'\xb7vOB)\xe5\xd8\xbd\xf3\xd75\xc9\\\x95\x13sU*\xe6\x9aT\xea\xe0C\x8e\ 150 \xa5~\x03\xa2\x9e`\x0c" 151 } 152
153 - def name (self):
154 return 'Requests'
155
156 - def MenuInfo (self):
157 return ('view', '&Requests') #FIXME fix the ampersand to a logical place in relationship to other buttons
158
159 - def GetIconData(self, anIconID = None):
160 if anIconID == None: 161 return self.__icons[_("""icon_blood_sample""")] 162 else: 163 if anIconID in self.__icons: 164 return self.__icons[anIconID] 165 else: 166 return self.__icons[_("""icon_blood_sample""")]
167
168 - def GetWidget (self, parent):
169 return RequestsPanel (parent, -1)
170 171 172 if __name__ == "__main__": 173 app = wxPyWidgetTester(size = (600, 600)) 174 app.SetWidget(RequestsPanel, -1) 175 app.MainLoop() 176