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

Source Code for Module Gnumed.wxpython.gui.gmEMRTimelinePlugin

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