[Zope-Checkins] CVS: Zope3/utilities - unittestgui.py:1.1.2.5
Fred Drake Jr
fdrake@acm.org
Mon, 3 Dec 2001 15:51:20 -0500
Update of /cvs-repository/Zope3/utilities
In directory cvs.zope.org:/tmp/cvs-serv4405/utilities
Modified Files:
Tag: Zope-3x-branch
unittestgui.py
Log Message:
Change the error traceback display to make it easier to select the traceback
so it can be pasted into email, and to make the dialog easier to dismiss
(just tap the spacebar). This has been submitted to the PyUnit project on
SourceForge as well:
http://sourceforge.net/tracker/index.php?func=detail&aid=488576&group_id=3912&atid=303912
=== Zope3/utilities/unittestgui.py 1.1.2.4 => 1.1.2.5 ===
import linecache
import unittest
+import ScrolledText
import sys
import Tkinter
import tkMessageBox
@@ -377,9 +378,18 @@
foreground="red", justify=tk.LEFT).pack(anchor=tk.W)
tracebackLines = apply(traceback.format_exception, error + (10,))
tracebackText = string.join(tracebackLines,'')
- tk.Label(window, text=tracebackText, justify=tk.LEFT).pack()
- tk.Button(window, text="Close",
- command=window.quit).pack(side=tk.BOTTOM)
+ text = ScrolledText.ScrolledText(window)
+ text.tag_config('sel', relief=tk.FLAT)
+ text.insert(tk.END, tracebackText)
+ if len(tracebackLines) < 20:
+ text.config(height=len(tracebackLines) + 5)
+ text.yview_pickplace(tk.END)
+ text['state'] = tk.DISABLED
+ text.pack(expand=1, fill=tk.BOTH)
+ b = tk.Button(window, text="Close",
+ command=window.quit)
+ b.pack(side=tk.BOTTOM)
+ b.focus_set()
window.bind('<Key-Return>', lambda e, w=window: w.quit())
window.mainloop()
window.destroy()