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

Source Code for Module Gnumed.wxpython.gui.gmEMRJournalPlugin

 1  # -*- coding: utf-8 -*- 
 2  #====================================================================== 
 3  # GNUmed patient EMR Journal plugin 
 4  #====================================================================== 
 5  __author__ = "Karsten Hilbert" 
 6  __license__ = 'GPL v2 or later (details at http://www.gnu.org)' 
 7   
 8  import logging 
 9   
10   
11  from Gnumed.pycommon import gmI18N 
12  from Gnumed.wxpython import gmPlugin 
13  from Gnumed.wxpython import gmEMRBrowser 
14  from Gnumed.wxpython import gmAccessPermissionWidgets 
15   
16  _log = logging.getLogger('gm.ui') 
17 18 #====================================================================== 19 -class gmEMRJournalPlugin(gmPlugin.cNotebookPlugin):
20 """Plugin to encapsulate patient EMR Journal window.""" 21 22 tab_name = _('EMR Journal') 23 required_minimum_role = 'full clinical access' 24
25 - def name (self):
27 28 @gmAccessPermissionWidgets.verify_minimum_required_role ( 29 required_minimum_role, 30 activity = _('loading plugin <%s>') % tab_name, 31 return_value_on_failure = False, 32 fail_silently = False 33 )
34 - def register(self):
36 #-------------------------------------------------
37 - def GetWidget (self, parent):
38 self._widget = gmEMRBrowser.cEMRJournalPluginPnl(parent, -1) 39 return self._widget
40
41 - def MenuInfo (self):
42 return ('emr', _('EMR &Journal (text)'))
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.cEMRJournalPluginPnl(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 Exception: 87 _log.exception("unhandled exception caught !") 88 # but re-raise them 89 raise 90 91 _log.info("closing emr journal plugin...") 92 93 #====================================================================== 94