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 gmDocumentWidgets 36 # self._widget = gmDocumentWidgets.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 gmPersonSearch 59 60 _log.info("starting emr browser plugin...") 61 62 try: 63 # obtain patient 64 patient = gmPersonSearch.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