pythonreports-users Mailing List for PythonReports (Page 5)
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...> - 2012-12-09 10:14:28
|
On 09.12.2012 12:05, Werner F. Bruhin wrote: > > I see this error when I click on the "template" and "printout" link in > the first para on this page: > > 1. *Server:* pythonreports.sourceforge.net > 2. *URL path:* /prt.html > 3. *Error notes:* NONE > 4. *Error type:* 404 Fixed. Thank you. Best wishes, alex. |
From: alexander s. <al...@go...> - 2012-12-09 10:05:26
|
On 09.12.2012 11:20, Werner F. Bruhin wrote: > > I like to have what I call a master template, currently probably just > two, one A4 Portrait and one A4 Landscape and both would have a standard > report header and footer. I would use a text file preprocessor for that. cpp is a tool at hand, but I'm sure there are others. A template system might also be a choice. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2012-12-09 10:04:20
|
Hi Alex, I see this error when I click on the "template" and "printout" link in the first para on this page: http://pythonreports.sourceforge.net/ An error has been encountered in accessing this page. 1. *Server:* pythonreports.sourceforge.net 2. *URL path:* /prt.html 3. *Error notes:* NONE 4. *Error type:* 404 5. *Request method:* GET 6. *Request query string:* NONE 7. *Time:* 2012-12-09 10:01:37 UTC (1355047297) Werner |
From: alexander s. <al...@go...> - 2012-12-09 09:56:13
|
On 09.12.2012 11:17, Werner F. Bruhin wrote: > > What is the recommended way to handle I18N? > > Do I import the "_" gettext/wxPython translation macro and then wrap > things like this _(u"some text to translate"), or ....? We here solve that by keeping different sets of template files for different languages. It is not difficult to support parallel sets of text files using tools like meld, or vim -d, or kdiff3, or even DVCS (in fact, we support a small subset unique for each customer), and it is not always possible to just drop in translated text and still have convenient page layout. Apart from different lengths of the same phrase in different languages, there are business differences for different countries and cultures. But yes, you can call ugettext/ungetttext in expressions. Though I'm not sure if message extraction tools would process such files. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2012-12-09 09:18:46
|
Hi, I like to have what I call a master template, currently probably just two, one A4 Portrait and one A4 Landscape and both would have a standard report header and footer. Is that best done as sub-report and if yes anything particular I have to watch out for? Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-09 09:16:07
|
Hi, What is the recommended way to handle I18N? Do I import the "_" gettext/wxPython translation macro and then wrap things like this _(u"some text to translate"), or ....? Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-09 09:02:40
|
Alex and Den, Thanks for your answers. I will merge Alex's latest changes with my local stuff, to be able to retain "persist" and "WIT" and will continue to learn/test/work with PythonReports using wxPython 2.9.4+. Have a nice Sunday Werner |
From: alexander s. <al...@go...> - 2012-12-09 08:01:59
|
On 08.12.2012 20:07, Werner F. Bruhin wrote: > >> 1) Plate Button has _SetState method instead of SetState in wxPython >> 2.9. So the fix is simple. Just replace all "SetState" occurrences in >> PythonReports/editor/elements/container.py file to "_SetState". > > Yes, one could just change it to _SetState (as I did in the suggested > patch), but I don't understand why you even call SetState - was it a > problem in 2.8? Yes, why? >> 3) "..." missing in list elements, because of PropertyGrid is for >> "wxPython 2.8". > > Again if the one change I suggested causes an issue in 2.8 > then why not make it conditional on the wx version. Your change works well with 2.8 and is included in PythonReports version 0.6.1. > Wouldn't you want to keep PythonReports compatible in one source code > for 2.8.x and 2.9.x I would definitely want that. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2012-12-08 18:05:48
|
Hi, On 08/12/2012 16:39, kacah wrote: > First of all I think I should create new discussion for PythonReports > editor problems onwxPython 2.9, because of "Patch for editor save and > save-as options" is not the problem, and I don't know why are you > discussing all bugs under that topic. That's why I think mailing > lists are completelyunreadable... Sorry, you are right should have continued with different threads, one for each issue. > > 1) Plate Button has _SetState method instead of SetState in wxPython > 2.9. So the fix is simple. Just replace all "SetState" occurrences in > PythonReports/editor/elements/container.py file to "_SetState". Yes, one could just change it to _SetState (as I did in the suggested patch), but I don't understand why you even call SetState - was it a problem in 2.8? The code in editor.elements.container.py for e.g. OnLeftDown is as far as I can see already done in platebtn.OnLeftDown handler, so couldn't the OnLeftDown and even highlight methods be removed or made conditional (e.g. using "if wx.VERSION > (2, 9, 0, 0)") on 2.8 if there was/is an issue with this in 2.8. > > 2) There are some background color problems with Plate Buttons. > Background color of Elements tree also should be fixed. There was a thread on the wxPython list just the other day and I believe Cody has a fix for it but wants to do more testing. > > 3) "..." missing in list elements, because of PropertyGrid is for > "wxPython 2.8". "..." is missing in all non standart PropertyGrid > properties (in all, that starts with Py...). ListProperty is inherited > from PyLongStringProperty, so it also has this bug. Yes, I understand that you have based this on the sourceforge version of the PropertyGrid which only became part or was wrapped by Robin for wxPython in the 2.9 series. Again if the one change I suggested causes an issue in 2.8 then why not make it conditional on the wx version. > > 4) There were huge problems with size, minsize and sizer of sections > developing this editor, so for now I don't know normal solution for > minsize problem. I believe we should search for it only after wxPython > 2.9 release, because of it may not work with current wxPython 2.8 version. wxPython 2.9 is released, there is already 2.9.4 and according to Robin 2.9.5 will soon come out. Do you mean to wait for 3.0? Wouldn't you want to keep PythonReports compatible in one source code for 2.8.x and 2.9.x and maybe (if needed) create a non backwards compatible version for wxPython Phoenix? Sizer handling has changed in 2.9 and some of it in a non backwards compatible way (lots of discussion on the wxWidget and wxPython list some time ago - overall goal was to make it cleaner better if I correctly understand what was said), so I would think the sooner one starts to test with 2.9x the better for everyone as maybe there are some issues the wx team might want to fix before 3.0 comes out. If some of these changes cause issues with 2.8.x then maybe still do them but have in a few places conditional code based on version. > > I suggest you to use wxPython 2.8 with PythonReports for now. If you > wan't to use wxPython 2.9 in your projects maybe this can help you: > http://www.wxpython.org/docs/api/wxversion-module.html The above won't work for me as I am planning to call PythonReports from within my application and maybe (not decided yet) provide the designer in my application distribution package (I use py2exe'd at this point but will look at other "freezer" packages and maybe even totally review/change the way I distribute early next year). My application, only works with 2.9+, and my application will not be released before the middle of 2013 with testing starting in early 2013 for at least 6 month. I am more then happy to be a "guinea pig" for the 2.9 version of PythonReports and to keep reporting issues I come across and if I can even suggest a patch. Best regards and have a nice weekend Werner |
From: kacah <kac...@gm...> - 2012-12-08 15:40:16
|
First of all I think I should create new discussion for PythonReports editor problems onwxPython 2.9, because of "Patch for editor save and save-as options" is not the problem, and I don't know why are you discussing all bugs under that topic. That's why I think mailing lists are completelyunreadable... 1) Plate Button has _SetState method instead of SetState in wxPython 2.9. So the fix is simple. Just replace all "SetState" occurrences in PythonReports/editor/elements/container.py file to "_SetState". 2) There are some background color problems with Plate Buttons. Background color of Elements tree also should be fixed. 3) "..." missing in list elements, because of PropertyGrid is for "wxPython 2.8". "..." is missing in all non standart PropertyGrid properties (in all, that starts with Py...). ListProperty is inherited from PyLongStringProperty, so it also has this bug. 4) There were huge problems with size, minsize and sizer of sections developing this editor, so for now I don't know normal solution for minsize problem. I believe we should search for it only after wxPython 2.9 release, because of it may not work with current wxPython 2.8 version. I suggest you to use wxPython 2.8 with PythonReports for now. If you wan't to use wxPython 2.9 in your projects maybe this can help you: http://www.wxpython.org/docs/api/wxversion-module.html |
From: Werner F. B. <wer...@fr...> - 2012-12-08 08:21:04
|
Hi Alex, I am waiting for the fat to melt, so a little time in front of computer. On 08/12/2012 07:46, alexander smishlajev wrote: > On 08.12.2012 0:01, Werner F. Bruhin wrote: >>> Text diff is fine, just don't use HTML in emails. >> Noted, and I set you and the list address as "text" recipient - >> but not sure this takes - is this one coming in as html for you? > This one is plain text. > >> Do you consider the WIT and the Persist stuff too, or do you have an >> issue with them - no problem either way. > Yes, I do consider, and yes, I have issues. ... > > For SetState fix, I don't understand why this method should not be > called in user code. I don't know why such calls are needed, either. So > I'm waiting when I meet with Den to ask him how this should be handled. I don't think SetState needs to be called, I think the base control does already do the "right" thing - at least to my eyes (but I am known to overlook little graphical differences). > > For Widget Inspection Tool, I understand that it is useful for UI > hacking, but I don't see it needed in production application. It's like > debug prints: you insert print statements all around your code, find > your bug, and then remove those prints. Perhaps it could be added with > InitInspection call hidden under "if False", but I did not made my mind > about that yet. Usually unneeded imports are not good for application > size and, mainly, for start-up times. I kind of agree, but:) - I don't use print statements to debug:), mostly use WingIDE to debug and lately I started using the Python logging module - I find having the WIT always there is very very very handy, even in production code. Haven't looked at what the overhead is but I didn't see a big increase in my shareware which I package with py2exe - so if I need to debug a py2exe'd version I just press ctrl-alt-i and get pretty far with this. Obviously totally up to you how you want to handle in PythonReports, what about a command line option "-d" and if present then the WIT.App is used, otherwise the normal wx.App. > > For element size change, there is a note that MinSize has issues. I'd > like to hear a comment from Den, too. Anyway, 50 is too big: there are > certain uses for elements with height near zero. What about putting MinSize back to -1 and do a call to SetInitialSize with 50 or something like that? Haven't tested if that would work. > > I have checked in font family fix. > > For persistence, I have just looked through it more carefully, and I > thing that will do. I'd probably add that after looking through code > yet another time. Note that the one style I use on this is only in recent versions of wx.lib.agw.persist, so if you test on wx 2.8 you need to get the agw stuff from SVN or condition the style setting (PM.PM_RESTORE_CAPTION_FROM_CODE) with version 2.9>. You might also want to consider moving the one line from the close event handler to a menu handler, so one saves the layout when one is happy and not on each close of the application. > >> Have a nice weekend - doing "confit de canard" over the next couple of >> days - so less time for computers:). > Wow! Does it take several days of intensive cooking? Yes it takes about 2-3 days but not full time. Yesterday we were cutting the four ducks up (2 persons for about 4 hours) and put some of it in the freezer, now the fat is being melted down (which one needs to check very often) and then this after noon we are doing the "confit" bit, which is cooking the meat which hasn't gone into the freezer in the melted down fat and then we put it into chars and sterilize it. And then we do the same thing again in early January - just to make sure that we don't starve next year:-) . Have a nice weekend Werner |
From: alexander s. <al...@go...> - 2012-12-08 06:48:23
|
On 08.12.2012 0:01, Werner F. Bruhin wrote: > >> Text diff is fine, just don't use HTML in emails. > > Noted, and I set you and the list address as "text" recipient - > but not sure this takes - is this one coming in as html for you? This one is plain text. > Do you consider the WIT and the Persist stuff too, or do you have an > issue with them - no problem either way. Yes, I do consider, and yes, I have issues. For SetState fix, I don't understand why this method should not be called in user code. I don't know why such calls are needed, either. So I'm waiting when I meet with Den to ask him how this should be handled. For Widget Inspection Tool, I understand that it is useful for UI hacking, but I don't see it needed in production application. It's like debug prints: you insert print statements all around your code, find your bug, and then remove those prints. Perhaps it could be added with InitInspection call hidden under "if False", but I did not made my mind about that yet. Usually unneeded imports are not good for application size and, mainly, for start-up times. For element size change, there is a note that MinSize has issues. I'd like to hear a comment from Den, too. Anyway, 50 is too big: there are certain uses for elements with height near zero. I have checked in font family fix. For persistence, I have just looked through it more carefully, and I thing that will do. I'd probably add that after looking through code yet another time. > Have a nice weekend - doing "confit de canard" over the next couple of > days - so less time for computers:). Wow! Does it take several days of intensive cooking? Cheers, alex. |
From: Werner F. B. <wer...@fr...> - 2012-12-07 22:00:13
|
Hi Alex, On 07/12/2012 16:14, alexander smishlajev wrote: > Werner F. Bruhin wrote, at 07.12.2012 15:58: >> Attached another little patch to add save/save-as options. > I have checked in an update for Save/SaveAs command. Thanks > >> P.S. >> FYI, locally have split the previous patch into individual commits on >> bazaar. So, if you like them in some other form let me know - but keep >> in mind that I now close to nothing about bazaar. > Text diff is fine, just don't use HTML in emails. Noted, and I set you and the list address as "text" recipient - but not sure this takes - is this one coming in as html for you? > > Werner F. Bruhin wrote, at 07.12.2012 16:49: >> Needed to change this to get the button in wx 2.9.4 for the "list" >> properties. > This is checked in too. Great. Do you consider the WIT and the Persist stuff too, or do you have an issue with them - no problem either way. Have a nice weekend - doing "confit de canard" over the next couple of days - so less time for computers:). Werner |
From: alexander s. <al...@go...> - 2012-12-07 15:15:31
|
Werner F. Bruhin wrote, at 07.12.2012 15:58: > > Attached another little patch to add save/save-as options. I have checked in an update for Save/SaveAs command. > P.S. > FYI, locally have split the previous patch into individual commits on > bazaar. So, if you like them in some other form let me know - but keep > in mind that I now close to nothing about bazaar. Text diff is fine, just don't use HTML in emails. Werner F. Bruhin wrote, at 07.12.2012 16:49: > > Needed to change this to get the button in wx 2.9.4 for the "list" > properties. This is checked in too. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2012-12-07 14:48:24
|
Hi Alex, On 07/12/2012 15:14, Werner F. Bruhin wrote: ... > "font", "style", "group" are in the "lists" category at the bottom of > the properties pane. > I see, there is another little problem with 2.9.4 here as the "..." > button to view the list doesn't show. IIRC have seen this in other > programs but don't recall the details. Will try to figure it out over > the next few days. Needed to change this to get the button in wx 2.9.4 for the "list" properties. === modified file PythonReports/editor/propertiesgrid.py --- PythonReports/editor/propertiesgrid.py 2012-12-05 09:13:33 +0000 +++ PythonReports/editor/propertiesgrid.py 2012-12-07 14:44:24 +0000 @@ -560,6 +560,10 @@ def GetClassName(self): return self.__class__.__name__ + + def GetEditor(self): + # Set editor to have button + return "TextCtrlAndButton" def GetValueAsString(self, flags): """Just return property name + _list""" Best regards Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-07 14:13:14
|
On 07/12/2012 14:07, alexander smishlajev wrote: > Werner F. Bruhin wrote, at 07.12.2012 13:24: >> Wouldn't the Editor need quit a bit of work before this would be useful? > Perhaps there should be reprort preview before the editor would be > really useful. Shouldn't be difficult to add since the renderer is > there from the beginning of the project. Though, as far as I remember, > it had some glitches caused by insufficient DC resolution. > >> E.g. support for things like "font", "style", "group" (and others I >> haven't noticed that they are not yet supported). > As far as I know, the editor fully supports all template elements. > > "font", "style", "group" are in the "lists" category at the bottom of > the properties pane. I see, there is another little problem with 2.9.4 here as the "..." button to view the list doesn't show. IIRC have seen this in other programs but don't recall the details. Will try to figure it out over the next few days. See you Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-07 13:57:49
|
Hi, Attached another little patch to add save/save-as options. Werner P.S. FYI, locally have split the previous patch into individual commits on bazaar. So, if you like them in some other form let me know - but keep in mind that I now close to nothing about bazaar. |
From: alexander s. <al...@go...> - 2012-12-07 13:35:04
|
Werner F. Bruhin wrote, at 07.12.2012 13:24: > > Wouldn't the Editor need quit a bit of work before this would be useful? Perhaps there should be reprort preview before the editor would be really useful. Shouldn't be difficult to add since the renderer is there from the beginning of the project. Though, as far as I remember, it had some glitches caused by insufficient DC resolution. > E.g. support for things like "font", "style", "group" (and others I > haven't noticed that they are not yet supported). As far as I know, the editor fully supports all template elements. "font", "style", "group" are in the "lists" category at the bottom of the properties pane. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2012-12-07 11:23:01
|
On 06/12/2012 09:48, alexander smishlajev wrote: > On 05.12.2012 22:08, Werner F. Bruhin wrote: >> What are your dev plans for PythonReports over the next few month - if any? > Well, I'm about to start using PythonReports in a new project; perhaps > that will result in some changes caused by new uses. Version 0.6.1, > which I plan to release really soon, would add new variable calculation > methods "list", "set", and "chain" and support for PDF encription along > with some rendering and compatibility fixes. > > Aside from that, there are no distinct plans. Features I'd like to see > include: > > - Standalone Windows binary+installer for wx-based editor that would > allow template editing on pythonless machines. Wouldn't the Editor need quit a bit of work before this would be useful? E.g. support for things like "font", "style", "group" (and others I haven't noticed that they are not yet supported). > > - HTML rendering. I guess this would be really useful when used with web frameworks such as Django/Turbogears and co > > - Front end for DB API + PythonReprorts that would provide database > reporting functionality found in products similar to PythonReports. > > - Outline tags to compose a table of contents for a report. > > I plan to work on that binary when I get some tuits, but it is unlikely > that I will start implementing any other features of this list. > >> What are your plans with the two designers will you continue developing >> both or .....? > As for me, I like Tk-based designer for template debugging and preview. > I use simple text editor to write templates. The WISIWYG editor was > meant for people coming from such platforms as FoxPro, MS Access, or > CrystalReports. The idea was mine, but author of the UI design and > editor code is Den Paltov. I am coming from ReportManager and a long time ago R&R (which we used in hotels as the reporting tool (dbase/clipper - Fidelio) and I use the first for my shareware. I have a few users who like to tweak the provided reports and for this a nice WISIWYG (or close) editor is just a must. I like to move away from ReportManager as it is really only Windows and having something Python/wxPython based is very attrative for me as my app is done in wxPython. If it would support all elements (font, style, group ...) then I am not even sure if a true Preview is that much needed, one could also just start a "wxprint" type script from within the designer which asks for the data and generates a PDF and then use the users preferred PDF viewer. Hope that Dan will find some time to keep working on it. > >> Is there somewhere a list of mandatory elements? > I don't believe there are mandatory elements other than the detail > section (and parent elements for it: layout and report). I looked again, the elements causing problem related to the "font" and "style" element, they are not created by the wx editor, nor shown if one loads a tk editor created template. > > Mandatory attributes should all be marked as such in the documentation, > http://pythonreports.sourceforge.net/prt.shtml Noticed those about half an hour after this - thanks. Werner |
From: Robin D. <ro...@al...> - 2012-12-07 01:17:55
|
On 12/5/12 12:57 AM, Werner wrote: > > It looks like a bug in wxPropertyGrid: logically, field names and > category names would go to different name spaces. > > And you get the exception because you use development version of > wxPython which has assertions enabled. Starting with 2.9 all builds will have assertions enabled by default, and IMO it is wrong to ever turn them off for wxPython. If something triggers an assertion then it means that the calling code has done something wrong and it is much nicer to get an exception raised than to silently ignore it or possibly crash. > > End Quote > > This is what I get when I run it with 1.4.15 installed into wxPython > 2.8.12 in the prop grid, so it confirms that there is problem with > duplicate name, hopefully fix will make it into 2.9.5:-) . Is there a ticket for it in wx's Trac? I think 2.9.5 is coming pretty soon so it may not make it in unless Jaakko jumps on it right away. -- Robin Dunn Software Craftsman http://wxPython.org |
From: Werner F. B. <wer...@fr...> - 2012-12-06 18:57:46
|
Hi Alex, I wanted to see what is what and I often use the wxPython WIT for that and I find it also very useful to track down sizer issues and at the same time I put in the code to persist the AUI layout. I am not sure how you want to deal with the SetState issue on the platebutton - the patch includes the code I use to be able to run it with wxPython 2.9.4. I hope you find this useful as is or at least as a start for however you would like to implement it. Currently the layout is persisted to the user configuration folder on closing, this could also be done as a user action (menu/toolbar). For the persist stuff to work things have to be named, that is why there are a few "name=" added and why the Workspace pane is added slightly differently to the aui manager. Best regards Werner |
From: alexander s. <al...@go...> - 2012-12-06 08:56:46
|
On 05.12.2012 22:08, Werner F. Bruhin wrote: > > What are your dev plans for PythonReports over the next few month - if any? Well, I'm about to start using PythonReports in a new project; perhaps that will result in some changes caused by new uses. Version 0.6.1, which I plan to release really soon, would add new variable calculation methods "list", "set", and "chain" and support for PDF encription along with some rendering and compatibility fixes. Aside from that, there are no distinct plans. Features I'd like to see include: - Standalone Windows binary+installer for wx-based editor that would allow template editing on pythonless machines. - HTML rendering. - Front end for DB API + PythonReprorts that would provide database reporting functionality found in products similar to PythonReports. - Outline tags to compose a table of contents for a report. I plan to work on that binary when I get some tuits, but it is unlikely that I will start implementing any other features of this list. > What are your plans with the two designers will you continue developing > both or .....? As for me, I like Tk-based designer for template debugging and preview. I use simple text editor to write templates. The WISIWYG editor was meant for people coming from such platforms as FoxPro, MS Access, or CrystalReports. The idea was mine, but author of the UI design and editor code is Den Paltov. > Is there somewhere a list of mandatory elements? I don't believe there are mandatory elements other than the detail section (and parent elements for it: layout and report). Mandatory attributes should all be marked as such in the documentation, http://pythonreports.sourceforge.net/prt.shtml > I like the wx designer better, so I hope that is the "future" and if yes > I will try and have ago and doing the change to allow to "Insert", > "Delete" elements and maybe also to move them, unless someone is already > working on this. I wish you good luck. If you make any progress, please keep us informed. Best wishes, alex. |
From: alexander s. <al...@go...> - 2012-12-06 07:11:17
|
On 05.12.2012 22:24, Werner F. Bruhin wrote: > > Now to my question I define my fields like this: > > "drinkinfo.subregion_lv.name" and my "data" contains a few entries of > type "cellarbook" each of them has "drinkinfo" relation and it I have > things like "country_lv", "subregion_lv" etc etc, some of them are > optional, i.e. not present on all rows. How should that be defined in > the "expr"? There are at least two ways, depending on your goal: 1. Add "printwhen" condition to the style of your field. 2. Use conditional expression, something like "drinkinfo.subregion_lv.name if 'lv' in drinkinfo.subregions else '--'" > Could I call a method of my own, something along these lines: > > def getRelInfo(objval, sainst): > """Get related information > > :param objval: e.g. "drinkinfo.someoptionalrel.name" > :param sainst: an SA Instance of the row, e.g. a "cellarbook" entry/row > :return: the column value or blank > > """ That is not a method, that's function. To call a (non-builtin) function you have to import module defining that function. See http://pythonreports.sourceforge.net/prt.shtml#import And yes, you should be able to call any method of a data object. Please see SQLAlchemy documentation if you need custom method on ORM objects. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2012-12-05 20:23:22
|
Hi Alex, O.K. redid my report using the Tk designer and added a few fields and preview - success:-) . Now to my question I define my fields like this: "drinkinfo.subregion_lv.name" and my "data" contains a few entries of type "cellarbook" each of them has "drinkinfo" relation and it I have things like "country_lv", "subregion_lv" etc etc, some of them are optional, i.e. not present on all rows. How should that be defined in the "expr"? Could I call a method of my own, something along these lines: def getRelInfo(objval, sainst): """Get related information :param objval: e.g. "drinkinfo.someoptionalrel.name" :param sainst: an SA Instance of the row, e.g. a "cellarbook" entry/row :return: the column value or blank """ try: newAttr = sainst parts = objval.attribute_name.split(".") rel, colname = (parts[:-1], parts[-1:][0]) for r in rel: if newAttr: with no_autoflush(wx.GetApp().ds): newAttr = getattr(newAttr, r) if newAttr: return getattr(newAttr, colname) else: return "" Thanks for hints, or links to documentation or a examples. Werner |
From: Werner F. B. <wer...@fr...> - 2012-12-05 20:07:23
|
Hi Alex, What are your dev plans for PythonReports over the next few month - if any? What are your plans with the two designers will you continue developing both or .....? Is there somewhere a list of mandatory elements? I started doing a report (in the wx designer) and then tried to open it in the Tk one and got an error, then some others when trying to preview my report in the Tk designer (after I manually added what was missing). Maybe a "New Template" could be changed so that all the mandatory elements are created. I like the wx designer better, so I hope that is the "future" and if yes I will try and have ago and doing the change to allow to "Insert", "Delete" elements and maybe also to move them, unless someone is already working on this. Before I start with this I am going to work on a simple report over the next few days when I have time and use data produced by a SQLAlchemy query - this is also kind of a show stopper for me. Again thanks for the time you spend on responding my posts. Have a nice evening. Werner |