PrEditor 0.4.0__py2.py3-none-any.whl → 0.5.0__py2.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-0.4.0.dist-info → PrEditor-0.5.0.dist-info}/METADATA +17 -17
- {PrEditor-0.4.0.dist-info → PrEditor-0.5.0.dist-info}/RECORD +22 -20
- {PrEditor-0.4.0.dist-info → PrEditor-0.5.0.dist-info}/WHEEL +1 -1
- preditor/gui/console.py +103 -6
- preditor/gui/editor_chooser.py +1 -1
- preditor/gui/group_tab_widget/__init__.py +1 -1
- preditor/gui/group_tab_widget/grouped_tab_widget.py +3 -0
- preditor/gui/loggerwindow.py +151 -68
- preditor/gui/set_text_editor_path_dialog.py +4 -4
- preditor/gui/status_label.py +14 -3
- preditor/gui/suggest_path_quotes_dialog.py +50 -0
- preditor/gui/ui/loggerwindow.ui +82 -34
- preditor/gui/ui/set_text_editor_path_dialog.ui +48 -8
- preditor/gui/ui/suggest_path_quotes_dialog.ui +225 -0
- preditor/gui/workbox_mixin.py +50 -18
- preditor/gui/workbox_text_edit.py +24 -4
- preditor/gui/workboxwidget.py +24 -2
- preditor/scintilla/documenteditor.py +3 -3
- preditor/version.py +2 -2
- {PrEditor-0.4.0.dist-info → PrEditor-0.5.0.dist-info}/LICENSE +0 -0
- {PrEditor-0.4.0.dist-info → PrEditor-0.5.0.dist-info}/entry_points.txt +0 -0
- {PrEditor-0.4.0.dist-info → PrEditor-0.5.0.dist-info}/top_level.txt +0 -0
preditor/gui/loggerwindow.py
CHANGED
|
@@ -14,9 +14,10 @@ import __main__
|
|
|
14
14
|
import six
|
|
15
15
|
from Qt import QtCompat, QtCore, QtWidgets
|
|
16
16
|
from Qt.QtCore import QByteArray, Qt, QTimer, Signal, Slot
|
|
17
|
-
from Qt.QtGui import QCursor, QFont,
|
|
17
|
+
from Qt.QtGui import QCursor, QFont, QIcon, QTextCursor
|
|
18
18
|
from Qt.QtWidgets import (
|
|
19
19
|
QApplication,
|
|
20
|
+
QFontDialog,
|
|
20
21
|
QInputDialog,
|
|
21
22
|
QMessageBox,
|
|
22
23
|
QTextBrowser,
|
|
@@ -75,6 +76,7 @@ class LoggerWindow(Window):
|
|
|
75
76
|
loadUi(__file__, self)
|
|
76
77
|
|
|
77
78
|
self.uiConsoleTXT.flash_window = self
|
|
79
|
+
self.uiConsoleTXT.clearExecutionTime = self.clearExecutionTime
|
|
78
80
|
self.uiConsoleTXT.reportExecutionTime = self.reportExecutionTime
|
|
79
81
|
self.uiClearToLastPromptACT.triggered.connect(
|
|
80
82
|
self.uiConsoleTXT.clearToLastPrompt
|
|
@@ -119,12 +121,38 @@ class LoggerWindow(Window):
|
|
|
119
121
|
self.uiCloseLoggerACT.triggered.connect(self.closeLogger)
|
|
120
122
|
|
|
121
123
|
self.uiRunAllACT.triggered.connect(self.execAll)
|
|
122
|
-
|
|
124
|
+
# Even though the RunSelected actions (with shortcuts) are connected
|
|
125
|
+
# here, this only affects if the action is chosen from the menu. The
|
|
126
|
+
# shortcuts are always intercepted by the workbox document editor. To
|
|
127
|
+
# handle this, the workbox.keyPressEvent method will perceive the
|
|
128
|
+
# shortcut press, and call .execSelected, which will then ultimately call
|
|
129
|
+
# workbox.__exec_selected__
|
|
130
|
+
self.uiRunSelectedACT.triggered.connect(
|
|
131
|
+
partial(self.execSelected, truncate=True)
|
|
132
|
+
)
|
|
133
|
+
self.uiRunSelectedDontTruncateACT.triggered.connect(
|
|
134
|
+
partial(self.execSelected, truncate=False)
|
|
135
|
+
)
|
|
123
136
|
|
|
124
|
-
self.
|
|
137
|
+
self.uiConsoleAutoCompleteEnabledACT.toggled.connect(
|
|
138
|
+
partial(self.setAutoCompleteEnabled, console=True)
|
|
139
|
+
)
|
|
140
|
+
self.uiWorkboxAutoCompleteEnabledACT.toggled.connect(
|
|
141
|
+
partial(self.setAutoCompleteEnabled, console=False)
|
|
142
|
+
)
|
|
125
143
|
|
|
126
144
|
self.uiAutoCompleteCaseSensitiveACT.toggled.connect(self.setCaseSensitive)
|
|
127
145
|
|
|
146
|
+
self.uiSelectMonospaceFontACT.triggered.connect(
|
|
147
|
+
partial(self.selectFont, monospace=True)
|
|
148
|
+
)
|
|
149
|
+
self.uiSelectProportionalFontACT.triggered.connect(
|
|
150
|
+
partial(self.selectFont, proportional=True)
|
|
151
|
+
)
|
|
152
|
+
self.uiSelectAllFontACT.triggered.connect(
|
|
153
|
+
partial(self.selectFont, monospace=True, proportional=True)
|
|
154
|
+
)
|
|
155
|
+
|
|
128
156
|
# Setup ability to cycle completer mode, and create action for each mode
|
|
129
157
|
self.completerModeCycle = itertools.cycle(CompleterMode)
|
|
130
158
|
# create CompleterMode submenu
|
|
@@ -234,27 +262,9 @@ class LoggerWindow(Window):
|
|
|
234
262
|
# Make action shortcuts available anywhere in the Logger
|
|
235
263
|
self.addAction(self.uiClearLogACT)
|
|
236
264
|
|
|
265
|
+
self.dont_ask_again = []
|
|
237
266
|
self.restorePrefs()
|
|
238
267
|
|
|
239
|
-
# add font menu list
|
|
240
|
-
curFamily = self.console().font().family()
|
|
241
|
-
fontDB = QFontDatabase()
|
|
242
|
-
fontFamilies = fontDB.families(QFontDatabase.Latin)
|
|
243
|
-
monospaceFonts = [fam for fam in fontFamilies if fontDB.isFixedPitch(fam)]
|
|
244
|
-
|
|
245
|
-
self.uiMonospaceFontMENU.clear()
|
|
246
|
-
self.uiProportionalFontMENU.clear()
|
|
247
|
-
|
|
248
|
-
for family in fontFamilies:
|
|
249
|
-
if family in monospaceFonts:
|
|
250
|
-
action = self.uiMonospaceFontMENU.addAction(family)
|
|
251
|
-
else:
|
|
252
|
-
action = self.uiProportionalFontMENU.addAction(family)
|
|
253
|
-
action.setObjectName(u'ui{}FontACT'.format(family))
|
|
254
|
-
action.setCheckable(True)
|
|
255
|
-
action.setChecked(family == curFamily)
|
|
256
|
-
action.triggered.connect(partial(self.selectFont, action))
|
|
257
|
-
|
|
258
268
|
# add stylesheet menu options.
|
|
259
269
|
for style_name in stylesheets.stylesheets():
|
|
260
270
|
action = self.uiStyleMENU.addAction(style_name)
|
|
@@ -276,6 +286,9 @@ class LoggerWindow(Window):
|
|
|
276
286
|
)
|
|
277
287
|
)
|
|
278
288
|
|
|
289
|
+
self.setWorkboxFontBasedOnConsole()
|
|
290
|
+
self.setEditorChooserFontBasedOnConsole()
|
|
291
|
+
|
|
279
292
|
self.setup_run_workbox()
|
|
280
293
|
|
|
281
294
|
if not standalone:
|
|
@@ -429,7 +442,7 @@ class LoggerWindow(Window):
|
|
|
429
442
|
if not workbox.hasFocus():
|
|
430
443
|
return
|
|
431
444
|
|
|
432
|
-
text = workbox.__selected_text__()
|
|
445
|
+
text, _line = workbox.__selected_text__(selectText=True)
|
|
433
446
|
if not text:
|
|
434
447
|
line, index = workbox.__cursor_position__()
|
|
435
448
|
text = workbox.__text__(line)
|
|
@@ -513,15 +526,7 @@ class LoggerWindow(Window):
|
|
|
513
526
|
newSize = font.pointSize() + delta
|
|
514
527
|
newSize = max(min(newSize, maxSize), minSize)
|
|
515
528
|
|
|
516
|
-
|
|
517
|
-
self.console().setConsoleFont(font)
|
|
518
|
-
|
|
519
|
-
for workbox in self.uiWorkboxTAB.all_widgets():
|
|
520
|
-
marginsFont = workbox.__margins_font__()
|
|
521
|
-
marginsFont.setPointSize(newSize)
|
|
522
|
-
workbox.__set_margins_font__(marginsFont)
|
|
523
|
-
|
|
524
|
-
workbox.__set_font__(font)
|
|
529
|
+
self.setFontSize(newSize)
|
|
525
530
|
else:
|
|
526
531
|
Window.wheelEvent(self, event)
|
|
527
532
|
|
|
@@ -539,41 +544,76 @@ class LoggerWindow(Window):
|
|
|
539
544
|
menu = action.parentWidget()
|
|
540
545
|
QToolTip.showText(QCursor.pos(), text, menu)
|
|
541
546
|
|
|
542
|
-
def
|
|
543
|
-
"""
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
action = None
|
|
548
|
-
for act in actions:
|
|
549
|
-
if act.isChecked():
|
|
550
|
-
action = act
|
|
551
|
-
break
|
|
552
|
-
|
|
553
|
-
return action
|
|
554
|
-
|
|
555
|
-
def selectFont(self, action):
|
|
556
|
-
"""Set console and workbox font to current font
|
|
547
|
+
def selectFont(self, monospace=False, proportional=False):
|
|
548
|
+
"""Present a QFontChooser dialog, offering, monospace, proportional, or all
|
|
549
|
+
fonts, based on user choice. If a font is chosen, set it on the console and
|
|
550
|
+
workboxes.
|
|
557
551
|
|
|
558
552
|
Args:
|
|
559
553
|
action (QAction): menu action associated with chosen font
|
|
560
554
|
"""
|
|
555
|
+
origFont = self.console().font()
|
|
556
|
+
curFontFamily = origFont.family()
|
|
557
|
+
|
|
558
|
+
if monospace and proportional:
|
|
559
|
+
options = QFontDialog.MonospacedFonts | QFontDialog.ProportionalFonts
|
|
560
|
+
kind = "monospace or proportional "
|
|
561
|
+
elif monospace:
|
|
562
|
+
options = QFontDialog.MonospacedFonts
|
|
563
|
+
kind = "monospace "
|
|
564
|
+
elif proportional:
|
|
565
|
+
options = QFontDialog.ProportionalFonts
|
|
566
|
+
kind = "proportional "
|
|
567
|
+
|
|
568
|
+
# Present a QFontDialog for user to choose a font
|
|
569
|
+
title = "Pick a {} font. Current font is: {}".format(kind, curFontFamily)
|
|
570
|
+
newFont, okClicked = QFontDialog.getFont(origFont, self, title, options=options)
|
|
571
|
+
|
|
572
|
+
if okClicked:
|
|
573
|
+
self.console().setConsoleFont(newFont)
|
|
574
|
+
self.setWorkboxFontBasedOnConsole()
|
|
575
|
+
self.setEditorChooserFontBasedOnConsole()
|
|
576
|
+
|
|
577
|
+
def setFontSize(self, newSize):
|
|
578
|
+
"""Update the font size in the console and current workbox.
|
|
561
579
|
|
|
562
|
-
|
|
563
|
-
|
|
580
|
+
Args:
|
|
581
|
+
newSize (int): The new size to set the font
|
|
582
|
+
"""
|
|
583
|
+
font = self.console().font()
|
|
584
|
+
font.setPointSize(newSize)
|
|
585
|
+
self.console().setConsoleFont(font)
|
|
564
586
|
|
|
565
|
-
|
|
566
|
-
|
|
587
|
+
self.setWorkboxFontBasedOnConsole()
|
|
588
|
+
self.setEditorChooserFontBasedOnConsole()
|
|
567
589
|
|
|
568
|
-
|
|
590
|
+
def setWorkboxFontBasedOnConsole(self):
|
|
591
|
+
"""If the current workbox's font is different to the console's font, set it to
|
|
592
|
+
match.
|
|
593
|
+
"""
|
|
569
594
|
font = self.console().font()
|
|
570
|
-
font.setFamily(family)
|
|
571
|
-
self.console().setConsoleFont(font)
|
|
572
595
|
|
|
573
|
-
|
|
596
|
+
workboxGroup = self.uiWorkboxTAB.currentWidget()
|
|
597
|
+
if workboxGroup is None:
|
|
598
|
+
return
|
|
599
|
+
|
|
600
|
+
workbox = workboxGroup.currentWidget()
|
|
601
|
+
if workbox is None:
|
|
602
|
+
return
|
|
603
|
+
|
|
604
|
+
if workbox.__font__() != font:
|
|
574
605
|
workbox.__set_margins_font__(font)
|
|
575
606
|
workbox.__set_font__(font)
|
|
576
607
|
|
|
608
|
+
def setEditorChooserFontBasedOnConsole(self):
|
|
609
|
+
"""Set the EditorChooser font to match console. This helps with legibility when
|
|
610
|
+
using EditorChooser.
|
|
611
|
+
"""
|
|
612
|
+
font = self.console().font()
|
|
613
|
+
for child in self.uiEditorChooserWGT.children():
|
|
614
|
+
if hasattr(child, "font"):
|
|
615
|
+
child.setFont(font)
|
|
616
|
+
|
|
577
617
|
@classmethod
|
|
578
618
|
def _genPrefName(cls, baseName, index):
|
|
579
619
|
if index:
|
|
@@ -635,11 +675,21 @@ class LoggerWindow(Window):
|
|
|
635
675
|
prompt = console.prompt()
|
|
636
676
|
console.startPrompt(prompt)
|
|
637
677
|
|
|
638
|
-
def execSelected(self):
|
|
639
|
-
"""Clears the console before executing selected workbox code
|
|
678
|
+
def execSelected(self, truncate=True):
|
|
679
|
+
"""Clears the console before executing selected workbox code.
|
|
680
|
+
|
|
681
|
+
NOTE! This method is not called when the uiRunSelectedACT is triggered,
|
|
682
|
+
because the workbox will always intercept it. So instead, the workbox's
|
|
683
|
+
keyPressEvent will notice the shortcut and call this method.
|
|
684
|
+
"""
|
|
685
|
+
|
|
640
686
|
if self.uiClearBeforeRunningACT.isChecked():
|
|
641
687
|
self.clearLog()
|
|
642
|
-
|
|
688
|
+
|
|
689
|
+
self.current_workbox().__exec_selected__(truncate=truncate)
|
|
690
|
+
|
|
691
|
+
if self.uiAutoPromptACT.isChecked():
|
|
692
|
+
self.console().startInputLine()
|
|
643
693
|
|
|
644
694
|
def keyPressEvent(self, event):
|
|
645
695
|
# Fix 'Maya : Qt tools lose focus' https://redmine.blur.com/issues/34430
|
|
@@ -652,6 +702,11 @@ class LoggerWindow(Window):
|
|
|
652
702
|
if self.uiClearLogOnRefreshACT.isChecked():
|
|
653
703
|
self.clearLog()
|
|
654
704
|
|
|
705
|
+
def clearExecutionTime(self):
|
|
706
|
+
"""Update status text with hyphens to indicate execution has begun."""
|
|
707
|
+
self.setStatusText('Exec: -.- Seconds')
|
|
708
|
+
QApplication.instance().processEvents()
|
|
709
|
+
|
|
655
710
|
def reportExecutionTime(self, seconds):
|
|
656
711
|
"""Update status text with seconds passed in."""
|
|
657
712
|
self.uiStatusLBL.showSeconds(seconds)
|
|
@@ -671,11 +726,15 @@ class LoggerWindow(Window):
|
|
|
671
726
|
'SplitterSize': self.uiSplitterSPLIT.sizes(),
|
|
672
727
|
'tabIndent': self.uiIndentationsTabsACT.isChecked(),
|
|
673
728
|
'copyIndentsAsSpaces': self.uiCopyTabsToSpacesACT.isChecked(),
|
|
674
|
-
'hintingEnabled': self.
|
|
729
|
+
'hintingEnabled': self.uiConsoleAutoCompleteEnabledACT.isChecked(),
|
|
730
|
+
'workboxHintingEnabled': (
|
|
731
|
+
self.uiWorkboxAutoCompleteEnabledACT.isChecked()
|
|
732
|
+
),
|
|
675
733
|
'spellCheckEnabled': self.uiSpellCheckEnabledACT.isChecked(),
|
|
676
734
|
'wordWrap': self.uiWordWrapACT.isChecked(),
|
|
677
735
|
'clearBeforeRunning': self.uiClearBeforeRunningACT.isChecked(),
|
|
678
736
|
'clearBeforeEnvRefresh': self.uiClearLogOnRefreshACT.isChecked(),
|
|
737
|
+
'uiSelectTextACT': self.uiSelectTextACT.isChecked(),
|
|
679
738
|
'toolbarStates': six.text_type(self.saveState().toHex(), 'utf-8'),
|
|
680
739
|
'consoleFont': self.console().font().toString(),
|
|
681
740
|
'uiAutoSaveSettingssACT': self.uiAutoSaveSettingssACT.isChecked(),
|
|
@@ -693,6 +752,10 @@ class LoggerWindow(Window):
|
|
|
693
752
|
),
|
|
694
753
|
'find_files_context': self.uiFindInWorkboxesWGT.uiContextSPN.value(),
|
|
695
754
|
'find_files_text': self.uiFindInWorkboxesWGT.uiFindTXT.text(),
|
|
755
|
+
'uiHighlightExactCompletionACT': (
|
|
756
|
+
self.uiHighlightExactCompletionACT.isChecked()
|
|
757
|
+
),
|
|
758
|
+
'dont_ask_again': self.dont_ask_again,
|
|
696
759
|
}
|
|
697
760
|
)
|
|
698
761
|
|
|
@@ -727,6 +790,15 @@ class LoggerWindow(Window):
|
|
|
727
790
|
with open(filename, 'w') as fp:
|
|
728
791
|
json.dump(pref, fp, indent=4)
|
|
729
792
|
|
|
793
|
+
def maybeDisplayDialog(self, dialog):
|
|
794
|
+
"""If user hasn't previously opted to not show this particular dialog again,
|
|
795
|
+
show it.
|
|
796
|
+
"""
|
|
797
|
+
if dialog.objectName() in self.dont_ask_again:
|
|
798
|
+
return
|
|
799
|
+
|
|
800
|
+
dialog.exec_()
|
|
801
|
+
|
|
730
802
|
def restartLogger(self):
|
|
731
803
|
"""Closes this PrEditor instance and starts a new process with the same
|
|
732
804
|
cli arguments.
|
|
@@ -776,21 +848,20 @@ class LoggerWindow(Window):
|
|
|
776
848
|
self.setWindowState(Qt.WindowStates(pref.get('windowState', 0)))
|
|
777
849
|
self.uiIndentationsTabsACT.setChecked(pref.get('tabIndent', True))
|
|
778
850
|
self.uiCopyTabsToSpacesACT.setChecked(pref.get('copyIndentsAsSpaces', False))
|
|
779
|
-
self.uiAutoCompleteEnabledACT.setChecked(pref.get('hintingEnabled', True))
|
|
780
851
|
|
|
781
852
|
# completer settings
|
|
782
853
|
self.setCaseSensitive(pref.get('caseSensitive', True))
|
|
783
854
|
completerMode = CompleterMode(pref.get('completerMode', 0))
|
|
784
855
|
self.cycleToCompleterMode(completerMode)
|
|
785
856
|
self.setCompleterMode(completerMode)
|
|
857
|
+
self.uiHighlightExactCompletionACT.setChecked(
|
|
858
|
+
pref.get('uiHighlightExactCompletionACT', False)
|
|
859
|
+
)
|
|
786
860
|
|
|
787
861
|
self.setSpellCheckEnabled(self.uiSpellCheckEnabledACT.isChecked())
|
|
788
862
|
self.uiSpellCheckEnabledACT.setChecked(pref.get('spellCheckEnabled', False))
|
|
789
863
|
self.uiSpellCheckEnabledACT.setDisabled(False)
|
|
790
864
|
|
|
791
|
-
self.uiConsoleTXT.completer().setEnabled(
|
|
792
|
-
self.uiAutoCompleteEnabledACT.isChecked()
|
|
793
|
-
)
|
|
794
865
|
self.uiAutoSaveSettingssACT.setChecked(pref.get('uiAutoSaveSettingssACT', True))
|
|
795
866
|
|
|
796
867
|
self.uiAutoPromptACT.setChecked(pref.get('uiAutoPromptACT', False))
|
|
@@ -814,7 +885,7 @@ class LoggerWindow(Window):
|
|
|
814
885
|
|
|
815
886
|
# External text editor filepath and command template
|
|
816
887
|
defaultExePath = r"C:\Program Files\Sublime Text 3\sublime_text.exe"
|
|
817
|
-
defaultCmd = r"{exePath} {modulePath}:{lineNum}
|
|
888
|
+
defaultCmd = r'"{exePath}" "{modulePath}":{lineNum}'
|
|
818
889
|
self.textEditorPath = pref.get('textEditorPath', defaultExePath)
|
|
819
890
|
self.textEditorCmdTempl = pref.get('textEditorCmdTempl', defaultCmd)
|
|
820
891
|
|
|
@@ -823,6 +894,7 @@ class LoggerWindow(Window):
|
|
|
823
894
|
self.uiClearBeforeRunningACT.setChecked(pref.get('clearBeforeRunning', False))
|
|
824
895
|
self.uiClearLogOnRefreshACT.setChecked(pref.get('clearBeforeEnvRefresh', False))
|
|
825
896
|
self.setClearBeforeRunning(self.uiClearBeforeRunningACT.isChecked())
|
|
897
|
+
self.uiSelectTextACT.setChecked(pref.get('uiSelectTextACT', True))
|
|
826
898
|
|
|
827
899
|
self._stylesheet = pref.get('currentStyleSheet', 'Bright')
|
|
828
900
|
if self._stylesheet == 'Custom':
|
|
@@ -833,6 +905,13 @@ class LoggerWindow(Window):
|
|
|
833
905
|
|
|
834
906
|
self.uiWorkboxTAB.restore_prefs(pref.get('workbox_prefs', {}))
|
|
835
907
|
|
|
908
|
+
hintingEnabled = pref.get('hintingEnabled', True)
|
|
909
|
+
self.uiConsoleAutoCompleteEnabledACT.setChecked(hintingEnabled)
|
|
910
|
+
self.setAutoCompleteEnabled(hintingEnabled, console=True)
|
|
911
|
+
workboxHintingEnabled = pref.get('workboxHintingEnabled', True)
|
|
912
|
+
self.uiWorkboxAutoCompleteEnabledACT.setChecked(workboxHintingEnabled)
|
|
913
|
+
self.setAutoCompleteEnabled(workboxHintingEnabled, console=False)
|
|
914
|
+
|
|
836
915
|
# Ensure the correct workbox stack page is shown
|
|
837
916
|
self.update_workbox_stack()
|
|
838
917
|
|
|
@@ -842,6 +921,8 @@ class LoggerWindow(Window):
|
|
|
842
921
|
if font.fromString(_font):
|
|
843
922
|
self.console().setConsoleFont(font)
|
|
844
923
|
|
|
924
|
+
self.dont_ask_again = pref.get('dont_ask_again', [])
|
|
925
|
+
|
|
845
926
|
def restoreToolbars(self, pref=None):
|
|
846
927
|
if pref is None:
|
|
847
928
|
pref = self.load_prefs()
|
|
@@ -851,10 +932,12 @@ class LoggerWindow(Window):
|
|
|
851
932
|
state = QByteArray.fromHex(bytes(state, 'utf-8'))
|
|
852
933
|
self.restoreState(state)
|
|
853
934
|
|
|
854
|
-
def setAutoCompleteEnabled(self, state):
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
935
|
+
def setAutoCompleteEnabled(self, state, console=True):
|
|
936
|
+
if console:
|
|
937
|
+
self.uiConsoleTXT.completer().setEnabled(state)
|
|
938
|
+
else:
|
|
939
|
+
for workbox, _, _, _, _ in self.uiWorkboxTAB.all_widgets():
|
|
940
|
+
workbox.__set_auto_complete_enabled__(state)
|
|
858
941
|
|
|
859
942
|
def setSpellCheckEnabled(self, state):
|
|
860
943
|
try:
|
|
@@ -17,7 +17,7 @@ class SetTextEditorPathDialog(QDialog):
|
|
|
17
17
|
super(SetTextEditorPathDialog, self).__init__(parent)
|
|
18
18
|
loadUi(__file__, self)
|
|
19
19
|
|
|
20
|
-
#
|
|
20
|
+
# Retrieve existing data from LoggerWindow
|
|
21
21
|
path = self.parent().textEditorPath
|
|
22
22
|
cmdTempl = self.parent().textEditorCmdTempl
|
|
23
23
|
|
|
@@ -29,9 +29,9 @@ class SetTextEditorPathDialog(QDialog):
|
|
|
29
29
|
|
|
30
30
|
toolTip = (
|
|
31
31
|
"Examples:\n"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
'SublimeText: "{exePath}" "{modulePath}":{lineNum}\n'
|
|
33
|
+
'notepad++: "{exePath}" "{modulePath}" -n{lineNum}\n'
|
|
34
|
+
'vim: "{exePath}" + {lineNum} "{modulePath}'
|
|
35
35
|
)
|
|
36
36
|
self.uiTextEditorCommandPatternLE.setToolTip(toolTip)
|
|
37
37
|
|
preditor/gui/status_label.py
CHANGED
|
@@ -54,17 +54,28 @@ class StatusLabel(QLabel):
|
|
|
54
54
|
|
|
55
55
|
def showSeconds(self, seconds):
|
|
56
56
|
self.times.append(seconds)
|
|
57
|
-
self.setText(self.secondsText(seconds))
|
|
57
|
+
self.setText(self.secondsText(seconds[0]))
|
|
58
58
|
|
|
59
59
|
def showMenu(self):
|
|
60
60
|
menu = QMenu(self)
|
|
61
61
|
if self.times:
|
|
62
62
|
# Show the time it took to run the last X code calls
|
|
63
|
+
times = []
|
|
63
64
|
for seconds in self.times:
|
|
64
|
-
|
|
65
|
+
secs, cmd = seconds
|
|
66
|
+
times.append(secs)
|
|
67
|
+
|
|
68
|
+
# Add a simplified copy of the command that was run
|
|
69
|
+
cmd = cmd.strip()
|
|
70
|
+
cmds = cmd.split("\n")
|
|
71
|
+
if len(cmds) > 1 or len(cmds[0]) > 50:
|
|
72
|
+
cmd = "{} ...".format(cmds[0][:50])
|
|
73
|
+
# Escape &'s so they dont' get turned into a shortcut'
|
|
74
|
+
cmd = cmd.replace("&", "&&")
|
|
75
|
+
menu.addAction("{}: {}".format(self.secondsText(secs), cmd))
|
|
65
76
|
|
|
66
77
|
menu.addSeparator()
|
|
67
|
-
avg = sum(
|
|
78
|
+
avg = sum(times) / len(times)
|
|
68
79
|
menu.addAction("Average: {:0.04f}s".format(avg))
|
|
69
80
|
act = menu.addAction("Clear")
|
|
70
81
|
act.triggered.connect(self.clearTimes)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
|
|
3
|
+
from Qt.QtWidgets import QDialog
|
|
4
|
+
|
|
5
|
+
from . import loadUi
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SuggestPathQuotesDialog(QDialog):
|
|
9
|
+
"""A dialog to suggest to enclose paths in double-quotes in the cmdTempl which is
|
|
10
|
+
used to launch an external text editor.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self, parent, oldCmdTempl, newCmdTempl):
|
|
14
|
+
super(SuggestPathQuotesDialog, self).__init__(parent)
|
|
15
|
+
loadUi(__file__, self)
|
|
16
|
+
|
|
17
|
+
self.parentWindow = self.parent().window()
|
|
18
|
+
|
|
19
|
+
self.uiTextEditorOldCommandPatternLE.setText(oldCmdTempl)
|
|
20
|
+
self.uiTextEditorNewCommandPatternLE.setText(newCmdTempl)
|
|
21
|
+
|
|
22
|
+
toolTip = (
|
|
23
|
+
"Examples:\n"
|
|
24
|
+
'SublimeText: "{exePath}" "{modulePath}":{lineNum}\n'
|
|
25
|
+
'notepad++: "{exePath}" "{modulePath}" -n{lineNum}\n'
|
|
26
|
+
'vim: "{exePath}" + {lineNum} "{modulePath}'
|
|
27
|
+
)
|
|
28
|
+
self.uiTextEditorNewCommandPatternLE.setToolTip(toolTip)
|
|
29
|
+
|
|
30
|
+
def accept(self):
|
|
31
|
+
"""Set the parentWindow's textEditorCmdTempl property from the dialog, and
|
|
32
|
+
optionally add dialog to parent's dont_ask_again list, and accept.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
cmdTempl = self.uiTextEditorNewCommandPatternLE.text()
|
|
36
|
+
self.parentWindow.textEditorCmdTempl = cmdTempl
|
|
37
|
+
|
|
38
|
+
if self.uiDontAskAgainCHK.isChecked():
|
|
39
|
+
if hasattr(self.parentWindow, "dont_ask_again"):
|
|
40
|
+
self.parentWindow.dont_ask_again.append(self.objectName())
|
|
41
|
+
|
|
42
|
+
super(SuggestPathQuotesDialog, self).accept()
|
|
43
|
+
|
|
44
|
+
def reject(self):
|
|
45
|
+
"""Optionally add dialog to parentWindow's dont_ask_again list, and reject"""
|
|
46
|
+
if self.uiDontAskAgainCHK.isChecked():
|
|
47
|
+
if hasattr(self.parentWindow, "dont_ask_again"):
|
|
48
|
+
self.parentWindow.dont_ask_again.append(self.objectName())
|
|
49
|
+
|
|
50
|
+
super(SuggestPathQuotesDialog, self).reject()
|
preditor/gui/ui/loggerwindow.ui
CHANGED
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
<x>0</x>
|
|
93
93
|
<y>0</y>
|
|
94
94
|
<width>796</width>
|
|
95
|
-
<height>
|
|
95
|
+
<height>29</height>
|
|
96
96
|
</rect>
|
|
97
97
|
</property>
|
|
98
98
|
<widget class="QMenu" name="uiDebugMENU">
|
|
@@ -137,10 +137,12 @@
|
|
|
137
137
|
<string>Run</string>
|
|
138
138
|
</property>
|
|
139
139
|
<addaction name="uiRunSelectedACT"/>
|
|
140
|
+
<addaction name="uiRunSelectedDontTruncateACT"/>
|
|
140
141
|
<addaction name="uiRunAllACT"/>
|
|
141
142
|
<addaction name="separator"/>
|
|
142
143
|
<addaction name="uiClearBeforeRunningACT"/>
|
|
143
144
|
<addaction name="uiClearToLastPromptACT"/>
|
|
145
|
+
<addaction name="uiSelectTextACT"/>
|
|
144
146
|
</widget>
|
|
145
147
|
<widget class="QMenu" name="uiFileMENU">
|
|
146
148
|
<property name="title">
|
|
@@ -160,34 +162,25 @@
|
|
|
160
162
|
</property>
|
|
161
163
|
<addaction name="separator"/>
|
|
162
164
|
</widget>
|
|
163
|
-
<widget class="QMenu" name="
|
|
165
|
+
<widget class="QMenu" name="uiSelectFontsMENU">
|
|
164
166
|
<property name="title">
|
|
165
|
-
<string>Font</string>
|
|
167
|
+
<string>Select Font</string>
|
|
166
168
|
</property>
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
</property>
|
|
171
|
-
<addaction name="uiFontMENU"/>
|
|
172
|
-
</widget>
|
|
173
|
-
<widget class="QMenu" name="uiProportionalFontMENU">
|
|
174
|
-
<property name="title">
|
|
175
|
-
<string>Proportional</string>
|
|
176
|
-
</property>
|
|
177
|
-
<addaction name="actionPlaceHolderProportionalFont"/>
|
|
178
|
-
</widget>
|
|
179
|
-
<addaction name="uiMonospaceFontMENU"/>
|
|
180
|
-
<addaction name="uiProportionalFontMENU"/>
|
|
169
|
+
<addaction name="uiSelectMonospaceFontACT"/>
|
|
170
|
+
<addaction name="uiSelectProportionalFontACT"/>
|
|
171
|
+
<addaction name="uiSelectAllFontACT"/>
|
|
181
172
|
</widget>
|
|
182
|
-
<addaction name="
|
|
173
|
+
<addaction name="uiConsoleAutoCompleteEnabledACT"/>
|
|
174
|
+
<addaction name="uiWorkboxAutoCompleteEnabledACT"/>
|
|
183
175
|
<addaction name="uiSpellCheckEnabledACT"/>
|
|
184
176
|
<addaction name="uiAutoCompleteCaseSensitiveACT"/>
|
|
185
177
|
<addaction name="uiCompleterModeMENU"/>
|
|
178
|
+
<addaction name="uiHighlightExactCompletionACT"/>
|
|
186
179
|
<addaction name="separator"/>
|
|
187
180
|
<addaction name="uiClearLogACT"/>
|
|
188
181
|
<addaction name="uiClearLogOnRefreshACT"/>
|
|
189
182
|
<addaction name="separator"/>
|
|
190
|
-
<addaction name="
|
|
183
|
+
<addaction name="uiSelectFontsMENU"/>
|
|
191
184
|
<addaction name="uiStyleMENU"/>
|
|
192
185
|
<addaction name="separator"/>
|
|
193
186
|
<addaction name="uiIndentationsTabsACT"/>
|
|
@@ -399,15 +392,21 @@
|
|
|
399
392
|
<string>Ctrl+Alt+Shift+D</string>
|
|
400
393
|
</property>
|
|
401
394
|
</action>
|
|
402
|
-
<action name="
|
|
395
|
+
<action name="uiConsoleAutoCompleteEnabledACT">
|
|
403
396
|
<property name="checkable">
|
|
404
397
|
<bool>true</bool>
|
|
405
398
|
</property>
|
|
406
399
|
<property name="checked">
|
|
407
|
-
<bool>
|
|
400
|
+
<bool>false</bool>
|
|
408
401
|
</property>
|
|
409
402
|
<property name="text">
|
|
410
|
-
<string>Use
|
|
403
|
+
<string>Use Auto-Complete in console</string>
|
|
404
|
+
</property>
|
|
405
|
+
<property name="iconText">
|
|
406
|
+
<string>Use Auto-Complete in console</string>
|
|
407
|
+
</property>
|
|
408
|
+
<property name="toolTip">
|
|
409
|
+
<string>Use Auto-Complete in console</string>
|
|
411
410
|
</property>
|
|
412
411
|
</action>
|
|
413
412
|
<action name="uiRunLineACT">
|
|
@@ -420,7 +419,7 @@
|
|
|
420
419
|
</action>
|
|
421
420
|
<action name="uiRunAllACT">
|
|
422
421
|
<property name="text">
|
|
423
|
-
<string>Run All
|
|
422
|
+
<string>Run All</string>
|
|
424
423
|
</property>
|
|
425
424
|
<property name="toolTip">
|
|
426
425
|
<string>Run all code from the current workbox</string>
|
|
@@ -436,7 +435,7 @@
|
|
|
436
435
|
</action>
|
|
437
436
|
<action name="uiRunSelectedACT">
|
|
438
437
|
<property name="text">
|
|
439
|
-
<string>Run Selected
|
|
438
|
+
<string>Run Selected - truncate return value</string>
|
|
440
439
|
</property>
|
|
441
440
|
<property name="toolTip">
|
|
442
441
|
<string><html><head/><body><p>Run some code from the current workbox. If you have text selected, only the selected text is run. With no text selected, the current line is run. You can also use the Number Pad Enter key to activate this.</p></body></html></string>
|
|
@@ -648,16 +647,6 @@
|
|
|
648
647
|
<string>FullFuzzy</string>
|
|
649
648
|
</property>
|
|
650
649
|
</action>
|
|
651
|
-
<action name="uiFontMENU">
|
|
652
|
-
<property name="text">
|
|
653
|
-
<string>PlaceHolderMonospaceFont</string>
|
|
654
|
-
</property>
|
|
655
|
-
</action>
|
|
656
|
-
<action name="actionPlaceHolderProportionalFont">
|
|
657
|
-
<property name="text">
|
|
658
|
-
<string>PlaceHolderProportionalFont</string>
|
|
659
|
-
</property>
|
|
660
|
-
</action>
|
|
661
650
|
<action name="uiCycleCompleterModeACT">
|
|
662
651
|
<property name="text">
|
|
663
652
|
<string>Cycle Completer Modes</string>
|
|
@@ -964,6 +953,65 @@ at the indicated line in the specified text editor.
|
|
|
964
953
|
<string>Ctrl+Shift+F</string>
|
|
965
954
|
</property>
|
|
966
955
|
</action>
|
|
956
|
+
<action name="uiSelectTextACT">
|
|
957
|
+
<property name="checkable">
|
|
958
|
+
<bool>true</bool>
|
|
959
|
+
</property>
|
|
960
|
+
<property name="checked">
|
|
961
|
+
<bool>true</bool>
|
|
962
|
+
</property>
|
|
963
|
+
<property name="text">
|
|
964
|
+
<string>Select text when Run Selected w/o selection</string>
|
|
965
|
+
</property>
|
|
966
|
+
</action>
|
|
967
|
+
<action name="uiWorkboxAutoCompleteEnabledACT">
|
|
968
|
+
<property name="checkable">
|
|
969
|
+
<bool>true</bool>
|
|
970
|
+
</property>
|
|
971
|
+
<property name="text">
|
|
972
|
+
<string>Use Auto-Complete in workbox</string>
|
|
973
|
+
</property>
|
|
974
|
+
</action>
|
|
975
|
+
<action name="uiSelectMonospaceFontACT">
|
|
976
|
+
<property name="text">
|
|
977
|
+
<string>Choose from monospace fonts</string>
|
|
978
|
+
</property>
|
|
979
|
+
<property name="toolTip">
|
|
980
|
+
<string>Choose from monospace fonts</string>
|
|
981
|
+
</property>
|
|
982
|
+
</action>
|
|
983
|
+
<action name="uiSelectProportionalFontACT">
|
|
984
|
+
<property name="text">
|
|
985
|
+
<string>Choose from proportional fonts</string>
|
|
986
|
+
</property>
|
|
987
|
+
<property name="toolTip">
|
|
988
|
+
<string>Choose from proportional fonts</string>
|
|
989
|
+
</property>
|
|
990
|
+
</action>
|
|
991
|
+
<action name="uiSelectAllFontACT">
|
|
992
|
+
<property name="text">
|
|
993
|
+
<string>Choose from all fonts</string>
|
|
994
|
+
</property>
|
|
995
|
+
<property name="toolTip">
|
|
996
|
+
<string>Choose from all fonts</string>
|
|
997
|
+
</property>
|
|
998
|
+
</action>
|
|
999
|
+
<action name="uiRunSelectedDontTruncateACT">
|
|
1000
|
+
<property name="text">
|
|
1001
|
+
<string>Run Selected - don't truncate return value</string>
|
|
1002
|
+
</property>
|
|
1003
|
+
<property name="shortcut">
|
|
1004
|
+
<string>Ctrl+Shift+Return</string>
|
|
1005
|
+
</property>
|
|
1006
|
+
</action>
|
|
1007
|
+
<action name="uiHighlightExactCompletionACT">
|
|
1008
|
+
<property name="checkable">
|
|
1009
|
+
<bool>true</bool>
|
|
1010
|
+
</property>
|
|
1011
|
+
<property name="text">
|
|
1012
|
+
<string>Highlight Exact Completion</string>
|
|
1013
|
+
</property>
|
|
1014
|
+
</action>
|
|
967
1015
|
</widget>
|
|
968
1016
|
<customwidgets>
|
|
969
1017
|
<customwidget>
|