[PythonReports-checkins] PythonReports/PythonReports design.py, 1.8, 1.9
Brought to you by:
a1s
From: alexander s. <a1...@us...> - 2006-11-04 14:56:17
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5704 Modified Files: design.py Log Message: capture report preview errors; print traceback on the console when showing error message; use Tk backend for report building Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** design.py 3 Nov 2006 17:32:21 -0000 1.8 --- design.py 4 Nov 2006 14:56:15 -0000 1.9 *************** *** 2,5 **** --- 2,8 ---- """History (most recent first): + 04-nov-2006 [als] capture report preview errors; + print traceback on the console when showing error message; + use Tk backend for report building 03-nov-2006 [als] fix IntegerSelection: mega widget has no .select_range() 03-nov-2006 [als] disable drawing canvas; *************** *** 38,41 **** --- 41,45 ---- import os import sys + import traceback from Tix import * *************** *** 762,765 **** --- 766,771 ---- # not sure what it will be on other platforms # (Gentoo Linux makes it Courier); try Courer + # FIXME: it is possible to look for monospaced + # font family names in tkFont.families(). self.shell = Shell(self.vp, borderwidth=2, relief=SUNKEN, width=80, height=20, font=("Courier", self.base_font[1])) *************** *** 1246,1254 **** self.report = prt.load(filename) except Exception, _err: _focus = self.focus_get() or self.tree.hlist Message(self, icon="error", type="ok", title=self._("File load error"), ! message=self._("Error loading file %(file)s:\n%(error)s") ! % {"file": os.path.abspath(filename), "error": _err}).show() # FIXME: still unfocused... _focus.focus_set() --- 1252,1263 ---- self.report = prt.load(filename) except Exception, _err: + traceback.print_exc() _focus = self.focus_get() or self.tree.hlist Message(self, icon="error", type="ok", title=self._("File load error"), ! message=self._("Error loading file %(file)s:\n%(error)s") % { ! "file": os.path.abspath(filename), ! "error": str(_err) or _err.__class__.__name__, ! }).show() # FIXME: still unfocused... _focus.focus_set() *************** *** 1420,1424 **** _focus.focus_set() # build printout tree ! _printout = Builder(self.report).run(_data) # printout must be validated before it can be displayed self._validate(_printout, prp.Printout) --- 1429,1435 ---- _focus.focus_set() # build printout tree ! # Note: it is best to use same backend for both building and rendering. ! # since we'll surely use Tk renderer, use Tk backend for builder too. ! _printout = Builder(self.report, text_backend="Tk").run(_data) # printout must be validated before it can be displayed self._validate(_printout, prp.Printout) *************** *** 1435,1443 **** def preview(self): """Show Report Preview for current template""" try: ! self["cursor"] = "watch" ! self._run_preview() ! finally: ! self["cursor"] = "" def run(argv=sys.argv): --- 1446,1463 ---- def preview(self): """Show Report Preview for current template""" + _focus = self.focus_get() or self.tree.hlist try: ! try: ! self["cursor"] = "watch" ! self._run_preview() ! finally: ! self["cursor"] = "" ! except Exception, _err: ! traceback.print_exc() ! Message(self, icon="error", type="ok", ! title=self._("Report preview error"), ! message=self._("Error running report preview:\n%s") ! % (str(_err) or _err.__class__.__name__)).show() ! _focus.focus_set() def run(argv=sys.argv): |