def insertHtmlMessage(self, text, setAsDefault=True, minLines=4, maxLines=10, replace=True): """Insert <text> (HTML) into the message groupbox. <minLines> - The minimum number of lines (of text) to display in the TextEdit. if <minLines>=0 the TextEdit will fit its own height to fit <text>. The default height is 4 (lines of text). <maxLines> - The maximum number of lines to display in the TextEdit widget. <replace> should be set to False if you do not wish to replace the current text. It will append <text> instead. Shows the message groupbox if it is hidden. """ if setAsDefault: self.defaultText = text self.setAsDefault = True if replace: self.MessageTextEdit.clear() if text: self._setHeight(minLines, maxLines) QTextEdit.insertHtml(self.MessageTextEdit, text) self.show() else: # Hide the message groupbox if it contains no text. self.hide()
def insertHtml(self, text, setAsDefault=False, minLines=4, maxLines=6, replace=True): """ Insert <text> (HTML) into the Prop Mgr's message groupbox. <minLines> is the minimum number of lines to display, even if the text takes up fewer lines. The default number of lines is 4. <maxLines> is the maximum number of lines to diplay before adding a vertical scrollbar. <replace> should be set to False if you do not wish to replace the current text. It will append <text> instead. """ if setAsDefault: self.defaultText = text self.setAsDefault = True if replace: # Replace the text by selecting effectively all text and # insert the new text 'over' it (overwrite). :jbirac: 20070629 cursor = self.textCursor() cursor.setPosition(0, QTextCursor.MoveAnchor) cursor.setPosition(len(self.toPlainText()), QTextCursor.KeepAnchor) self.setTextCursor(cursor) QTextEdit.insertHtml(self, text) if replace: # Restore the previous cursor position/selection and mode. cursor.setPosition(len(self.toPlainText()), QTextCursor.MoveAnchor) self.setTextCursor(cursor)
def insertHtml(self, text, setAsDefault = False, minLines = 4, maxLines = 6, replace = True ): """ Insert <text> (HTML) into the Prop Mgr's message groupbox. <minLines> is the minimum number of lines to display, even if the text takes up fewer lines. The default number of lines is 4. <maxLines> is the maximum number of lines to diplay before adding a vertical scrollbar. <replace> should be set to False if you do not wish to replace the current text. It will append <text> instead. """ if setAsDefault: self.defaultText = text self.setAsDefault = True if replace: # Replace the text by selecting effectively all text and # insert the new text 'over' it (overwrite). :jbirac: 20070629 cursor = self.textCursor() cursor.setPosition( 0, QTextCursor.MoveAnchor ) cursor.setPosition( len(self.toPlainText()), QTextCursor.KeepAnchor ) self.setTextCursor( cursor ) QTextEdit.insertHtml(self, text) if replace: # Restore the previous cursor position/selection and mode. cursor.setPosition( len(self.toPlainText()), QTextCursor.MoveAnchor ) self.setTextCursor( cursor )