Fixes for layer info.

git-svn-id: http://svn.robofab.com/branches/ufo3k@535 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
This commit is contained in:
Tal Leming 2011-12-28 04:20:47 +00:00
parent 08a3293c63
commit 4edebba7fc
2 changed files with 13 additions and 3 deletions

View File

@ -20,7 +20,7 @@ from robofab import RoboFabError
from robofab.misc.arrayTools import updateBounds, pointInRect, unionRect, sectRect from robofab.misc.arrayTools import updateBounds, pointInRect, unionRect, sectRect
from fontTools.pens.basePen import AbstractPen from fontTools.pens.basePen import AbstractPen
from defcon.objects.color as DefconColor from defcon.objects.color import Color as DefconColor
# ---- # ----
# Base # Base

View File

@ -664,10 +664,14 @@ class RLayer(RBaseObject):
def __init__(self, layer): def __init__(self, layer):
super(RLayer, self).__init__() super(RLayer, self).__init__()
self._object = layer self._object = layer
self._lib = None
def glyphClass(self): def glyphClass(self):
return RGlyph return RGlyph
def libClass(self):
return RLib
# XXX def __repr__(self): # XXX def __repr__(self):
# layer info # layer info
@ -680,7 +684,10 @@ class RLayer(RBaseObject):
lib = property(_get_lib) lib = property(_get_lib)
def _get_color(self): def _get_color(self):
return BaseColor(self._object.color) color = self._object.color
if color is not None:
color = BaseColor(color)
return color
def _set_color(self, value): def _set_color(self, value):
self._object.color = value self._object.color = value
@ -1572,6 +1579,9 @@ if __name__ == "__main__":
print print
print "lib:", font.lib print "lib:", font.lib
print print
print "layer:", font.layers[None], [layer for layer in font.layers] print "layer:", font.layers[None]
font.layers[None].color = ".5, 1, 0, .2"
print "layer.color:", font.layers[None].color
print "layer.lib:", font.layers[None].lib
print print