1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#===========================================================================
#
# Example script to be run off GNUmed hooks.
#
# It will print a message to the stdout window
# or console whenever any hook is invoked.
#
# Copy this file to ~/.gnumed/scripts/hook_script.py and modify as needed.
#
#===========================================================================
# $Id: hook_script_example.py,v 1.3 2007/11/03 17:52:40 ncq Exp $
# $Source: /sources/gnumed/gnumed/gnumed/client/doc/hook_script_example.py,v $
__version__ = "$Revision: 1.3 $"
__author__ = "K.Hilbert <Karsten.Hilbert@gmx.net>"
__license__ = "GPL (details at http://www.gnu.org)"
#from Gnumed.wxpython import gmGuiHelpers, gmPatSearchWidgets
#from Gnumed.business import gmPerson
#def on_startup_after_GUI_init():
# examine external patient sources
#gmPatSearchWidgets.load_patient_from_external_sources(search_immediately=False)
#def request_user_attention():
# signal user to look at GNUmed
#gmGuiHelpers.gm_show_info(_('Hey, GNUmed wants you to take a look at it !'))
#def on_app_activated_startup():
#pass
#def on_app_activated():
# might want to look at external sources again
#gmPatSearchWidgets.load_patient_from_external_sources(search_immediately=False)
#def on_post_patient_activation():
#def on_app_deactivated():
# might want to export the active patient into an xDT file
#curr_pat = gmPerson.gmCurrentPatient()
#if curr_pat.connected:
# enc = 'cp850' # FIXME: configurable
# fname = os.path.expanduser(os.path.join('~', 'gnumed', 'export', 'xDT', 'current-patient.gdt'))
# curr_pat.export_as_gdt(filename = fname, encoding = enc)
# main entry point
def run_script(hook=None):
if hook is None:
hook = _('no hook specified, please report bug')
print 'GNUmed invoked the hook [%s]' % hook
# a few examples:
#if hook == u'startup-after-GUI-init':
# on_startup_after_GUI_init()
#if hook == u'request_user_attention':
# on_request_user_attention()
#if hook == u'app_activated_startup':
# on_app_activated_startup()
#if hook == u'app_activated':
# on_app_activated()
#if hook == u'app_deactivated':
# on_app_deactivated()
#if hook == u'post_patient_activation':
# on_post_patient_activation()
return
#===========================================================================
# $Log: hook_script_example.py,v $
# Revision 1.3 2007/11/03 17:52:40 ncq
# - much enhanced with examples
#
# Revision 1.2 2007/03/26 15:04:24 ncq
# - better docs
#
# Revision 1.1 2007/02/19 16:23:08 ncq
# - better name
#
# Revision 1.1 2007/02/19 16:21:07 ncq
# - an example for the hooks framework
#
#
|