On Wednesday, November 17, 2010 05:58:23 pm John Fabiani wrote:
> Hi,
> I had an itch!
> I'd like to commit the following to provide a way to change the color of
> the text associated with a dCheckBox.  Below is the patch.  I'm NOT sure
> this the best way to have others check my code - so tell me if there is a
> better way! Since this is not my code I'm changing I did not just commit!
> 
> Index: .
> ===================================================================
> --- . (revision 6179)
> +++ . (working copy)
> @@ -6,6 +6,7 @@
> 
>  import dDataControlMixin as dcm
>  import dabo.dEvents as dEvents
> +import dabo.dColors as dColors
>  from dabo.dLocalize import _
>  from dabo.ui import makeDynamicProperty
> 
> @@ -95,6 +96,17 @@
>                       except KeyError:
>                               state = False
>                       self.Set3StateValue(state)
> +
> +     def _getFontColor(self):
> +             return self.GetForegroundColour()
> +
> +     def _setFontColor(self, val):
> +             if isinstance(val, basestring):
> +                     val = dColors.colorTupleFromName(val)
> +                     self.SetForegroundColour(val)
> +             else:
> +                     self.SetForegroundColour(val)
> +
> 
> 
>       # property definitions follow:
> @@ -118,6 +130,8 @@
> 
>       Value = property(_getValue, _setValue, None,
>                       _("Specifies the current state of the control (the 
> value of
> the field). (varies)"))
> +
> +     ForeColor = ForeColour = property(_getFontColor, _setFontColor, None,
> _("Set the color of the font"))
> 
> 
>       DynamicAlignment = makeDynamicProperty(Alignment)
> @@ -130,6 +144,8 @@
>  class _dCheckBox_test(dCheckBox):
>       def initProperties(self):
>               self.Caption = _("Do you wish to pass?")
> +     def afterInit(self):
> +             self.ForeColor = 'red'
> 
>  if __name__ == "__main__":
>       import test
> 
> Johnf

Also if the code is accepted a change to the available properties of the 
ClassDesigner will be required.  It again is not my code but it's not to hard 
to change if memory serves.

Johnf

_______________________________________________
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