Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Lib/defcon/objects/guideline.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ def _set_color(self, color):
oldColor = self.get("color")
if newColor == oldColor:
return
self["color"] = newColor
if newColor is None:
del self["color"]
else:
self["color"] = newColor
self.postNotification("Guideline.ColorChanged", data=dict(oldValue=oldColor, newValue=newColor))

color = property(_get_color, _set_color, doc="The guideline's :class:`Color` object. When setting, the value can be a UFO color string, a sequence of (r, g, b, a) or a :class:`Color` object. Setting this posts *Guideline.ColorChanged* and *Guideline.Changed* notifications.")
Expand Down
2 changes: 2 additions & 0 deletions Lib/defcon/test/objects/test_guideline.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ def test_color(self):
g = Guideline()
g.color = "1,1,1,1"
self.assertEqual(g.color, "1,1,1,1")
self.assertTrue("color" in g)
self.assertTrue(g.dirty)
g.color = None
self.assertIsNone(g.color)
self.assertFalse("color" in g)
self.assertTrue(g.dirty)

def test_identifier(self):
Expand Down
Loading