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