How to use the defcon.objects.color.Color function in defcon

To help you get started, we’ve selected a few defcon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sugarlabs / edit-fonts-activity / third_party / defcon / objects / glyph.py View on Github external
def _get_markColor(self):
        value = self.lib.get("public.markColor")
        if value is not None:
            value = Color(value)
        return value
github robotools / defcon / Lib / defcon / objects / guideline.py View on Github external
def _set_color(self, color):
        if color is None:
            newColor = None
        else:
            newColor = Color(color)
        oldColor = self.get("color")
        if newColor == oldColor:
            return
        self["color"] = newColor
        self.postNotification("Guideline.ColorChanged", data=dict(oldValue=oldColor, newValue=newColor))
github robotools / defcon / Lib / defcon / objects / glyph.py View on Github external
def _set_markColor(self, value):
        # convert to a color object
        if value is not None:
            value = Color(value)
        # don't write if there is no change
        oldValue = self.lib.get("public.markColor")
        if oldValue is not None:
            oldValue = Color(oldValue)
        if value == oldValue:
            return
        # remove
        if value is None:
            if "public.markColor" in self.lib:
                del self.lib["public.markColor"]
        # store
        else:
            self.lib["public.markColor"] = value
        self.postNotification(notification="Glyph.MarkColorChanged", data=dict(oldValue=oldValue, newValue=value))
github sugarlabs / edit-fonts-activity / third_party / defcon / objects / glyph.py View on Github external
def _set_markColor(self, value):
        # convert to a color object
        if value is not None:
            value = Color(value)
        # don't write if there is no change
        oldValue = self.lib.get("public.markColor")
        if oldValue is not None:
            oldValue = Color(oldValue)
        if value == oldValue:
            return
        # remove
        if value is None:
            if "public.markColor" in self.lib:
                del self.lib["public.markColor"]
        # store
        else:
            self.lib["public.markColor"] = value
        self.postNotification(notification="Glyph.MarkColorChanged",
                              data=dict(oldValue=oldValue,
                                        newValue=value))
github robotools / defcon / Lib / defcon / objects / glyph.py View on Github external
def _get_markColor(self):
        value = self.lib.get("public.markColor")
        if value is not None:
            value = Color(value)
        return value
github sugarlabs / edit-fonts-activity / third_party / defcon / objects / guideline.py View on Github external
def _set_color(self, color):
        if color is None:
            newColor = None
        else:
            newColor = Color(color)
        oldColor = self.get("color")
        if newColor == oldColor:
            return
        self["color"] = newColor
        self.postNotification("Guideline.ColorChanged",
                              data=dict(oldValue=oldColor,
                                        newValue=newColor))
github robotools / defcon / Lib / defcon / objects / layer.py View on Github external
def _set_color(self, color):
        if color is None:
            newColor = None
        else:
            newColor = Color(color)
        oldColor = self._color
        if oldColor != newColor:
            self._color = newColor
            data = dict(oldColor=oldColor, newColor=newColor)
            self.postNotification(notification="Layer.ColorChanged", data=data)
            self.dirty = True
github sugarlabs / edit-fonts-activity / third_party / defcon / objects / glyph.py View on Github external
def _set_markColor(self, value):
        # convert to a color object
        if value is not None:
            value = Color(value)
        # don't write if there is no change
        oldValue = self.lib.get("public.markColor")
        if oldValue is not None:
            oldValue = Color(oldValue)
        if value == oldValue:
            return
        # remove
        if value is None:
            if "public.markColor" in self.lib:
                del self.lib["public.markColor"]
        # store
        else:
            self.lib["public.markColor"] = value
        self.postNotification(notification="Glyph.MarkColorChanged",
                              data=dict(oldValue=oldValue,
                                        newValue=value))
github robotools / defcon / Lib / defcon / objects / image.py View on Github external
def _set_color(self, color):
        if color is None:
            newColor = None
        else:
            newColor = Color(color)
        oldColor = self.get("color")
        if newColor == oldColor:
            return
        self["color"] = newColor
        self.postNotification("Image.ColorChanged", data=dict(oldValue=oldColor, newValue=newColor))
github fonttools / fonttools / Lib / robofab / objects / objectsBase.py View on Github external
new.append(int(round(n)))
				setattr(self, name, new)
			else:
				v = getattr(self, name)
				if v is None:
					continue
				new = []
				for n in v:
					new.append([int(round(m)) for m in n])
				setattr(self, name, new)

# -----
# Color
# -----

class BaseColor(DefconColor): pass


# ---------
# Constants
# ---------

MOVE = 'move'
LINE = 'line'
CORNER = 'corner'
CURVE = 'curve'
QCURVE = 'qcurve'
OFFCURVE = 'offcurve'
DEGREE = 180 / math.pi

# ------------
# Math Support