dabo Commit
Revision 5445
Date: 2009-09-29 21:20:00 -0700 (Tue, 29 Sep 2009)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5445

Changed:
A   trunk/dabo/lib/reporting_tests/invoice_demo/invoice_progressControl.py

Log:
Added demo showing a basic reporting form with a progress control.


Diff:
Added: trunk/dabo/lib/reporting_tests/invoice_demo/invoice_progressControl.py
===================================================================
--- trunk/dabo/lib/reporting_tests/invoice_demo/invoice_progressControl.py      
                        (rev 0)
+++ trunk/dabo/lib/reporting_tests/invoice_demo/invoice_progressControl.py      
2009-09-30 04:20:00 UTC (rev 5445)
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+This demo is like invoice.py, but shows how to use the progress dialog.
+"""
+import dabo
+dabo.ui.loadUI("wx")
+from dabo.dReportWriter import dReportWriter
+from dabo.lib import reportUtils
+
+class ReportingForm(dabo.ui.dForm):
+       def initProperties(self):
+               self.Caption = "Invoice Report"
+
+       def afterInit(self):
+               ms = self.Sizer = dabo.ui.dSizer("v")
+               ms.append(dabo.ui.dLabel(self, Caption="Invoice Report with 
Cancelable Progress Output"), "expand")
+               self.progress = dabo.ui.dReportProgress(self)
+               ms.append(self.progress)
+               ms.append(dabo.ui.dButton(self, Caption="Preview", 
OnHit=self.onPreview))
+               self.fitToSizer()
+
+       def onPreview(self, evt):
+               self.SaveRestorePosition = False
+               self.preview()
+
+       def preview(self):
+               rw = dReportWriter()
+               rw.ReportFormFile = "invoice.rfxml"
+               rw.OutputFile = "invoice.pdf"
+               rw.UseTestCursor = True
+               rw.bindEvent(dabo.dEvents.ReportEnd, self.onReportEnd)
+               rw.ProgressControl = self.progress
+               self.progress.ReportWriter = rw
+               rw.write()
+
+       def onReportEnd(self, evt):
+               """Will be called only if the user didn't cancel; you could 
also bind to
+               ReportCancel to set a flag, but this seemed cleaner."""
+               print "report end"
+               reportUtils.previewPDF("invoice.pdf")
+
+
+app = dabo.dApp(MainFormClass=ReportingForm)
+app.start()
+


Property changes on: 
trunk/dabo/lib/reporting_tests/invoice_demo/invoice_progressControl.py
___________________________________________________________________
Name: svn:executable
   + *




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to