1
#------------------------------------------------------------------------------
3
# Copyright (c) 2005, Enthought, Inc.
6
# This software is provided without warranty under the terms of the BSD
7
# license included in enthought/LICENSE.txt and may be redistributed only
8
# under the conditions described in the aforementioned license. The license
9
# is also available online at http://www.enthought.com/licenses/BSD.txt
11
# Thanks for using Enthought open source!
13
# Author: David C. Morrill
16
#------------------------------------------------------------------------------
18
""" Defines the help interface for displaying the help associated with a
19
Traits UI View object.
22
#-------------------------------------------------------------------------------
24
#-------------------------------------------------------------------------------
26
from __future__ import absolute_import
28
from .toolkit import toolkit
30
#-------------------------------------------------------------------------------
31
# Default handler for showing the help associated with a view:
32
#-------------------------------------------------------------------------------
34
def default_show_help ( info, control ):
35
""" Default handler for showing the help associated with a view.
37
toolkit().show_help( info.ui, control )
39
# The default handler for showing help
40
show_help = default_show_help
42
#-------------------------------------------------------------------------------
43
# Allows an application to change the default show help handler:
44
#-------------------------------------------------------------------------------
46
def on_help_call ( new_show_help = None ):
47
""" Sets a new global help provider function.
51
new_show_help : function
52
The function to set as the new global help provider
56
The previous global help provider function
60
The help provider function must have a signature of
61
*function*(*info*, *control*), where *info* is a UIInfo object for the
62
current view, and *control* is the UI control that invokes the function
63
(typically, a **Help** button). It is provided in case the help provider
64
needs to position the help window relative to the **Help** button.
66
To retrieve the current help provider function, call this function with
72
if new_show_help is not None:
73
show_help = new_show_help