pythonreports-users Mailing List for PythonReports (Page 3)
Brought to you by:
a1s
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(78) |
2013 |
Jan
(15) |
Feb
(12) |
Mar
(25) |
Apr
(2) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
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. |
From: Werner F. B. <wer...@fr...> - 2013-01-02 16:47:34
|
Hi Alex, On 02/01/2013 17:06, alexander smishlajev wrote: > Werner F. Bruhin wrote, at 02.01.2013 17:44: >> In my application the user can store images (e.g. wine labels, recipe >> preparation etc), the images are stored in the file system in a user >> defined folder and the application just stores the file name. >> >> On my recipe report I like to show the image of the "Recipe finished" >> image if it exists. >> >> I was hoping to use a function "getImagePath(THIS.id, 'imgtype') and it >> comes back with the appropriate full path to the image, in the case of >> the recipe report it would find the image showing the "finished" stage >> of the recipe. >> >> 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. > > 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? 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. Werner |
From: alexander s. <al...@go...> - 2013-01-02 16:07:49
|
Werner F. Bruhin wrote, at 02.01.2013 17:44: > > In my application the user can store images (e.g. wine labels, recipe > preparation etc), the images are stored in the file system in a user > defined folder and the application just stores the file name. > > On my recipe report I like to show the image of the "Recipe finished" > image if it exists. > > I was hoping to use a function "getImagePath(THIS.id, 'imgtype') and it > comes back with the appropriate full path to the image, in the case of > the recipe report it would find the image showing the "finished" stage > of the recipe. > > 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. 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. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2013-01-02 15:42:43
|
Hi, In my application the user can store images (e.g. wine labels, recipe preparation etc), the images are stored in the file system in a user defined folder and the application just stores the file name. On my recipe report I like to show the image of the "Recipe finished" image if it exists. I was hoping to use a function "getImagePath(THIS.id, 'imgtype') and it comes back with the appropriate full path to the image, in the case of the recipe report it would find the image showing the "finished" stage of the recipe. Looking at the image element I don't see how I could do this, if it is possible could you give me some tips. Werner |
From: Werner F. B. <wer...@fr...> - 2013-01-02 09:08:26
|
Hi Alex, Done it again, resend it to list:(. On 02/01/2013 08:12, alexander smishlajev wrote: ... > Look at the sakila template: > > <field expr="PAGE_NUMBER" evaltime="report" align="left"> > <box x="8.6cm" width="3cm" height="-3mm" /> > </field> > > If you are not going to make hundreds of thousands of pages, your box > width may be smaller too. I had tried changing the width but couldn't get that working for PAGE_NUMBER also it works for numbers in my data. The align="left" doesn't make it into the file for this one field (have others with align="right" which work as expected), have to go out this morning, will look at it in more detail later today or tomorrow. Werner P.S. Thanks for your other suggestions for the if/else - the flexibility of PythonReports has still not made it into my head:) |
From: alexander s. <al...@go...> - 2013-01-02 07:26:17
|
On 01.01.2013 13:13, Werner F. Bruhin wrote: > > In some of my reports I have conditional values, how could I do this in > PythonReports: > > if ru.oCurrentvalue: # variable defined on an import alias "ru" > currentvalue # variable from report data set > else: > lastpurchaseprice # variable from report data set There are several possible ways to achieve that. If you are using Python 2.5 or newer, the simplest way is field expr="currentvalue if ru.oCurrentvalue else lastpurchaseprice". You may also do it using template conditionals: <field expr="currentvalue"> <style printwhen="ru.oCurrentvalue" /> </field> <field expr="lastpurchaseprice"> <style printwhen="not ru.oCurrentvalue" /> </field> Finally, you may create a Python module with any functions you need and import it into your template. Best wishes, alex. |
From: alexander s. <al...@go...> - 2013-01-02 07:14:06
|
On 31.12.2012 17:32, Werner F. Bruhin wrote: > > The page number printing is showing e.g. > > 1 / 2 > > but I like to show it as: > > 1 / 2 > > or maybe: > > 1 / 2 > > I tried all kind of stuff for "format" but it always uses about 10+ > characters between the "/" and the number. > > Is there any trick to get what I like to see? Look at the sakila template: <field expr="PAGE_NUMBER" evaltime="report" align="left"> <box x="8.6cm" width="3cm" height="-3mm" /> </field> If you are not going to make hundreds of thousands of pages, your box width may be smaller too. Happy New Year, alex. |
From: Werner F. B. <wer...@fr...> - 2013-01-01 13:54:48
|
On 01/01/2013 13:59, Werner F. Bruhin wrote: ... > if ru.oShowprice: > if ru.oCurrentvalue: > currentvalue > else: > lastpurchaseprice > > "lambda" gives me headaches, but I assume above can be done with a more > complex lambda - so I go get an Aspirin:) Got it, was easier then I thought, maybe this will be helpful for someone else, so here is what I ended up with: (lambda o1, o2, cV, pV: '' if not o1 else (lambda o2, cV, pV: "%.2f" % cV if o2 else "%.2f" % pV)(o2, cV, pV))(ru.oShowprice, ru.oCurrentvalue, currentvalue, lastpurchaseprice) Werner |
From: Werner F. B. <wer...@fr...> - 2013-01-01 12:58:20
|
On 01/01/2013 12:13, Werner F. Bruhin wrote: > Hi, > > I hope you got well into the New Year! > > In some of my reports I have conditional values, how could I do this in > PythonReports: > > if ru.oCurrentvalue: # variable defined on an import alias "ru" > currentvalue # variable from report data set > else: > lastpurchaseprice # variable from report data set I am getting there: (lambda o, c, p: c if o else p) (ru.oCurrentvalue, currentvalue, lastpurchaseprice) Now I just need to figure out how to do: if ru.oShowprice: if ru.oCurrentvalue: currentvalue else: lastpurchaseprice "lambda" gives me headaches, but I assume above can be done with a more complex lambda - so I go get an Aspirin:) Werner |
From: Werner F. B. <wer...@fr...> - 2013-01-01 11:11:55
|
Hi, I hope you got well into the New Year! In some of my reports I have conditional values, how could I do this in PythonReports: if ru.oCurrentvalue: # variable defined on an import alias "ru" currentvalue # variable from report data set else: lastpurchaseprice # variable from report data set Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-31 15:31:09
|
Hi, The page number printing is showing e.g. 1 / 2 but I like to show it as: 1 / 2 or maybe: 1 / 2 I tried all kind of stuff for "format" but it always uses about 10+ characters between the "/" and the number. Is there any trick to get what I like to see? Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-29 14:29:23
|
On 29/12/2012 15:19, Werner F. Bruhin wrote: > On 29/12/2012 12:25, Werner F. Bruhin wrote: >> Hi, >> >> I don't think it is my changes as the problem seems to be in: >> >> DesignPlace.move_up_shape and DesignPlace.move_down_shape methods. >> Whatever item I select it never gets past the "if" statement in these >> methods. > Actually if I have more then 3 items under detail then I get past the if > and once I managed to move one, but can't repeat that. O.K. forget it, it just confuses me that move_up moves the item down in the list and move_down moves it up in the list. Looking at the code comments made me realize this - maybe not enough coffee yet:). Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-29 14:17:49
|
On 29/12/2012 12:25, Werner F. Bruhin wrote: > Hi, > > I don't think it is my changes as the problem seems to be in: > > DesignPlace.move_up_shape and DesignPlace.move_down_shape methods. > Whatever item I select it never gets past the "if" statement in these > methods. Actually if I have more then 3 items under detail then I get past the if and once I managed to move one, but can't repeat that. Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-29 11:24:03
|
Hi, I don't think it is my changes as the problem seems to be in: DesignPlace.move_up_shape and DesignPlace.move_down_shape methods. Whatever item I select it never gets past the "if" statement in these methods. Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-29 10:35:46
|
Hi Alex, On 28/12/2012 19:35, alexander smishlajev wrote: > Werner F. Bruhin wrote, at 28.12.2012 20:12: >> Another question, I like to have every alternate detail line with a >> different background, to help reading the report. >> >> I copied "Style 23" on the detail band in sakila.prt, i.e. setting a >> bgcolor of my choice and in when I have "PAGE_COUNT % 2", I also tried >> with "ITEM_NUMBER % 2". >> >> But neither in Preview nor when Printing is my bgcolor showing. >> >> Is there something else I need to set? > I don't think so. > > Alternate background colours in sakila.prt are yet another thing meant > for demonstration purposes. Needed to add a rectangle to make it work. First thought it was columns, but then saw that there was a rectangle on the detail which didn't show, it seems to be this which makes it work. Maybe add a "how to" section to the doc or have things like this on the wiki? BTW, I can't move items, i.e. adding the rectangle after my other fields nothing, except the background, showed. Wanted to move it up/down but nothing happens - probably due to the change the split up things. Will try and look into this later today. Werner |
From: alexander s. <al...@go...> - 2012-12-28 18:37:27
|
Werner F. Bruhin wrote, at 28.12.2012 20:12: > > Another question, I like to have every alternate detail line with a > different background, to help reading the report. > > I copied "Style 23" on the detail band in sakila.prt, i.e. setting a > bgcolor of my choice and in when I have "PAGE_COUNT % 2", I also tried > with "ITEM_NUMBER % 2". > > But neither in Preview nor when Printing is my bgcolor showing. > > Is there something else I need to set? I don't think so. Alternate background colours in sakila.prt are yet another thing meant for demonstration purposes. Of course, there always is a possibility of error in program. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2012-12-28 18:13:21
|
On 28/12/2012 18:51, alexander smishlajev wrote: > Werner F. Bruhin wrote, at 28.12.2012 15:40: >> Is there a way to get at the total page count? >> >> In other words like to print something like this "Page nnn of ttt". > The sakila template contains such a thing for demonstration purposes. > > <field expr="PAGE_NUMBER" evaltime="report" /> Thanks, found it in the mean time but sent response to Den instead of the list. > > Happy New Year, I wish you also a very happy, healthy and prosperous New Year Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-28 18:12:02
|
Hi, Another question, I like to have every alternate detail line with a different background, to help reading the report. I copied "Style 23" on the detail band in sakila.prt, i.e. setting a bgcolor of my choice and in when I have "PAGE_COUNT % 2", I also tried with "ITEM_NUMBER % 2". But neither in Preview nor when Printing is my bgcolor showing. Is there something else I need to set? Werner |
From: alexander s. <al...@go...> - 2012-12-28 17:52:22
|
Werner F. Bruhin wrote, at 28.12.2012 15:40: > > Is there a way to get at the total page count? > > In other words like to print something like this "Page nnn of ttt". The sakila template contains such a thing for demonstration purposes. <field expr="PAGE_NUMBER" evaltime="report" /> Happy New Year, alex. |
From: Den P. <kac...@gm...> - 2012-12-28 13:59:39
|
Hi, Thanks for your patches and report. I haven't merged them with main PythonReports repo yet, but hopefully will do this soon. > > BTW, there is a sizing issue with 2.9.5 preview, reported it on wxPython > dev and Robin has fixed part of it already and will hopefully be able to > fix the remaining issue related to PyCollapsiblePane. > Great news! Den |
From: Werner F. B. <wer...@fr...> - 2012-12-28 13:39:27
|
Hi, Is there a way to get at the total page count? In other words like to print something like this "Page nnn of ttt". In ReportManager one had to define report to do "two passes", obviously slower but if reports are not huge one doesn't see a difference. Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-28 09:49:45
|
Hi Den, Found one issue with this, missed the following line in ListProperty.OnButtonClick: def OnButtonClick(self, prop_grid, value): _dlg = ListPropertyDialog(wx.GetApp().pyr_editor_env.get_main_frame(), self.GetValue()) BTW, there is a sizing issue with 2.9.5 preview, reported it on wxPython dev and Robin has fixed part of it already and will hopefully be able to fix the remaining issue related to PyCollapsiblePane. Werner |
From: alexander s. <al...@go...> - 2012-12-22 11:49:40
|
On 22.12.2012 11:42, Werner F. Bruhin wrote: >> >> I think I got it, they are in self.properties for the ListElement, I'll >> make that change. > I moved it to ListPropertyValue.after_property_changed , had it first in > __init__ but at that point e.g. font name shows "default" instead of > "body". This is checked in. Thank you. Merry Christmas, alex. |
From: Werner F. B. <wer...@fr...> - 2012-12-22 09:41:08
|
On 22/12/2012 10:03, Werner F. Bruhin wrote: > Hi Alex, > > I think I got it, they are in self.properties for the ListElement, I'll > make that change. I moved it to ListPropertyValue.after_property_changed , had it first in __init__ but at that point e.g. font name shows "default" instead of "body". Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-22 09:02:45
|
Hi Alex, I think I got it, they are in self.properties for the ListElement, I'll make that change. Werner |