Re: [PythonReports-users] Images
Brought to you by:
a1s
From: alexander s. <al...@go...> - 2013-01-02 18:39:58
|
Werner F. Bruhin wrote, at 02.01.2013 18:48: >>> >>> Looking at the image element I don't see how I could do this, if it is >>> possible could you give me some tips. >> Sorry, at present there is no way to dynamically compute image file path >> or bitmap data. > Not the end of the world, but would definitely be very very nice if you > can come up with something. As a workaround, you could create a side-effect function that puts image files to a constant path, and then call this function via field or variable expression. Set embed="true" in image element. That is a terribly dirty hack, but for now it seems to be the only solution. >> That is quite a flaw in the template language. I will have to think of >> a syntax for such things. So far I've got several ideas, but all of >> them are either ugly or not backward compatible. > Is backward compatibility for something like this that important? There are people that use PythonReports for many years and I do not want to break all their existing templates if I can avoid that. > Could you create a "dynamic image" element which is ignored by older > versions? > > If you do something can you please allow the program to define what > image type is used. I think I will do it like this: For all body elements, box, and style elements all attributes will be allowed to contain an expression to evaluate in context of current data item. If attribute value is an expression rather than constant, it must be prefixed with equal sign. E.g.: <image file="=picture['file']" type="=picture['type']" /> For data elements, I will add attribute 'expr'; same as with fields, expression evaluation results will take precedence over literal data. This change will surely slow down report building for existing templates. Comments, anyone? Best wishes, alex. |