def __init__( self, name=_("New Layer"), visible=1, printable=1, locked=0, outlined=0, outline_color=config.preferences.layer_color, is_MasterLayer=0, is_Page=0, ): EditableCompound.__init__(self, []) self.name = name self.visible = visible self.printable = printable self.locked = locked self.outlined = outlined self.is_MasterLayer = is_MasterLayer self.is_Page = is_Page if type(outline_color) == TupleType: if len(outline_color) == 3: outline_color = ("RGB", outline_color[0], outline_color[1], outline_color[2]) self.outline_color = apply(color.ParseSKColor, outline_color) else: self.outline_color = outline_color
def permute_objects(self, permutation): # make sure the mask stays at index 0 if permutation[0] != 0: permutation = list(permutation) permutation.remove(0) permutation.insert(0, 0) return EditableCompound.permute_objects(self, permutation)
def __init__(self, name=_("New Layer"), visible=1, printable=1, locked=0, outlined=0, outline_color=(0, 0, 0)): EditableCompound.__init__(self, []) self.name = name self.visible = visible self.printable = printable self.locked = locked self.outlined = outlined if type(outline_color) == TupleType: self.outline_color = apply(color.CreateRGBColor, outline_color) else: self.outline_color = outline_color
def PickObject(self, p, rect, device): if not self.visible: return None if self.outlined: device.StartOutlineMode() result = EditableCompound.PickObject(self, p, rect, device) if self.outlined: device.EndOutlineMode() return result
def SelectSubobject(self, p, rect, device, path=(), *rest): if not self.CanSelect(): return None if self.outlined: device.StartOutlineMode() try: result = EditableCompound.SelectSubobject(self, p, rect, device, path) finally: if self.outlined: device.EndOutlineMode() return result
def Draw(self, device, rect=None): # Draw all objects on the device device. RECT, if provided, # gives the bounding rect of the region to be drawn allowing to # optimize the redisplay by drawing only those objects that # overlap with this rect. if device.draw_visible and self.visible \ or device.draw_printable and self.printable: outlined = self.outlined or device.IsOutlineActive() if outlined: device.StartOutlineMode(self.outline_color) EditableCompound.DrawShape(self, device, rect) if outlined: device.EndOutlineMode()
def Ungroup(self): objects = EditableCompound.GetObjects(self) # Move the mask, which is in objects[0] to the end of the # objects list, because it was on top of all other objects # before the group was created. # # Use a copy of the objects list or we're modifying the list # used by the mask group itself with unpredictable consequences # for undo. # XXX perhaps it would be better to have GetObjects return a # copy of the list. objects = objects[:] objects.append(objects[0]) del objects[0] return objects
def __init__(self, name=_("New Layer"), visible=1, printable=1, locked=0, outlined=0, outline_color=config.preferences.layer_color, is_MasterLayer=0, is_Page=0): EditableCompound.__init__(self, []) self.name = name self.visible = visible self.printable = printable self.locked = locked self.outlined = outlined self.is_MasterLayer = is_MasterLayer self.is_Page = is_Page if type(outline_color) == TupleType: if len(outline_color) == 3: outline_color = ('RGB', outline_color[0], outline_color[1], outline_color[2]) self.outline_color = apply(color.ParseSKColor, outline_color) else: self.outline_color = outline_color
def Hit(self, p, rect, device): if self.objects[0].Hit(p, rect, device, clip=1): return EditableCompound.Hit(self, p, rect, device)
def ChildChanged(self, child): if child is self.objects[0]: if self.document is not None: self.document.AddClearRect(child.bounding_rect) EditableCompound.ChildChanged(self, child)
def __init__(self, objects=None, duplicate=None): EditableCompound.__init__(self, objects, duplicate=duplicate)
def __init__(self, name="", page_layout=PageLayout(), *args, **kw): self.name = name self.page_layout = page_layout EditableCompound.__init__(self, *args, **kw)