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

# Source Code for Module Gnumed.wxpython.patient.gmGP_Recalls

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