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

Source Code for Module Gnumed.wxpython.gui.gmNotebookedPatientEditionPlugin

  1  #====================================================================== 
  2  # GNUmed notebook based patient edition plugin 
  3  # ------------------------------------------------ 
  4  # 
  5  # this plugin displays a notebook container for patient edition 
  6  # current pages (0.1): identity, contacts, occupation 
  7  # 
  8  # @copyright: author 
  9  #====================================================================== 
 10  __version__ = "$Revision: 1.15 $" 
 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  _log.info(__version__) 
34 #====================================================================== 35 -class gmNotebookedPatientEditionPlugin(gmPlugin.cNotebookPlugin):
36 """Plugin to encapsulate notebooked patient edition window.""" 37 38 tab_name = _('Demographics') 39 required_minimum_role = 'staff' 40 41 @gmAccessPermissionWidgets.verify_minimum_required_role ( 42 required_minimum_role, 43 activity = _('loading plugin <%s>') % tab_name, 44 return_value_on_failure = False, 45 fail_silently = False 46 )
47 - def register(self):
49 #-------------------------------------------------
50 - def name (self):
52
53 - def GetWidget (self, parent):
54 self._widget = gmDemographicsWidgets.cNotebookedPatEditionPanel(parent, -1) 55 return self._widget
56
57 - def MenuInfo (self):
58 return ('patient', _('&Demographics'))
59
60 - def can_receive_focus(self):
61 # need patient 62 if not self._verify_patient_avail(): 63 return None 64 return 1
65 66 #====================================================================== 67 # main 68 #---------------------------------------------------------------------- 69 if __name__ == "__main__": 70 71 # 3rd party 72 import wx 73 74 # GNUmed 75 from Gnumed.business import gmPersonSearch 76 77 _log.info("starting Notebooked patient edition 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 standalone notebooked patient editor 88 application = wx.PyWidgetTester(size=(800,600)) 89 application.SetWidget(gmDemographicsWidgets.cNotebookedPatEditionPanel, -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 StandardError: 101 _log.exception("unhandled exception caught !") 102 # but re-raise them 103 raise 104 105 _log.info("closing Notebooked progress notes input plugin...") 106 107 #====================================================================== 108