예제 #1
0
def exit_on_error(traceback, fatal=False):
    # Note that nothing is being called on app.
    # This is because the __main__ file as a try/except/finally
    # and the finally called app.halt()
    # Since we are raising SystemExit, finally *WILL*
    # take place before the system quits. Therefore,
    # it is redundant (and dangerous since app.halt() closes files)
    # to call end twice. Therefore, when you raise SystemExit
    # app.halt() is called in the finally clause of the
    # __main__.py file
    alert = mtk.Ttk("alert win in CLS: HandleError")
    alert.title("Fatal Error")
    alertlabel = mtk.TLabel(alert,
                            text="Something went wrong and PyEdit needs to"
                                 "close.\nYou may lose unsaved changes."
                                 "\nWe Apologize for the inconvenience.")
    alerterror = mtk.TLabel(alert, text="\n\n{}\n\n".format(traceback))
    if fatal:
        alertbutton = mtk.Button(alert, text="Quit",
                                 command=pyedit_panic)
    else:
        alertbutton = mtk.Button(alert, text="Quit",
                                 command=alert.destroy)
    alertlabel.pack()
    alerterror.pack()
    alertbutton.pack()
    alert.mainloop()
예제 #2
0
def askForBugs(app):
    """Dependent on <app> argument being PyEdit. Not a good repurpose"""
    bug_report = mtk.Ttk("Bug Report")
    bug_report.protocol("WM_DELETE_WINDOW", lambda: quitWin(bug_report))
    bug_report.title("Submit a Bug")
    mtk.TLabel(bug_report, text="Enter a name: ").pack()
    name = mtk.Entry(bug_report)
    name.pack()
    mtk.TLabel(bug_report,
               text="Describe the steps to recreate the bug: ").pack()
    steps = mtk.Text(bug_report, width=40, height=10)
    steps.pack()
    mtk.TLabel(bug_report,
               text="Include any other additional"
                    "information that could help: ").pack()
    info = mtk.Text(bug_report, width=40, height=10)
    info.pack()
    qu = mtk.Button(bug_report, text="Next...",
                    command=lambda: askToSubmitBugs(name, steps, info, app,
                                                    bug_report))
    qu.pack()
    bug_report.mainloop()
예제 #3
0
def askToSubmitBugs(name, steps, info, app, br):
    br.quit()
    _name = name.get()
    _steps = steps.get(0.0, mtk.END)
    _info = info.get(0.0, mtk.END)
    br.destroy()
    error_report = writeBugReport(_name, _steps, _info, app)
    tosend = mtk.Ttk("To Send")
    tosend.title("Bug Report")
    mtk.TLabel(tosend,
               text="The following information will be submitted \n"
                    "(no personally identifiable information is sent) ").pack()
    a = mtk.Text(tosend, width=125, height=30)
    a.insert(0.0, error_report)
    a.pack()
    can = mtk.Button(tosend, text='Cancel', command=lambda: quitWin(tosend))
    can.pack()
    qu = mtk.Button(tosend, text="Go",
                    command=lambda: sendReport(error_report, tosend))
    qu.pack()
    tosend.mainloop()