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

Source Code for Module Gnumed.wxpython.gui.gmPatientOverviewPlugin

  1  # -*- coding: utf-8 -*- 
  2  #====================================================================== 
  3  # GNUmed patient overview plugin 
  4  # ------------------------------ 
  5  # 
  6  #====================================================================== 
  7  __author__ = "Carlos Moro, Karsten Hilbert" 
  8  __license__ = 'GPL v2 or later (details at http://www.gnu.org)' 
  9   
 10   
 11  import logging 
 12   
 13   
 14  if __name__ == '__main__': 
 15          # stdlib 
 16          import sys 
 17          sys.path.insert(0, '../../../') 
 18   
 19          from Gnumed.pycommon import gmI18N 
 20          gmI18N.activate_locale() 
 21          gmI18N.install_domain() 
 22   
 23  # GNUmed 
 24  from Gnumed.wxpython import gmPlugin, gmPatOverviewWidgets 
 25  from Gnumed.wxpython import gmAccessPermissionWidgets 
 26   
 27   
 28  _log = logging.getLogger('gm.ui') 
29 30 #====================================================================== 31 -class gmPatientOverviewPlugin(gmPlugin.cNotebookPlugin):
32 33 tab_name = _('Overview') 34 required_minimum_role = 'full clinical access' 35 36 @gmAccessPermissionWidgets.verify_minimum_required_role ( 37 required_minimum_role, 38 activity = _('loading plugin <%s>') % tab_name, 39 return_value_on_failure = False, 40 fail_silently = False 41 )
42 - def register(self):
44 45 #-------------------------------------------------
46 - def name(self):
48
49 - def GetWidget(self, parent):
50 self._widget = gmPatOverviewWidgets.cPatientOverviewPnl(parent, -1) 51 return self._widget
52
53 - def MenuInfo(self):
54 return ('emr', _('&Overview'))
55
56 - def can_receive_focus(self):
57 if not self._verify_patient_avail(): 58 return None 59 return True
60 61 #====================================================================== 62 # main 63 #---------------------------------------------------------------------- 64 if __name__ == "__main__": 65 66 # 3rd party 67 import wx 68 69 # GNUmed 70 from Gnumed.business import gmPersonSearch 71 from Gnumed.wxpython import gmSOAPWidgets 72 73 _log.info("starting Notebooked progress notes input plugin...") 74 75 try: 76 # obtain patient 77 patient = gmPersonSearch.ask_for_patient() 78 if patient is None: 79 print("None patient. Exiting gracefully...") 80 sys.exit(0) 81 gmPatSearchWidgets.set_active_patient(patient=patient) 82 83 # display standalone multisash progress notes input 84 application = wx.wx.PyWidgetTester(size = (800,600)) 85 multisash_notes = gmSOAPWidgets.cNotebookedProgressNoteInputPanel(application.frame, -1) 86 87 application.frame.Show(True) 88 application.MainLoop() 89 90 # clean up 91 if patient is not None: 92 try: 93 patient.cleanup() 94 except: 95 print("error cleaning up patient") 96 except Exception: 97 _log.exception("unhandled exception caught !") 98 # but re-raise them 99 raise 100 101 _log.info("closing Notebooked progress notes input plugin...") 102