Пример #1
0
def help_html(app, document, dir_, top=None):
    global help_html_viewer, help_html_index
    if not document:
        return None
    if top is None:
        top = app.top
    try:
        doc = app.dataloader.findFile(document, dir_)
        if help_html_index is None:
            document, dir_ = "index.html", "html"
            help_html_index = app.dataloader.findFile(document, dir_)
    except EnvironmentError:
        MfxMessageDialog(app.top,
                         title=TITLE + _(" HTML Problem"),
                         text=_("Cannot find help document\n") + document,
                         bitmap="warning")
        return None
    # print doc, help_html_index
    try:
        viewer = help_html_viewer
        # if viewer.parent.winfo_parent() != top._w:
        #    viewer.destroy()
        #    viewer = None
        viewer.updateHistoryXYView()
        viewer.display(doc, relpath=0)
    except Exception:
        # traceback.print_exc()
        top = make_help_toplevel(app, title=TITLE + _(" Help"))
        if top.winfo_screenwidth() < 800 or top.winfo_screenheight() < 600:
            # maximized = 1
            top.wm_minsize(300, 150)
        else:
            # maximized = 0
            top.wm_minsize(400, 200)
        viewer = HTMLViewer(top, app, help_html_index)
        viewer.display(doc)
    # wm_map(top, maximized=maximized)
    viewer.parent.wm_deiconify()
    viewer.parent.tkraise()
    help_html_viewer = viewer
    return viewer
Пример #2
0
def help_html(app, document, dir_, top=None):
    global help_html_viewer, help_html_index
    if not document:
        return None
    if top is None:
        top = app.top
    try:
        doc = app.dataloader.findFile(document, dir_)
        if help_html_index is None:
            document, dir_ = "index.html", "html"
            help_html_index = app.dataloader.findFile(document, dir_)
    except EnvironmentError:
        MfxMessageDialog(app.top, title=TITLE + _(" HTML Problem"),
                         text=_("Cannot find help document\n") + document,
                         bitmap="warning")
        return None
    # print doc, help_html_index
    try:
        viewer = help_html_viewer
        # if viewer.parent.winfo_parent() != top._w:
        #    viewer.destroy()
        #    viewer = None
        viewer.updateHistoryXYView()
        viewer.display(doc, relpath=0)
    except Exception:
        # traceback.print_exc()
        top = make_help_toplevel(app, title=TITLE+_(" Help"))
        if top.winfo_screenwidth() < 800 or top.winfo_screenheight() < 600:
            # maximized = 1
            top.wm_minsize(300, 150)
        else:
            # maximized = 0
            top.wm_minsize(400, 200)
        viewer = HTMLViewer(top, app, help_html_index)
        viewer.display(doc)
    # wm_map(top, maximized=maximized)
    viewer.parent.wm_deiconify()
    viewer.parent.tkraise()
    help_html_viewer = viewer
    return viewer