Package Gnumed :: Package wxpython :: Package gui :: Module gmEMRBrowserPlugin
[frames] | no frames]

Source Code for Module Gnumed.wxpython.gui.gmEMRBrowserPlugin

  1  #====================================================================== 
  2  # GnuMed patient EMR browser plugin 
  3  # ---------------------------------------------- 
  4  # 
  5  # this plugin holds patient EMR tree 
  6  # 
  7  # @copyright: author 
  8  #====================================================================== 
  9  __version__ = "$Revision: 1.19 $" 
 10  __author__ = "Carlos Moro" 
 11  __license__ = 'GPL (details at http://www.gnu.org)' 
 12   
 13  import logging 
 14   
 15   
 16  from Gnumed.wxpython import gmPlugin, gmEMRBrowser 
 17  from Gnumed.pycommon import gmI18N 
 18   
 19  _log = logging.getLogger('gm.ui') 
 20  _log.info(__version__) 
 21   
 22  #====================================================================== 
23 -class gmEMRBrowserPlugin(gmPlugin.cNotebookPlugin):
24 """Plugin to encapsulate patient EMR browser window.""" 25 26 tab_name = _('EMR tree') 27
28 - def name(self):
30 #-------------------------------------------------
31 - def GetWidget(self, parent):
32 self._widget = gmEMRBrowser.cSplittedEMRTreeBrowserPnl(parent, -1) 33 # self._widget = gmEMRBrowser.cEMRBrowserPanel(parent, -1) 34 # self._widget = gmEMRBrowser.cScrolledEMRTreePnl(parent, -1) 35 # from Gnumed.wxpython import gmMedDocWidgets 36 # self._widget = gmMedDocWidgets.cSelectablySortedDocTreePnl(parent, -1) 37 return self._widget
38 #-------------------------------------------------
39 - def MenuInfo(self):
40 #return ('emr_show', _('Topical &tree')) 41 return ('emr', _('Topical &tree'))
42 #-------------------------------------------------
43 - def can_receive_focus(self):
44 # need patient 45 if not self._verify_patient_avail(): 46 return None 47 return 1
48 #====================================================================== 49 # main 50 #---------------------------------------------------------------------- 51 if __name__ == "__main__": 52 53 import sys 54 55 import wx 56 57 from Gnumed.exporters import gmPatientExporter 58 from Gnumed.business import gmPerson 59 60 _log.info("starting emr browser plugin...") 61 62 try: 63 # obtain patient 64 patient = gmPerson.ask_for_patient() 65 if patient is None: 66 print "None patient. Exiting gracefully..." 67 sys.exit(0) 68 gmPatSearchWidgets.set_active_patient(patient=patient) 69 70 # display standalone browser 71 application = wx.wxPyWidgetTester(size=(800,600)) 72 emr_browser = gmEMRBrowser.cEMRBrowserPanel(application.frame, -1) 73 emr_browser.refresh_tree() 74 75 application.frame.Show(True) 76 application.MainLoop() 77 78 # clean up 79 if patient is not None: 80 try: 81 patient.cleanup() 82 except: 83 print "error cleaning up patient" 84 except StandardError: 85 _log.exception("unhandled exception caught !") 86 # but re-raise them 87 raise 88 89 _log.info("closing emr browser plugin...") 90 91 #====================================================================== 92 # $Log: gmEMRBrowserPlugin.py,v $ 93 # Revision 1.19 2010/02/07 15:17:57 ncq 94 # - Jim wants this in EMR rather than EMR - Show as 95 # 96 # Revision 1.18 2009/06/29 15:13:25 ncq 97 # - improved placement in menu hierarchy 98 # - add active letters 99 # 100 # Revision 1.17 2009/06/04 16:31:24 ncq 101 # - use set-active-patient from pat-search-widgets 102 # 103 # Revision 1.16 2008/03/06 18:32:30 ncq 104 # - standard lib logging only 105 # 106 # Revision 1.15 2008/01/27 21:21:59 ncq 107 # - no more gmCfg 108 # 109 # Revision 1.14 2007/10/12 07:28:24 ncq 110 # - lots of import related cleanup 111 # 112 # Revision 1.13 2006/10/31 16:06:19 ncq 113 # - no more gmPG 114 # 115 # Revision 1.12 2006/10/25 07:23:30 ncq 116 # - no gmPG no more 117 # 118 # Revision 1.11 2006/05/28 16:18:52 ncq 119 # - use new splitter plugin class 120 # 121 # Revision 1.10 2006/05/04 09:49:20 ncq 122 # - get_clinical_record() -> get_emr() 123 # - adjust to changes in set_active_patient() 124 # - need explicit set_active_patient() after ask_for_patient() if wanted 125 # 126 # Revision 1.9 2005/12/27 19:05:36 ncq 127 # - use gmI18N 128 # 129 # Revision 1.8 2005/09/28 21:38:11 ncq 130 # - more 2.6-ification 131 # 132 # Revision 1.7 2005/09/26 18:01:52 ncq 133 # - use proper way to import wx26 vs wx2.4 134 # - note: THIS WILL BREAK RUNNING THE CLIENT IN SOME PLACES 135 # - time for fixup 136 # 137 # Revision 1.6 2005/06/07 20:56:56 ncq 138 # - take advantage of improved EMR menu 139 # 140 # Revision 1.5 2005/03/29 07:33:47 ncq 141 # - fix naming 142 # 143 # Revision 1.4 2005/03/11 22:53:37 ncq 144 # - ask_for_patient() is now in gmPerson 145 # 146 # Revision 1.3 2004/10/31 00:35:40 cfmoro 147 # Fixed some method names. Added sys import. Refesh browser at startup in standalone mode 148 # 149 # Revision 1.2 2004/09/25 13:12:15 ncq 150 # - switch to from wxPython import wx 151 # 152 # Revision 1.1 2004/09/06 18:59:18 ncq 153 # - Carlos wrote a plugin wrapper for us 154 # 155