diff -r cb044ec27c24 -r 4f53795beff0 RefactoringRope/PreviewDialogBase.py --- a/RefactoringRope/PreviewDialogBase.py Sat Jun 25 18:06:56 2022 +0200 +++ b/RefactoringRope/PreviewDialogBase.py Wed Sep 21 15:30:34 2022 +0200 @@ -21,54 +21,50 @@ """ Class implementing a dialog base class to preview changes. """ + def __init__(self, parent=None): """ Constructor - + @param parent reference to the parent widget @type QWidget """ QDialog.__init__(self, parent) self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) self.setupUi(self) - + if Globals.isWindowsPlatform(): self.previewEdit.setFontFamily("Lucida Console") else: self.previewEdit.setFontFamily("Monospace") - + self.formats = {} - self.formats[' '] = self.previewEdit.currentCharFormat() - + self.formats[" "] = self.previewEdit.currentCharFormat() + charFormat = self.previewEdit.currentCharFormat() - charFormat.setBackground( - QBrush(Preferences.getDiffColour("AddedColor"))) - self.formats['+'] = charFormat - - charFormat = self.previewEdit.currentCharFormat() - charFormat.setBackground( - QBrush(Preferences.getDiffColour("RemovedColor"))) - self.formats['-'] = charFormat - + charFormat.setBackground(QBrush(Preferences.getDiffColour("AddedColor"))) + self.formats["+"] = charFormat + charFormat = self.previewEdit.currentCharFormat() - charFormat.setBackground( - QBrush(Preferences.getDiffColour("ReplacedColor"))) - self.formats['@'] = charFormat - + charFormat.setBackground(QBrush(Preferences.getDiffColour("RemovedColor"))) + self.formats["-"] = charFormat + + charFormat = self.previewEdit.currentCharFormat() + charFormat.setBackground(QBrush(Preferences.getDiffColour("ReplacedColor"))) + self.formats["@"] = charFormat + charFormat = self.previewEdit.currentCharFormat() - charFormat.setBackground( - QBrush(Preferences.getDiffColour("ContextColor"))) - self.formats['?'] = charFormat - + charFormat.setBackground(QBrush(Preferences.getDiffColour("ContextColor"))) + self.formats["?"] = charFormat + charFormat = self.previewEdit.currentCharFormat() - charFormat.setBackground( - QBrush(Preferences.getDiffColour("HeaderColor"))) - self.formats['='] = charFormat - + charFormat.setBackground(QBrush(Preferences.getDiffColour("HeaderColor"))) + self.formats["="] = charFormat + def _appendText(self, txt, charFormat): """ Protected method to append text to the end of the contents pane. - + @param txt text to insert @type str @param charFormat text format to be used