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

Source Code for Module Gnumed.wxpython.gui.gmEMRTimelinePlugin

  1  # -*- coding: utf-8 -*- 
  2  __doc__ = """ This is the EMR Timeline plugin.""" 
  3   
  4  #================================================================ 
  5  __author__ = "karsten.hilbert@gmx.net" 
  6  __license__ = "GPL v2 or later" 
  7   
  8  raise Exception 
  9   
 10   
 11  import logging 
 12   
 13   
 14  import wx 
 15   
 16   
 17  from Gnumed.wxpython import gmPlugin, gmEMRTimelineWidgets 
 18  from Gnumed.wxpython import gmAccessPermissionWidgets 
 19   
 20   
 21  _log = logging.getLogger('gm.ui') 
22 #================================================================ 23 -class gmEMRTimelinePlugin(gmPlugin.cNotebookPlugin):
24 25 tab_name = _("EMR Timeline") 26 required_minimum_role = 'full clinical access' 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 name (self):
39 #--------------------------------------------------------
40 - def GetWidget (self, parent):
41 self._widget = gmEMRTimelineWidgets.cEMRTimelinePluginPnl(parent, -1) 42 return self._widget
43 #--------------------------------------------------------
44 - def MenuInfo (self):
45 return ('emr', _('EMR &Timeline'))
46 #--------------------------------------------------------
47 - def can_receive_focus(self):
48 if not self._verify_patient_avail(): 49 return None 50 return 1
51 #--------------------------------------------------------
52 - def _on_raise_by_signal(self, **kwds):
53 if not gmPlugin.cNotebookPlugin._on_raise_by_signal(self, **kwds): 54 return False 55 try: 56 pass 57 except KeyError: 58 pass 59 return True
60 #================================================================ 61 # MAIN 62 #---------------------------------------------------------------- 63 if __name__ == '__main__': 64 65 # stdlib 66 import sys 67 sys.path.insert(0, '../../../') 68 69 from Gnumed.pycommon import gmI18N 70 gmI18N.activate_locale() 71 gmI18N.install_domain() 72 73 # GNUmed 74 from Gnumed.business import gmPersonSearch 75 from Gnumed.wxpython import gmPatSearchWidgets 76 77 _log.info("starting template plugin...") 78 79 try: 80 # obtain patient 81 patient = gmPersonSearch.ask_for_patient() 82 if patient is None: 83 print("None patient. Exiting gracefully...") 84 sys.exit(0) 85 gmPatSearchWidgets.set_active_patient(patient=patient) 86 87 # display the plugin standalone 88 application = wx.wx.PyWidgetTester(size = (800,600)) 89 widgets = gmExamplePluginWidgets.cExamplePluginPnl(application.frame, -1) 90 91 application.frame.Show(True) 92 application.MainLoop() 93 94 # clean up 95 if patient is not None: 96 try: 97 patient.cleanup() 98 except: 99 print("error cleaning up patient") 100 except Exception: 101 _log.exception("unhandled exception caught !") 102 # but re-raise them 103 raise 104 105 _log.info("closing example plugin...") 106