5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog base class to preview changes. |
7 Module implementing a dialog base class to preview changes. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt5.QtCore import Qt |
10 from PyQt6.QtCore import Qt |
11 from PyQt5.QtGui import QBrush, QTextCursor |
11 from PyQt6.QtGui import QBrush, QTextCursor |
12 from PyQt5.QtWidgets import QDialog |
12 from PyQt6.QtWidgets import QDialog |
13 |
13 |
14 from .Ui_PreviewDialog import Ui_PreviewDialog |
14 from .Ui_PreviewDialog import Ui_PreviewDialog |
15 |
15 |
16 import Globals |
16 import Globals |
17 import Preferences |
17 import Preferences |
27 |
27 |
28 @param parent reference to the parent widget |
28 @param parent reference to the parent widget |
29 @type QWidget |
29 @type QWidget |
30 """ |
30 """ |
31 QDialog.__init__(self, parent) |
31 QDialog.__init__(self, parent) |
32 self.setAttribute(Qt.WA_DeleteOnClose) |
32 self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) |
33 self.setupUi(self) |
33 self.setupUi(self) |
34 |
34 |
35 if Globals.isWindowsPlatform(): |
35 if Globals.isWindowsPlatform(): |
36 self.previewEdit.setFontFamily("Lucida Console") |
36 self.previewEdit.setFontFamily("Lucida Console") |
37 else: |
37 else: |
73 @type str |
73 @type str |
74 @param charFormat text format to be used |
74 @param charFormat text format to be used |
75 @type QTextCharFormat |
75 @type QTextCharFormat |
76 """ |
76 """ |
77 tc = self.previewEdit.textCursor() |
77 tc = self.previewEdit.textCursor() |
78 tc.movePosition(QTextCursor.End) |
78 tc.movePosition(QTextCursor.MoveOperation.End) |
79 self.previewEdit.setTextCursor(tc) |
79 self.previewEdit.setTextCursor(tc) |
80 self.previewEdit.setCurrentCharFormat(charFormat) |
80 self.previewEdit.setCurrentCharFormat(charFormat) |
81 self.previewEdit.insertPlainText(txt) |
81 self.previewEdit.insertPlainText(txt) |