Ticket #1143: testRprt.py

File testRprt.py, 1.0 kB (added by kweinert, 5 months ago)

test script

Line 
1 #!/usr/bin/python
2 # -*- coding: iso8859_15 -*-
3
4 import dabo
5 from dabo.lib.reportWriter import ReportWriter
6 from dabo.lib import reportUtils
7 from treepower.res import getResource
8
9    
10 if __name__ == "__main__":
11     dabo.infoLog.write("onButtonReportResPlanHit: Instantiating the report writer...")
12     rw = ReportWriter()
13     # Set some required properties:
14     rw.ReportFormFile = getResource("resourcePlan.rfxml")
15     rw.OutputFile = outFile = reportUtils.getTempFile()
16     rw.Encoding="utf-8"
17     # rw.Cursor = #todo
18     # (Normally, you'd also set the Cursor property, to provide the data,
19     #  but this sample just uses the test cursor inside the report form.)
20
21     # Set some optional properties:
22     rw.UseTestCursor = True
23     rw.ShowBandOutlines = True
24
25     dabo.infoLog.write("onButtonReportResPlanHit: Writing %s..." % outFile)
26     rw.write()
27
28     dabo.infoLog.write("onButtonReportResPlanHit: Trying to preview it...")
29     reportUtils.previewPDF(outFile)     
30    
31     raw_input("press enter for deletion...")