RefactoringRope/PreviewDialogBase.py

changeset 343
c40aa744ed47
parent 326
67bcde9c65b9
child 346
877cac2e8d94
equal deleted inserted replaced
342:0a18c09cb9eb 343:c40aa744ed47
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 from PyQt5.QtCore import Qt 12 from PyQt5.QtCore import Qt
13 from PyQt5.QtGui import QBrush, QColor, QTextCursor 13 from PyQt5.QtGui import QBrush, QTextCursor
14 from PyQt5.QtWidgets import QDialog 14 from PyQt5.QtWidgets import QDialog
15 15
16 from .Ui_PreviewDialog import Ui_PreviewDialog 16 from .Ui_PreviewDialog import Ui_PreviewDialog
17 17
18 import Globals 18 import Globals
19 import Preferences
19 20
20 21
21 class PreviewDialogBase(QDialog, Ui_PreviewDialog): 22 class PreviewDialogBase(QDialog, Ui_PreviewDialog):
22 """ 23 """
23 Class implementing a dialog base class to preview changes. 24 Class implementing a dialog base class to preview changes.
38 else: 39 else:
39 self.previewEdit.setFontFamily("Monospace") 40 self.previewEdit.setFontFamily("Monospace")
40 41
41 self.formats = {} 42 self.formats = {}
42 self.formats[' '] = self.previewEdit.currentCharFormat() 43 self.formats[' '] = self.previewEdit.currentCharFormat()
44
43 charFormat = self.previewEdit.currentCharFormat() 45 charFormat = self.previewEdit.currentCharFormat()
44 charFormat.setBackground(QBrush(QColor(190, 237, 190))) 46 charFormat.setBackground(
47 QBrush(Preferences.getDiffColour("AddedColor")))
45 self.formats['+'] = charFormat 48 self.formats['+'] = charFormat
49
46 charFormat = self.previewEdit.currentCharFormat() 50 charFormat = self.previewEdit.currentCharFormat()
47 charFormat.setBackground(QBrush(QColor(237, 190, 190))) 51 charFormat.setBackground(
52 QBrush(Preferences.getDiffColour("RemovedColor")))
48 self.formats['-'] = charFormat 53 self.formats['-'] = charFormat
54
49 charFormat = self.previewEdit.currentCharFormat() 55 charFormat = self.previewEdit.currentCharFormat()
50 charFormat.setBackground(QBrush(QColor(190, 190, 237))) 56 charFormat.setBackground(
57 QBrush(Preferences.getDiffColour("ReplacedColor")))
51 self.formats['@'] = charFormat 58 self.formats['@'] = charFormat
59
52 charFormat = self.previewEdit.currentCharFormat() 60 charFormat = self.previewEdit.currentCharFormat()
53 charFormat.setBackground(QBrush(QColor(124, 124, 124))) 61 charFormat.setBackground(
62 QBrush(Preferences.getDiffColour("ContextColor")))
54 self.formats['?'] = charFormat 63 self.formats['?'] = charFormat
64
55 charFormat = self.previewEdit.currentCharFormat() 65 charFormat = self.previewEdit.currentCharFormat()
56 charFormat.setBackground(QBrush(QColor(190, 190, 190))) 66 charFormat.setBackground(
67 QBrush(Preferences.getDiffColour("HeaderColor")))
57 self.formats['='] = charFormat 68 self.formats['='] = charFormat
58 69
59 def _appendText(self, txt, charFormat): 70 def _appendText(self, txt, charFormat):
60 """ 71 """
61 Protected method to append text to the end of the contents pane. 72 Protected method to append text to the end of the contents pane.

eric ide

mercurial