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

Source Code for Module Gnumed.wxpython.patient.gmGP_Recalls

  1  #!/usr/bin/python 
  2  ############################################################### 
  3  # 
  4  # gmGP_Recalls.py 
  5  # ---------------------------------- 
  6  # 
  7  # This panel will hold all the recall details, and allow entry 
  8  # of those details via the editing area (gmEditArea.py) 
  9  #  
 10  # @author: Dr. Richard Terry 
 11  # @copyright: author 
 12  # @license: GPL v2 or later (details at http://www.gnu.org) 
 13  # @dependencies: wxPython (>= version 2.3.1) 
 14  # @change log: 
 15  #           0108.2002 rterry initial implementation, untested 
 16  # 
 17  # @TODO: 
 18  #       
 19  ############################################################### 
 20  try: 
 21          import wxversion 
 22          import wx 
 23  except ImportError: 
 24          from wxPython import wx 
 25   
 26  import gmGuiElement_HeadingCaptionPanel         #panel class to display top headings 
 27  import gmGuiElement_DividerCaptionPanel         #panel class to display sub-headings or divider headings  
 28  import gmGuiElement_AlertCaptionPanel           #panel to hold flashing alert messages 
 29  import gmEditArea                                       #panel class holding editing prompts and text boxes 
 30  import gmPlugin_Patient 
 31  from gmPatientHolder import PatientHolder 
 32  ID_RECALL_LIST = wxNewId() 
 33  gmSECTION_RECALLS = 12 
 34  #------------------------------------------------------------------ 
 35  #Dummy data to simulate recall items 
 36  #this is best displayed as a concatenated string of edit area lines 
 37  #------------------------------------------------------------------ 
 38  recalldata = { 
 39  1 : ("Rectal examination and prostate blood test on 10/11/2002 to see Dr R Terry (Letter)","NOT SAVED"), 
 40  2 : ("Screening Colonoscopy on 01/07/2004 to see Dr R Terry (Letter)", "RECALL LOGGED") 
 41  } 
 42   
 43  recallprompts = { 
 44  1:("To see Dr"), 
 45  2:("For"), 
 46  3:("Date Due"), 
 47  4:("Add Text"), 
 48  5:("Include Forms"), 
 49  6:("Contact By"), 
 50  7:("Progress Notes"), 
 51  8:("")            
 52  } 
 53   
 54   
55 -class RecallsPanel(wxPanel , PatientHolder):
56 - def __init__(self, parent,id):
57 wxPanel.__init__(self, parent, id,wxDefaultPosition,wxDefaultSize,wxRAISED_BORDER) 58 PatientHolder.__init__(self) 59 #-------------------- 60 #add the main heading 61 #-------------------- 62 self.recallspanelheading = gmGuiElement_HeadingCaptionPanel.HeadingCaptionPanel(self,-1," RECALLS & REVIEWS ") 63 #-------------------------------------------- 64 #dummy panel will later hold the editing area 65 #-------------------------------------------- 66 self.dummypanel = wxPanel(self,-1,wxDefaultPosition,wxDefaultSize,0) 67 self.dummypanel.SetBackgroundColour(wxColor(222,222,222)) 68 #---------------------------------------------- 69 #now create the editarea specific for allergies 70 #---------------------------------------------- 71 self.editarea = gmEditArea.gmRecallEditArea(self,-1) 72 self.dummypanel2 = wxPanel(self,-1,wxDefaultPosition,wxDefaultSize,0) 73 self.dummypanel2.SetBackgroundColour(wxColor(222,222,222)) 74 #----------------------------------------------- 75 #add the divider headings below the editing area 76 #----------------------------------------------- 77 self.recall_subheading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Recalls entered this consultation")) 78 self.sizer_divider_recalls = wxBoxSizer(wxHORIZONTAL) 79 self.sizer_divider_recalls.Add(self.recall_subheading,1, wxEXPAND) 80 #-------------------------------------------------------------------------------------- 81 #add the list to contain the recalls entered this session 82 # 83 # c++ Default Constructor: 84 # wxListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, 85 # const wxSize& size = wxDefaultSize, long style = wxLC_ICON, 86 # const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl") 87 # 88 #-------------------------------------------------------------------------------------- 89 self.list_recalls = wxListCtrl(self, ID_RECALL_LIST, wxDefaultPosition, wxDefaultSize,wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER) 90 #self.list_recalls.SetForegroundColour(wxColor(131,129,131)) 91 self.list_recalls.SetFont(wxFont(12,wxSWISS, wxNORMAL, wxNORMAL, False, '')) 92 #---------------------------------------- 93 # add some dummy data to the allergy list 94 self.list_recalls.InsertColumn(0, _("Recall Details")) 95 self.list_recalls.InsertColumn(1, _("Status")) 96 #------------------------------------------------------------- 97 #loop through the scriptdata array and add to the list control 98 #note the different syntax for the first coloum of each row 99 #i.e. here > self.list_recalls.InsertStringItem(x, data[0])!! 100 #------------------------------------------------------------- 101 items = recalldata.items() 102 for x in range(len(items)): 103 key, data = items[x] 104 self.list_recalls.InsertStringItem(x, data[0]) 105 self.list_recalls.SetStringItem(x, 1, data[1]) 106 self.list_recalls.SetItemData(x, key) 107 self.list_recalls.SetColumnWidth(0, wxLIST_AUTOSIZE) 108 self.list_recalls.SetColumnWidth(1, wxLIST_AUTOSIZE) 109 #---------------------------------------- 110 #add an alert caption panel to the bottom 111 #---------------------------------------- 112 self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel(self,-1," Alerts ") 113 #--------------------------------------------- 114 #add all elements to the main background sizer 115 #--------------------------------------------- 116 self.mainsizer = wxBoxSizer(wxVERTICAL) 117 self.mainsizer.Add(self.recallspanelheading,0,wxEXPAND) 118 #self.mainsizer.Add(self.dummypanel,1,wxEXPAND) 119 self.mainsizer.Add(self.editarea,6,wxEXPAND) 120 #self.mainsizer.Add(self.dummypanel2,1,wxEXPAND) 121 self.mainsizer.Add(self.sizer_divider_recalls,0,wxEXPAND) 122 self.mainsizer.Add(self.list_recalls,4,wxEXPAND) 123 self.mainsizer.Add(self.alertpanel,0,wxEXPAND) 124 self.SetSizer(self.mainsizer) 125 self.mainsizer.Fit 126 self.SetAutoLayout(True) 127 self.Show(True)
128 #----------------------------------------------------------------------
129 -class gmGP_Recalls(gmPlugin_Patient.wxPatientPlugin):
130 """Plugin to encapsulate the immunisation window.""" 131 132 __icons = { 133 """icon_talking_head""": 'x\xda\x8d\x8e=\x0b\xc3 \x10\x86\xf7\xfc\x8a\x03\x85\x14\x02\xa2Kc\xb7\xa0\ 134 \x901\x0eY\\C\xe8\xd4P\xfb\xff\xa7z\xa7\xd1\xa6\xcd\xd0\xd3\xe5yx\xef\xe3\ 135 \xb2\xbdT3\xb7\xea\n\xf1\xdf@\xb5\xcd2\xb7\x02V0\xdb\xb2>\x88X$\xd6\xeb\xdeJ\ 136 I\xdc![\x89\x8f\xd8!\x8f\xba\xf0\xb0\xf3\xa8\x899\xb2\x96Z\xe6~\x88<\x85\xe7\ 137 \x9d\xc0\xa7\xf0hs8 \x1bm\xacI\x0c"\x17\xa4J\xf7\xd5:\x95\xe2/\xe9}\xf8\x91\ 138 \x1e\xe5\xd7\xcc\xe8\xbc8lw\xe8\xcaMI:G\xb9\xee\xd0\xee\x06Ou.\xc3\xe7v\x97\ 139 \x83\xd11^\xb6\x97n^\x93\xfbH\xc6\x80\xefI\x9c\x86%\x80\xd5\x99\xe9H:3fQ\x8a\ 140 7\x97\xb8jB' 141 } 142
143 - def name (self):
144 return 'Recalls and Reviews Window'
145
146 - def MenuInfo (self):
147 return ('view', '&Recalls + Reviews')
148
149 - def GetIconData(self, anIconID = None):
150 if anIconID == None: 151 return self.__icons[_("""icon_talking_head""")] 152 else: 153 if self.__icons.has_key(anIconID): 154 return self.__icons[anIconID] 155 else: 156 return self.__icons[_("""icon_talking_head""")]
157
158 - def GetWidget (self, parent):
159 return RecallsPanel (parent, -1)
160 #---------------------------------------------------------------------- 161 if __name__ == "__main__": 162 app = wxPyWidgetTester(size = (600, 600)) 163 app.SetWidget(RecallsPanel, -1) 164 app.MainLoop() 165