wx.html.HtmlHelpController

Inheritance diagram for wx.html.HtmlHelpController:



Description

This help controller provides an easy way of displaying HTML help in your application.

The help system is based on books (see AddBook). A book is a logical section of documentation (for example “User’s Guide” or “Programmer’s Guide”). The help controller can handle as many books as you want.

Although this class has an API compatible with other wxPython help controllers as documented by wx.HelpController, it is recommended that you use the enhanced capabilities of wx.html.HtmlHelpController‘s API.

wxHTML uses Microsoft’s HTML Help Workshop project files (.hhp, .hhk, .hhc) as its native format.

The commercial tool HelpBlocks (http://www.helpblocks.com) can also create these files.

Derived From

Properties Summary

Class API

Methods

__init__(style=wx.html.HF_DEFAULT_STYLE, parentWindow=None)

Constructor.

Parameters:

  • style (int): A combination of the following flags:

    Style Flag

    Description

    wx.html.HF_TOOLBAR

    The help window has a toolbar.

    wx.html.HF_FLAT_TOOLBAR

    The help window has a toolbar with flat buttons (aka coolbar).

    wx.html.HF_CONTENTS

    The help window has a contents panel.

    wx.html.HF_INDEX

    The help window has an index panel.

    wx.html.HF_SEARCH

    The help window has a search panel.

    wx.html.HF_BOOKMARKS

    The help window has bookmarks controls.

    wx.html.HF_OPEN_FILES

    Allows user to open arbitrary HTML document.

    wx.html.HF_PRINT

    The toolbar contains “print” button.

    wx.html.HF_MERGE_BOOKS

    The contents pane does not show book nodes. All books are merged together and appear as single book to the user.

    wx.html.HF_ICONS_BOOK

    All nodes in contents pane have a book icon. This is how Microsoft’s HTML help viewer behaves.

    wx.html.HF_ICONS_FOLDER

    Book nodes in contents pane have a book icon, book’s sections have a folder icon. This is the default.

    wx.html.HF_ICONS_BOOK_CHAPTER

    Both book nodes and nodes of top-level sections of a book (i.e. chapters) have a book icon, all other sections (sections, subsections, ...) have a folder icon.

    wx.html.HF_EMBEDDED

    Specifies that the help controller controls an embedded window of class wx.html.HtmlHelpWindow that should not be destroyed when the controller is destroyed.

    wx.html.HF_DIALOG

    Specifies that the help controller should create a dialog containing the help window.

    wx.html.HF_FRAME

    Specifies that the help controller should create a frame containing the help window. This is the default if neither wx.html.HF_DIALOG nor wx.html.HF_EMBEDDED is specified.

    wx.html.HF_MODAL

    Specifies that the help controller should create a modal dialog containing the help window (used with the wx.html.HF_DIALOG style).

    wx.html.HF_DEFAULT_STYLE

    wx.html.HF_TOOLBAR | wx.html.HF_CONTENTS | wx.html.HF_INDEX | wx.html.HF_SEARCH | wx.html.HF_BOOKMARKS | wx.html.HF_PRINT.


  • parentWindow (wx.Window): is an optional window to be used as the parent for the help window.

Returns:

wx.html.HtmlHelpController


AddBook(book, show_wait_msg=False)

Adds book (.hhp file – HTML Help Workshop project file) into the list of loaded books. This must be called at least once before displaying any help.

book may be either .hhp file or ZIP archive that contains arbitrary number of .hhp files in top-level directory. This ZIP archive must have .zip or .htb extension (the latter stands for “HTML book”). In other words, AddBook(“help.zip”) is possible and is the recommended way.

Parameters:

  • book (string): Help book filename.
  • show_wait_msg: If True then a decoration-less window with progress message is displayed.

Returns:

bool


Display(x)

Displays page x. This is THE important function - it is used to display the help in application.

You can specify the page in many ways:

  • as direct filename of HTML document
  • as chapter name (from contents) or as a book name
  • as some word from index
  • even as any word (will be searched)

Looking for the page runs in these steps:

  1. Try to locate file named x (if x is for example “doc/howto.htm”)
  2. Try to open starting page of book named x
  3. Try to find x in contents (if x is for example “How To ...”)
  4. Try to find x in index (if x is for example “How To ...”)
  5. Switch to search panel and start searching

Parameters:

  • x (string)

DisplayContents()
Displays help window and focuses contents panel.

DisplayID(id)

Search help contents by numeric Id.

See Display for an explanation of how the display search works.

Parameters:

  • id (int)

See also

Display


DisplayIndex()
Displays help window and focuses index panel.

FindTopLevelWindow()
No docstrings available for this method.

GetDialog()
No docstrings available for this method.

GetFrame()
No docstrings available for this method.

GetHelpWindow()
No docstrings available for this method.

KeywordSearch(keyword, mode=wx.html.HELP_SEARCH_ALL)

Displays help window, focuses search panel and starts searching.

Returns True if the keyword was found. Optionally it searches through the index (mode = wx.html.HELP_SEARCH_INDEX), default the content (mode = wx.html.HELP_SEARCH_ALL).

Parameters:

  • keyword (string)
  • mode (int)

Returns:

bool

Important

KeywordSearch searches only pages listed in .hhc file(s). You should list all pages in the contents file.


MakeModalIfNeeded()
No docstrings available for this method.

ReadCustomization(cfg, path="")

Reads the controller’s setting (position of window, etc...).

Parameters:


SetHelpWindow(helpWindow)

Parameters:


SetTempDir(path)

Sets the path for storing temporary files – cached binary versions of index and contents files. These binary forms are much faster to read.

Default value is empty string (empty string means that no cached data are stored). Note that these files are not deleted when program exits.

Once created these cached files will be used in all subsequent executions of your application. If cached files become older than corresponding .hhp file (e.g. if you regenerate documentation) it will be refreshed.

Parameters:

  • path (string)

SetTitleFormat(format)

Sets format of title of the frame. Must contain exactly one “%s” (for title of displayed HTML page).

Parameters:

  • format (string)

UseConfig(config, rootpath="")

Associates config object with the controller.

If there is associated config object, wx.html.HtmlHelpController automatically reads and writes settings (including wx.html.HtmlWindow‘s settings) when needed.

The only thing you must do is create wx.Config object and call UseConfig.

If you do not use UseConfig, wx.html.HtmlHelpController will use default wx.Config object if available (for details see wx.ConfigBase.Get and wx.ConfigBase.Set).

Parameters:


WriteCustomization(cfg, path="")

Stores controllers setting (position of window etc...).

Parameters:


Properties

Dialog
See GetDialog
Frame
See GetFrame
HelpWindow
See GetHelpWindow and SetHelpWindow