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