Package Gnumed :: Package pycommon :: Module gmHooks
[frames] | no frames]

Module gmHooks

source code

GNUmed hooks framework.

This module provides convenience functions and definitions
for accessing the GNUmed hooks framework.

This framework calls the script

        ~/.gnumed/scripts/hook_script.py

at various times during client execution. The script must
contain a function

def run_script(hook=None):
        pass

which accepts a single argument <hook>. That argument will
contain the hook that is being activated.


Author: K. Hilbert <Karsten.Hilbert@gmx.net>

License: GPL v2 or later (details at http://www.gnu.org)

Functions
 
setup_hook_dir() source code
 
import_hook_module(reimport=False) source code
 
run_hook_script(hook=None) source code
Variables
  known_hooks = ['post_patient_activation', 'post_person_creatio...
  README_pat_dir = """Directory for data files containing the cu...
  HOOK_SCRIPT_EXAMPLE = """#!/usr/bin/pyth...
  HOOK_SCRIPT_NAME = 'hook_script.py'
  HOOK_SCRIPT_DIR = os.path.expanduser(os.path.join('~', '.gnume...
  HOOK_SCRIPT_FULL_NAME = os.path.join(HOOK_SCRIPT_DIR, HOOK_SCR...
  README_hook_dir = """Directory for scripts called from hooks a...
  hook_module = None

Imports: os, sys, stat, logging, io, gmDispatcher, gmTools


Variables Details

known_hooks

Value:
['post_patient_activation', 'post_person_creation', 'after_waiting_lis\
t_modified', 'shutdown-post-GUI', 'startup-after-GUI-init', 'startup-b\
efore-GUI', 'request_user_attention', 'app_activated_startup', 'app_ac\
tivated', 'app_deactivated', 'after_substance_intake_modified', 'after\
_test_result_modified', 'after_soap_modified', 'after_code_link_modifi\
ed', 'after_new_doc_created', 'before_print_doc', 'before_fax_doc', 'b\
efore_mail_doc', 'before_print_doc_part', 'before_fax_doc_part', 'befo\
re_mail_doc_part', 'before_external_doc_access', 'db_maintenance_warni\
...

README_pat_dir

Value:
"""Directory for data files containing the current patient.

Whenever the patient is changed GNUmed will export
formatted demographics into files in this directory
for use by 3rd party software.

Currently exported formats:

...

HOOK_SCRIPT_EXAMPLE

Value:
"""#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
#=====================================================================\
======
#
# Example script to be run off GNUmed hooks.
#
...

HOOK_SCRIPT_DIR

Value:
os.path.expanduser(os.path.join('~', '.gnumed', 'scripts'))

HOOK_SCRIPT_FULL_NAME

Value:
os.path.join(HOOK_SCRIPT_DIR, HOOK_SCRIPT_NAME)

README_hook_dir

Value:
"""Directory for scripts called from hooks at client runtime.

Known hooks:

	%s

You can use <%s.example> as a script template.
""" %('\n\t'.join(known_hooks), HOOK_SCRIPT_NAME)