help.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:CodeReader 作者: jasonrbr 项目源码 文件源码
def OpenHelpFile(fileName, helpCmd = None, helpArg = None):
    "Open a help file, given a full path"
    # default help arg.
    win32ui.DoWaitCursor(1)
    try:
        if helpCmd is None: helpCmd = win32con.HELP_CONTENTS
        ext = os.path.splitext(fileName)[1].lower()
        if ext == ".hlp":
            win32api.WinHelp( win32ui.GetMainFrame().GetSafeHwnd(), fileName, helpCmd, helpArg)
        # XXX - using the htmlhelp API wreaks havoc with keyboard shortcuts
        # so we disable it, forcing ShellExecute, which works fine (but
        # doesn't close the help file when Pythonwin is closed.
        # Tom Heller also points out http://www.microsoft.com/mind/0499/faq/faq0499.asp,
        # which may or may not be related.
        elif 0 and ext == ".chm":
            import win32help
            global htmlhelp_handle
            helpCmd = html_help_command_translators.get(helpCmd, helpCmd)
            #frame = win32ui.GetMainFrame().GetSafeHwnd()
            frame = 0 # Dont want it overlapping ours!
            if htmlhelp_handle is None:
                htmlhelp_hwnd, htmlhelp_handle = win32help.HtmlHelp(frame, None, win32help.HH_INITIALIZE)
            win32help.HtmlHelp(frame, fileName, helpCmd, helpArg)
        else:
            # Hope that the extension is registered, and we know what to do!
            win32api.ShellExecute(0, "open", fileName, None, "", win32con.SW_SHOW)
        return fileName
    finally:
        win32ui.DoWaitCursor(-1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号