def set_content(self, content):
        """
        Sets document with given content while providing undo capability.

        :param content: Content to set.
        :type content: list
        :return: Method success.
        :rtype: bool
        """

        cursor = self.textCursor()
        cursor.movePosition(QTextCursor.Start, QTextCursor.MoveAnchor)
        cursor.movePosition(QTextCursor.End, QTextCursor.KeepAnchor)
        cursor.removeSelectedText()
        for line in content:
            self.moveCursor(QTextCursor.End)
            self.insertPlainText(line)
        return True
def set_content ( self , content ) : cursor = self . textCursor ( ) cursor . movePosition ( QTextCursor . Start , QTextCursor . MoveAnchor ) cursor . movePosition ( QTextCursor . End , QTextCursor . KeepAnchor ) cursor . removeSelectedText ( ) for line in content : self . moveCursor ( QTextCursor . End ) self . insertPlainText ( line ) return True
Sets document with given content while providing undo capability.

        :param content: Content to set.
        :type content: list
        :return: Method success.
        :rtype: bool