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

Source Code for Module Gnumed.wxpython.patient.gmGP_Requests

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