pythonreports-checkins Mailing List for PythonReports (Page 7)
Brought to you by:
a1s
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(45) |
Dec
(56) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(6) |
2009 |
Jan
|
Feb
|
Mar
(5) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
(10) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(1) |
Nov
(3) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
(10) |
Apr
|
May
(18) |
Jun
(6) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: alexander s. <a1...@us...> - 2006-11-04 14:24:03
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26974 Modified Files: drivers.py Log Message: added text driver backend "Tk"; have different backend lists for texts and images Index: drivers.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/drivers.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** drivers.py 3 Nov 2006 17:52:24 -0000 1.4 --- drivers.py 4 Nov 2006 14:24:01 -0000 1.5 *************** *** 6,9 **** --- 6,11 ---- """ """History (most recent first): + 04-nov-2006 [als] added text driver backend "Tk"; + have different backend lists for texts and images 03-nov-2006 [als] fix image drivers loading (broken in revision 1.3) 01-nov-2006 [als] get_driver won't fail if no image driver found *************** *** 56,66 **** # then we can get through without image driver. _driver = _image_drivers[None] = ImageDriver else: _driver = None # NOTE backend preference: ! # RL (ReportLab) is best for texts # PIL is best for images (ReportLab image handling uses PIL too) ! # wx can handle both, but with serious drawbacks. ! for _backend in ("wx", "PIL", "RL"): # most preferred last _vars = {} try: --- 58,72 ---- # then we can get through without image driver. _driver = _image_drivers[None] = ImageDriver + # most preferred backend goes last + _backends = ("wx", "PIL") else: _driver = None + _backends = ("Tk", "wx", "PIL", "RL") # NOTE backend preference: ! # RL (ReportLab) is best for texts, no image support # PIL is best for images (ReportLab image handling uses PIL too) ! # wx can handle both but has serious drawbacks ! # Tk has no image support, does not need 3rd party modules ! for _backend in _backends: _vars = {} try: |
From: alexander s. <a1...@us...> - 2006-11-04 14:18:54
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25141 Added Files: TkDrivers.py Log Message: Rendering utilities for Tkinter backend --- NEW FILE: TkDrivers.py --- """Rendering utilities for Tkinter backend This module contains no image driver: Tkinter does not provide sufficient image functionality. """ """History (most recent first): 04-nov-2006 [als] created """ __version__ = "$Revision: 1.1 $"[11:-2] __date__ = "$Date: 2006/11/04 14:18:45 $"[7:-2] __all__ = ["TextDriver"] import math import tkFont from PythonReports import drivers class TextDriver(drivers.TextDriver): """Text processing driver The driver is instantiated once for each report font and handles all texts printed out with that font. """ backend = "Tk" def __init__(self, font): """Create text driver instance Parameters: font: report font definition (element instance) """ super(TextDriver, self).__init__(font) self._font = self._get_font(font) self.height = self._font["size"] # Tk fonts measure everything in pixels. we need points. self._pointsize = self._font._root.winfo_fpixels("1p") # convert linespace to points. self._linespace = self._font.metrics("linespace") / self._pointsize self.leading = int(math.ceil(self._linespace - self.height)) @staticmethod def _get_font(font): """Return tkFont.Font for given template/printout font element""" _attrs = { "family": font.get("typeface"), "size": font.get("size"), "weight": "normal", "slant": "roman", "underline": False, } for (_prop, _attr, _value) in ( ("bold", "weight", "bold"), ("italic", "style", "italic"), ("underline", "underline", True), ): if font.get(_prop, False): _attrs[_attr] = _value return tkFont.Font(**_attrs) def getsize(self, text): """Return size tuple (width, height) for given text""" _lines = text.split("\n") _height = int(math.ceil(self._linespace)) * len(_lines) - self.leading _width = int(math.ceil( max([self._font.measure(_line) for _line in _lines]) / self._pointsize)) return (_width, _height) # vim: set et sts=4 sw=4 : |
From: alexander s. <a1...@us...> - 2006-11-04 07:20:26
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5166 Modified Files: setup.py Log Message: added maintainer_email and download_url; name the license and platform in addition to classifiers Index: setup.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/setup.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** setup.py 3 Nov 2006 19:49:45 -0000 1.2 --- setup.py 4 Nov 2006 07:20:18 -0000 1.3 *************** *** 3,6 **** --- 3,8 ---- # FIXME! generate_docs() must be reimplemented as a distutils command """History: + 04-nov-2006 [als] added maintainer_email and download_url; + name the license and platform in addition to classifiers 03-nov-2006 [als] read version number from the package sources; generate htmls automatically (skip if no docutils); *************** *** 88,95 **** version=get_version(), url="http://pythonreports.sourceforge.net/", description="Database report generator", long_description=DESCRIPTION, author="alexander smishlajev", ! author_email="al...@ty...", classifiers=[ "Development Status :: 3 - Alpha", --- 90,103 ---- version=get_version(), url="http://pythonreports.sourceforge.net/", + download_url= + "http://sourceforge.net/project/showfiles.php?group_id=181233", description="Database report generator", long_description=DESCRIPTION, author="alexander smishlajev", ! author_email="al...@Ty...", ! # XXX maintainer_email always overwrites author_email. ! # (good thing too, but PyPI has two slots, and i'd like to ! # have both filled.) ! maintainer_email="pyt...@li...", classifiers=[ "Development Status :: 3 - Alpha", *************** *** 104,107 **** --- 112,122 ---- "Topic :: Printing", ], + # cheeseshop says "you should enter a full description here + # only if appropriate classifiers aren't available", but + # if license and platforms settings are not present, + # they are filled with word "UNKNOWN" in PKG-INFO and PyPI + # registration. + license="MIT License", + platforms=["OS Independent"], packages=["PythonReports"], scripts=SCRIPTS, |
From: alexander s. <a1...@us...> - 2006-11-03 19:49:47
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17410 Modified Files: setup.py Log Message: read version number from the package sources; generate htmls automatically (skip if no docutils); added docs, scripts and package metadata Index: setup.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/setup.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup.py 1 Nov 2006 11:28:32 -0000 1.1 --- setup.py 3 Nov 2006 19:49:45 -0000 1.2 *************** *** 1,5 **** --- 1,9 ---- """PythonReports setup script""" + # FIXME! generate_docs() must be reimplemented as a distutils command """History: + 03-nov-2006 [als] read version number from the package sources; + generate htmls automatically (skip if no docutils); + added docs, scripts and package metadata 03-oct-2006 [als] created """ *************** *** 9,20 **** from distutils.core import setup ! setup(name="PythonReports", ! version="0.0.1", ! description="Database report generator", ! author="alexander smishlajev", ! author_email="al...@ty...", ! packages=["PythonReports"], ! ) # vim: set et sts=4 sw=4 : --- 13,115 ---- from distutils.core import setup + import glob + import os ! try: ! from docutils.core import publish_cmdline ! except ImportError: ! publish_cmdline = None ! ! if os.name == "nt": ! DOC_DIR = "Lib\\site-packages\\PythonReports\\doc" ! SCRIPTS=["scripts/prd", "scripts/prd.bat"] ! else: ! DOC_DIR = "share/PythonReports/doc" ! SCRIPTS=["scripts/prd"] ! ! DESCRIPTION = """\ ! PythonReports is a toolkit aimed to build database reports ! in Python programs. The toolkit includes report template ! designer, report builder and several printout renderers ! for GUI and graphic file output. ! ! Report builder applies a template to a sequence of uniform ! data objects and produces a printout structure that can be ! saved to file and/or rendered by one of the front-end drivers ! to screen, printer, PDF etc. ! ! """ ! ! def get_version(): ! """Return package version string""" ! # don't use import to avoid fiddling with sys.path ! # and leaving behind compiled module file ! _vars = {} ! exec file("PythonReports/version.py") in _vars ! return _vars["__version__"] ! ! def rst2html(source, target, force=False): ! """Generate HTML document from RST source ! ! Parameters: ! source: source (rst) file name ! target: target (html) file name ! force: if set, generate html even if ! source file is not newer than target ! ! """ ! if not force: ! force = os.stat(source).st_mtime > os.stat(target).st_mtime ! if force: ! print "Generating %s => %s" % (source, target) ! publish_cmdline(writer_name='html', argv=[ ! "--stylesheet-path=doc/default.css", source, target]) ! ! def generate_docs(): ! """Generate HTML documentation from RST sources""" ! # make sure docutils are loaded ! if not publish_cmdline: ! return ! # use floating timestamps ! os.stat_float_times(True) ! for (_source, _target) in ( ! ("doc/prt.txt", "doc/prt.html"), ! ("doc/prp.txt", "doc/prp.html"), ! ("README", "doc/README.html"), ! ("CHANGES", "doc/CHANGES.html"), ! ): ! rst2html(_source, _target) ! ! def run(): ! if publish_cmdline: ! # docutitls available - generate htmls ! generate_docs() ! setup(name="PythonReports", ! version=get_version(), ! url="http://pythonreports.sourceforge.net/", ! description="Database report generator", ! long_description=DESCRIPTION, ! author="alexander smishlajev", ! author_email="al...@ty...", ! classifiers=[ ! "Development Status :: 3 - Alpha", ! "Environment :: Win32 (MS Windows)", ! "Environment :: X11 Applications", ! "Intended Audience :: Developers", ! "Intended Audience :: Information Technology", ! "License :: OSI Approved :: MIT License", ! "Operating System :: OS Independent", ! "Programming Language :: Python", ! "Topic :: Database :: Front-Ends", ! "Topic :: Printing", ! ], ! packages=["PythonReports"], ! scripts=SCRIPTS, ! data_files=[(DOC_DIR, ! ["README", "LICENSE", "CHANGES"] + glob.glob("doc/*.html"))], ! ) ! ! if __name__ == "__main__": ! run() # vim: set et sts=4 sw=4 : |
From: alexander s. <a1...@us...> - 2006-11-03 19:46:02
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15987 Modified Files: MANIFEST.in Log Message: include scripts and top-level documents Index: MANIFEST.in =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/MANIFEST.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MANIFEST.in 1 Nov 2006 11:26:33 -0000 1.1 --- MANIFEST.in 3 Nov 2006 19:45:57 -0000 1.2 *************** *** 1,3 **** include PythonReports/*.py ! include test/*.py test/sakila.prt include doc/*.txt doc/*.html doc/default.css doc/Makefile --- 1,5 ---- + include README LICENSE CHANGES include PythonReports/*.py ! include scripts/prd scripts/*.bat include doc/*.txt doc/*.html doc/default.css doc/Makefile + include test/*.py test/sakila.prt |
From: alexander s. <a1...@us...> - 2006-11-03 19:42:27
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14853 Added Files: CHANGES Log Message: PythonReports release history --- NEW FILE: CHANGES --- PythonReports release history ============================= version 0.1.0 (03-nov-2006) --------------------------- first public release |
From: alexander s. <a1...@us...> - 2006-11-03 19:40:41
|
Update of /cvsroot/pythonreports/PythonReports/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14150 Added Files: prd.bat Log Message: PythonReports Designer command-line interface (MS Windows) --- NEW FILE: prd.bat --- rem = """ PythonReports Designer command-line interface python %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 goto exit rem = """ from PythonReports import design design.run() rem = """ :exit rem = """ |
From: alexander s. <a1...@us...> - 2006-11-03 19:40:02
|
Update of /cvsroot/pythonreports/PythonReports/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13708 Added Files: prd Log Message: PythonReports Designer command-line interface (*nix-like) --- NEW FILE: prd --- #! /usr/bin/env python # # PythonReports Designer command-line interface from PythonReports import design design.run() # vim: set et sts=4 sw=4 : |
From: alexander s. <a1...@us...> - 2006-11-03 19:39:30
|
Update of /cvsroot/pythonreports/PythonReports/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13675 Added Files: .cvsignore Log Message: ignore backups and temporary files --- NEW FILE: .cvsignore --- *~ .#* *.tmp *.swp *.bak |
From: alexander s. <a1...@us...> - 2006-11-03 19:39:01
|
Update of /cvsroot/pythonreports/PythonReports/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13322/scripts Log Message: Directory /cvsroot/pythonreports/PythonReports/scripts added to the repository |
From: alexander s. <a1...@us...> - 2006-11-03 17:52:26
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6837 Modified Files: drivers.py Log Message: fix image drivers loading (broken in revision 1.3) Index: drivers.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/drivers.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** drivers.py 1 Nov 2006 19:21:55 -0000 1.3 --- drivers.py 3 Nov 2006 17:52:24 -0000 1.4 *************** *** 6,9 **** --- 6,10 ---- """ """History (most recent first): + 03-nov-2006 [als] fix image drivers loading (broken in revision 1.3) 01-nov-2006 [als] get_driver won't fail if no image driver found (but the first image operation will raise an error) *************** *** 48,52 **** # load all available drivers if not _drivers: ! _driver = None # NOTE backend preference: # RL (ReportLab) is best for texts --- 49,61 ---- # load all available drivers if not _drivers: ! if type == "Image": ! # Use ImageDriver class from this module as dummy fallback driver ! # (will be overwritten as soon as any actual driver is found). ! # This will raise NotImplementdedError when the first image ! # operation is attempted, but if there are no images in report ! # then we can get through without image driver. ! _driver = _image_drivers[None] = ImageDriver ! else: ! _driver = None # NOTE backend preference: # RL (ReportLab) is best for texts *************** *** 245,255 **** return _rv - # Use above ImageDriver class as dummy fallback driver - # (will be overwritten as soon as any actual driver is found). - # This will raise NotImplementdedError when the first image - # operation is attempted, but if there are no images in report - # then we can get through without image driver. - _image_drivers[None] = ImageDriver - class TextDriver(object): --- 254,257 ---- |
From: alexander s. <a1...@us...> - 2006-11-03 17:32:26
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31614 Modified Files: design.py Log Message: fix IntegerSelection: mega widget has no .select_range() Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** design.py 3 Nov 2006 17:18:25 -0000 1.7 --- design.py 3 Nov 2006 17:32:21 -0000 1.8 *************** *** 2,5 **** --- 2,6 ---- """History (most recent first): + 03-nov-2006 [als] fix IntegerSelection: mega widget has no .select_range() 03-nov-2006 [als] disable drawing canvas; force fixed font for the shell *************** *** 371,374 **** --- 372,380 ---- LPAD = 5 + def OnSetFocus(self, event): + _entry = self.widget.entry + _entry.focus_set() + _entry.select_range(0, "end") + class BooleanSelection(PropertyEntry): |
From: alexander s. <a1...@us...> - 2006-11-03 17:18:36
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26314 Modified Files: design.py Log Message: disable drawing canvas; force fixed font for the shell Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** design.py 3 Nov 2006 16:33:34 -0000 1.6 --- design.py 3 Nov 2006 17:18:25 -0000 1.7 *************** *** 2,5 **** --- 2,7 ---- """History (most recent first): + 03-nov-2006 [als] disable drawing canvas; + force fixed font for the shell 03-nov-2006 [als] handle file loading errors; prompt to save changes on open file/new file/exit *************** *** 737,740 **** --- 739,743 ---- # FIXME? on X windows, this makes entries slightly darker self.color_window = _tree_hlist["background"] + self.base_font = self.tk.splitlist(_tree_hlist["font"]) # XXX on X windows, selected item is shown grey on grey! if _tree_hlist["selectforeground"] == _tree_hlist["selectbackground"]: *************** *** 750,758 **** self.hp.add(self.pl) self.vp.add(self.hp) ! self.shell = Shell(self.vp, borderwidth=2, relief=SUNKEN, height=10) self.vp.add(self.shell.frame) ! self.canvas = Canvas(self.vp, borderwidth=2, relief=SUNKEN, ! width=720, height=100) ! self.vp.add(self.canvas) self.bind("<Destroy>", self.OnWindowClose) --- 753,767 ---- self.hp.add(self.pl) self.vp.add(self.hp) ! # on windows, the shell gets proportional font. ! # not sure what it will be on other platforms ! # (Gentoo Linux makes it Courier); try Courer ! self.shell = Shell(self.vp, borderwidth=2, relief=SUNKEN, ! width=80, height=20, font=("Courier", self.base_font[1])) self.vp.add(self.shell.frame) ! # it was planned to have a drag-and-click-style visual editor ! # on the third pane. maybe somewhen it'll be implemented too. ! #self.canvas = Canvas(self.vp, borderwidth=2, relief=SUNKEN, ! # width=720, height=100) ! #self.vp.add(self.canvas) self.bind("<Destroy>", self.OnWindowClose) *************** *** 1016,1020 **** _hlist = self.tree.hlist _bbox = _hlist.tk.call(str(_hlist), "info", "bbox", self.current_node) ! _ypos = _hlist.winfo_rooty() + int(_bbox.split(" ")[3]) _xpos = _hlist.winfo_rootx() + 20 * (self.current_node.count(".") + 1) return (_xpos, _ypos) --- 1025,1029 ---- _hlist = self.tree.hlist _bbox = _hlist.tk.call(str(_hlist), "info", "bbox", self.current_node) ! _ypos = _hlist.winfo_rooty() + int(self.tk.splitlist(_bbox)[3]) _xpos = _hlist.winfo_rootx() + 20 * (self.current_node.count(".") + 1) return (_xpos, _ypos) |
From: alexander s. <a1...@us...> - 2006-11-03 16:33:42
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9698 Modified Files: design.py Log Message: handle file loading errors; prompt to save changes on open file/new file/exit Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** design.py 3 Nov 2006 12:49:31 -0000 1.5 --- design.py 3 Nov 2006 16:33:34 -0000 1.6 *************** *** 2,10 **** """History (most recent first): ! 02-nov-2006 [als] fix ColorSelection: hide indicator when color is unset, bell when invalid value entered, pass rgb string to askcolor(), retake focus after askcolor ! 02-nov-2006 [als] pop up the tree menu on Shift+F10; added element reordering commands "move up" and "move down" 02-nov-2006 [als] create automatic hotkeys in insertion menus --- 2,12 ---- """History (most recent first): ! 03-nov-2006 [als] handle file loading errors; ! prompt to save changes on open file/new file/exit ! 03-nov-2006 [als] fix ColorSelection: hide indicator when color is unset, bell when invalid value entered, pass rgb string to askcolor(), retake focus after askcolor ! 03-nov-2006 [als] pop up the tree menu on Shift+F10; added element reordering commands "move up" and "move down" 02-nov-2006 [als] create automatic hotkeys in insertion menus *************** *** 677,680 **** --- 679,683 ---- report = None current_node = None + terminated = False @property *************** *** 698,705 **** Toplevel.__init__(self, class_="PythonReportsDesigner", **options) self.build() if filename: self.loadFile(filename) - else: - self.makeReport() # layout --- 701,709 ---- Toplevel.__init__(self, class_="PythonReportsDesigner", **options) self.build() + # build a pristine tree to use if filename is not passed + # or cannot be opened. + self.makeReport() if filename: self.loadFile(filename) # layout *************** *** 708,712 **** """Do the window layout""" self.buildMenu() - # statusbar self.statusbar = Label(self, borderwidth=1, relief=SUNKEN) self.statusbar.pack(side=BOTTOM, fill=X) --- 712,715 ---- *************** *** 752,755 **** --- 755,759 ---- width=720, height=100) self.vp.add(self.canvas) + self.bind("<Destroy>", self.OnWindowClose) def buildMenu(self): *************** *** 761,765 **** # File menu _popup = self._build_menu_item(_menu, ''"_File", type="cascade") ! self._build_menu_item(_popup, ''"_New", command=self.makeReport) self._build_menu_item(_popup, ''"_Open", command=self.OnMenuFileOpen) self._build_menu_item(_popup, ''"_Save", --- 765,769 ---- # File menu _popup = self._build_menu_item(_menu, ''"_File", type="cascade") ! self._build_menu_item(_popup, ''"_New", command=self.OnMenuFileNew) self._build_menu_item(_popup, ''"_Open", command=self.OnMenuFileOpen) self._build_menu_item(_popup, ''"_Save", *************** *** 886,891 **** --- 890,916 ---- _widget.event_generate(event) + def OnWindowClose(self, event): + """Handle Destroy event for the toplevel window""" + # this handler gets destroy events for all child widgets, + # including Message dialogs. Check update when the first + # child of the tree widget gets destroyed, ignore all others. + if not self.terminated and event.widget.startswith(str(self.tree)): + # some of the window widgets have been destroyed yet + # and the window looks weird. hide it away. + # (we cannot return to the editor anyway.) + self.withdraw() + self.checkUpdate(dlgtype="yesno") + self.terminated = True + + def OnMenuFileNew(self): + """Create new empty template""" + if not self.checkUpdate(): + return + self.makeReport() + def OnMenuFileOpen(self): """Load template file""" + if not self.checkUpdate(): + return _filename = tkFileDialog.askopenfilename(**self.fileoptions) if _filename: *************** *** 894,898 **** def OnMenuQuit(self): """Exit the application""" ! # TODO: save file self.destroy() --- 919,924 ---- def OnMenuQuit(self): """Exit the application""" ! if not self.checkUpdate(): ! return self.destroy() *************** *** 1193,1200 **** _tree.open("report") self.select("report") def loadFile(self, filename): """Load report file""" ! self.report = prt.load(filename) self.filename = filename self.filedir = os.path.dirname(os.path.abspath(filename)) --- 1219,1242 ---- _tree.open("report") self.select("report") + # Note: str(report) returns normalized text, + # may differ from contents of the loaded file. + # Note: loaded_text must be evaluated + # after TreeNodeData construction (that may + # make some unsignificant changes to the tree) + self.loaded_text = str(self.report) def loadFile(self, filename): """Load report file""" ! try: ! 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() ! return self.filename = filename self.filedir = os.path.dirname(os.path.abspath(filename)) *************** *** 1216,1229 **** if None, open Save File dialog. """ if not self.updateTree(): ! return if not filename: filename = tkFileDialog.asksaveasfilename(**self.fileoptions) if not filename: ! return self.report.write(filename) self.report.filename = self.filename = filename self.filedir = os.path.dirname(os.path.abspath(filename)) def updateTree(self, errors="strict"): --- 1258,1276 ---- if None, open Save File dialog. + Return value: True if the template saved successfully, + False otherwise. + """ if not self.updateTree(): ! return False if not filename: filename = tkFileDialog.asksaveasfilename(**self.fileoptions) if not filename: ! return False self.report.write(filename) self.report.filename = self.filename = filename self.filedir = os.path.dirname(os.path.abspath(filename)) + self.loaded_text = str(self.report) + return True def updateTree(self, errors="strict"): *************** *** 1274,1277 **** --- 1321,1361 ---- return True + def checkUpdate(self, dlgtype="yesnocancel"): + """Check if the template has unsaved changes; prompt to save + + Parameters: + dlgtype: MessageBox type - "yesno" or "yesnocancel". + + If there are unsaved changes in the tree, prompt user + to save the template. By default, the prompt dialog + has buttons "Yes", "No" and "Cancel". When the window + is closed by operational system, the operation cannot + be canceled, so there may be only "Yes" and "No" buttons, + giving the user one last chance to save changes. + + Return value: False to cancel operation, True to proceed. + + """ + # first, do silent update (saveFile will do validating update later) + self.updateTree(errors="ignore") + if str(self.report) == self.loaded_text: + # no changes + return True + _focus = self.focus_get() + if self.filename: + _msg = self._("Do you want to save the changes you made to %s?") \ + % os.path.basename(self.filename) + else: + _msg = self._("Do you want to save the changes" + " you made to new template?") + _okcancel = Message(self, icon="warning", type=dlgtype, + title=self._("Unsaved changes detected"), message=_msg).show() + _focus.focus_set() + if _okcancel == "cancel": + return False + elif _okcancel == "no": + return True + return self.saveFile(self.filename) + @staticmethod def _validate(tree, validator): *************** *** 1287,1290 **** --- 1371,1375 ---- _focus = self.focus_get() # validate the tree + # XXX seems to be a repetition (done in updateTree?) - unneeded self._validate(self.report, prt.Report) # get the data |
From: alexander s. <a1...@us...> - 2006-11-03 16:12:09
|
Update of /cvsroot/pythonreports/PythonReports/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1151 Modified Files: Makefile Log Message: build htmls for toplevel documents too; don't include generation timestamp Index: Makefile =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/doc/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 1 Nov 2006 12:11:23 -0000 1.2 --- Makefile 3 Nov 2006 16:11:58 -0000 1.3 *************** *** 2,5 **** --- 2,7 ---- # History (most recent first): + # 03-nov-2006 [als] build htmls for toplevel documents too; + # don't include generation timestamp # 01-nov-2006 [als] added upload target # 10-jul-2006 [als] rst2html arguments changed for docutils-0.4 *************** *** 20,32 **** HTMLS = $(SOURCE:.txt=.html) ! all: ${HTMLS} upload: ${HTMLS} scp $^ ${UPLOAD_PATH} - %.html: %.txt default.css - ${STXTOHTML} --report=warning -d $< $@ - clean: ! rm -f ${HTMLS} --- 22,40 ---- HTMLS = $(SOURCE:.txt=.html) + ALL_HTMLS = $(HTMLS) README.html CHANGES.html ! all: ${ALL_HTMLS} ! ! build: ${ALL_HTMLS} upload: ${HTMLS} scp $^ ${UPLOAD_PATH} clean: ! -rm ${ALL_HTMLS} 2> /dev/null ! ! %.html: ../% default.css ! ${STXTOHTML} --report=warning $< $@ ! ! %.html: %.txt default.css ! ${STXTOHTML} --report=warning $< $@ |
From: alexander s. <a1...@us...> - 2006-11-03 12:49:39
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24875 Modified Files: design.py Log Message: fix ColorSelection: hide indicator when color is unset, bell when invalid value entered, pass rgb string to askcolor(), retake focus after askcolor Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** design.py 3 Nov 2006 11:29:24 -0000 1.4 --- design.py 3 Nov 2006 12:49:31 -0000 1.5 *************** *** 2,5 **** --- 2,9 ---- """History (most recent first): + 02-nov-2006 [als] fix ColorSelection: hide indicator when color is unset, + bell when invalid value entered, + pass rgb string to askcolor(), + retake focus after askcolor 02-nov-2006 [als] pop up the tree menu on Shift+F10; added element reordering commands "move up" and "move down" *************** *** 287,316 **** self["background"] = self.winfo_toplevel().color_panel _select = CodeSelection(self, editable=True, variable=self.var, ! values=sorted(Color.names.keys()), validatecmd=self.OnEntry) _select.grid(row=0, column=0) ! self.indicator = Frame(self, relief=RIDGE, borderwidth=4, ! background=self.var.get()) ! self.indicator.grid(row=0, column=1, sticky=NE+SW, padx=5, pady=1) ! _btn = Button(self, command=self.OnButton, text=self.winfo_toplevel()._("...")) ! _btn.grid(row=0, column=2) self.columnconfigure(1, weight=1) ! def OnEntry(self, value): ! """Validate the combo box value""" ! try: ! _color = Color.fromValue(value) ! except InvalidLiteral: ! value = self.var.get() else: self.indicator["background"] = _color return value def OnButton(self): # askcolor returns ((r, g, b), "#rrggbb") or (None, None) ! _color = askcolor(self.var.get())[1] if _color: ! self.var.set(_color) ! self.indicator["background"] = _color class PropertyEntry(Frame): --- 291,330 ---- self["background"] = self.winfo_toplevel().color_panel _select = CodeSelection(self, editable=True, variable=self.var, ! values=sorted(Color.names.keys()), validatecmd=self.updateColor) _select.grid(row=0, column=0) ! self.indicator = Frame(self, relief=RIDGE, borderwidth=4) ! self.button = Button(self, command=self.OnButton, text=self.winfo_toplevel()._("...")) ! self.button.grid(row=0, column=2) self.columnconfigure(1, weight=1) + self.updateColor() ! def updateColor(self, value=NOTHING): ! """Validate the combo box value; update color indicator""" ! if value is NOTHING: ! _color = Color.fromValue(self.var.get()) else: + try: + _color = Color.fromValue(value) + except InvalidLiteral: + self.bell() + # validation will return current value + value = self.var.get() + _color = Color.fromValue(value) + else: + self.var.set(value) + if _color: self.indicator["background"] = _color + self.indicator.grid(row=0, column=1, sticky=NE+SW, padx=5, pady=1) + else: + self.indicator.grid_forget() return value def OnButton(self): # askcolor returns ((r, g, b), "#rrggbb") or (None, None) ! _color = askcolor(Color.fromValue(self.var.get()))[1] if _color: ! self.updateColor(_color) ! self.button.focus_set() class PropertyEntry(Frame): |
From: alexander s. <a1...@us...> - 2006-11-03 11:51:25
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3892 Modified Files: datatypes.py Log Message: ElementTree: string conversion returns full XML text Index: datatypes.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/datatypes.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** datatypes.py 1 Nov 2006 11:03:32 -0000 1.1 --- datatypes.py 3 Nov 2006 11:51:17 -0000 1.2 *************** *** 1,4 **** --- 1,5 ---- """Data types and element primitives, common for templates and printouts""" """History: + 03-nov-2006 [als] ElementTree: string conversion returns full XML text 20-oct-2006 [als] added Structure 29-sep-2006 [als] ElementTree: keep filename after .parse() *************** *** 1164,1167 **** --- 1165,1174 ---- self.root_validator.writexml(file, self._root, encoding) + def __str__(self): + """Return string representation of the tree""" + _stream = StringIO() + self.write(_stream) + return _stream.getvalue() + ### elements common for templates and printouts |
From: alexander s. <a1...@us...> - 2006-11-03 11:29:29
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28383 Modified Files: design.py Log Message: pop up the tree menu on Shift+F10; added element reordering commands "move up" and "move down" Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** design.py 2 Nov 2006 19:55:38 -0000 1.3 --- design.py 3 Nov 2006 11:29:24 -0000 1.4 *************** *** 2,5 **** --- 2,7 ---- """History (most recent first): + 02-nov-2006 [als] pop up the tree menu on Shift+F10; + added element reordering commands "move up" and "move down" 02-nov-2006 [als] create automatic hotkeys in insertion menus 02-nov-2006 [als] pop up menus on right-click and insert key in the list *************** *** 705,708 **** --- 707,712 ---- _tree_hlist.bind("<Insert>", self.OnTreeInsert) _tree_hlist.bind("<Button-3>", self.OnTreeRClick) + _tree_hlist.bind("<Shift-F10>", lambda event: + self.report_menu.tk_popup(*self._get_popup_position())) self.hp.add(self.tree) # Tkish way to get standard visual attributes is .option_get(), *************** *** 762,765 **** --- 766,772 ---- self._build_menu_item(_popup, ''"_Delete element", command=lambda: self.deleteNode(self.current_node)) + self._build_menu_item(_popup, ''"Move _Up", command=self.OnMenuMoveUp) + self._build_menu_item(_popup, ''"Move Dow_n", + command=self.OnMenuMoveDown) _popup.add_separator() self._build_menu_item(_popup, ''"Print Pre_view", command=self.preview) *************** *** 879,886 **** """Display "About..." dialog""" ! def OnTreeBrowse(self, node): """Select new item on the tree""" # XXX why the browse event always comes twice? ! if node == self.current_node: return # TODO? if self.current_node is not None, --- 886,942 ---- """Display "About..." dialog""" ! def OnMenuMoveUp(self): ! """Move selected node before it's previous sibling""" ! _path = self.current_node ! _data = self.getNodeData(_path) ! _parent = _data.parent ! if not _parent: ! # can't happen - menu item should be disabled ! return ! _idx = _parent.index(_data) ! if _idx < 1: ! # can't happen either ! return ! _sibling = _parent[_idx - 1] ! _parent[_idx-1:_idx+1] = (_data, _sibling) ! self.tree.hlist.delete_entry(_path) ! _data.addToTree(self.tree, before=_sibling.path) ! self.tree.autosetmode() ! self.select(_path) ! ! def OnMenuMoveDown(self): ! """Move selected node after it's next sibling""" ! _path = self.current_node ! _data = self.getNodeData(_path) ! _parent = _data.parent ! if not _parent: ! # can't happen - menu item should be disabled ! return ! _idx = _parent.index(_data) ! if (_idx + 1) >= len(_parent): ! # can't happen either ! return ! _parent[_idx:_idx+2] = (_parent[_idx+1], _data) ! self.tree.hlist.delete_entry(_path) ! try: ! _before = _parent[_idx+2] ! except IndexError: ! # at the end of the siblings list ! _before = None ! else: ! _before = _before.path ! _data.addToTree(self.tree, before=_before) ! self.tree.autosetmode() ! self.select(_path) ! ! @staticmethod ! def _enabled(enable): ! """Return Tk widget state constant for boolean value""" ! return (DISABLED, NORMAL)[bool(enable)] ! ! def OnTreeBrowse(self, node, force=False): """Select new item on the tree""" # XXX why the browse event always comes twice? ! if (node == self.current_node) and not force: return # TODO? if self.current_node is not None, *************** *** 890,901 **** self.current_node = node # replace insertion menu ! _menu = self.insert_menus[_data.tag] ! if _menu is None: ! self.report_menu.entryconfigure(0, state=DISABLED) else: ! self.report_menu.entryconfigure(0, state=NORMAL, menu=_menu) ! # enable/disable "Delete element" command ! self.report_menu.entryconfigure(1, ! state=(NORMAL, DISABLED)[_data.tag in self.FIXED_TAGS]) def _get_popup_position(self): --- 946,966 ---- self.current_node = node # replace insertion menu ! _rmenu = self.report_menu ! _imenu = self.insert_menus[_data.tag] ! if _imenu is None: ! _rmenu.entryconfigure(0, state=DISABLED) else: ! _rmenu.entryconfigure(0, state=NORMAL, menu=_imenu) ! # enable/disable other element commands ! _rmenu.entryconfigure(1, ! state=self._enabled(_data.tag not in self.FIXED_TAGS)) ! if _data.parent is None: ! _rmenu.entryconfigure(2, state=DISABLED) ! _rmenu.entryconfigure(3, state=DISABLED) ! else: ! _index = _data.parent.index(_data) ! _rmenu.entryconfigure(2, state=self._enabled(_index > 0)) ! _rmenu.entryconfigure(3, ! state=self._enabled((_index + 1) < len(_data.parent))) def _get_popup_position(self): *************** *** 980,984 **** _hlist.selection_set(path) _hlist.anchor_set(path) ! self.OnTreeBrowse(path) def getNodeData(self, path): --- 1045,1049 ---- _hlist.selection_set(path) _hlist.anchor_set(path) ! self.OnTreeBrowse(path, force=True) def getNodeData(self, path): |
From: alexander s. <a1...@us...> - 2006-11-03 10:35:28
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8787 Modified Files: __init__.py Log Message: import __version__ and __date__ from the version module Index: __init__.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 1 Nov 2006 11:15:32 -0000 1.2 --- __init__.py 3 Nov 2006 10:35:26 -0000 1.3 *************** *** 12,15 **** --- 12,16 ---- """ """History: + 03-nov-2006 [als] import __version__ and __date__ from the version module 01-nov-2006 [als] fix: Builder not imported 01-nov-2006 [als] added API exports *************** *** 17,23 **** """ - __version__ = "$Revision$"[11:-2] - __date__ = "$Date$"[7:-2] - __all__ = [ "template", "load_template", --- 18,21 ---- *************** *** 30,33 **** --- 28,32 ---- from PythonReports.printout import load as load_printout from PythonReports.builder import Builder + from PythonReports.version import * try: |
From: alexander s. <a1...@us...> - 2006-11-03 10:28:36
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6254 Added Files: version.py Log Message: PythonReports package version declaration --- NEW FILE: version.py --- """PythonReports package version declaration""" """History: 03-nov-2006 [als] created """ # Note: __date__ is a string because all modules have __date_ as a string. # wouldn't datetime.date object be better? __version__ = "0.1.0" __date__ = "2006-11-03" __all__ = ["__version__", "__date__"] # vim: set et sts=4 sw=4 : |
From: alexander s. <a1...@us...> - 2006-11-02 19:55:47
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15994 Modified Files: design.py Log Message: create automatic hotkeys in insertion menus Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** design.py 2 Nov 2006 18:42:21 -0000 1.2 --- design.py 2 Nov 2006 19:55:38 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- """History (most recent first): + 02-nov-2006 [als] create automatic hotkeys in insertion menus 02-nov-2006 [als] pop up menus on right-click and insert key in the list 31-oct-2006 [als] boolean property checkbuttons have grey background; *************** *** 787,796 **** _menu = Menu(self.report_menu, tearoff=False) self.insert_menus[_tag] = _menu for (_child, _restrict) in validator.children: self.element_validators[(_tag, _child.tag)] = (_child, _restrict) self.buildInsertionMenus(_child) if _child.tag not in self.FIXED_TAGS: ! # FIXED_TAGS cannot be inserted ! self._build_menu_item(_menu, _child.tag, command=lambda tag=_child.tag: self.insertNode(tag)) --- 788,806 ---- _menu = Menu(self.report_menu, tearoff=False) self.insert_menus[_tag] = _menu + _hotkeys = set() for (_child, _restrict) in validator.children: self.element_validators[(_tag, _child.tag)] = (_child, _restrict) self.buildInsertionMenus(_child) + # FIXED_TAGS cannot be inserted if _child.tag not in self.FIXED_TAGS: ! # find the first letter of the element tag ! # not used as a hot key yet ! for (_underline, _letter) in enumerate(_child.tag): ! if _letter not in _hotkeys: ! _hotkeys.add(_letter) ! break ! else: ! _underline = -1 ! self._build_menu_item(_menu, _child.tag, underline=_underline, command=lambda tag=_child.tag: self.insertNode(tag)) |
From: alexander s. <a1...@us...> - 2006-11-02 18:42:27
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21366 Modified Files: design.py Log Message: pop up menus on right-click and insert key in the list Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** design.py 1 Nov 2006 11:07:02 -0000 1.1 --- design.py 2 Nov 2006 18:42:21 -0000 1.2 *************** *** 1,4 **** --- 1,6 ---- """PythonReports Template Designer""" + """History (most recent first): + 02-nov-2006 [als] pop up menus on right-click and insert key in the list 31-oct-2006 [als] boolean property checkbuttons have grey background; fix: ElementTree not updated on element deletion; *************** *** 700,703 **** --- 702,707 ---- _tree_hlist.bind("<Delete>", lambda event: self.deleteNode(self.current_node)) + _tree_hlist.bind("<Insert>", self.OnTreeInsert) + _tree_hlist.bind("<Button-3>", self.OnTreeRClick) self.hp.add(self.tree) # Tkish way to get standard visual attributes is .option_get(), *************** *** 885,888 **** --- 889,928 ---- state=(NORMAL, DISABLED)[_data.tag in self.FIXED_TAGS]) + def _get_popup_position(self): + """Return position for the tree popup menu + + Menu is popped up with it's top left corner just below + currently selected tree node, offset from the left side + by the nesting level. + + Return value: 2-element tuple (x, y). + + """ + _hlist = self.tree.hlist + _bbox = _hlist.tk.call(str(_hlist), "info", "bbox", self.current_node) + _ypos = _hlist.winfo_rooty() + int(_bbox.split(" ")[3]) + _xpos = _hlist.winfo_rootx() + 20 * (self.current_node.count(".") + 1) + return (_xpos, _ypos) + + def OnTreeRClick(self, event): + """Right click on the tree list - open pulldown menu""" + # set focus to the tree: click moves selection pointer + # and it looks like the pointer can further be moved + # by keyboard. not true unless we force focus to the tree. + _hlist = self.tree.hlist + _hlist.focus_set() + # select tree node nearest to the click position + _path = _hlist.nearest(event.y) + self.select(_path) + # menu will be popped up below selected row, + # horizontally near to the click position + self.report_menu.tk_popup(event.x_root, self._get_popup_position()[1]) + + def OnTreeInsert(self, event): + """Insert key pressed in the tree - pop up insert element menu""" + _menu = self.insert_menus[self.getNodeData(self.current_node).tag] + if _menu: + _menu.tk_popup(*self._get_popup_position()) + def OnPropListResize(self, event=0): """Adjust width of value col in the property list upon window resize""" |
From: alexander s. <a1...@us...> - 2006-11-02 15:35:47
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17871 Modified Files: README Log Message: guess "the standard library" should have the definite article Index: README =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README 2 Nov 2006 14:00:26 -0000 1.1 --- README 2 Nov 2006 15:35:31 -0000 1.2 *************** *** 23,30 **** All parts of the PythonReports_ toolkit require the ElementTree_ ! module. Python 2.5 includes this module as part of standard library. ! Users of older Python versions can download separate distribution ! package from http://effbot.org/downloads/ (cElementTree_ add-on is ! highly recommended too). Report building requires either ReportLab_ or PIL_ or wxPython_ --- 23,30 ---- All parts of the PythonReports_ toolkit require the ElementTree_ ! module. Python 2.5 includes this module as part of the standard ! library. Users of older Python versions can download separate ! distribution package from http://effbot.org/downloads/ ! (cElementTree_ add-on is highly recommended too). Report building requires either ReportLab_ or PIL_ or wxPython_ |
From: alexander s. <a1...@us...> - 2006-11-02 14:00:40
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15219 Added Files: README Log Message: guess what? readme! --- NEW FILE: README --- ============ Introduction ============ PythonReports_ is a toolkit aimed to build database reports in |Python(r)| programs. The toolkit includes report template_ designer, report builder and several printout_ renderers for GUI and graphic file output. Report builder applies a template_ to a sequence of uniform data objects and produces a printout_ structure that can be saved in a file and/or rendered by one of the front-end drivers to screen, printer, HTML [*]_, PDF etc. .. [*] HTML output is not implemented yet. ============ Requirements ============ PythonReports_ require Python_ version 2.4 or newer. No support is planned for earlier Python versions. All parts of the PythonReports_ toolkit require the ElementTree_ module. Python 2.5 includes this module as part of standard library. Users of older Python versions can download separate distribution package from http://effbot.org/downloads/ (cElementTree_ add-on is highly recommended too). Report building requires either ReportLab_ or PIL_ or wxPython_ (in that order of preference). If report template contains images then either `Python Imaging Library`_ (PIL_) or wxPython_ must be installed. Requirements for printout_ rendering depend on selected frontend: * PDF output requires the ReportLab_ Toolkit; * wx-based preview and printing require wxPython_; * Tk-based report preview requires Tkinter (part of the Python Standard Library). Report template designer requires Tkinter with Tix_ support (standard Python installer for Windows includes Tix_; on some platforms Tix_ must be installed separately). =========== Quick Start =========== No documentation yet. Please look at the `test script`_ for report building example. All printout rendering modules (``pdf``, ``Tk`` and ``wxPrint``) have command line interface that can serve as their API usage example. .. _External hyperlink targets: .. _PythonReports: http://pythonreports.sourceforge.net/ .. _template: http://pythonreports.sourceforge.net/prt.html .. _printout: http://pythonreports.sourceforge.net/prp.html .. _Python: http://www.python.org/ .. _ElementTree: http://effbot.org/zone/element-index.htm .. _cElementTree: http://effbot.org/zone/celementtree.htm .. _ReportLab: http://www.reportlab.org/rl_toolkit.html .. _Python Imaging Library: .. _PIL: http://www.pythonware.com/products/pil/ .. _wxPython: http://www.wxpython.org/ .. _Tix: http://tix.sourceforge.net/ .. _test script: http://pythonreports.cvs.sourceforge.net/pythonreports/PythonReports/test/test_build.py?view=markup .. |Python(r)| unicode:: Python U+00AE .. vim: set et ft=rst sts=2 sw=2 : |
From: alexander s. <a1...@us...> - 2006-11-02 11:30:39
|
Update of /cvsroot/pythonreports/PythonReports/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22202 Modified Files: test_build.py Log Message: initialize wx.App (may be needed for wx backend); add wx-based progress indicator; limit the number of processed rows Index: test_build.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/test/test_build.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_build.py 1 Nov 2006 11:24:31 -0000 1.1 --- test_build.py 2 Nov 2006 11:30:19 -0000 1.2 *************** *** 3,6 **** --- 3,9 ---- """History (most recent first): + 01-nov-2006 [als] initialize wx.App (may be needed for wx backend); + add wx-based progress indicator; + limit the number of processed rows 25-jul-2006 [als] file output adjusted for ElementTree-based API 17-jul-2006 [als] created *************** *** 12,19 **** --- 15,33 ---- import sys + try: + import wx + except ImportError: + wx = None + from PythonReports.builder import Builder import sakila + # limit the number of data objects to render + # (set to sys.maxint to process the whole sequence). + # (444 doesn't cause page break before the summary section + # with wx and RL drivers and is big enough to see the progress.) + DATA_LIMIT = 444 + class Progress(object): *************** *** 26,29 **** --- 40,49 ---- self.percent = -1 + def indicate(self): + """Show progress indicator at self.percent""" + _pos = int(_percent / 100 * self.BAR_WIDTH) + sys.stdout.write("\r[%s>%s] %5.1f%%" + % ("=" * _pos, " " * (self.BAR_WIDTH - _pos), _percent)) + def __call__(self): _context = self.builder.context *************** *** 32,48 **** if _percent > self.percent: self.percent = _percent ! _pos = int(_percent / 100 * self.BAR_WIDTH) ! sys.stdout.write("\r[%s>%s] %5.1f%%" ! % ("=" * _pos, " " * (self.BAR_WIDTH - _pos), _percent)) def run(): _builder = Builder("sakila.prt") try: ! _printout = _builder.run(sakila.load(), ! item_callback=Progress(_builder)) ! except: ! raise ! # end progress report - print newline ! print # write printout file _out = file("sakila.prp", "w") --- 52,96 ---- if _percent > self.percent: self.percent = _percent ! self.indicate() ! ! def terminate(self): ! """Finalize the progress display""" ! print # line feed ! ! if wx: ! class wxProgress(Progress): ! ! def __init__(self, builder): ! super(wxProgress, self).__init__(builder) ! self.dialog = wx.ProgressDialog("Build Report", ! "Building the report, please wait...", ! style = wx.PD_APP_MODAL | wx.PD_SMOOTH | wx.PD_AUTO_HIDE ! | wx.PD_ELAPSED_TIME | wx.PD_ESTIMATED_TIME) ! ! def indicate(self): ! self.dialog.Update(self.percent) ! ! def terminate(self): ! self.dialog.Hide() ! self.dialog.Destroy() def run(): + if wx: + # if wx backend is used, App must be created + # before builder initialization. + _app = wx.App(0) + # create report builder _builder = Builder("sakila.prt") + # create progress indicator + if wx: + _progress = wxProgress(_builder) + else: + _progress = Progress(_builder) + # build printout try: ! _printout = _builder.run(sakila.load()[:DATA_LIMIT], ! item_callback=_progress) ! finally: ! _progress.terminate() # write printout file _out = file("sakila.prp", "w") |