Ghini / ghini.desktop

plant collections manager (desktop version)
http://ghini.github.io/
GNU General Public License v2.0
24 stars 14 forks source link

we need order in template-based reports #431

Closed mfrasca closed 6 years ago

mfrasca commented 6 years ago

todo:

second thoughts

postscript production is currently severely bulky: in each template we have font definitions, this even messes up github statistics, making the system consider postscript the main language for our project. every template also contains copies of a couple of python functions which really belong in the report tool. now we would be adding pictures, and I would rather have them as external resources, not as included postscript data.

original notes

it is possible to include JPG data in PS files, but not out of the box, in the sense that we better provide some tools in the libs, that let us:

PS lets us easily work with JPG (it contains the right decoder), while if we want to do PNG (lossless) then we need do more work in Python, like decoding the PNG then encoding possibly with LZW (known to PS) before going to ASCII. I have not been successful with ASCII85.

please refer to this Q&A on stackoverflow.

if we want to do any other RGB format, consider we cannot do transparency (only True/False mask is available), we can go through PIL:

>>> import PIL.Image
>>> i = PIL.Image.open("/tmp/from-template.png")
>>> "".join("%02x%02x%02x" % k[:3] for k in i.getdata())

convert image.png -background white -alpha remove white.png

mfrasca commented 6 years ago

in the template authoring instructions, consider referring to the site: http://getdrawings.com/tropical-leaves-drawing

mfrasca commented 6 years ago

As mentioned in #434, I grew definitely fed up with the low quality of the Mako documentation. I wanted to use inheritance in templates and from the Jinja2 docs I could produce a working example in 20 minutes, while I've spent no less than 2 hours trying to pin it down in Mako and did not manage. So I'm leaving Mako for historical reasons and I'm moving to Jinja2. Most utility functions still apply, obviously, as does this whole issue too.

mfrasca commented 6 years ago

loader = ChoiceLoader([FileSystemLoader(), PackageLoader()]), forsan