[wingide-users] How to use ActiveState's Python HTMLHelp file with
Wing IDE
Dan Roger
wingusr at gmail.com
Tue Mar 10 07:22:50 MDT 2009
Since I'm having trouble getting auto-completion and the Source Assistant
to reliably work in Wing IDE Pro 3.1.7-1, I made a minor mod to
Brandon Corfman's hack to add context-sensitive help to Komodo
(http://mysite.verizon.net/bcorfman/labels/hacks.html) so it
would work as a WingIDE script instead:
def _showHTMLHelpPage(keywords):
import sys
oldSysPath = sys.path
sys.path.append("C:/Python25/Lib/site-packages/win32")
import win32help
# Restore sys.path in case messing with it is a bad idea?
sys.path = oldSysPath
win32help.HtmlHelp(0, None, win32help.HH_INITIALIZE, None)
link = win32help.HH_AKLINK()
link.indexOnFail = 1
link.keywords = keywords
link.url = ""
link.msgText = ""
link.msgTitle = ""
link.window = ""
win32help.HtmlHelp(0, "C:/Python25/Doc/ActivePython25.chm",
win32help.HH_KEYWORD_LOOKUP, link)
def showActiveStatePythonHelp():
editor = wingApp.GetActiveEditor()
doc = editor.GetDocument()
start, end = editor.GetSelection()
txt = doc.GetCharRange(start, end)
_showHTMLHelpPage(txt)
After you bind showActiveStatePythonHelp to, say, Ctrl+H, selecting
logging and then pressing Ctrl+H will open ActiveState's compiled help
file for Python to the logging module's documentation.
Depending on the selection, you'll either get right to the page, be
given a list of choices in a popup menu, or find yourself in the index
pane at its closest match.
More information about the wingide-users
mailing list