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

Source Code for Module Gnumed.wxpython.gui.gmNotebookedPatientEditionPlugin

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