dabo Commit
Revision 3654
Date: 2007-11-11 10:06:03 -0800 (Sun, 11 Nov 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3654
Changed:
U trunk/dabo/lib/datanav2/Form.py
Log:
Made the handling of reporting a little smarter. If the required modules aren't
present, the Quick Report button will be disabled. This was made at the
suggestion of Heling Yao, who noticed that clicking the report button caused
his app to "crash", when it was simply exiting; without a terminal window,
there is no indication or explanation as to what happened.
Diff:
Modified: trunk/dabo/lib/datanav2/Form.py
===================================================================
--- trunk/dabo/lib/datanav2/Form.py 2007-11-11 18:04:01 UTC (rev 3653)
+++ trunk/dabo/lib/datanav2/Form.py 2007-11-11 18:06:03 UTC (rev 3654)
@@ -9,6 +9,13 @@
import PageFrame
import Page
import Grid
+# See if the reporting libraries are present
+_has_reporting_libs = True
+try:
+ from dabo.lib.reportWriter import Report, Page, TestCursor, TestRecord,
String, Rectangle
+ from dabo.lib.reportWriter import ReportWriter
+except ImportError, e:
+ _has_reporting_libs = False
dabo.ui.loadUI("wx")
@@ -100,7 +107,7 @@
if self.FormType == "Normal":
self.appendToolBarButton(_("Quick Report"),
"%s/actions/document-print-preview.png" % iconPath,
- OnHit=self.onQuickReport, tip=_("Quick
Report"),
+ OnHit=self.onQuickReport, tip=_("Quick
Report"), Enabled=_has_reporting_libs,
help=_("Run a Quick Report on the
current dataset"))
@@ -202,7 +209,7 @@
def enableQuickReport(self):
## Can't enable quick report unless the dataset has been
requeried once and
## the browse grid exists (because it gets the layout from the
browse grid).
- ret = True
+ ret = _has_reporting_libs
try:
self.PageFrame.Pages[1].BrowseGrid
except AttributeError:
@@ -546,8 +553,6 @@
def getAutoReportForm_list(self):
- from dabo.lib.reportWriter import Report, Page, TestCursor,
TestRecord, String, Rectangle
- from dabo.lib.reportWriter import ReportWriter
grid = self.PageFrame.Pages[1].BrowseGrid
rw = ReportWriter()
rf = rw.ReportForm = Report(reportWriter=rw, parent=None)
_______________________________________________
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/dabo-dev/[EMAIL PROTECTED]