daboide Commit
Revision 404
Date: 2006-01-27 18:05:54 -0800 (Fri, 27 Jan 2006)
Author: paul

Changed:
U   trunk/ReportDesigner.py

Log:
Added color editor to the report propsheet, allowing you to set things like
font color, stroke color, and fill color using the nifty getColor dialog.


Diff:
Modified: trunk/ReportDesigner.py
===================================================================
--- trunk/ReportDesigner.py     2006-01-28 02:04:46 UTC (rev 403)
+++ trunk/ReportDesigner.py     2006-01-28 02:05:54 UTC (rev 404)
@@ -620,6 +620,11 @@
                property value.
                """
                reInit = False
+
+               if typ == "color":
+                       # need to convert from rgb to reportlab rgb, and 
stringify.
+                       val = rdc.ActiveEditor._rw.getReportLabColorTuple(val)
+                       val = "(%.2f, %.2f, %.2f)" % (val[0], val[1], val[2])
                for obj in self._selected:
                        obj.setProp(prop, val)
                        if isinstance(obj, Group) and prop.lower() == "expr":
@@ -638,6 +643,18 @@
                        typ = objs[0].__class__.__name__
                self.lblType.Caption = typ
 
+       def editColor(self, objs, prop, val):
+               # Override base editColor: need to convert stringified rl tuple 
to 
+               # rgb tuple.
+               try:
+                       rgbTuple = eval(val)
+               except:
+                       rgbTuple = None
+               if rgbTuple is None:
+                       rgbTuple = (0, 0, 0)
+               rgbTuple = 
rdc.ActiveEditor._rw.getColorTupleFromReportLab(rgbTuple)
+               ReportPropSheet.doDefault(objs, prop, rgbTuple)
+               
 
 class PropSheetForm(DesignerControllerForm):
        def initProperties(self):




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to