1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.html.HtmlHelpController:
==========================================================================================================================================
|phoenix_title| **wx.html.HtmlHelpController**
==========================================================================================================================================
This help controller provides an easy way of displaying HTML help in your application (see :ref:`HTML Sample <html sample>`, test example).
The help system is based on **books** (see :meth:`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 :ref:`wx.HelpController`, it is recommended that you use the enhanced capabilities of :ref:`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 :ref:`Help Files Format <help files format>`. The directory ``helpfiles`` in the :ref:`HTML Sample <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 <http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc>`_) also runs on other platforms using ``WINE`` (`http://www.winehq.org/ <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 <http://www.helpblocks.com>`_) can also create these files.
.. seealso:: BestHelpController, :ref:`wx.html.HtmlHelpFrame`, :ref:`wx.html.HtmlHelpDialog`, :ref:`wx.html.HtmlHelpWindow`, :ref:`wx.html.HtmlModalHelp`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>HtmlHelpController</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.html.HtmlHelpController_inheritance.png" alt="Inheritance diagram of HtmlHelpController" usemap="#dummy" class="inheritance"/></center>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.html.HtmlHelpController.html" title="wx.html.HtmlHelpController" alt="" coords="5,160,211,189"/> <area shape="rect" id="node2" href="wx.HelpControllerBase.html" title="wx.HelpControllerBase" alt="" coords="23,83,193,112"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="65,5,151,35"/> </map>
</p>
</div>
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.html.HtmlHelpController.__init__` Constructor.
:meth:`~wx.html.HtmlHelpController.AddBook` Adds a book (i.e.
:meth:`~wx.html.HtmlHelpController.CreateHelpDialog` This protected virtual method may be overridden so that when specifying the ``HF_DIALOG`` style, the controller uses a different dialog.
:meth:`~wx.html.HtmlHelpController.CreateHelpFrame` This protected virtual method may be overridden so that the controller uses a different frame.
:meth:`~wx.html.HtmlHelpController.Display` Displays page `x`.
:meth:`~wx.html.HtmlHelpController.DisplayContents` Displays help window and focuses contents panel.
:meth:`~wx.html.HtmlHelpController.DisplayIndex` Displays help window and focuses index panel.
:meth:`~wx.html.HtmlHelpController.GetDialog` Returns the current help dialog.
:meth:`~wx.html.HtmlHelpController.GetFrame` Returns the current help frame.
:meth:`~wx.html.HtmlHelpController.GetHelpWindow` Get the current help window.
:meth:`~wx.html.HtmlHelpController.KeywordSearch` Displays the help window, focuses search panel and starts searching.
:meth:`~wx.html.HtmlHelpController.ReadCustomization` Reads the controller's setting (position of window, etc.)
:meth:`~wx.html.HtmlHelpController.SetHelpWindow` Set the help window to be managed by this controller.
:meth:`~wx.html.HtmlHelpController.SetShouldPreventAppExit` Sets whether the help frame should prevent application from exiting if it's the only remaining top level window.
:meth:`~wx.html.HtmlHelpController.SetTempDir` Sets the path for storing temporary files - cached binary versions of index and contents files.
:meth:`~wx.html.HtmlHelpController.SetTitleFormat` Sets format of title of the frame.
:meth:`~wx.html.HtmlHelpController.UseConfig` Associates the `config` object with the controller.
:meth:`~wx.html.HtmlHelpController.WriteCustomization` Stores controllers setting (position of window etc.)
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.html.HtmlHelpController.Dialog` See :meth:`~wx.html.HtmlHelpController.GetDialog`
:attr:`~wx.html.HtmlHelpController.Frame` See :meth:`~wx.html.HtmlHelpController.GetFrame`
:attr:`~wx.html.HtmlHelpController.HelpWindow` See :meth:`~wx.html.HtmlHelpController.GetHelpWindow` and :meth:`~wx.html.HtmlHelpController.SetHelpWindow`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: 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).
.. method:: __init__(self, *args, **kw)
|overload| Overloaded Implementations:
:html:`<hr class="overloadsep" /><br />`
**__init__** `(self, style=HF_DEFAULT_STYLE, parentWindow=None)`
Constructor.
:param `style`: This is a combination of these flags:
- ``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 :ref:`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``
:type `style`: int
:param `parentWindow`: This is an optional window to be used as the parent for the help window.
:type `parentWindow`: wx.Window
:html:`<hr class="overloadsep" /><br />`
**__init__** `(self, parentWindow, style=HF_DEFAULT_STYLE)`
:param `parentWindow`:
:type `parentWindow`: wx.Window
:param `style`:
:type `style`: int
:html:`<hr class="overloadsep" /><br />`
.. method:: AddBook(self, *args, **kw)
|overload| Overloaded Implementations:
:html:`<hr class="overloadsep" /><br />`
**AddBook** `(self, bookFile, showWaitMsg=False)`
Adds a book (i.e.
a :ref:`.hhp file <.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.
:param `bookFile`: Help book filename. It is recommended to use this prototype instead of the one taking URL, because it is less error-prone.
:type `bookFile`: string
:param `showWaitMsg`: If ``True`` then a decoration-less window with progress message is displayed.
:type `showWaitMsg`: bool
:rtype: `bool`
:html:`<hr class="overloadsep" /><br />`
**AddBook** `(self, bookUrl, showWaitMsg=False)`
Adds a book (i.e.
a :ref:`.hhp file <.hhp file>`; an HTML Help Workshop project file) into the list of loaded books.
See the other overload for additional info.
:param `bookUrl`: Help book URL (note that syntax of filename and URL is different on most platforms).
:type `bookUrl`: string
:param `showWaitMsg`: If ``True`` then a decoration-less window with progress message is displayed.
:type `showWaitMsg`: bool
:rtype: `bool`
:html:`<hr class="overloadsep" /><br />`
.. method:: CreateHelpDialog(self, data)
This protected virtual method may be overridden so that when specifying the ``HF_DIALOG`` style, the controller uses a different dialog.
:param `data`:
:type `data`: wx.html.HtmlHelpData
:rtype: :ref:`wx.html.HtmlHelpDialog`
.. method:: CreateHelpFrame(self, data)
This protected virtual method may be overridden so that the controller uses a different frame.
:param `data`:
:type `data`: wx.html.HtmlHelpData
:rtype: :ref:`wx.html.HtmlHelpFrame`
.. method:: Display(self, *args, **kw)
|overload| Overloaded Implementations:
:html:`<hr class="overloadsep" /><br />`
**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:
- 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:
- try to locate file named x (if x is for example "doc/howto.htm")
- try to open starting page of book named x
- try to find x in contents (if x is for example "How To ...")
- try to find x in index (if x is for example "How To ...")
- switch to Search panel and start searching
:param `x`:
:type `x`: string
:rtype: `bool`
:html:`<hr class="overloadsep" /><br />`
**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.
:param `id`:
:type `id`: int
:rtype: `bool`
:html:`<hr class="overloadsep" /><br />`
.. method:: DisplayContents(self)
Displays help window and focuses contents panel.
:rtype: `bool`
.. method:: DisplayIndex(self)
Displays help window and focuses index panel.
:rtype: `bool`
.. method:: GetDialog(self)
Returns the current help dialog.
(May be ``None``.)
:rtype: :ref:`wx.html.HtmlHelpDialog`
.. method:: GetFrame(self)
Returns the current help frame.
(May be ``None``.)
:rtype: :ref:`wx.html.HtmlHelpFrame`
.. method:: GetHelpWindow(self)
Get the current help window.
:rtype: :ref:`wx.html.HtmlHelpWindow`
.. method:: 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`` ).
:param `keyword`:
:type `keyword`: string
:param `mode`:
:type `mode`: wx.HelpSearchMode
:rtype: `bool`
.. note::
:meth:`KeywordSearch` searches only pages listed in ``".hhc"`` file(s). You should list all pages in the contents file.
.. method:: ReadCustomization(self, cfg, path=EmptyString)
Reads the controller's setting (position of window, etc.)
:param `cfg`:
:type `cfg`: wx.ConfigBase
:param `path`:
:type `path`: string
.. method:: 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 :ref:`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.
:param `helpWindow`:
:type `helpWindow`: wx.html.HtmlHelpWindow
.. method:: SetShouldPreventAppExit(self, enable)
Sets whether the help frame should prevent application from exiting if it's the only remaining top level window.
:param `enable`: 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.
:type `enable`: bool
.. versionadded:: 2.9.2
.. seealso:: :meth:`wx.App.SetExitOnFrameDelete`
.. method:: 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.
:param `path`:
:type `path`: string
.. method:: SetTitleFormat(self, format)
Sets format of title of the frame.
Must contain exactly one "%s" (for title of displayed HTML page).
:param `format`:
:type `format`: string
.. method:: UseConfig(self, config, rootpath=EmptyString)
Associates the `config` object with the controller.
If there is associated config object, :ref:`wx.html.HtmlHelpController` automatically reads and writes settings (including :ref:`wx.html.HtmlWindow`'s settings) when needed. The only thing you must do is create Config object and call :meth:`UseConfig` .
If you do not use :meth:`UseConfig` , :ref:`wx.html.HtmlHelpController` will use the default Config object if available (for details see :meth:`wx.ConfigBase.Get` and :meth:`wx.ConfigBase.Set` ).
:param `config`:
:type `config`: wx.ConfigBase
:param `rootpath`:
:type `rootpath`: string
.. method:: WriteCustomization(self, cfg, path=EmptyString)
Stores controllers setting (position of window etc.)
:param `cfg`:
:type `cfg`: wx.ConfigBase
:param `path`:
:type `path`: string
.. attribute:: Dialog
See :meth:`~wx.html.HtmlHelpController.GetDialog`
.. attribute:: Frame
See :meth:`~wx.html.HtmlHelpController.GetFrame`
.. attribute:: HelpWindow
See :meth:`~wx.html.HtmlHelpController.GetHelpWindow` and :meth:`~wx.html.HtmlHelpController.SetHelpWindow`
|