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

Source Code for Module Gnumed.wxpython.gui.gmEMRJournalPlugin

 1  #====================================================================== 
 2  # GnuMed patient EMR Journal plugin 
 3  # ---------------------------------------------- 
 4  # 
 5  # @copyright: author 
 6  #====================================================================== 
 7  __version__ = "$Revision: 1.15 $" 
 8  __author__ = "Karsten Hilbert" 
 9  __license__ = 'GPL (details at http://www.gnu.org)' 
10   
11  import logging 
12   
13   
14  from Gnumed.wxpython import gmPlugin, gmEMRBrowser 
15  from Gnumed.pycommon import gmI18N 
16   
17  _log = logging.getLogger('gm.ui') 
18  _log.info(__version__) 
19   
20  #====================================================================== 
21 -class gmEMRJournalPlugin(gmPlugin.cNotebookPlugin):
22 """Plugin to encapsulate patient EMR Journal window.""" 23 24 tab_name = _('EMR journal') 25
26 - def name (self):
28
29 - def GetWidget (self, parent):
30 self._widget = gmEMRBrowser.cEMRJournalPanel(parent, -1) 31 return self._widget
32
33 - def MenuInfo (self):
34 #return ('emr_show', _('Chronological &journal')) 35 return ('emr', _('Chronological &journal'))
36
37 - def can_receive_focus(self):
38 # need patient 39 if not self._verify_patient_avail(): 40 return None 41 return 1
42 43 #====================================================================== 44 # main 45 #---------------------------------------------------------------------- 46 if __name__ == "__main__": 47 48 import sys 49 50 import wx 51 52 from Gnumed.exporters import gmPatientExporter 53 from Gnumed.business import gmPersonSearch 54 55 _log.info("starting emr journal plugin...") 56 57 try: 58 # obtain patient 59 patient = gmPersonSearch.ask_for_patient() 60 if patient is None: 61 print "None patient. Exiting gracefully..." 62 sys.exit(0) 63 gmPatSearchWidgets.set_active_patient(patient=patient) 64 65 # display standalone browser 66 application = wx.wxPyWidgetTester(size=(800,600)) 67 emr_journal = gmEMRBrowser.cEMRJournalPanel(application.frame, -1) 68 emr_journal.refresh_journal() 69 70 application.frame.Show(True) 71 application.MainLoop() 72 73 # clean up 74 if patient is not None: 75 try: 76 patient.cleanup() 77 except: 78 print "error cleaning up patient" 79 except StandardError: 80 _log.exception("unhandled exception caught !") 81 # but re-raise them 82 raise 83 84 _log.info("closing emr journal plugin...") 85 86 #====================================================================== 87