reporting framework for wx (was: ideas for Andrea)

Werner F. Bruhin wrote:

One question, does it handle I18n issues? I.e. can one report
definition handle multiple languages for all the text strings
(preferably using gettext) and are date formats adjusted to the user
settings (mm/dd/yyyy or dd/mm/yyyy etc etc)?

It is close, yes.

···

--
Paul McNett
http://paulmcnett.com
http://dabodev.com

Igor Prischepoff wrote:

> http://paulmcnett.com/dabo-sample-report_invoice.rfxml
I think it would be nice to see PDF output of this report.

Okay...
http://paulmcnett.com/dabo-sample-report_invoice.pdf

  And most complex case which this Writer could handle, i.e. subtotals,
totals, images, page margins, coloring lines (for example negative ones)
etc...

I believe this report sample shows most of this. The coloring of lines or text isn't done, but here's what you would do. Referring to the invoice.rfxml file, if you add a line at #557 making the fontColor dynamic instead of the default hard-coded black, it would work. The example I show below anticipates a python feature that isn't implemented yet, but you get the idea:

<string>
  <expr>self.Record["amount"]</expr>
  <fontColor>(0, 0, 0) if self.Record["amount"] >= 0 else (.7, .1, .1)</fontColor>
  <hAnchor>"right"</hAnchor>
  <align>"right"</align>
  <height>12</height>
  <width>"0.75 in"</width>
  <x>"6.925 in"</x>
  <vAnchor>"top"</vAnchor>
  <y>self.Bands["detail"]["height"]</y>
</string>

Is it possible?
Can it handle non latin letters (other languages) as well?

Whatever encoding you set it to.

Can it work on Windows?

Yes.

I'm willing to test it if you show me where i can get it.
I'm afraid my proxy have blocked CVS access, so can't get to CVS port.

Can you do subversion?

svn checkout svn://paulmcnett.com/dabo/trunk dabo
svn checkout svn://paulmcnett.com/daboide/trunk daboide

The report writer is in dabo/lib/reportWriter.py
The report designer is in daboide/ReportDesigner.py

···

> If the Dabo Report Writer could be seen as a good start, it wouldn't be too
> difficult to use it separately from Dabo itself.
That's good.
I have evaluated last Dabo build (from site, not from CVS) but didn't find any reporting tools in it.

--
Paul McNett
http://paulmcnett.com
http://dabodev.com

Hi Paul,

Paul McNett wrote:

Werner F. Bruhin wrote:

One question, does it handle I18n issues? I.e. can one report
definition handle multiple languages for all the text strings
(preferably using gettext) and are date formats adjusted to the user
settings (mm/dd/yyyy or dd/mm/yyyy etc etc)?

It is close, yes.

One more question, how do you handle "report parameters", e.g. there might be some selection stuff on there (e.g. only invoice number 15), or how to sort etc? Are they defined using the report designer or does one have to build them separately in wxPython?

See you
Werner

Werner F. Bruhin wrote:

One more question, how do you handle "report parameters", e.g. there might be some selection stuff on there (e.g. only invoice number 15), or how to sort etc? Are they defined using the report designer or does one have to build them separately in wxPython?

The report writer only takes in a dataset (list of dicts) and combines it with a report form (rfxml). How you create the dataset is up to you.

In the case of my invoice report, the "invoice" menu item pops up a frame that prompts the user for invoice number, date range, client range, etc. Then I run the SQL query, get the dataset, modify some stuff in the dataset, and pass that on to the report writer to get the PDF.

···

--
Paul McNett
http://paulmcnett.com
http://dabodev.com

Paul McNett wrote:

The report writer only takes in a dataset (list of dicts) and combines it with a report form (rfxml). How you create the dataset is up to you.

By the way, how are you generating the pdf? Reportlab? or roll your own?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Chris Barker wrote:

By the way, how are you generating the pdf? Reportlab? or roll your own?

Reportlab.

···

--
Paul McNett
http://paulmcnett.com
http://dabodev.com

Hi Paul,

Paul McNett wrote:

Werner F. Bruhin wrote:

One more question, how do you handle "report parameters", e.g. there might be some selection stuff on there (e.g. only invoice number 15), or how to sort etc? Are they defined using the report designer or does one have to build them separately in wxPython?

The report writer only takes in a dataset (list of dicts) and combines it with a report form (rfxml). How you create the dataset is up to you.

Fair enough.

I currently use Report Manager for reporting, it offers "report parameters" on which you define selection criteria (with optional lookup from the db). It is not as flexible as your solution but it is simple to use, even for none programmers with a little bit of technical understanding.

In the case of my invoice report, the "invoice" menu item pops up a frame that prompts the user for invoice number, date range, client range, etc. Then I run the SQL query, get the dataset, modify some stuff in the dataset, and pass that on to the report writer to get the PDF.

BTW, when you do your next version could you provide the db for download. I already use Firebird so it would be much easier to play around with it on my machine, instead of connecting via the Internet (especially as I am still on dial up - ADSL is only coming to the village next year).

See you
Werner

Andreas Kaiser wrote:

Hi,

Andreas Kaiser wrote:

I will sort the information about this thread and put it on the
list.

Should we use the wxPython wiki for discuss and collect the infos
about reporting framework?

For collect yes, but for discussion I think that the better solution is
the mailing list - or - private mail if you want, so we don't will
annoying this list :slight_smile:

Andreas

Michele

Andreas Kaiser wrote:

Hi Michele,

Michele Petrazzo schrieb:

Other idea that now jump into my mind is to modify my PySketch_2
for make a report designer for the engine posted by Ricardo.

What do you think?

I've played with your pysketch2. Following point are remarkable:

1. Draw an easy sketch, esp. textObjects. 2. Name the textObjects.

Yes.I'll do it in the next free time, with also the align and size (like
to the smallest, to the largest) of the objs

3. Save the file.

But pysketch2 already save the file! or you mean save into xml?

4. At line 1989 (in loadContents):

for layer, type, data in objData: print data if data[23] == 'Text0':
#This is the name of my textObject data[16] = u'Andreas' # change the
content obj = DrawingObject(type, layer=layer) obj.setData(data) self.Contents[layer].append(obj) self.__objCounter[type] +=1

I think that a new object type, like you say (textObjects) is the better
solution!

5. Voila, it works!

With pysketch we can preview, setup, print only with wxPython. So I think, there is a way to separate pysketch in a designer part
(already done ;-))) and a control for embedding in the wxPython app.
The control has only the load, preview, setup, print functions.

Yes, I think the same. But what do you think about the integration of
Ricardo code for preview and other functions?

However I have to split pysketch2 into some class, because I use the
same code for another draw application, so they will be more specialized
classes and the code will be more simply reusable (also for the
functions that you mentioned if we don't decide to use Ricardo's code)

Questions: What about the core function for reporting DB-tables? How
can we made this?

Good question! I haven't a big experience about print of data became
from a db! I have experience with another printing framework that I use,
not develop, but it's closely connected to its db-data (that is a thing
that I, and I hope you, not want to do)
I think that the solution used by reportman is that we could try to use,
so leave to the user create the data file that, after, the framework can
read.

Logical example:

designer part:
  -create some bands: header, text1, text2, footer (random names)
   -header's field names: title, date
   -text1's field names: name, surname, image
   -text2's field names: bill,month ( restaurants bill for this year :slight_smile: )
   -footer_user's field names: total(a formula that calculate the bill
    sum for this user)
   -footer's field names: total (a formula that calculate the bill sum)

external application part:
  -do some query, do some work, do number calculation (or not?)
  -create a xml file (or csv file) like:
  -header;title=Print for example;data=2006
  -text1;name=Michele;surname=Petrazzo;image=base64 encoding image
  -text2;bill=200,month=01
  -text2;bill=200,month=02
  -text2;bill=200,month=03
  -footer_user;
  -text1;name=OtherName;surname=OtherSurname;image=base64 encoding image
  -footer_user;
  -footer;

preview part:
  -read the data passed into the command line (for a stand-alone print
   application) or from the data passed by python code
  -Start the preview, drawing the data with the instruction passed by the
   caller. Pay attention if into the report the user want to make some
   calculations at preview time (the sum for example)
  -Finally print, if the user want! :slight_smile:

Do you like this like starting idea?

What about page breaks?

No problems! With the printout derived class, we can do what we want!
Into th

For the moment, I will play around with the pysketch solution.

Tell me if you have other ideas! (or code, of course!)

Andreas

Michele

Can you do subversion?
svn checkout svn://paulmcnett.com/dabo/trunk dabo
svn checkout svn://paulmcnett.com/daboide/trunk daboide

Do you have http version of repository?

The report writer is in dabo/lib/reportWriter.py
The report designer is in daboide/ReportDesigner.py

Downloaded nightly tarball. November,25.

···

-------------------------
:python ReportDesigner.py
Dabo Info Log: Thu Nov 24 12:18:31 2005: 1 database connection definition(s) loaded.
Dabo Info Log: Thu Nov 24 12:18:31 2005: User interface already set to 'wx', so dApp didn't touch it.
Dabo Info Log: Thu Nov 24 12:18:31 2005: wxPython Version: 2.6.1.0 wxMSW (ascii)
Traceback (most recent call last):
  File "ReportDesigner.py", line 1838, in ?
    form.getCurrentEditor().newFile()
  File "ReportDesigner.py", line 1332, in newFile
    self.initReportForm()
  File "ReportDesigner.py", line 1368, in initReportForm
    b = Band(self, Caption=band)
  File "C:\Python23\Lib\site-packages\Dabo-0.4.2-py2.3.egg\dabo\ui\uiwx\dPanel.py", line 19, in __init__
    cm.dControlMixin.__init__(self, preClass, parent, properties, *args, **kwargs)
  File "C:\Python23\Lib\site-packages\Dabo-0.4.2-py2.3.egg\dabo\ui\uiwx\dPemMixin.py", line 130, in __init__
    self.setProperties(properties)
  File "C:\Python23\Lib\site-packages\Dabo-0.4.2-py2.3.egg\dabo\lib\propertyHelperMixin.py", line 170, in setProperties
    _setProps(propDict)
  File "C:\Python23\Lib\site-packages\Dabo-0.4.2-py2.3.egg\dabo\lib\propertyHelperMixin.py", line 162, in _setProps
    setter(self, _propDict[prop])
  File "ReportDesigner.py", line 985, in _setCaption
    self.bandLabel.Caption = val
AttributeError: 'Band' object has no attribute 'bandLabel'

--
Ñ óâàæåíèåì, Ïðèùåïîâ Èãîðü
                         mailto:igor@tyumbit.ru

Igor Prischepoff wrote:

> Can you do subversion?
> svn checkout svn://paulmcnett.com/dabo/trunk dabo
> svn checkout svn://paulmcnett.com/daboide/trunk daboide
Do you have http version of repository?
> The report writer is in dabo/lib/reportWriter.py
> The report designer is in daboide/ReportDesigner.py
Downloaded nightly tarball. November,25.
-------------------------
:python ReportDesigner.py

[snip]

AttributeError: 'Band' object has no attribute 'bandLabel'

Thanks for reporting this. This problem is solved. But remember, the Report Designer isn't working yet. However, launch it with:

python ReportDesigner.py sampleReport.rfxml

and note how you can move things, resize things with the mouse, as well as with the property sheet.

···

--
Paul McNett
http://paulmcnett.com
http://dabodev.com