Example #1
0
    def copy(self, parent=None):
        u"""Answer a full copy of self, where the "unique" fields are set to default.
        Also perform a deep copy on all child elements.

        >>> e = TextBox('Hello world', name='Child', w=100)
        >>> copyE = e.copy() # Copy the element attribute, including the string of self.
        >>> #copyE.bs # TODO: Needs development and testing
        Hello world
        """
        e = Element.copy(self, parent=parent)
        e.bs = self.bs # Copy the string separately.
        return e
Example #2
0
    def copy(self, parent=None):
        """Answer a full copy of self, where the "unique" fields are set to default.
        Also perform a deep copy on all child elements.

        >>> from pagebot.toolbox.color import blackColor, noColor
        >>> style = dict(textFill=blackColor, textStroke=noColor)
        >>> e = TextBox('Hello world', name='Child', w=100, style=style)
        >>> copyE = e.copy() # Copy the element attribute, including the string of self.
        >>> #copyE.bs # TODO: Needs development and testing
        Hello world
        """
        e = Element.copy(self, parent=parent)
        e.bs = self.bs  # Copy the string separately.
        return e
Example #3
0
    def copy(self, parent=None):
        """Answers a full copy of `self`, where the "unique" fields are set to
        default. Also performs a deep copy on all child elements.

        >>> from pagebot.toolbox.color import blackColor, noColor
        >>> from pagebot.toolbox.units import pt
        >>> from pagebot.contexts import getContext
        >>> from pagebot.document import Document
        >>> context = getContext()
        >>> doc = Document(w=300, h=400, context=context)
        >>> page = doc[1]
        >>> style = dict(textFill=blackColor, textStroke=noColor)
        >>> bs = context.newString('Hello world', style)
        >>> t = Text(bs, name='Child', w=100, parent=page)
        >>> copyE = t.copy() # Copy the element attribute, including the string of self.
        >>> copyE.bs
        $Hello worl...$
        """
        e = Element.copy(self, parent=parent)
        e.bs = deepcopy(self.bs)  # Copy the string separately.
        return e