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 v2 or later (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 return self._widget
34 #-------------------------------------------------
35 - def MenuInfo(self):
36 #return ('emr_show', _('Topical &tree')) 37 return ('emr', _('Topical &tree'))
38 #-------------------------------------------------
39 - def can_receive_focus(self):
40 # need patient 41 if not self._verify_patient_avail(): 42 return None 43 return 1
44 #====================================================================== 45 # main 46 #---------------------------------------------------------------------- 47 if __name__ == "__main__": 48 49 import sys 50 51 import wx 52 53 from Gnumed.exporters import gmPatientExporter 54 from Gnumed.business import gmPersonSearch 55 56 _log.info("starting emr browser plugin...") 57 58 try: 59 # obtain patient 60 patient = gmPersonSearch.ask_for_patient() 61 if patient is None: 62 print "None patient. Exiting gracefully..." 63 sys.exit(0) 64 gmPatSearchWidgets.set_active_patient(patient=patient) 65 66 # display standalone browser 67 application = wx.wxPyWidgetTester(size=(800,600)) 68 emr_browser = gmEMRBrowser.cEMRBrowserPanel(application.frame, -1) 69 emr_browser.refresh_tree() 70 71 application.frame.Show(True) 72 application.MainLoop() 73 74 # clean up 75 if patient is not None: 76 try: 77 patient.cleanup() 78 except: 79 print "error cleaning up patient" 80 except StandardError: 81 _log.exception("unhandled exception caught !") 82 # but re-raise them 83 raise 84 85 _log.info("closing emr browser plugin...") 86 87 #====================================================================== 88