def line_slice_iterator(self, new_line_separator=True):
        """Return an iterator on the line's flat slices.  If *new_line_separator* is set then the line
        separator is included.

        """

        if new_line_separator:
            for start, end in pairwise(self._line_start_locations):
                yield FlatSlice(start, end)
        else:
            for i, start_end in enumerate(pairwise(
                    self._line_start_locations)):
                start, end = start_end
                end -= len(self._line_separators[i])
                yield FlatSlice(start, end)
Ejemplo n.º 2
0
    def line_slice_iterator(self, new_line_separator=True):

        """Return an iterator on the line's flat slices.  If *new_line_separator* is set then the line
        separator is included.

        """

        if new_line_separator:
            for start, end in pairwise(self._line_start_locations):
                yield FlatSlice(start, end)
        else:
            for i, start_end in enumerate(pairwise(self._line_start_locations)):
                start, end = start_end
                end -= len(self._line_separators[i])
                yield FlatSlice(start, end)
Ejemplo n.º 3
0
    def end(self):
        """Insert a block and set the y positions."""

        self._cursor.insertBlock()
        self._text_blocks[-1].y_bottom = self.y()
        for text_block0, text_block1 in pairwise(self._text_blocks):
            text_block0.y_bottom = text_block1.y_top
Ejemplo n.º 4
0
    def end(self):

        """Insert a block and set the y positions."""

        self._cursor.insertBlock()
        self._text_blocks[-1].y_bottom = self.y()
        for text_block0, text_block1 in pairwise(self._text_blocks):
            text_block0.y_bottom = text_block1.y_top