Gnumed.wxpython.patient.gmGP_FamilyHistory

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

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

      1  #!/usr/bin/python
      2  #############################################################################
      3  #
      4  # gmGP_FamilyHistory.py
      5  # ----------------------------------
      6  #
      7  # This panel will hold all the family history details
      8  #
      9  # If you don't like it - change this code see @TODO!
     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
     16  # @TODO:
     17  #       almost everything
     18  #
     19  ############################################################################
     20  # $Source: /home/ncq/Projekte/cvs2git/vcs-mirror/gnumed/gnumed/client/wxpython/patient/gmGP_FamilyHistory.py,v $
     21  __version__ = "$Revision: 1.11 $"
     22  __author__  = "R.Terry <rterry@gnumed.net>, H.Herb <hherb@gnumed.net>, S.Tan"
     23
     24  try:
     25          import wxversion
     26          import wx
     27  except ImportError:
     28          from wxPython import wx
     29
     30  import gmEditArea, gmPlugin_Patient
     31  import gmGuiElement_HeadingCaptionPanel         #panel class to display top headings
     32  import gmGuiElement_DividerCaptionPanel         #panel class to display sub-headings or divider headings
     33  import gmGuiElement_AlertCaptionPanel           #panel to hold flashing alert messages
     34  from gmPatientHolder import PatientHolder
     35
     36
     37  ID_MEMBERCONDITIONSLIST = wxNewId()
     38  ID_FAMILYMEMBERSLIST = wxNewId()
     39  ID_IMMUNISATIONS = wxNewId()
     40  ID_ALL_MENU  = wxNewId()
     41  gmSECTION_FAMILYHISTORY = 4
     42  #------------------------------------
     43  #Dummy data to simulate allergy items
     44  #------------------------------------
     45  familymemberdata = {
     46  1 : ("Mother",""),
     47  2 : ("General Family History",""),
     48  3 : ("Freda -Aunt",""),
     49  }
     50  membersconditionsdata = {
     51  1 : ("Acute myocardial infarction aged 73, caused death 73",""),
     52  2 : ("Hypertension age onset 40",""),
     53  }
     54
     55  #----------------------------------------------------------------------
     56 -class FamilyHistoryPanel(wxPanel, PatientHolder):
     57
     58 -        def __init__(self, parent,id):
     59                  wxPanel.__init__(self, parent, id,wxDefaultPosition,wxDefaultSize,wxRAISED_BORDER)
     60                  PatientHolder.__init__(self)
     61                  # main heading
     62                  self.FamilyHistoryPanelheading = gmGuiElement_HeadingCaptionPanel.HeadingCaptionPanel(self,-1,"  FAMILY AND SOCIAL HISTORY  ")
     63                  # editarea
     64                  self.editarea = gmEditArea.gmFamilyHxEditArea(self, -1)
     65                  #self.editarea = gmFamilyHxEditArea(self, -1)
     66                  #-----------------------------------------------
     67                  #add the divider headings below the editing area
     68                  #-----------------------------------------------
     69                  self.family_members_heading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,"Family Members")
     70                  self.members_disease_conditions = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,"Condition")
     71                  self.sizer_divider_members_condition = wxBoxSizer(wxHORIZONTAL)
     72                  self.sizer_divider_members_condition.Add(self.family_members_heading,1, wxEXPAND)
     73                  self.sizer_divider_members_condition.Add( self.members_disease_conditions,1, wxEXPAND)
     74                  #--------------------------------------------------------------------------------------
     75                  #add the list to contain the family members
     76                  #
     77                  # c++ Default Constructor:
     78                  # wxListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
     79                  # const wxSize& size = wxDefaultSize, long style = wxLC_ICON,
     80                  # const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl")
     81                  #
     82                  #--------------------------------------------------------------------------------------
     83                  self.family_members_list = wxListCtrl(self, ID_FAMILYMEMBERSLIST,  wxDefaultPosition, wxDefaultSize,wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER)
     84                  self.family_members_list.SetFont(wxFont(12,wxSWISS, wxNORMAL, wxNORMAL, False, ''))
     85                  self.member_conditions_list = wxListCtrl(self,ID_MEMBERCONDITIONSLIST,  wxDefaultPosition, wxDefaultSize,wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER)
     86                  self.member_conditions_list.SetFont(wxFont(12,wxSWISS, wxNORMAL, wxNORMAL, False, ''))
     87                  self.sizer_members_conditions = wxBoxSizer(wxHORIZONTAL)
     88                  self.sizer_members_conditions.Add(self.family_members_list,4,wxEXPAND)
     89                  self.sizer_members_conditions.Add(self.member_conditions_list,6, wxEXPAND)
     90                  #----------------------------------------
     91                  # add some dummy data to the Members list
     92                  #-----------------------------------------
     93                  self.family_members_list.InsertColumn(0, "Member")
     94                  self.family_members_list.InsertColumn(1, "null")
     95                  #-------------------------------------------------------------
     96                  #loop through the familymemberdata array and add to the list control
     97                  #note the different syntax for the first coloum of each row
     98                  #i.e. here > self.family_members_list.InsertStringItem(x, data[0])!!
     99                  #-------------------------------------------------------------
    100                  items = familymemberdata.items()
    101                  for x in range(len(items)):
    102                          key, data = items[x]
    103                          #gmLog.gmDefLog.Log (gmLog.lData, items[x])
    104                          self.family_members_list.InsertStringItem(x, data[0])
    105                          self.family_members_list.SetStringItem(x, 1, data[1])
    106                          self.family_members_list.SetItemData(x, key)
    107                  self.family_members_list.SetColumnWidth(0, wxLIST_AUTOSIZE)
    108                  #-------------------------------------------
    109                  # add some dummy data to the conditions list
    110                  #-------------------------------------------
    111                  self.member_conditions_list.InsertColumn(0, "Condition")
    112                  self.member_conditions_list.InsertColumn(1, "null")
    113                  #-------------------------------------------------------------
    114                  #loop through the familymemberdata array and add to the list control
    115                  #note the different syntax for the first coloum of each row
    116                  #i.e. here > self.family_members_list.InsertStringItem(x, data[0])!!
    117                  #-------------------------------------------------------------
    118                  items = membersconditionsdata.items()
    119                  for x in range(len(items)):
    120                          key, data = items[x]
    121                          #gmLog.gmDefLog.Log (gmLog.lData, items[x])
    122                          self.member_conditions_list.InsertStringItem(x, data[0])
    123                          self.member_conditions_list.SetStringItem(x, 1, data[1])
    124                          self.member_conditions_list.SetItemData(x, key)
    125
    126                  self.member_conditions_list.SetColumnWidth(0, wxLIST_AUTOSIZE)
    127                  self.member_conditions_list.SetColumnWidth(1, wxLIST_AUTOSIZE)
    128                  #------------------------------------------------------------------------------------------
    129                  #add a richtext control or a wxTextCtrl multiline to allow user to enter the social history
    130                  #------------------------------------------------------------------------------------------
    131                  self.social_history_subheading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,"Social History")
    132                  self.txt_social_history = wxTextCtrl(self, 30,
    133                                          "Born in QLD, son of an itinerant drover. Mother worked as a bush nurse. "
    134                                          "Two brothers, Fred and Peter. Left school aged 15yrs, apprentice fitter "
    135                                          "then worked in industry for 10ys. At 22yrs age married Joan, two children"
    136                                          "Peter b1980 and Rachaelb1981. Retired in 1990 due to receiving a fortune.",
    137                                          wxDefaultPosition,wxDefaultSize, style=wxTE_MULTILINE|wxNO_3D|wxSIMPLE_BORDER)
    138                  self.txt_social_history.SetInsertionPoint(0)
    139                  self.txt_social_history.SetFont(wxFont(12,wxSWISS, wxNORMAL, wxNORMAL, False, ''))
    140                  #----------------------------------------
    141                  #add an alert caption panel to the bottom
    142                  #----------------------------------------
    143                  self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel(self,-1,"  Alerts  ")
    144                  #---------------------------------------------
    145                  #add all elements to the main background sizer
    146                  #---------------------------------------------
    147                  self.mainsizer = wxBoxSizer(wxVERTICAL)
    148                  self.mainsizer.Add(self.FamilyHistoryPanelheading,0,wxEXPAND)
    149  #               self.mainsizer.Add(self.dummypanel1,1,wxEXPAND)
    150                  self.mainsizer.Add(self.editarea,6,wxEXPAND)
    151                  self.mainsizer.Add(self.sizer_divider_members_condition,0,wxEXPAND)
    152                  self.mainsizer.Add(self.sizer_members_conditions,4,wxEXPAND)
    153                  self.mainsizer.Add(self.social_history_subheading,0,wxEXPAND)
    154                  self.mainsizer.Add(self.txt_social_history,4,wxEXPAND)
    155                  self.mainsizer.Add(self.alertpanel,0,wxEXPAND)
    156                  self.SetSizer(self.mainsizer)
    157                  self.mainsizer.Fit (self)
    158                  self.SetAutoLayout(True)
    159                  EVT_SIZE (self, self.OnSize)
    160
    161 -        def OnSize (self, event):
    162                  w, h = event.GetSize ()
    163                  self.mainsizer.SetDimension (0, 0, w, h)
    164  #----------------------------------------------------------------------
    165 -class gmGP_FamilyHistory(gmPlugin_Patient.wxPatientPlugin):
    166          """Plugin to encapsulate the family history window."""
    167
    168          __icons = {
    169  """icon_two_people""": 'x\xda\x9d\x90\xb1\x0e\x83 \x10\x86w\x9f\xe2\x12@\x9b\x98\x10X\xaa#\x81\xc4\
    170  \xb1\x0c.\xae\xc6t\xaa)}\xff\xa9w\x07\xd8\xb4n\x05\xf5\xf2}w?$^\xf6\x97m\xe6\
    171  \xce^\x81\x1e\x0b\xb6k\xd6\xb9\x93\xb0\x81\xdf\xd7\xed\xc1\xd4"\x89a\x1c\x82\
    172  1\xcc\x82x\x1a\x8d\x99F\xe6\x85\xd8\xe0\n\xb9\x1f+\x97\xbe\xcey2\xcc)\xe7C\
    173  \xed\x03\xf2-=\xef\x0c.\x87\xa7P\x9a\xaa^V\xc2=\xb1\x1f}\xf05\xfc\xbd\x8a\
    174  \xd4Z3\xe6\x9a\xa5^p\x93[\x12\xd52\x99R\xe2A\xac\x1f\t\xa9\x1c\x97\x8e3c\x8c\
    175  =\xbe\xe0\x9c\x13\xc2\xb9C\xba\x08(A:\tU\x82\x94\x92%H\xa8R\xb0\x14\xb8\x95R\
    176  \xf8-\x17I\x1a\x01rh\x7f$\'N\xb2\xc5}\xc8\x0c\x7f\xcb\xd3\xaf\xd3o\x85>c\\'
    177  }
    178
    179 -        def name (self):
    180                  return 'Family History Window'
    181
    182          #FIXME - put ampersand in correct position
    183 -        def MenuInfo (self):
    184                  return ('view', '&Family History')
    185
    186 -        def GetIconData(self, anIconID = None):
    187                  if anIconID == None:
    188                          return self.__icons[_("""icon_two_people""")]
    189                  else:
    190                          if self.__icons.has_key(anIconID):
    191                                  return self.__icons[anIconID]
    192                          else:
    193                                  return self.__icons[_("""icon_two_people""")]
    194
    195 -        def GetWidget (self, parent):
    196                  return FamilyHistoryPanel (parent, -1)
    197  #======================================================================
    198  # main
    199  #----------------------------------------------------------------------
    200  if __name__ == "__main__":
    201          app = wxPyWidgetTester(size = (600, 600))
    202          app.SetWidget(FamilyHistoryPanel, -1)
    203          app.MainLoop()
    204  #======================================================================#
    205  # $Log: gmGP_FamilyHistory.py,v $
    206  # Revision 1.11  2008-04-13 14:39:49  ncq
    207  # - no more old style logging
    208  #
    209  # Revision 1.10  2005/09/26 18:01:53  ncq
    210  # - use proper way to import wx26 vs wx2.4
    211  # - note: THIS WILL BREAK RUNNING THE CLIENT IN SOME PLACES
    212  # - time for fixup
    213  #
    214  # Revision 1.9  2004/07/18 20:30:54  ncq
    215  # - wxPython.true/false -> Python.True/False as Python tells us to do
    216  #
    217  # Revision 1.8  2004/06/25 13:28:00  ncq
    218  # - logically separate notebook and clinical window plugins completely
    219  #
    220  # Revision 1.7  2003/11/17 10:56:41  sjtan
    221  #
    222  # synced and commiting.
    223  #
    224  # Revision 1.2  2003/10/25 08:29:40  sjtan
    225  #
    226  # uses gmDispatcher to send new currentPatient objects to toplevel gmGP_ widgets. Proprosal to use
    227  # yaml serializer to store editarea data in  narrative text field of clin_root_item until
    228  # clin_root_item schema stabilizes.
    229  #
    230  # Revision 1.1  2003/10/23 06:02:40  sjtan
    231  #
    232  # manual edit areas modelled after r.terry's specs.
    233  #
    234  # Revision 1.6  2003/06/01 12:50:46  ncq
    235  # - cleanup, CVS keywords
    236  #
    237  # @change log:
    238  #           10.06.2002 rterry initial implementation, untested
    239  #           30.07.2002 rterry initial implementation, untested
    240