RefactoringRope/PreviewDialogBase.py

branch
eric7
changeset 389
4f53795beff0
parent 374
958f34e97952
child 396
933b8fcd854f
equal deleted inserted replaced
388:cb044ec27c24 389:4f53795beff0
19 19
20 class PreviewDialogBase(QDialog, Ui_PreviewDialog): 20 class PreviewDialogBase(QDialog, Ui_PreviewDialog):
21 """ 21 """
22 Class implementing a dialog base class to preview changes. 22 Class implementing a dialog base class to preview changes.
23 """ 23 """
24
24 def __init__(self, parent=None): 25 def __init__(self, parent=None):
25 """ 26 """
26 Constructor 27 Constructor
27 28
28 @param parent reference to the parent widget 29 @param parent reference to the parent widget
29 @type QWidget 30 @type QWidget
30 """ 31 """
31 QDialog.__init__(self, parent) 32 QDialog.__init__(self, parent)
32 self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) 33 self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
33 self.setupUi(self) 34 self.setupUi(self)
34 35
35 if Globals.isWindowsPlatform(): 36 if Globals.isWindowsPlatform():
36 self.previewEdit.setFontFamily("Lucida Console") 37 self.previewEdit.setFontFamily("Lucida Console")
37 else: 38 else:
38 self.previewEdit.setFontFamily("Monospace") 39 self.previewEdit.setFontFamily("Monospace")
39 40
40 self.formats = {} 41 self.formats = {}
41 self.formats[' '] = self.previewEdit.currentCharFormat() 42 self.formats[" "] = self.previewEdit.currentCharFormat()
42 43
43 charFormat = self.previewEdit.currentCharFormat() 44 charFormat = self.previewEdit.currentCharFormat()
44 charFormat.setBackground( 45 charFormat.setBackground(QBrush(Preferences.getDiffColour("AddedColor")))
45 QBrush(Preferences.getDiffColour("AddedColor"))) 46 self.formats["+"] = charFormat
46 self.formats['+'] = charFormat 47
47
48 charFormat = self.previewEdit.currentCharFormat() 48 charFormat = self.previewEdit.currentCharFormat()
49 charFormat.setBackground( 49 charFormat.setBackground(QBrush(Preferences.getDiffColour("RemovedColor")))
50 QBrush(Preferences.getDiffColour("RemovedColor"))) 50 self.formats["-"] = charFormat
51 self.formats['-'] = charFormat 51
52
53 charFormat = self.previewEdit.currentCharFormat() 52 charFormat = self.previewEdit.currentCharFormat()
54 charFormat.setBackground( 53 charFormat.setBackground(QBrush(Preferences.getDiffColour("ReplacedColor")))
55 QBrush(Preferences.getDiffColour("ReplacedColor"))) 54 self.formats["@"] = charFormat
56 self.formats['@'] = charFormat 55
57
58 charFormat = self.previewEdit.currentCharFormat() 56 charFormat = self.previewEdit.currentCharFormat()
59 charFormat.setBackground( 57 charFormat.setBackground(QBrush(Preferences.getDiffColour("ContextColor")))
60 QBrush(Preferences.getDiffColour("ContextColor"))) 58 self.formats["?"] = charFormat
61 self.formats['?'] = charFormat 59
62
63 charFormat = self.previewEdit.currentCharFormat() 60 charFormat = self.previewEdit.currentCharFormat()
64 charFormat.setBackground( 61 charFormat.setBackground(QBrush(Preferences.getDiffColour("HeaderColor")))
65 QBrush(Preferences.getDiffColour("HeaderColor"))) 62 self.formats["="] = charFormat
66 self.formats['='] = charFormat 63
67
68 def _appendText(self, txt, charFormat): 64 def _appendText(self, txt, charFormat):
69 """ 65 """
70 Protected method to append text to the end of the contents pane. 66 Protected method to append text to the end of the contents pane.
71 67
72 @param txt text to insert 68 @param txt text to insert
73 @type str 69 @type str
74 @param charFormat text format to be used 70 @param charFormat text format to be used
75 @type QTextCharFormat 71 @type QTextCharFormat
76 """ 72 """

eric ide

mercurial