|
11 | 11 | from functools import partial |
12 | 12 |
|
13 | 13 | import __main__ |
| 14 | +import Qt as Qt_py |
14 | 15 | import six |
15 | 16 | from Qt import QtCompat, QtCore, QtWidgets |
16 | 17 | from Qt.QtCore import QByteArray, Qt, QTimer, Signal, Slot |
17 | | -from Qt.QtGui import QCursor, QFont, QIcon, QTextCursor |
| 18 | +from Qt.QtGui import QCursor, QFont, QIcon, QKeySequence, QTextCursor |
18 | 19 | from Qt.QtWidgets import ( |
19 | 20 | QApplication, |
20 | 21 | QFontDialog, |
21 | 22 | QInputDialog, |
22 | 23 | QMessageBox, |
23 | 24 | QTextBrowser, |
| 25 | + QTextEdit, |
24 | 26 | QToolTip, |
25 | 27 | QVBoxLayout, |
26 | 28 | ) |
@@ -172,7 +174,7 @@ def __init__(self, parent, name=None, run_workbox=False, standalone=False): |
172 | 174 | self.uiCompleterModeMENU.addSeparator() |
173 | 175 | action = self.uiCompleterModeMENU.addAction('Cycle mode') |
174 | 176 | action.setObjectName('uiCycleModeACT') |
175 | | - action.setShortcut(Qt.CTRL | Qt.Key_M) |
| 177 | + action.setShortcut(QKeySequence(Qt.Modifier.CTRL | Qt.Key.Key_M)) |
176 | 178 | action.triggered.connect(self.cycleCompleterMode) |
177 | 179 | self.uiCompleterModeMENU.hovered.connect(self.handleMenuHovered) |
178 | 180 |
|
@@ -542,7 +544,10 @@ def handleMenuHovered(self, action): |
542 | 544 | else: |
543 | 545 | text = action.toolTip() |
544 | 546 |
|
545 | | - menu = action.parentWidget() |
| 547 | + if Qt_py.IsPyQt4: |
| 548 | + menu = action.parentWidget() |
| 549 | + else: |
| 550 | + menu = action.parent() |
546 | 551 | QToolTip.showText(QCursor.pos(), text, menu) |
547 | 552 |
|
548 | 553 | def selectFont(self, monospace=False, proportional=False): |
@@ -722,7 +727,7 @@ def recordPrefs(self, manual=False): |
722 | 727 | pref.update( |
723 | 728 | { |
724 | 729 | 'loggergeom': [geo.x(), geo.y(), geo.width(), geo.height()], |
725 | | - 'windowState': int(self.windowState()), |
| 730 | + 'windowState': QtCompat.enumValue(self.windowState()), |
726 | 731 | 'SplitterVertical': self.uiEditorVerticalACT.isChecked(), |
727 | 732 | 'SplitterSize': self.uiSplitterSPLIT.sizes(), |
728 | 733 | 'tabIndent': self.uiIndentationsTabsACT.isChecked(), |
@@ -846,7 +851,7 @@ def restorePrefs(self): |
846 | 851 | sizes = pref.get('SplitterSize') |
847 | 852 | if sizes: |
848 | 853 | self.uiSplitterSPLIT.setSizes(sizes) |
849 | | - self.setWindowState(Qt.WindowStates(pref.get('windowState', 0))) |
| 854 | + self.setWindowState(Qt.WindowState(pref.get('windowState', 0))) |
850 | 855 | self.uiIndentationsTabsACT.setChecked(pref.get('tabIndent', True)) |
851 | 856 | self.uiCopyTabsToSpacesACT.setChecked(pref.get('copyIndentsAsSpaces', False)) |
852 | 857 |
|
@@ -919,7 +924,7 @@ def restorePrefs(self): |
919 | 924 | _font = pref.get('consoleFont', None) |
920 | 925 | if _font: |
921 | 926 | font = QFont() |
922 | | - if font.fromString(_font): |
| 927 | + if QtCompat.QFont.fromString(font, _font): |
923 | 928 | self.console().setConsoleFont(font) |
924 | 929 |
|
925 | 930 | self.dont_ask_again = pref.get('dont_ask_again', []) |
@@ -1098,9 +1103,9 @@ def setFlashWindowInterval(self): |
1098 | 1103 |
|
1099 | 1104 | def setWordWrap(self, state): |
1100 | 1105 | if state: |
1101 | | - self.uiConsoleTXT.setLineWrapMode(self.uiConsoleTXT.WidgetWidth) |
| 1106 | + self.uiConsoleTXT.setLineWrapMode(QTextEdit.WidgetWidth) |
1102 | 1107 | else: |
1103 | | - self.uiConsoleTXT.setLineWrapMode(self.uiConsoleTXT.NoWrap) |
| 1108 | + self.uiConsoleTXT.setLineWrapMode(QTextEdit.NoWrap) |
1104 | 1109 |
|
1105 | 1110 | def show_about(self): |
1106 | 1111 | """Shows `preditor.about_preditor()`'s output in a message box.""" |
|
0 commit comments