Bug#431962: python-gnome2-desktop: gtksourceview.SourceTagStyle().mask is not writable
Adeodato Simó
dato at net.com.org.es
Wed Jul 18 18:06:24 UTC 2007
* Josselin Mouette [Tue, 17 Jul 2007 23:55:33 +0200]:
> Le vendredi 06 juillet 2007 à 13:29 +0200, Adeodato Simó a écrit :
> > Package: python-gnome2-desktop
> > Version: 2.18.0-2
> > Severity: normal
> > Tags: upstream
> > Hello.
> > It seems that the 'mask' attribute of gtksourceview.SourceTagStyle
> > objects is not writable, but instead derived whenever
> > SourceTagSytle.foreground or SourceTagStyle.background are set (see
> > gtksourceview.override).
> > I see no reason for this to be this way, since it breaks setting all
> > three foreground, background and mask, letting the TagStyle object
> > figure out which colors to finally use. Which works from C (it's what
> > gedit does, see string_to_tag_style() in gedit-languages-manager.c).
> > All this makes it necessary when working in Python code to check the
> > value of mask, and refraining from setting foreground or background
> > colors according to its value, which seems more unpythonic to me than
> > having the attribute writable.
> The upstream developers don't intend to change that:
> "I disagree. The 'mask' field only exists because of limitations in the C
> language. In Python we can instead automatically compute mask based on the
> attributes that have been actually set, which is more intuitive and less error
> prone. I don't know why you'd ever want to e.g. modify style.background but
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> not set the flag in style.mask saying background was set."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bah, I made that very clear in my text:
> > it breaks setting all
> > three foreground, background and mask, letting the TagStyle object
> > figure out which colors to finally use. Which works from C (it's what
> > gedit does, see string_to_tag_style() in gedit-languages-manager.c).
If you read from gedit's configuration files, background and foreground
are stored, even if only the foreground was configured (the background
is set to #000). So what gedit does is set both colors, plus the mask
(which is also stored), and let the tagstyle code figure out what to
use. That is not possible from Python.
> If you need more information, I suggest you followup on the upstream
> bug: http://bugzilla.gnome.org/show_bug.cgi?id=456750
Many thanks for forwarding the bug upstream. Would you mind forwarding
the above as well, so that the developer can see at least what's the use
case? (Since I doubt he'll change his mind; so this should be the last
comment on this bug.)
Thanks,
--
Adeodato Simó dato at net.com.org.es
Debian Developer adeodato at debian.org
Listening to: The Rolling Stones - Undercover of the Night
More information about the pkg-gnome-maintainers
mailing list