5 |
5 |
6 """ |
6 """ |
7 Module implementing an editor for simple editing tasks. |
7 Module implementing an editor for simple editing tasks. |
8 """ |
8 """ |
9 |
9 |
|
10 import contextlib |
10 import os |
11 import os |
11 import pathlib |
12 import pathlib |
12 import re |
13 import re |
13 import contextlib |
|
14 |
14 |
15 import editorconfig |
15 import editorconfig |
16 |
16 |
|
17 from PyQt6.Qsci import QsciScintilla |
17 from PyQt6.QtCore import ( |
18 from PyQt6.QtCore import ( |
|
19 QCoreApplication, |
|
20 QPoint, |
|
21 QSignalMapper, |
|
22 QSize, |
|
23 Qt, |
|
24 QTimer, |
18 pyqtSignal, |
25 pyqtSignal, |
19 pyqtSlot, |
26 pyqtSlot, |
20 Qt, |
|
21 QSignalMapper, |
|
22 QPoint, |
|
23 QTimer, |
|
24 QSize, |
|
25 QCoreApplication, |
|
26 ) |
27 ) |
27 from PyQt6.QtGui import QKeySequence, QPalette, QFont, QPixmap, QActionGroup, QAction |
28 from PyQt6.QtGui import QAction, QActionGroup, QFont, QKeySequence, QPalette, QPixmap |
|
29 from PyQt6.QtPrintSupport import QAbstractPrintDialog, QPrintDialog, QPrinter |
28 from PyQt6.QtWidgets import ( |
30 from PyQt6.QtWidgets import ( |
29 QWidget, |
31 QApplication, |
30 QWhatsThis, |
|
31 QDialog, |
32 QDialog, |
|
33 QHBoxLayout, |
32 QInputDialog, |
34 QInputDialog, |
33 QApplication, |
35 QLabel, |
34 QMenu, |
36 QMenu, |
35 QVBoxLayout, |
37 QVBoxLayout, |
36 QHBoxLayout, |
38 QWhatsThis, |
37 QLabel, |
39 QWidget, |
38 ) |
40 ) |
39 from PyQt6.QtPrintSupport import QPrinter, QPrintDialog, QAbstractPrintDialog |
41 |
40 from PyQt6.Qsci import QsciScintilla |
42 from eric7 import Preferences, Utilities |
41 |
43 from eric7.EricGui import EricPixmapCache |
42 from eric7.EricGui.EricAction import EricAction, createActionGroup |
44 from eric7.EricGui.EricAction import EricAction, createActionGroup |
43 from eric7.EricWidgets import EricMessageBox, EricFileDialog |
45 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor |
|
46 from eric7.EricWidgets import EricFileDialog, EricMessageBox |
|
47 from eric7.EricWidgets.EricClickableLabel import EricClickableLabel |
44 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
48 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
45 from eric7.EricWidgets.EricClickableLabel import EricClickableLabel |
|
46 from eric7.EricWidgets.EricZoomWidget import EricZoomWidget |
49 from eric7.EricWidgets.EricZoomWidget import EricZoomWidget |
47 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor |
50 from eric7.Globals import isMacPlatform |
|
51 from eric7.UI import Config |
48 |
52 |
49 from .QsciScintillaCompat import QsciScintillaCompat |
53 from .QsciScintillaCompat import QsciScintillaCompat |
50 |
|
51 from eric7.EricGui import EricPixmapCache |
|
52 from eric7.UI import Config |
|
53 |
|
54 from eric7.Globals import isMacPlatform |
|
55 |
|
56 from eric7 import Preferences, Utilities |
|
57 |
54 |
58 |
55 |
59 class MiniScintilla(QsciScintillaCompat): |
56 class MiniScintilla(QsciScintillaCompat): |
60 """ |
57 """ |
61 Class implementing a QsciScintillaCompat subclass for handling focus |
58 Class implementing a QsciScintillaCompat subclass for handling focus |
3680 def __printPreviewFile(self): |
3677 def __printPreviewFile(self): |
3681 """ |
3678 """ |
3682 Private slot to show a print preview of the text. |
3679 Private slot to show a print preview of the text. |
3683 """ |
3680 """ |
3684 from PyQt6.QtPrintSupport import QPrintPreviewDialog |
3681 from PyQt6.QtPrintSupport import QPrintPreviewDialog |
|
3682 |
3685 from .Printer import Printer |
3683 from .Printer import Printer |
3686 |
3684 |
3687 printer = Printer(mode=QPrinter.PrinterMode.HighResolution) |
3685 printer = Printer(mode=QPrinter.PrinterMode.HighResolution) |
3688 if self.__curFile: |
3686 if self.__curFile: |
3689 printer.setDocName(pathlib.Path(self.__curFile).name) |
3687 printer.setDocName(pathlib.Path(self.__curFile).name) |