10 import sys |
10 import sys |
11 import re |
11 import re |
12 import contextlib |
12 import contextlib |
13 import enum |
13 import enum |
14 |
14 |
15 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QFileInfo, Qt, QEvent |
15 from PyQt6.QtCore import pyqtSignal, pyqtSlot, QFileInfo, Qt, QEvent |
16 from PyQt5.QtGui import QClipboard, QPalette, QFont |
16 from PyQt6.QtGui import QClipboard, QPalette, QFont, QShortcut |
17 from PyQt5.QtWidgets import ( |
17 from PyQt6.QtWidgets import ( |
18 QDialog, QInputDialog, QApplication, QMenu, QWidget, QHBoxLayout, |
18 QDialog, QInputDialog, QApplication, QMenu, QWidget, QHBoxLayout, |
19 QVBoxLayout, QShortcut, QSizePolicy |
19 QVBoxLayout, QSizePolicy |
20 ) |
20 ) |
21 from PyQt5.Qsci import QsciScintilla |
21 from PyQt6.Qsci import QsciScintilla |
22 |
22 |
23 from E5Gui.E5Application import e5App |
23 from E5Gui.E5Application import e5App |
24 from E5Gui import E5MessageBox |
24 from E5Gui import E5MessageBox |
25 |
25 |
26 from .QsciScintillaCompat import QsciScintillaCompat |
26 from .QsciScintillaCompat import QsciScintillaCompat |
434 |
434 |
435 # get the font for style 0 and set it as the default font |
435 # get the font for style 0 and set it as the default font |
436 key = 'Scintilla/{0}/style0/font'.format(self.lexer_.language()) |
436 key = 'Scintilla/{0}/style0/font'.format(self.lexer_.language()) |
437 fdesc = Preferences.Prefs.settings.value(key) |
437 fdesc = Preferences.Prefs.settings.value(key) |
438 if fdesc is not None: |
438 if fdesc is not None: |
439 font = QFont(fdesc[0], int(fdesc[1])) |
439 font = QFont([fdesc[0]], int(fdesc[1])) |
440 self.lexer_.setDefaultFont(font) |
440 self.lexer_.setDefaultFont(font) |
441 self.setLexer(self.lexer_) |
441 self.setLexer(self.lexer_) |
442 self.lexer_.readSettings(Preferences.Prefs.settings, "Scintilla") |
442 self.lexer_.readSettings(Preferences.Prefs.settings, "Scintilla") |
443 if self.lexer_.hasSubstyles(): |
443 if self.lexer_.hasSubstyles(): |
444 self.lexer_.readSubstyles(self) |
444 self.lexer_.readSubstyles(self) |
1246 Protected method to handle the mouse press event. |
1246 Protected method to handle the mouse press event. |
1247 |
1247 |
1248 @param event the mouse press event (QMouseEvent) |
1248 @param event the mouse press event (QMouseEvent) |
1249 """ |
1249 """ |
1250 self.setFocus() |
1250 self.setFocus() |
1251 if event.button() == Qt.MouseButton.MidButton: |
1251 if event.button() == Qt.MouseButton.MiddleButton: |
1252 lines = QApplication.clipboard().text(QClipboard.Mode.Selection) |
1252 lines = QApplication.clipboard().text(QClipboard.Mode.Selection) |
1253 self.paste(lines) |
1253 self.paste(lines) |
1254 else: |
1254 else: |
1255 super().mousePressEvent(event) |
1255 super().mousePressEvent(event) |
1256 |
1256 |