Ejemplo n.º 1
0
    def insertUnorderedList(self):
        """
        Inserts an ordered list into the editor.
        """
        cursor = self.editor().textCursor()
        currlist = cursor.currentList()
        new_style = QTextListFormat.ListDisc
        indent = 1

        if currlist:
            format = currlist.format()
            indent = format.indent() + 1
            style = format.style()

            if style == QTextListFormat.ListDisc:
                new_style = QTextListFormat.ListCircle
            elif style == QTextListFormat.ListCircle:
                new_style = QTextListFormat.ListSquare

        new_format = QTextListFormat()
        new_format.setStyle(new_style)
        new_format.setIndent(indent)
        new_list = cursor.createList(new_format)

        self.editor().setFocus()

        return new_list
Ejemplo n.º 2
0
    def insertUnorderedList(self):
        """
        Inserts an ordered list into the editor.
        """
        cursor = self.editor().textCursor()
        currlist = cursor.currentList()
        new_style = QTextListFormat.ListDisc
        indent = 1

        if currlist:
            format = currlist.format()
            indent = format.indent() + 1
            style = format.style()

            if style == QTextListFormat.ListDisc:
                new_style = QTextListFormat.ListCircle
            elif style == QTextListFormat.ListCircle:
                new_style = QTextListFormat.ListSquare

        new_format = QTextListFormat()
        new_format.setStyle(new_style)
        new_format.setIndent(indent)
        new_list = cursor.createList(new_format)

        self.editor().setFocus()

        return new_list
Ejemplo n.º 3
0
    def insertOrderedList(self):
        """
        Inserts an ordered list into the editor.
        """
        cursor = self.editor().textCursor()
        currlist = cursor.currentList()
        new_style = QTextListFormat.ListDecimal
        indent = 1

        if currlist:
            format = currlist.format()
            indent = format.indent() + 1
            style = format.style()

            if style == QTextListFormat.ListDecimal:
                new_style = QTextListFormat.ListLowerRoman
            elif style == QTextListFormat.ListLowerRoman:
                new_style = QTextListFormat.ListUpperAlpha
            elif style == QTextListFormat.ListUpperAlpha:
                new_style = QTextListFormat.ListLowerAlpha

        new_format = QTextListFormat()
        new_format.setStyle(new_style)
        new_format.setIndent(indent)
        new_list = cursor.createList(new_format)

        self.editor().setFocus()

        return new_list
Ejemplo n.º 4
0
    def insertOrderedList(self):
        """
        Inserts an ordered list into the editor.
        """
        cursor = self.editor().textCursor()
        currlist = cursor.currentList()
        new_style = QTextListFormat.ListDecimal
        indent = 1

        if currlist:
            format = currlist.format()
            indent = format.indent() + 1
            style = format.style()

            if style == QTextListFormat.ListDecimal:
                new_style = QTextListFormat.ListLowerRoman
            elif style == QTextListFormat.ListLowerRoman:
                new_style = QTextListFormat.ListUpperAlpha
            elif style == QTextListFormat.ListUpperAlpha:
                new_style = QTextListFormat.ListLowerAlpha

        new_format = QTextListFormat()
        new_format.setStyle(new_style)
        new_format.setIndent(indent)
        new_list = cursor.createList(new_format)

        self.editor().setFocus()

        return new_list