PrEditor 1.0.0__py3-none-any.whl → 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of PrEditor might be problematic. Click here for more details.
- preditor/__init__.py +4 -1
- preditor/about_module.py +6 -2
- preditor/config.py +16 -0
- preditor/dccs/.hab.json +10 -0
- preditor/dccs/maya/PrEditor_maya.mod +0 -1
- preditor/dccs/maya/README.md +22 -0
- preditor/dccs/maya/plug-ins/PrEditor_maya.py +32 -1
- preditor/dccs/studiomax/PackageContents.xml +32 -0
- preditor/dccs/studiomax/PrEditor-PrEditor_Show.mcr +8 -0
- preditor/dccs/studiomax/README.md +17 -0
- preditor/dccs/studiomax/preditor.ms +16 -0
- preditor/dccs/studiomax/preditor_menu.mnx +7 -0
- preditor/debug.py +7 -3
- preditor/excepthooks.py +15 -6
- preditor/gui/app.py +2 -2
- preditor/gui/codehighlighter.py +10 -24
- preditor/gui/completer.py +17 -6
- preditor/gui/console.py +77 -47
- preditor/gui/dialog.py +10 -7
- preditor/gui/drag_tab_bar.py +7 -7
- preditor/gui/errordialog.py +2 -2
- preditor/gui/find_files.py +7 -5
- preditor/gui/fuzzy_search/fuzzy_search.py +8 -4
- preditor/gui/group_tab_widget/__init__.py +4 -4
- preditor/gui/group_tab_widget/grouped_tab_models.py +4 -4
- preditor/gui/group_tab_widget/grouped_tab_widget.py +6 -4
- preditor/gui/level_buttons.py +16 -1
- preditor/gui/loggerwindow.py +51 -28
- preditor/gui/set_text_editor_path_dialog.py +3 -1
- preditor/gui/window.py +4 -4
- preditor/gui/workbox_mixin.py +40 -11
- preditor/gui/workbox_text_edit.py +5 -3
- preditor/gui/workboxwidget.py +16 -12
- preditor/logging_config.py +5 -2
- preditor/scintilla/__init__.py +19 -1
- preditor/scintilla/delayables/smart_highlight.py +7 -4
- preditor/scintilla/delayables/spell_check.py +5 -4
- preditor/scintilla/documenteditor.py +165 -116
- preditor/scintilla/finddialog.py +3 -3
- preditor/scintilla/lang/language.py +1 -1
- preditor/scintilla/lexers/cpplexer.py +3 -2
- preditor/scintilla/lexers/javascriptlexer.py +6 -4
- preditor/scintilla/lexers/maxscriptlexer.py +8 -7
- preditor/scintilla/lexers/mellexer.py +3 -2
- preditor/scintilla/lexers/mulexer.py +3 -2
- preditor/scintilla/lexers/pythonlexer.py +7 -6
- preditor/utils/cute.py +9 -8
- preditor/version.py +16 -3
- {preditor-1.0.0.dist-info → preditor-1.2.0.dist-info}/METADATA +69 -32
- {preditor-1.0.0.dist-info → preditor-1.2.0.dist-info}/RECORD +56 -47
- preditor-1.2.0.dist-info/top_level.txt +3 -0
- tests/find_files/test_find_files.py +74 -0
- tests/ide/test_delayable_engine.py +171 -0
- preditor-1.0.0.dist-info/top_level.txt +0 -1
- {preditor-1.0.0.dist-info → preditor-1.2.0.dist-info}/WHEEL +0 -0
- {preditor-1.0.0.dist-info → preditor-1.2.0.dist-info}/entry_points.txt +0 -0
- {preditor-1.0.0.dist-info → preditor-1.2.0.dist-info}/licenses/LICENSE +0 -0
preditor/gui/console.py
CHANGED
|
@@ -15,7 +15,14 @@ from functools import partial
|
|
|
15
15
|
import __main__
|
|
16
16
|
from Qt import QtCompat
|
|
17
17
|
from Qt.QtCore import QPoint, Qt, QTimer
|
|
18
|
-
from Qt.QtGui import
|
|
18
|
+
from Qt.QtGui import (
|
|
19
|
+
QColor,
|
|
20
|
+
QFontMetrics,
|
|
21
|
+
QKeySequence,
|
|
22
|
+
QTextCharFormat,
|
|
23
|
+
QTextCursor,
|
|
24
|
+
QTextDocument,
|
|
25
|
+
)
|
|
19
26
|
from Qt.QtWidgets import QAbstractItemView, QAction, QApplication, QTextEdit
|
|
20
27
|
|
|
21
28
|
from .. import settings, stream
|
|
@@ -32,7 +39,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
32
39
|
|
|
33
40
|
# These Qt Properties can be customized using style sheets.
|
|
34
41
|
commentColor = QtPropertyInit('_commentColor', QColor(0, 206, 52))
|
|
35
|
-
errorMessageColor = QtPropertyInit('_errorMessageColor', QColor(Qt.red))
|
|
42
|
+
errorMessageColor = QtPropertyInit('_errorMessageColor', QColor(Qt.GlobalColor.red))
|
|
36
43
|
keywordColor = QtPropertyInit('_keywordColor', QColor(17, 154, 255))
|
|
37
44
|
resultColor = QtPropertyInit('_resultColor', QColor(128, 128, 128))
|
|
38
45
|
stdoutColor = QtPropertyInit('_stdoutColor', QColor(17, 154, 255))
|
|
@@ -99,7 +106,9 @@ class ConsolePrEdit(QTextEdit):
|
|
|
99
106
|
|
|
100
107
|
self.uiClearToLastPromptACT = QAction('Clear to Last', self)
|
|
101
108
|
self.uiClearToLastPromptACT.triggered.connect(self.clearToLastPrompt)
|
|
102
|
-
self.uiClearToLastPromptACT.setShortcut(
|
|
109
|
+
self.uiClearToLastPromptACT.setShortcut(
|
|
110
|
+
QKeySequence(Qt.Modifier.CTRL | Qt.Modifier.SHIFT | Qt.Key.Key_Backspace)
|
|
111
|
+
)
|
|
103
112
|
self.addAction(self.uiClearToLastPromptACT)
|
|
104
113
|
|
|
105
114
|
self.x = 0
|
|
@@ -155,8 +164,8 @@ class ConsolePrEdit(QTextEdit):
|
|
|
155
164
|
workbox = self.window().current_workbox()
|
|
156
165
|
if workbox:
|
|
157
166
|
tab_width = workbox.__tab_width__()
|
|
158
|
-
fontPixelWidth = QFontMetrics(font).
|
|
159
|
-
self.
|
|
167
|
+
fontPixelWidth = QFontMetrics(font).horizontalAdvance(" ")
|
|
168
|
+
self.setTabStopDistance(fontPixelWidth * tab_width)
|
|
160
169
|
|
|
161
170
|
# Scroll to same relative position where we started
|
|
162
171
|
if origPercent is not None:
|
|
@@ -170,7 +179,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
170
179
|
self.clickPos = event.pos()
|
|
171
180
|
self.anchor = self.anchorAt(event.pos())
|
|
172
181
|
if self.anchor:
|
|
173
|
-
QApplication.setOverrideCursor(Qt.PointingHandCursor)
|
|
182
|
+
QApplication.setOverrideCursor(Qt.CursorShape.PointingHandCursor)
|
|
174
183
|
return super(ConsolePrEdit, self).mousePressEvent(event)
|
|
175
184
|
|
|
176
185
|
def mouseReleaseEvent(self, event):
|
|
@@ -178,7 +187,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
178
187
|
click position is the same as release position, if so, call errorHyperlink.
|
|
179
188
|
"""
|
|
180
189
|
samePos = event.pos() == self.clickPos
|
|
181
|
-
left = event.button() == Qt.LeftButton
|
|
190
|
+
left = event.button() == Qt.MouseButton.LeftButton
|
|
182
191
|
if samePos and left and self.anchor:
|
|
183
192
|
self.errorHyperlink()
|
|
184
193
|
|
|
@@ -192,7 +201,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
192
201
|
# scrolling. If used in LoggerWindow, use that wheel event
|
|
193
202
|
# May not want to import LoggerWindow, so perhaps
|
|
194
203
|
# check by str(type())
|
|
195
|
-
ctrlPressed = event.modifiers() == Qt.ControlModifier
|
|
204
|
+
ctrlPressed = event.modifiers() == Qt.KeyboardModifier.ControlModifier
|
|
196
205
|
if ctrlPressed and "LoggerWindow" in str(type(self.window())):
|
|
197
206
|
self.window().wheelEvent(event)
|
|
198
207
|
else:
|
|
@@ -202,7 +211,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
202
211
|
"""Override of keyReleaseEvent to determine when to end navigation of
|
|
203
212
|
previous commands
|
|
204
213
|
"""
|
|
205
|
-
if event.key() == Qt.Key_Alt:
|
|
214
|
+
if event.key() == Qt.Key.Key_Alt:
|
|
206
215
|
self._prevCommandIndex = 0
|
|
207
216
|
else:
|
|
208
217
|
event.ignore()
|
|
@@ -319,7 +328,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
319
328
|
prevCommand = self._prevCommands[self._prevCommandIndex]
|
|
320
329
|
|
|
321
330
|
cursor = self.textCursor()
|
|
322
|
-
cursor.select(QTextCursor.LineUnderCursor)
|
|
331
|
+
cursor.select(QTextCursor.SelectionType.LineUnderCursor)
|
|
323
332
|
if cursor.selectedText().startswith(self._consolePrompt):
|
|
324
333
|
prevCommand = "{}{}".format(self._consolePrompt, prevCommand)
|
|
325
334
|
cursor.insertText(prevCommand)
|
|
@@ -335,7 +344,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
335
344
|
currentCursor = self.textCursor()
|
|
336
345
|
# move to the end of the document so we can search backwards
|
|
337
346
|
cursor = self.textCursor()
|
|
338
|
-
cursor.movePosition(
|
|
347
|
+
cursor.movePosition(QTextCursor.MoveOperation.End)
|
|
339
348
|
self.setTextCursor(cursor)
|
|
340
349
|
# Check if the last line is a empty prompt. If so, then preform two finds so we
|
|
341
350
|
# find the prompt we are looking for instead of this empty prompt
|
|
@@ -343,12 +352,14 @@ class ConsolePrEdit(QTextEdit):
|
|
|
343
352
|
2 if self.toPlainText()[-len(self.prompt()) :] == self.prompt() else 1
|
|
344
353
|
)
|
|
345
354
|
for _ in range(findCount):
|
|
346
|
-
self.find(self.prompt(), QTextDocument.FindBackward)
|
|
355
|
+
self.find(self.prompt(), QTextDocument.FindFlag.FindBackward)
|
|
347
356
|
# move to the end of the found line, select the rest of the text and remove it
|
|
348
357
|
# preserving history if there is anything to remove.
|
|
349
358
|
cursor = self.textCursor()
|
|
350
|
-
cursor.movePosition(
|
|
351
|
-
cursor.movePosition(
|
|
359
|
+
cursor.movePosition(QTextCursor.MoveOperation.EndOfLine)
|
|
360
|
+
cursor.movePosition(
|
|
361
|
+
QTextCursor.MoveOperation.End, QTextCursor.MoveMode.KeepAnchor
|
|
362
|
+
)
|
|
352
363
|
txt = cursor.selectedText()
|
|
353
364
|
if txt:
|
|
354
365
|
self.setTextCursor(cursor)
|
|
@@ -364,7 +375,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
364
375
|
if self.clearExecutionTime is not None:
|
|
365
376
|
self.clearExecutionTime()
|
|
366
377
|
cursor = self.textCursor()
|
|
367
|
-
cursor.select(QTextCursor.BlockUnderCursor)
|
|
378
|
+
cursor.select(QTextCursor.SelectionType.BlockUnderCursor)
|
|
368
379
|
line = cursor.selectedText()
|
|
369
380
|
if line and line[0] not in string.printable:
|
|
370
381
|
line = line[1:]
|
|
@@ -472,7 +483,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
472
483
|
"""inserts the completion text into the editor"""
|
|
473
484
|
if self.completer().widget() == self:
|
|
474
485
|
cursor = self.textCursor()
|
|
475
|
-
cursor.select(QTextCursor.WordUnderCursor)
|
|
486
|
+
cursor.select(QTextCursor.SelectionType.WordUnderCursor)
|
|
476
487
|
cursor.insertText(completion)
|
|
477
488
|
self.setTextCursor(cursor)
|
|
478
489
|
|
|
@@ -535,21 +546,21 @@ class ConsolePrEdit(QTextEdit):
|
|
|
535
546
|
# character, or remove it if backspace or delete has just been pressed.
|
|
536
547
|
key = event.text()
|
|
537
548
|
_, prefix = completer.currentObject(scope=__main__.__dict__)
|
|
538
|
-
isBackspaceOrDel = event.key() in (Qt.Key_Backspace, Qt.Key_Delete)
|
|
549
|
+
isBackspaceOrDel = event.key() in (Qt.Key.Key_Backspace, Qt.Key.Key_Delete)
|
|
539
550
|
if key.isalnum() or key in ("-", "_"):
|
|
540
551
|
prefix += str(key)
|
|
541
552
|
elif isBackspaceOrDel and prefix:
|
|
542
553
|
prefix = prefix[:-1]
|
|
543
554
|
|
|
544
555
|
if completer and event.key() in (
|
|
545
|
-
Qt.Key_Backspace,
|
|
546
|
-
Qt.Key_Delete,
|
|
547
|
-
Qt.Key_Escape,
|
|
556
|
+
Qt.Key.Key_Backspace,
|
|
557
|
+
Qt.Key.Key_Delete,
|
|
558
|
+
Qt.Key.Key_Escape,
|
|
548
559
|
):
|
|
549
560
|
completer.hideDocumentation()
|
|
550
561
|
|
|
551
562
|
# enter || return keys will execute the command
|
|
552
|
-
if event.key() in (Qt.Key_Return, Qt.Key_Enter):
|
|
563
|
+
if event.key() in (Qt.Key.Key_Return, Qt.Key.Key_Enter):
|
|
553
564
|
if completer.popup().isVisible():
|
|
554
565
|
completer.clear()
|
|
555
566
|
event.ignore()
|
|
@@ -557,11 +568,11 @@ class ConsolePrEdit(QTextEdit):
|
|
|
557
568
|
self.executeCommand()
|
|
558
569
|
|
|
559
570
|
# home key will move the cursor to home
|
|
560
|
-
elif event.key() == Qt.Key_Home:
|
|
571
|
+
elif event.key() == Qt.Key.Key_Home:
|
|
561
572
|
self.moveToHome()
|
|
562
573
|
|
|
563
574
|
# otherwise, ignore the event for completion events
|
|
564
|
-
elif event.key() in (Qt.Key_Tab, Qt.Key_Backtab):
|
|
575
|
+
elif event.key() in (Qt.Key.Key_Tab, Qt.Key.Key_Backtab):
|
|
565
576
|
if not completer.popup().isVisible():
|
|
566
577
|
# The completer does not get updated if its not visible while typing.
|
|
567
578
|
# We are about to complete the text using it so ensure its updated.
|
|
@@ -571,19 +582,28 @@ class ConsolePrEdit(QTextEdit):
|
|
|
571
582
|
)
|
|
572
583
|
# Insert the correct text and clear the completion model
|
|
573
584
|
index = completer.popup().currentIndex()
|
|
574
|
-
self.insertCompletion(index.data(Qt.DisplayRole))
|
|
585
|
+
self.insertCompletion(index.data(Qt.ItemDataRole.DisplayRole))
|
|
575
586
|
completer.clear()
|
|
576
587
|
|
|
577
|
-
elif event.key() == Qt.Key_Escape and completer.popup().isVisible():
|
|
588
|
+
elif event.key() == Qt.Key.Key_Escape and completer.popup().isVisible():
|
|
578
589
|
completer.clear()
|
|
579
590
|
|
|
580
591
|
# other wise handle the keypress
|
|
581
592
|
else:
|
|
582
593
|
# define special key sequences
|
|
583
594
|
modifiers = QApplication.instance().keyboardModifiers()
|
|
584
|
-
ctrlSpace =
|
|
585
|
-
|
|
586
|
-
|
|
595
|
+
ctrlSpace = (
|
|
596
|
+
event.key() == Qt.Key.Key_Space
|
|
597
|
+
and modifiers == Qt.KeyboardModifier.ControlModifier
|
|
598
|
+
)
|
|
599
|
+
ctrlM = (
|
|
600
|
+
event.key() == Qt.Key.Key_M
|
|
601
|
+
and modifiers == Qt.KeyboardModifier.ControlModifier
|
|
602
|
+
)
|
|
603
|
+
ctrlI = (
|
|
604
|
+
event.key() == Qt.Key.Key_I
|
|
605
|
+
and modifiers == Qt.KeyboardModifier.ControlModifier
|
|
606
|
+
)
|
|
587
607
|
|
|
588
608
|
# Process all events we do not want to override
|
|
589
609
|
if not (ctrlSpace or ctrlM or ctrlI):
|
|
@@ -602,20 +622,20 @@ class ConsolePrEdit(QTextEdit):
|
|
|
602
622
|
# check for particular events for the completion
|
|
603
623
|
if completer:
|
|
604
624
|
# look for documentation popups
|
|
605
|
-
if event.key() == Qt.Key_ParenLeft:
|
|
625
|
+
if event.key() == Qt.Key.Key_ParenLeft:
|
|
606
626
|
rect = self.cursorRect()
|
|
607
627
|
point = self.mapToGlobal(QPoint(rect.x(), rect.y()))
|
|
608
628
|
completer.showDocumentation(pos=point, scope=__main__.__dict__)
|
|
609
629
|
|
|
610
630
|
# hide documentation popups
|
|
611
|
-
elif event.key() == Qt.Key_ParenRight:
|
|
631
|
+
elif event.key() == Qt.Key.Key_ParenRight:
|
|
612
632
|
completer.hideDocumentation()
|
|
613
633
|
|
|
614
634
|
# determine if we need to show the popup or if it already is visible, we
|
|
615
635
|
# need to update it
|
|
616
636
|
elif (
|
|
617
|
-
event.key() == Qt.Key_Period
|
|
618
|
-
or event.key() == Qt.Key_Escape
|
|
637
|
+
event.key() == Qt.Key.Key_Period
|
|
638
|
+
or event.key() == Qt.Key.Key_Escape
|
|
619
639
|
or completer.popup().isVisible()
|
|
620
640
|
or ctrlSpace
|
|
621
641
|
or ctrlI
|
|
@@ -646,7 +666,9 @@ class ConsolePrEdit(QTextEdit):
|
|
|
646
666
|
completer.setCurrentRow(index.row())
|
|
647
667
|
|
|
648
668
|
# Make sure that current selection is visible, ie scroll to it
|
|
649
|
-
completer.popup().scrollTo(
|
|
669
|
+
completer.popup().scrollTo(
|
|
670
|
+
index, QAbstractItemView.ScrollHint.EnsureVisible
|
|
671
|
+
)
|
|
650
672
|
|
|
651
673
|
# show the completer for the rect
|
|
652
674
|
rect = self.cursorRect()
|
|
@@ -663,7 +685,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
663
685
|
if completer.wasCompleting and not completer.popup().isVisible():
|
|
664
686
|
wasCompletingCounterMax = completer.wasCompletingCounterMax
|
|
665
687
|
if completer.wasCompletingCounter <= wasCompletingCounterMax:
|
|
666
|
-
if event.key() not in (Qt.Key_Backspace, Qt.Key_Left):
|
|
688
|
+
if event.key() not in (Qt.Key.Key_Backspace, Qt.Key.Key_Left):
|
|
667
689
|
completer.wasCompletingCounter += 1
|
|
668
690
|
else:
|
|
669
691
|
completer.wasCompletingCounter = 0
|
|
@@ -671,20 +693,26 @@ class ConsolePrEdit(QTextEdit):
|
|
|
671
693
|
|
|
672
694
|
def moveToHome(self):
|
|
673
695
|
"""moves the cursor to the home location"""
|
|
674
|
-
mode = QTextCursor.MoveAnchor
|
|
696
|
+
mode = QTextCursor.MoveMode.MoveAnchor
|
|
675
697
|
# select the home
|
|
676
|
-
if
|
|
677
|
-
|
|
698
|
+
if (
|
|
699
|
+
QApplication.instance().keyboardModifiers()
|
|
700
|
+
== Qt.KeyboardModifier.ShiftModifier
|
|
701
|
+
):
|
|
702
|
+
mode = QTextCursor.MoveMode.KeepAnchor
|
|
678
703
|
# grab the cursor
|
|
679
704
|
cursor = self.textCursor()
|
|
680
|
-
if
|
|
705
|
+
if (
|
|
706
|
+
QApplication.instance().keyboardModifiers()
|
|
707
|
+
== Qt.KeyboardModifier.ControlModifier
|
|
708
|
+
):
|
|
681
709
|
# move to the top of the document if control is pressed
|
|
682
|
-
cursor.movePosition(QTextCursor.Start)
|
|
710
|
+
cursor.movePosition(QTextCursor.MoveOperation.Start)
|
|
683
711
|
else:
|
|
684
712
|
# Otherwise just move it to the start of the line
|
|
685
|
-
cursor.movePosition(QTextCursor.StartOfBlock, mode)
|
|
713
|
+
cursor.movePosition(QTextCursor.MoveOperation.StartOfBlock, mode)
|
|
686
714
|
# move the cursor to the end of the prompt.
|
|
687
|
-
cursor.movePosition(QTextCursor.Right, mode, len(self.prompt()))
|
|
715
|
+
cursor.movePosition(QTextCursor.MoveOperation.Right, mode, len(self.prompt()))
|
|
688
716
|
self.setTextCursor(cursor)
|
|
689
717
|
|
|
690
718
|
def outputPrompt(self):
|
|
@@ -721,7 +749,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
721
749
|
prompt(str): The prompt to start the line with. If this prompt
|
|
722
750
|
is already the only text on the last line this function does nothing.
|
|
723
751
|
"""
|
|
724
|
-
self.moveCursor(QTextCursor.End)
|
|
752
|
+
self.moveCursor(QTextCursor.MoveOperation.End)
|
|
725
753
|
|
|
726
754
|
# if this is not already a new line
|
|
727
755
|
if self.textCursor().block().text() != prompt:
|
|
@@ -744,9 +772,11 @@ class ConsolePrEdit(QTextEdit):
|
|
|
744
772
|
self.startPrompt(self._outputPrompt)
|
|
745
773
|
|
|
746
774
|
def removeCurrentLine(self):
|
|
747
|
-
self.moveCursor(QTextCursor.End, QTextCursor.MoveAnchor)
|
|
748
|
-
self.moveCursor(
|
|
749
|
-
|
|
775
|
+
self.moveCursor(QTextCursor.MoveOperation.End, QTextCursor.MoveMode.MoveAnchor)
|
|
776
|
+
self.moveCursor(
|
|
777
|
+
QTextCursor.MoveOperation.StartOfLine, QTextCursor.MoveMode.MoveAnchor
|
|
778
|
+
)
|
|
779
|
+
self.moveCursor(QTextCursor.MoveOperation.End, QTextCursor.MoveMode.KeepAnchor)
|
|
750
780
|
self.textCursor().removeSelectedText()
|
|
751
781
|
self.textCursor().deletePreviousChar()
|
|
752
782
|
self.insertPlainText("\n")
|
|
@@ -787,7 +817,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
787
817
|
hasattr(window, 'uiErrorHyperlinksACT')
|
|
788
818
|
and window.uiErrorHyperlinksACT.isChecked()
|
|
789
819
|
)
|
|
790
|
-
self.moveCursor(QTextCursor.End)
|
|
820
|
+
self.moveCursor(QTextCursor.MoveOperation.End)
|
|
791
821
|
|
|
792
822
|
charFormat = QTextCharFormat()
|
|
793
823
|
if not error:
|
|
@@ -806,7 +836,7 @@ class ConsolePrEdit(QTextEdit):
|
|
|
806
836
|
info = None
|
|
807
837
|
|
|
808
838
|
if doHyperlink and msg == '\n':
|
|
809
|
-
cursor.select(QTextCursor.BlockUnderCursor)
|
|
839
|
+
cursor.select(QTextCursor.SelectionType.BlockUnderCursor)
|
|
810
840
|
line = cursor.selectedText()
|
|
811
841
|
|
|
812
842
|
# Remove possible leading unicode paragraph separator, which really
|
preditor/gui/dialog.py
CHANGED
|
@@ -24,11 +24,14 @@ class Dialog(QDialog):
|
|
|
24
24
|
if not cls._instance:
|
|
25
25
|
cls._instance = cls(parent=parent)
|
|
26
26
|
# protect the memory
|
|
27
|
-
cls._instance.setAttribute(Qt.WA_DeleteOnClose, False)
|
|
27
|
+
cls._instance.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, False)
|
|
28
28
|
return cls._instance
|
|
29
29
|
|
|
30
30
|
def __init__(
|
|
31
|
-
self,
|
|
31
|
+
self,
|
|
32
|
+
parent=None,
|
|
33
|
+
flags=Qt.WindowType.WindowMinMaxButtonsHint
|
|
34
|
+
| Qt.WindowType.WindowCloseButtonHint,
|
|
32
35
|
):
|
|
33
36
|
# if there is no root, create
|
|
34
37
|
if not parent:
|
|
@@ -68,7 +71,7 @@ class Dialog(QDialog):
|
|
|
68
71
|
# dead dialogs
|
|
69
72
|
|
|
70
73
|
# set the delete attribute to clean up the window once it is closed
|
|
71
|
-
self.setAttribute(Qt.WA_DeleteOnClose, True)
|
|
74
|
+
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, True)
|
|
72
75
|
|
|
73
76
|
# set this property to true to properly handle tracking events to control
|
|
74
77
|
# keyboard overrides
|
|
@@ -109,7 +112,7 @@ class Dialog(QDialog):
|
|
|
109
112
|
def closeEvent(self, event):
|
|
110
113
|
# ensure this object gets deleted
|
|
111
114
|
wwidget = None
|
|
112
|
-
if self.testAttribute(Qt.WA_DeleteOnClose):
|
|
115
|
+
if self.testAttribute(Qt.WidgetAttribute.WA_DeleteOnClose):
|
|
113
116
|
# collect the win widget to uncache it
|
|
114
117
|
if self.parent() and self.parent().inherits('QWinWidget'):
|
|
115
118
|
wwidget = self.parent()
|
|
@@ -128,10 +131,10 @@ class Dialog(QDialog):
|
|
|
128
131
|
# This function properly transfers ownership of the dialog instance back to
|
|
129
132
|
# Python anyway
|
|
130
133
|
|
|
131
|
-
self.setAttribute(Qt.WA_DeleteOnClose, False)
|
|
134
|
+
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, False)
|
|
132
135
|
|
|
133
136
|
# execute the dialog
|
|
134
|
-
return
|
|
137
|
+
return super().exec()
|
|
135
138
|
|
|
136
139
|
def setGeometry(self, *args):
|
|
137
140
|
"""
|
|
@@ -158,7 +161,7 @@ class Dialog(QDialog):
|
|
|
158
161
|
# allow the global instance to be cleared
|
|
159
162
|
if this == cls._instance:
|
|
160
163
|
cls._instance = None
|
|
161
|
-
this.setAttribute(Qt.WA_DeleteOnClose, True)
|
|
164
|
+
this.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, True)
|
|
162
165
|
try:
|
|
163
166
|
this.close()
|
|
164
167
|
except RuntimeError:
|
preditor/gui/drag_tab_bar.py
CHANGED
|
@@ -52,12 +52,12 @@ class DragTabBar(QTabBar):
|
|
|
52
52
|
drag.setMimeData(self._mime_data)
|
|
53
53
|
drag.setPixmap(self._mime_data.imageData())
|
|
54
54
|
drag.setHotSpot(event_pos - pos_in_tab)
|
|
55
|
-
cursor = QCursor(Qt.OpenHandCursor)
|
|
56
|
-
drag.setDragCursor(cursor.pixmap(), Qt.MoveAction)
|
|
57
|
-
action = drag.
|
|
55
|
+
cursor = QCursor(Qt.CursorShape.OpenHandCursor)
|
|
56
|
+
drag.setDragCursor(cursor.pixmap(), Qt.DropAction.MoveAction)
|
|
57
|
+
action = drag.exec(Qt.DropAction.MoveAction)
|
|
58
58
|
# If the user didn't successfully add this to a new tab widget, restore
|
|
59
59
|
# the tab to the original location.
|
|
60
|
-
if action == Qt.IgnoreAction:
|
|
60
|
+
if action == Qt.DropAction.IgnoreAction:
|
|
61
61
|
original_tab_index = self._mime_data.property('original_tab_index')
|
|
62
62
|
self.parentWidget().insertTab(
|
|
63
63
|
original_tab_index, widget, self._mime_data.text()
|
|
@@ -66,7 +66,7 @@ class DragTabBar(QTabBar):
|
|
|
66
66
|
self._mime_data = None
|
|
67
67
|
|
|
68
68
|
def mousePressEvent(self, event): # noqa: N802
|
|
69
|
-
if event.button() == Qt.LeftButton and not self._mime_data:
|
|
69
|
+
if event.button() == Qt.MouseButton.LeftButton and not self._mime_data:
|
|
70
70
|
tab_index = self.tabAt(event.pos())
|
|
71
71
|
|
|
72
72
|
# While we don't remove the tab on mouse press, capture its tab image
|
|
@@ -123,7 +123,7 @@ class DragTabBar(QTabBar):
|
|
|
123
123
|
if event.source().parentWidget() == self:
|
|
124
124
|
return
|
|
125
125
|
|
|
126
|
-
event.setDropAction(Qt.MoveAction)
|
|
126
|
+
event.setDropAction(Qt.DropAction.MoveAction)
|
|
127
127
|
event.accept()
|
|
128
128
|
counter = self.count()
|
|
129
129
|
|
|
@@ -184,7 +184,7 @@ class DragTabBar(QTabBar):
|
|
|
184
184
|
tab_widget.setDocumentMode(True)
|
|
185
185
|
|
|
186
186
|
if menu:
|
|
187
|
-
bar.setContextMenuPolicy(Qt.CustomContextMenu)
|
|
187
|
+
bar.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
|
188
188
|
bar.customContextMenuRequested.connect(bar.tab_menu)
|
|
189
189
|
|
|
190
190
|
return bar
|
preditor/gui/errordialog.py
CHANGED
|
@@ -21,7 +21,7 @@ class ErrorDialog(Dialog):
|
|
|
21
21
|
|
|
22
22
|
self.parent_ = parent
|
|
23
23
|
self.setWindowTitle('Error Occurred')
|
|
24
|
-
self.uiErrorLBL.setTextFormat(Qt.RichText)
|
|
24
|
+
self.uiErrorLBL.setTextFormat(Qt.TextFormat.RichText)
|
|
25
25
|
self.uiIconLBL.setPixmap(
|
|
26
26
|
QPixmap(
|
|
27
27
|
os.path.join(
|
|
@@ -30,7 +30,7 @@ class ErrorDialog(Dialog):
|
|
|
30
30
|
'img',
|
|
31
31
|
'warning-big.png',
|
|
32
32
|
)
|
|
33
|
-
).scaledToHeight(64, Qt.SmoothTransformation)
|
|
33
|
+
).scaledToHeight(64, Qt.TransformationMode.SmoothTransformation)
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
self.uiLoggerBTN.clicked.connect(self.show_logger)
|
preditor/gui/find_files.py
CHANGED
|
@@ -30,22 +30,24 @@ class FindFiles(QWidget):
|
|
|
30
30
|
|
|
31
31
|
# Create shortcuts
|
|
32
32
|
self.uiCloseSCT = QShortcut(
|
|
33
|
-
QKeySequence(Qt.Key_Escape),
|
|
33
|
+
QKeySequence(Qt.Key.Key_Escape),
|
|
34
|
+
self,
|
|
35
|
+
context=Qt.ShortcutContext.WidgetWithChildrenShortcut,
|
|
34
36
|
)
|
|
35
37
|
|
|
36
38
|
self.uiCloseSCT.activated.connect(self.hide)
|
|
37
39
|
|
|
38
40
|
self.uiCaseSensitiveSCT = QShortcut(
|
|
39
|
-
QKeySequence(Qt.AltModifier | Qt.Key_C),
|
|
41
|
+
QKeySequence(Qt.KeyboardModifier.AltModifier | Qt.Key.Key_C),
|
|
40
42
|
self,
|
|
41
|
-
context=Qt.WidgetWithChildrenShortcut,
|
|
43
|
+
context=Qt.ShortcutContext.WidgetWithChildrenShortcut,
|
|
42
44
|
)
|
|
43
45
|
self.uiCaseSensitiveSCT.activated.connect(self.uiCaseSensitiveBTN.toggle)
|
|
44
46
|
|
|
45
47
|
self.uiRegexSCT = QShortcut(
|
|
46
|
-
QKeySequence(Qt.AltModifier | Qt.Key_R),
|
|
48
|
+
QKeySequence(Qt.KeyboardModifier.AltModifier | Qt.Key.Key_R),
|
|
47
49
|
self,
|
|
48
|
-
context=Qt.WidgetWithChildrenShortcut,
|
|
50
|
+
context=Qt.ShortcutContext.WidgetWithChildrenShortcut,
|
|
49
51
|
)
|
|
50
52
|
self.uiRegexSCT.activated.connect(self.uiRegexBTN.toggle)
|
|
51
53
|
|
|
@@ -22,14 +22,18 @@ class FuzzySearch(QFrame):
|
|
|
22
22
|
self.y_offset = 100
|
|
23
23
|
self.setMinimumSize(400, 200)
|
|
24
24
|
self.uiCloseSCT = QShortcut(
|
|
25
|
-
Qt.Key_Escape,
|
|
25
|
+
Qt.Key.Key_Escape,
|
|
26
|
+
self,
|
|
27
|
+
context=Qt.ShortcutContext.WidgetWithChildrenShortcut,
|
|
26
28
|
)
|
|
27
29
|
self.uiCloseSCT.activated.connect(self._canceled)
|
|
28
30
|
|
|
29
|
-
self.uiUpSCT = QShortcut(
|
|
31
|
+
self.uiUpSCT = QShortcut(
|
|
32
|
+
Qt.Key.Key_Up, self, context=Qt.ShortcutContext.WidgetWithChildrenShortcut
|
|
33
|
+
)
|
|
30
34
|
self.uiUpSCT.activated.connect(partial(self.increment_selection, -1))
|
|
31
35
|
self.uiDownSCT = QShortcut(
|
|
32
|
-
Qt.Key_Down, self, context=Qt.WidgetWithChildrenShortcut
|
|
36
|
+
Qt.Key.Key_Down, self, context=Qt.ShortcutContext.WidgetWithChildrenShortcut
|
|
33
37
|
)
|
|
34
38
|
self.uiDownSCT.activated.connect(partial(self.increment_selection, 1))
|
|
35
39
|
|
|
@@ -90,4 +94,4 @@ class FuzzySearch(QFrame):
|
|
|
90
94
|
def popup(self):
|
|
91
95
|
self.show()
|
|
92
96
|
self.reposition()
|
|
93
|
-
self.uiLineEDIT.setFocus(Qt.PopupFocusReason)
|
|
97
|
+
self.uiLineEDIT.setFocus(Qt.FocusReason.PopupFocusReason)
|
|
@@ -61,13 +61,13 @@ class GroupTabWidget(OneTabWidget):
|
|
|
61
61
|
corner.uiMenuBTN = QToolButton(corner)
|
|
62
62
|
corner.uiMenuBTN.setIcon(QIcon(resourcePath('img/chevron-down.png')))
|
|
63
63
|
corner.uiMenuBTN.setObjectName('group_tab_widget_menu_btn')
|
|
64
|
-
corner.uiMenuBTN.setPopupMode(QToolButton.InstantPopup)
|
|
64
|
+
corner.uiMenuBTN.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
|
65
65
|
corner.uiCornerMENU = GroupTabMenu(self, parent=corner.uiMenuBTN)
|
|
66
66
|
corner.uiMenuBTN.setMenu(corner.uiCornerMENU)
|
|
67
67
|
lyt.addWidget(corner.uiMenuBTN)
|
|
68
68
|
|
|
69
69
|
self.uiCornerBTN = corner
|
|
70
|
-
self.setCornerWidget(self.uiCornerBTN, Qt.TopRightCorner)
|
|
70
|
+
self.setCornerWidget(self.uiCornerBTN, Qt.Corner.TopRightCorner)
|
|
71
71
|
|
|
72
72
|
def add_new_tab(self, group, title="Workbox", group_fmt=None):
|
|
73
73
|
"""Adds a new tab to the requested group, creating the group if the group
|
|
@@ -148,9 +148,9 @@ class GroupTabWidget(OneTabWidget):
|
|
|
148
148
|
'Are you sure you want to close all tabs under the "{}" tab?'.format(
|
|
149
149
|
self.tabText(self.currentIndex())
|
|
150
150
|
),
|
|
151
|
-
QMessageBox.Yes | QMessageBox.Cancel,
|
|
151
|
+
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.Cancel,
|
|
152
152
|
)
|
|
153
|
-
if ret == QMessageBox.Yes:
|
|
153
|
+
if ret == QMessageBox.StandardButton.Yes:
|
|
154
154
|
# Clean up all temp files created by this group's editors if they
|
|
155
155
|
# are not using actual saved files.
|
|
156
156
|
tab_widget = self.widget(self.currentIndex())
|
|
@@ -7,7 +7,7 @@ from Qt.QtGui import QStandardItem, QStandardItemModel
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class GroupTabItemModel(QStandardItemModel):
|
|
10
|
-
GroupIndexRole = Qt.UserRole + 1
|
|
10
|
+
GroupIndexRole = Qt.ItemDataRole.UserRole + 1
|
|
11
11
|
TabIndexRole = GroupIndexRole + 1
|
|
12
12
|
|
|
13
13
|
def __init__(self, manager, *args, **kwargs):
|
|
@@ -24,7 +24,7 @@ class GroupTabItemModel(QStandardItemModel):
|
|
|
24
24
|
def pathFromIndex(self, index):
|
|
25
25
|
parts = [""]
|
|
26
26
|
while index.isValid():
|
|
27
|
-
parts.append(self.data(index, Qt.DisplayRole))
|
|
27
|
+
parts.append(self.data(index, Qt.ItemDataRole.DisplayRole))
|
|
28
28
|
index = index.parent()
|
|
29
29
|
if len(parts) == 1:
|
|
30
30
|
return ""
|
|
@@ -56,7 +56,7 @@ class GroupTabTreeItemModel(GroupTabItemModel):
|
|
|
56
56
|
|
|
57
57
|
class GroupTabListItemModel(GroupTabItemModel):
|
|
58
58
|
def flags(self, index):
|
|
59
|
-
return Qt.ItemIsEnabled | Qt.ItemIsSelectable
|
|
59
|
+
return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable
|
|
60
60
|
|
|
61
61
|
def process(self):
|
|
62
62
|
root = self.invisibleRootItem()
|
|
@@ -101,7 +101,7 @@ class GroupTabFuzzyFilterProxyModel(QSortFilterProxyModel):
|
|
|
101
101
|
def pathFromIndex(self, index):
|
|
102
102
|
parts = [""]
|
|
103
103
|
while index.isValid():
|
|
104
|
-
parts.append(self.data(index, Qt.DisplayRole))
|
|
104
|
+
parts.append(self.data(index, Qt.ItemDataRole.DisplayRole))
|
|
105
105
|
index = index.parent()
|
|
106
106
|
if len(parts) == 1:
|
|
107
107
|
return ""
|
|
@@ -25,7 +25,7 @@ class GroupedTabWidget(OneTabWidget):
|
|
|
25
25
|
self.uiCornerBTN.setText('+')
|
|
26
26
|
self.uiCornerBTN.setIcon(QIcon(resourcePath('img/file-plus.png')))
|
|
27
27
|
self.uiCornerBTN.released.connect(lambda: self.add_new_editor())
|
|
28
|
-
self.setCornerWidget(self.uiCornerBTN, Qt.TopRightCorner)
|
|
28
|
+
self.setCornerWidget(self.uiCornerBTN, Qt.Corner.TopRightCorner)
|
|
29
29
|
|
|
30
30
|
def add_new_editor(self, title="Workbox"):
|
|
31
31
|
editor, title = self.default_tab(title)
|
|
@@ -41,16 +41,18 @@ class GroupedTabWidget(OneTabWidget):
|
|
|
41
41
|
def close_tab(self, index):
|
|
42
42
|
if self.count() == 1:
|
|
43
43
|
msg = "You have to leave at least one tab open."
|
|
44
|
-
QMessageBox.critical(
|
|
44
|
+
QMessageBox.critical(
|
|
45
|
+
self, 'Tab can not be closed.', msg, QMessageBox.StandardButton.Ok
|
|
46
|
+
)
|
|
45
47
|
return
|
|
46
48
|
ret = QMessageBox.question(
|
|
47
49
|
self,
|
|
48
50
|
'Donate to the cause?',
|
|
49
51
|
"Would you like to donate this tabs contents to the /dev/null fund "
|
|
50
52
|
"for wayward code?",
|
|
51
|
-
QMessageBox.Yes | QMessageBox.Cancel,
|
|
53
|
+
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.Cancel,
|
|
52
54
|
)
|
|
53
|
-
if ret == QMessageBox.Yes:
|
|
55
|
+
if ret == QMessageBox.StandardButton.Yes:
|
|
54
56
|
# If the tab was saved to a temp file, remove it from disk
|
|
55
57
|
editor = self.widget(index)
|
|
56
58
|
editor.__remove_tempfile__()
|
preditor/gui/level_buttons.py
CHANGED
|
@@ -134,7 +134,7 @@ class LoggingLevelButton(QToolButton):
|
|
|
134
134
|
parent (QWidget, optional): The parent widget for this button.
|
|
135
135
|
"""
|
|
136
136
|
super(LoggingLevelButton, self).__init__(parent=parent)
|
|
137
|
-
self.setPopupMode(QToolButton.InstantPopup)
|
|
137
|
+
self.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
|
138
138
|
|
|
139
139
|
# create root logger menu
|
|
140
140
|
root = logging.getLogger("")
|
|
@@ -291,6 +291,21 @@ class LoggingLevelMenu(LazyMenu):
|
|
|
291
291
|
self.addMenu(HandlerMenu(self.logger, self))
|
|
292
292
|
self.addSeparator()
|
|
293
293
|
|
|
294
|
+
if self.logger.disabled:
|
|
295
|
+
# Warn the user that this logger has been disabled. The documentation
|
|
296
|
+
# says to consider this property as read only so this is just info
|
|
297
|
+
# and does not implement a way to re-enable this logger. It's not
|
|
298
|
+
# disabled because that would prevent the tooltip from showing.
|
|
299
|
+
action = self.addAction("Logger is disabled")
|
|
300
|
+
action.setToolTip(
|
|
301
|
+
'This <b>logger has been disabled</b> and does not handle events '
|
|
302
|
+
"so you likely won't see events from it or its children. "
|
|
303
|
+
'This normally happens when using logging.config with '
|
|
304
|
+
'"disable_existing_loggers" defaulted to True.'
|
|
305
|
+
)
|
|
306
|
+
action.setIcon(QIcon(resourcePath('img/warning-big.png')))
|
|
307
|
+
self.addSeparator()
|
|
308
|
+
|
|
294
309
|
for logger_level in LoggerLevels:
|
|
295
310
|
is_current = logger_level.is_current(self.logger)
|
|
296
311
|
|