This help controller provides an easy way of displaying HTML help in your application (see HTML Sample, test example).
The help system is based on books (see wx.html.HtmlHelpController.AddBook
). A book is a logical section of documentation (for example “User’s Guide” or “Programmer’s Guide” or “C++ Reference” or “wxWidgets Reference”). The help controller can handle as many books as you want.
Although this class has an API compatible with other wxWidgets help controllers as documented by HelpController , it is recommended that you use the enhanced capabilities of wx.html.HtmlHelpController‘s API.
HTML uses Microsoft’s HTML Help Workshop project files (.hhp, .hhk, .hhc) as its native format. The file format is described in Help Files Format. The directory helpfiles
in the HTML Sample contains sample project files.
Note that the Microsoft’s HTML Help Workshop (http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc) also runs on other platforms using WINE
(http://www.winehq.org/) and it can be used to create the .hpp, .hhk and .hhc files through a friendly GUI. The commercial tool HelpBlocks (http://www.helpblocks.com) can also create these files.
See also
BestHelpController, wx.html.HtmlHelpFrame, wx.html.HtmlHelpDialog, wx.html.HtmlHelpWindow, wx.html.HtmlModalHelp
__init__ |
Constructor. |
AddBook |
Adds a book (i.e. |
CreateHelpDialog |
This protected virtual method may be overridden so that when specifying the HF_DIALOG style, the controller uses a different dialog. |
CreateHelpFrame |
This protected virtual method may be overridden so that the controller uses a different frame. |
Display |
Displays page x. |
DisplayContents |
Displays help window and focuses contents panel. |
DisplayIndex |
Displays help window and focuses index panel. |
GetDialog |
Returns the current help dialog. |
GetFrame |
Returns the current help frame. |
GetHelpWindow |
Get the current help window. |
KeywordSearch |
Displays the help window, focuses search panel and starts searching. |
ReadCustomization |
Reads the controller’s setting (position of window, etc.) |
SetHelpWindow |
Set the help window to be managed by this controller. |
SetShouldPreventAppExit |
Sets whether the help frame should prevent application from exiting if it’s the only remaining top level window. |
SetTempDir |
Sets the path for storing temporary files - cached binary versions of index and contents files. |
SetTitleFormat |
Sets format of title of the frame. |
UseConfig |
Associates the config object with the controller. |
WriteCustomization |
Stores controllers setting (position of window etc.) |
Dialog |
See GetDialog |
Frame |
See GetFrame |
HelpWindow |
See GetHelpWindow and SetHelpWindow |
wx.html.
HtmlHelpController
(HelpControllerBase)¶Possible constructors:
HtmlHelpController(style=HF_DEFAULT_STYLE, parentWindow=None)
HtmlHelpController(parentWindow, style=HF_DEFAULT_STYLE)
This help controller provides an easy way of displaying HTML help in your application (see HTML Sample, test example).
__init__
(self, *args, **kw)¶__init__ (self, style=HF_DEFAULT_STYLE, parentWindow=None)
Constructor.
Parameters: |
|
---|
__init__ (self, parentWindow, style=HF_DEFAULT_STYLE)
Parameters: |
|
---|
AddBook
(self, *args, **kw)¶AddBook (self, bookFile, showWaitMsg=False)
Adds a book (i.e.
a .hhp file; an HTML Help Workshop project file) into the list of loaded books.
This must be called at least once before displaying any help. bookFile or bookUrl may be either ".hhp"
file or a ZIP
archive that contains an arbitrary number of ".hhp"
files in its 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: |
|
---|---|
Return type: | bool |
AddBook (self, bookUrl, showWaitMsg=False)
Adds a book (i.e.
a .hhp file; an HTML Help Workshop project file) into the list of loaded books.
See the other overload for additional info.
Parameters: |
|
---|---|
Return type: | bool |
CreateHelpDialog
(self, data)¶This protected virtual method may be overridden so that when specifying the HF_DIALOG
style, the controller uses a different dialog.
Parameters: | data (wx.html.HtmlHelpData) – |
---|---|
Return type: | wx.html.HtmlHelpDialog |
CreateHelpFrame
(self, data)¶This protected virtual method may be overridden so that the controller uses a different frame.
Parameters: | data (wx.html.HtmlHelpData) – |
---|---|
Return type: | wx.html.HtmlHelpFrame |
Display
(self, *args, **kw)¶Display (self, 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:
Looking for the page runs in these steps:
Parameters: | x (string) – |
---|---|
Return type: | bool |
Display (self, id)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Parameters: | id (int) – |
---|---|
Return type: | bool |
DisplayContents
(self)¶Displays help window and focuses contents panel.
Return type: | bool |
---|
DisplayIndex
(self)¶Displays help window and focuses index panel.
Return type: | bool |
---|
GetDialog
(self)¶Returns the current help dialog.
(May be None
.)
Return type: | wx.html.HtmlHelpDialog |
---|
GetFrame
(self)¶Returns the current help frame.
(May be None
.)
Return type: | wx.html.HtmlHelpFrame |
---|
GetHelpWindow
(self)¶Get the current help window.
Return type: | wx.html.HtmlHelpWindow |
---|
KeywordSearch
(self, keyword, mode=HELP_SEARCH_ALL)¶Displays the help window, focuses search panel and starts searching.
Returns True
if the keyword was found. Optionally it searches through the index (mode = HELP_SEARCH_INDEX
), default the content (mode = HELP_SEARCH_ALL
).
Parameters: |
|
---|---|
Return type: | bool |
Note
KeywordSearch
searches only pages listed in ".hhc"
file(s). You should list all pages in the contents file.
ReadCustomization
(self, cfg, path="")¶Reads the controller’s setting (position of window, etc.)
Parameters: |
|
---|
SetHelpWindow
(self, helpWindow)¶Set the help window to be managed by this controller.
This makes it possible to have a help window that might not be in a wx.html.HtmlHelpFrame or dialog but is embedded in some other window in the application. Be sure to use the wx.html.HF_EMBEDDED
style in this case.
Parameters: | helpWindow (wx.html.HtmlHelpWindow) – |
---|
SetShouldPreventAppExit
(self, enable)¶Sets whether the help frame should prevent application from exiting if it’s the only remaining top level window.
Parameters: | enable (bool) – If True , the application will not quit unless the help frame is closed. Default is False , i.e. the application does exit if only the help window remains opened. |
---|
New in version 2.9.2.
See also
SetTempDir
(self, 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
(self, format)¶Sets format of title of the frame.
Must contain exactly one “%s” (for title of displayed HTML page).
Parameters: | format (string) – |
---|
UseConfig
(self, config, rootpath="")¶Associates the 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 Config object and call UseConfig
.
If you do not use UseConfig
, wx.html.HtmlHelpController will use the default Config object if available (for details see wx.ConfigBase.Get
and wx.ConfigBase.Set
).
Parameters: |
|
---|
WriteCustomization
(self, cfg, path="")¶Stores controllers setting (position of window etc.)
Parameters: |
|
---|
HelpWindow
¶See GetHelpWindow
and SetHelpWindow