Customizing GNUmed client startup and shutdown
There are several built-in hooks for customization of the startup/shutdown process. this is over and above any custom shell scripts/batch files by which to launch the client, and/or hacking of the Python source code itself to achieve any needed behaviour.
Startup
shell command line
The GNUmed client accepts a few command line options. They are documented in the
man page. The options are passed to the
/usr/bin/gnumed
launcher shell script and eventually to the
gnumed.py
Python launcher script.
In particular, it may be convenient to use
--conf-file
to specify the use of a config file other than what GNUmed would have used by default. This is addressed further in
GmManualConfigFiles.
launcher shell script: /usr/bin/gnumed
The client is usually launched with the
/usr/bin/gnumed
shell script which is included in the release tarball. This script looks for
-
/etc/gnumed/gnumed-startup-local.sh
- can be used for site-wide "local" customization
-
~/.gnumed/scripts/gnumed-startup-local.sh
- can be used for user-specific customization
and executes them (in that order) if they exist. Both scripts can do anything the user launching
/usr/bin/gnumed
can do (unless they are setuid-root). GNUmed as a project will never overwrite those files (but your package manager may decide to provide an updated
/etc/gnumed/gnumed-startup-local.sh
from time to time).
launcher Python script: gnumed.py
When this script has been called the client as such is running. During startup, two
hooks provide for customization:
- hook
startup-before-GUI
- this is called before the wxPython GUI is initialized
- hook
startup-post-GUI-init
- this is called after the wxPython GUI has been initialized but before flow control is handed to user input
Among other things, connecting to the backend
(which can be customized as well) happens between those two hooks.
other customization of client startup (plugins, workplaces)
Additional configuration can include the selection of plugins that are to be loaded into the GNumed toolbar, and their order. This is treated further in
WorkPlaces.
widget loading: Gnumed/wxGladeWidgets/
The GNUmed client launcher code
gnumed.py
checks for the directory
~/.gnumed/local_code/CLIENT_BRANCH/Gnumed/wxGladeWidgets
. If it exists it will be made available for importing whenever GNUmed imports code from package
Gnumed.wxGladeWidgets
. Several conditions must be met:
- permissions of
~/.gnumed/local_code/CLIENT_BRANCH/Gnumed/wxGladeWidgets
must be 0700
(rwx------
)
- no files or directories other than
wxGladeWidgets
, __init__.py
, and __init__.pyc
may exist within ~/.gnumed/local_code/CLIENT_BRANCH/Gnumed/
- (empty)
__init__.py
files must exist in ~/.gnumed/local_code/CLIENT_BRANCH/Gnumed/
and ~/.gnumed/local_code/CLIENT_BRANCH/Gnumed/wxGladeWidgets/
The
CLIENT_BRANCH
part is to be replaced with the branch in which one wants to override wxGlade widgets because code may need to be different between branches.
Shutdown
During shutdown the hook
shutdown-post-GUI
is called when the wxPython GUI has been closed.