Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_markColor(self):
value = self.lib.get("public.markColor")
if value is not None:
value = Color(value)
return value
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))
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))
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))
def _get_markColor(self):
value = self.lib.get("public.markColor")
if value is not None:
value = Color(value)
return value
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))
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
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))
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))
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