eric6/QScintilla/Shell.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7990
3b865f4b7dff
child 8142
43248bafe9b2
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7802
diff changeset
3 # Copyright (c) 2002 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a graphical Python shell.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import sys
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import re
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
7703
1f800f8295ea Third Party packages: removed th no longer needed 'enum' package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7536
diff changeset
13 from enum import Enum
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
14
7408
0d58e708f57b Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7389
diff changeset
15 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QFileInfo, Qt, QEvent
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3631
diff changeset
16 from PyQt5.QtGui import QClipboard, QPalette, QFont
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
17 from PyQt5.QtWidgets import (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
18 QDialog, QInputDialog, QApplication, QMenu, QWidget, QHBoxLayout,
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
19 QVBoxLayout, QShortcut, QSizePolicy
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
20 )
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3631
diff changeset
21 from PyQt5.Qsci import QsciScintilla
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
2084
d3f083dd0222 Made the fiveth set of Qt5 compatibility changes (some of the previous changes are backed out due to changes in PyQt4).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2077
diff changeset
23 from E5Gui.E5Application import e5App
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
24 from E5Gui import E5MessageBox
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
97
c4086afea02b Finished cleaning up the code supported by py3flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
26 from .QsciScintillaCompat import QsciScintillaCompat
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 import Preferences
5020
d0afdfd8e45b Added capability to filter ANSI escape sequences out of output strings. This is limited to color sequences at the moment.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
29 import Utilities
d0afdfd8e45b Added capability to filter ANSI escape sequences out of output strings. This is limited to color sequences at the moment.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
30
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 import UI.PixmapCache
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
97
c4086afea02b Finished cleaning up the code supported by py3flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
33 from Debugger.DebugClientCapabilities import HasCompleter
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
35
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
36 class ShellAssembly(QWidget):
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
37 """
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
38 Class implementing the containing widget for the shell.
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
39 """
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
40 def __init__(self, dbs, vm, project, horizontal=True, parent=None):
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
41 """
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
42 Constructor
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
43
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
44 @param dbs reference to the debug server object
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
45 @type DebugServer
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
46 @param vm reference to the viewmanager object
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
47 @type ViewManager
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
48 @param project reference to the project object
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
49 @type Project
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
50 @param horizontal flag indicating a horizontal layout
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
51 @type bool
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
52 @param parent parent widget
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
53 @type QWidget
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
54 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2474
diff changeset
55 super(ShellAssembly, self).__init__(parent)
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
56
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
57 self.__shell = Shell(dbs, vm, project, False, self)
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
58
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
59 from UI.SearchWidget import SearchWidget
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
60 self.__searchWidget = SearchWidget(self.__shell, self, horizontal)
6387
a168b5f26a14 Shell, ShellWindow, LogViewer: fixed the layouts, an ambigous shortcut and added a missing method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6377
diff changeset
61 self.__searchWidget.setSizePolicy(QSizePolicy.Fixed,
a168b5f26a14 Shell, ShellWindow, LogViewer: fixed the layouts, an ambigous shortcut and added a missing method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6377
diff changeset
62 QSizePolicy.Preferred)
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
63 self.__searchWidget.hide()
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
64
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
65 if horizontal:
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
66 self.__layout = QHBoxLayout(self)
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
67 else:
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
68 self.__layout = QVBoxLayout(self)
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
69 self.__layout.setContentsMargins(1, 1, 1, 1)
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
70 self.__layout.addWidget(self.__shell)
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
71 self.__layout.addWidget(self.__searchWidget)
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
72
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
73 self.__searchWidget.searchNext.connect(self.__shell.searchNext)
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
74 self.__searchWidget.searchPrevious.connect(self.__shell.searchPrev)
2940
e9348df06994 Fixed an issue in the interpreter shell window causing data to be deleted if it contained the secondary prompt (sys.ps2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2640
diff changeset
75 self.__shell.searchStringFound.connect(
e9348df06994 Fixed an issue in the interpreter shell window causing data to be deleted if it contained the secondary prompt (sys.ps2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2640
diff changeset
76 self.__searchWidget.searchStringFound)
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
77
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
78 def showFind(self, txt=""):
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
79 """
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
80 Public method to display the search widget.
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
81
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
82 @param txt text to be shown in the combo (string)
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
83 """
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
84 self.__searchWidget.showFind(txt)
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
85
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
86 def shell(self):
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
87 """
6987
3371a03ed0a7 Performed some interface cleanups.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
88 Public method to get a reference to the shell widget.
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
89
2474
8727522a69d5 Removed the Terminal widget because there are severe issues with certain shells that cannot be fixed and it is a rarely used feature.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
90 @return reference to the shell widget (Shell)
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
91 """
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
92 return self.__shell
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
93
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
94
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
95 class ShellHistoryStyle(Enum):
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
96 """
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
97 Class defining the shell history styles.
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
98 """
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
99 Disabled = 0
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
100 LinuxStyle = 1
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
101 WindowsStyle = 2
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
102
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
103
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 class Shell(QsciScintillaCompat):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 Class implementing a graphical Python shell.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
108 A user can enter commands that are executed in the remote
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
109 Python interpreter.
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
110
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
111 @signal searchStringFound(bool) emitted to indicate the search
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
112 result
5799
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
113 @signal historyStyleChanged(ShellHistoryStyle) emitted to indicate a
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
114 change of the history style
6335
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
115 @signal queueText(str) emitted to queue some text for processing
6581
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
116 @signal virtualEnvironmentChanged(str) emitted to signal the new virtual
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
117 environment of the shell
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 """
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
119 searchStringFound = pyqtSignal(bool)
5799
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
120 historyStyleChanged = pyqtSignal(ShellHistoryStyle)
6335
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
121 queueText = pyqtSignal(str)
6581
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
122 virtualEnvironmentChanged = pyqtSignal(str)
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
123
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
124 def __init__(self, dbs, vm, project, windowedVariant, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 @param dbs reference to the debug server object
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
129 @type DebugServer
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 @param vm reference to the viewmanager object
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
131 @type ViewManager
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
132 @param project reference to the project object
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
133 @type Project
5709
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
134 @param windowedVariant flag indicating the shell window variant
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
135 @type bool
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
136 @param parent parent widget
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
137 @type QWidget
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2474
diff changeset
139 super(Shell, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 self.setUtf8(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 self.vm = vm
1833
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
143 self.__mainWindow = parent
f7cd855680f1 Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1743
diff changeset
144 self.__lastSearch = ()
5709
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
145 self.__windowed = windowedVariant
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
146 self.__currentVenv = ""
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6581
diff changeset
147 self.__currentWorkingDirectory = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 self.linesepRegExp = r"\r\n|\n|\r"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
151 self.passive = ((not self.__windowed) and
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
152 Preferences.getDebugger("PassiveDbgEnabled"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 if self.passive:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
154 self.setWindowTitle(self.tr('Shell - Passive'))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
156 self.setWindowTitle(self.tr('Shell'))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157
5709
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
158 if self.__windowed:
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
159 self.setWhatsThis(self.tr(
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
160 """<b>The Shell Window</b>"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
161 """<p>You can use the cursor keys while entering commands."""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
162 """ There is also a history of commands that can be recalled"""
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
163 """ using the up and down cursor keys while holding down the"""
5800
c3379bf35654 Updated translations and source docu for the shell changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5799
diff changeset
164 """ Ctrl-key. This can be switched to just the up and down"""
c3379bf35654 Updated translations and source docu for the shell changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5799
diff changeset
165 """ cursor keys on the Shell page of the configuration"""
c3379bf35654 Updated translations and source docu for the shell changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5799
diff changeset
166 """ dialog. Pressing these keys after some text has been"""
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
167 """ entered will start an incremental search.</p>"""
6581
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
168 """<p>The shell has some special commands. 'restart' kills"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
169 """ the shell and starts a new one. 'clear' clears the"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
170 """ display of the shell window. 'start' is used to start a"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
171 """ shell for a virtual environment and should be followed"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
172 """ by a virtual environment name. start' without a virtual"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
173 """ environment name starts the default shell. Available"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
174 """ virtual environments may be listed with the 'envs' or"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
175 """ 'environments' commands. The active virtual environment"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
176 """ can be questioned by the 'which' command. 'quit' or"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
177 """ 'exit' is used to exit the application. These commands"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
178 """ (except environments', 'envs' and 'which') are available"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
179 """ through the window menus as well.</p>"""
5709
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
180 """<p>Pressing the Tab key after some text has been entered"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
181 """ will show a list of possible completions. The relevant"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
182 """ entry may be selected from this list. If only one entry"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
183 """ is available, this will be inserted automatically.</p>"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
184 ))
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
185 else:
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
186 self.setWhatsThis(self.tr(
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
187 """<b>The Shell Window</b>"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
188 """<p>This is simply an interpreter running in a window. The"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
189 """ interpreter is the one that is used to run the program"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
190 """ being debugged. This means that you can execute any"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
191 """ command while the program being debugged is running.</p>"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
192 """<p>You can use the cursor keys while entering commands."""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
193 """ There is also a history of commands that can be recalled"""
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
194 """ using the up and down cursor keys while holding down the"""
5800
c3379bf35654 Updated translations and source docu for the shell changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5799
diff changeset
195 """ Ctrl-key. This can be switched to just the up and down"""
c3379bf35654 Updated translations and source docu for the shell changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5799
diff changeset
196 """ cursor keys on the Shell page of the configuration"""
c3379bf35654 Updated translations and source docu for the shell changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5799
diff changeset
197 """ dialog. Pressing these keys after some text has been"""
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
198 """ entered will start an incremental search.</p>"""
6581
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
199 """<p>The shell has some special commands. 'restart' kills"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
200 """ the shell and starts a new one. 'clear' clears the"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
201 """ display of the shell window. 'start' is used to start a"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
202 """ shell for a virtual environment and should be followed"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
203 """ by a virtual environment name. start' without a virtual"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
204 """ environment name starts the default shell. Available"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
205 """ virtual environments may be listed with the 'envs' or"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
206 """ 'environments' commands. The active virtual environment"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
207 """ can be questioned by the 'which' command. These commands"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
208 """ (except environments' and 'envs') are available through"""
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
209 """ the context menu as well.</p>"""
5709
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
210 """<p>Pressing the Tab key after some text has been entered"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
211 """ will show a list of possible completions. The relevant"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
212 """ entry may be selected from this list. If only one entry"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
213 """ is available, this will be inserted automatically.</p>"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
214 """<p>In passive debugging mode the shell is only available"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
215 """ after the program to be debugged has connected to the"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
216 """ IDE until it has finished. This is indicated by a"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
217 """ different prompt and by an indication in the window"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
218 """ caption.</p>"""
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
219 ))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 482
diff changeset
221 self.userListActivated.connect(self.__completionListSelected)
2640
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2474
diff changeset
222 self.linesChanged.connect(self.__resizeLinenoMargin)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223
5709
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
224 if self.__windowed:
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
225 self.__showStdOutErr = True
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
226 else:
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
227 self.__showStdOutErr = Preferences.getShell("ShowStdOutErr")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 if self.__showStdOutErr:
481
ad71812ba395 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
229 dbs.clientProcessStdout.connect(self.__writeStdOut)
ad71812ba395 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
230 dbs.clientProcessStderr.connect(self.__writeStdErr)
6478
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
231 dbs.clientOutput.connect(self.__writeQueued)
481
ad71812ba395 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
232 dbs.clientStatement.connect(self.__clientStatement)
ad71812ba395 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
233 dbs.clientGone.connect(self.__initialise)
ad71812ba395 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
234 dbs.clientRawInput.connect(self.__raw_input)
ad71812ba395 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
235 dbs.clientBanner.connect(self.__writeBanner)
ad71812ba395 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
236 dbs.clientCompletionList.connect(self.__showCompletions)
ad71812ba395 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 454
diff changeset
237 dbs.clientCapabilities.connect(self.__clientCapabilities)
3974
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
238 dbs.clientException.connect(self.__clientException)
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
239 dbs.clientSyntaxError.connect(self.__clientSyntaxError)
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
240 dbs.clientSignal.connect(self.__clientSignal)
8138
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
241 dbs.mainClientExit.connect(self.__writePrompt)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 self.dbs = dbs
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243
7408
0d58e708f57b Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7389
diff changeset
244 self.__debugUI = None
0d58e708f57b Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7389
diff changeset
245
8138
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
246 # Make sure we have prompts.
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
247 if self.passive:
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
248 sys.ps1 = self.tr("Passive >>> ")
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
249 else:
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
250 try:
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
251 sys.ps1
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
252 except AttributeError:
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
253 sys.ps1 = ">>> "
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
254 try:
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
255 sys.ps2
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
256 except AttributeError:
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
257 sys.ps2 = "... "
169e65a6787c Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7990
diff changeset
258
2640
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2474
diff changeset
259 # Initialize instance variables.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 self.__initialise()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 self.prline = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 self.prcol = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 self.inDragDrop = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 self.lexer_ = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 self.completionText = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266
5799
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
267 self.clientType = ''
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
268
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 # Initialize history
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
270 self.__historyLists = {}
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
271 self.__maxHistoryEntries = Preferences.getShell("MaxHistoryEntries")
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
272 self.__historyStyle = Preferences.getShell("HistoryStyle")
5799
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
273 self.__historyWrap = Preferences.getShell("HistoryWrap")
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
274 self.__history = []
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
275 self.__setHistoryIndex()
5108
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
276 # remove obsolete shell histories (Python and Ruby)
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
277 for clientType in ["Python", "Ruby"]:
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
278 Preferences.Prefs.settings.remove("Shell/Histories/" + clientType)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 # clear QScintilla defined keyboard commands
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 # we do our own handling through the view manager
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 self.clearAlternateKeys()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 self.clearKeys()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 self.__actionsAdded = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 if self.passive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 self.__getBanner()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288
5709
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
289 if not self.__windowed:
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
290 # Create a little language context menu
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
291 self.lmenu = QMenu(self.tr('Start'))
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
292 self.lmenu.aboutToShow.connect(self.__showStartMenu)
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
293 self.lmenu.triggered.connect(self.__startDebugClient)
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
294
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
295 # Create the history context menu
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
296 self.hmenu = QMenu(self.tr('History'))
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
297 self.hmenu.addAction(self.tr('Select entry'), self.selectHistory)
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
298 self.hmenu.addAction(self.tr('Show'), self.showHistory)
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
299 self.hmenu.addAction(self.tr('Clear'), self.clearHistory)
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
300
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
301 # Create a little context menu
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
302 self.menu = QMenu(self)
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
303 self.menu.addAction(self.tr('Cut'), self.cut)
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
304 self.menu.addAction(self.tr('Copy'), self.copy)
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
305 self.menu.addAction(self.tr('Paste'), self.paste)
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
306 self.menu.addMenu(self.hmenu).setEnabled(self.isHistoryEnabled())
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
307
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
308 self.menu.addSeparator()
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
309 self.menu.addAction(self.tr('Find'), self.__find)
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
310 self.menu.addSeparator()
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
311 self.menu.addAction(self.tr('Clear'), self.clear)
6581
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
312 self.menu.addAction(self.tr('Restart'), self.doRestart)
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
313 self.menu.addAction(
6581
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
314 self.tr('Restart and Clear'), self.doClearRestart)
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
315 self.menu.addSeparator()
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
316 self.menu.addMenu(self.lmenu)
6581
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
317 self.menu.addAction(self.tr('Active Name'), self.__showVenvName)
5709
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
318 self.menu.addSeparator()
f81d0eca2c62 Started implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
319 self.menu.addAction(self.tr("Configure..."), self.__configure)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 self.__bindLexer()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 self.__setTextDisplay()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 self.__setMargin0()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 # set the autocompletion and calltips function
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 self.__setAutoCompletion()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 self.__setCallTips()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7387
diff changeset
329 self.setWindowIcon(UI.PixmapCache.getIcon("eric"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 self.incrementalSearchString = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 self.incrementalSearchActive = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 self.supportedEditorCommands = {
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
335 QsciScintilla.SCI_LINEDELETE: self.__clearCurrentLine,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
336 QsciScintilla.SCI_TAB: self.__QScintillaTab,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
337 QsciScintilla.SCI_NEWLINE: self.__QScintillaNewline,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
339 QsciScintilla.SCI_DELETEBACK: self.__QScintillaDeleteBack,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
340 QsciScintilla.SCI_CLEAR: self.__QScintillaDelete,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
341 QsciScintilla.SCI_DELWORDLEFT: self.__QScintillaDeleteWordLeft,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
342 QsciScintilla.SCI_DELWORDRIGHT: self.__QScintillaDeleteWordRight,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
343 QsciScintilla.SCI_DELLINELEFT: self.__QScintillaDeleteLineLeft,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
344 QsciScintilla.SCI_DELLINERIGHT: self.__QScintillaDeleteLineRight,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
346 QsciScintilla.SCI_CHARLEFT: self.__QScintillaCharLeft,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
347 QsciScintilla.SCI_CHARRIGHT: self.__QScintillaCharRight,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
348 QsciScintilla.SCI_WORDLEFT: self.__QScintillaWordLeft,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
349 QsciScintilla.SCI_WORDRIGHT: self.__QScintillaWordRight,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
350 QsciScintilla.SCI_VCHOME: self.__QScintillaVCHome,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
351 QsciScintilla.SCI_LINEEND: self.__QScintillaLineEnd,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352
6037
9aec96a3a82a Fixed an issue related to cursor key navigation within completion lists caused by the new history navigation style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6029
diff changeset
353 QsciScintilla.SCI_LINEUP: self.__QScintillaCursorCommand,
9aec96a3a82a Fixed an issue related to cursor key navigation within completion lists caused by the new history navigation style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6029
diff changeset
354 QsciScintilla.SCI_LINEDOWN: self.__QScintillaCursorCommand,
9aec96a3a82a Fixed an issue related to cursor key navigation within completion lists caused by the new history navigation style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6029
diff changeset
355 QsciScintilla.SCI_LINESCROLLUP: self.__QScintillaCursorCommand,
9aec96a3a82a Fixed an issue related to cursor key navigation within completion lists caused by the new history navigation style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6029
diff changeset
356 QsciScintilla.SCI_LINESCROLLDOWN: self.__QScintillaCursorCommand,
9aec96a3a82a Fixed an issue related to cursor key navigation within completion lists caused by the new history navigation style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6029
diff changeset
357
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
358 QsciScintilla.SCI_PAGEUP: self.__QScintillaAutoCompletionCommand,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
359 QsciScintilla.SCI_PAGEDOWN: self.__QScintillaAutoCompletionCommand,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
361 QsciScintilla.SCI_CHARLEFTEXTEND: self.__QScintillaCharLeftExtend,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
362 QsciScintilla.SCI_CHARRIGHTEXTEND: self.extendSelectionRight,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
363 QsciScintilla.SCI_WORDLEFTEXTEND: self.__QScintillaWordLeftExtend,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
364 QsciScintilla.SCI_WORDRIGHTEXTEND: self.extendSelectionWordRight,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
365 QsciScintilla.SCI_VCHOMEEXTEND: self.__QScintillaVCHomeExtend,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
366 QsciScintilla.SCI_LINEENDEXTEND: self.extendSelectionToEOL,
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
367
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
368 QsciScintilla.SCI_CANCEL: self.__QScintillaCancel,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 }
6037
9aec96a3a82a Fixed an issue related to cursor key navigation within completion lists caused by the new history navigation style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6029
diff changeset
370
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
371 self.__historyNavigateByCursor = (
6037
9aec96a3a82a Fixed an issue related to cursor key navigation within completion lists caused by the new history navigation style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6029
diff changeset
372 Preferences.getShell("HistoryNavigateByCursor")
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
373 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374
6335
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
375 self.__queuedText = ''
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
376 self.__blockTextProcessing = False
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
377 self.queueText.connect(self.__concatenateText, Qt.QueuedConnection)
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
378
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
379 self.__project = project
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
380 if self.__project:
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
381 self.__project.projectOpened.connect(self.__projectOpened)
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
382 self.__project.projectClosed.connect(self.__projectClosed)
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
383
1518
e6e21910210d Added capability to zoom by a pinch gesture to the editor, the shell, the terminal, the web browser and various graphics related windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
384 self.grabGesture(Qt.PinchGesture)
5799
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
385
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
386 def __showStartMenu(self):
4479
fd9ceecf5a65 Changed the shell language menu to be dynamic.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4366
diff changeset
387 """
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
388 Private slot to prepare the start submenu.
4479
fd9ceecf5a65 Changed the shell language menu to be dynamic.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4366
diff changeset
389 """
fd9ceecf5a65 Changed the shell language menu to be dynamic.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4366
diff changeset
390 self.lmenu.clear()
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
391 venvManager = e5App().getObject("VirtualEnvManager")
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
392 for venvName in sorted(venvManager.getVirtualenvNames()):
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
393 self.lmenu.addAction(venvName)
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
394 if self.__project.isOpen():
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
395 self.lmenu.addSeparator()
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
396 self.lmenu.addAction(self.tr("Project"))
4479
fd9ceecf5a65 Changed the shell language menu to be dynamic.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4366
diff changeset
397
2640
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2474
diff changeset
398 def __resizeLinenoMargin(self):
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2474
diff changeset
399 """
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2474
diff changeset
400 Private slot to resize the line numbers margin.
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2474
diff changeset
401 """
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2474
diff changeset
402 linenoMargin = Preferences.getShell("LinenoMargin")
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2474
diff changeset
403 if linenoMargin:
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2474
diff changeset
404 self.setMarginWidth(0, '8' * (len(str(self.lines())) + 1))
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2474
diff changeset
405
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 def closeShell(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
408 Public method to shutdown the shell.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 """
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
410 for clientType in self.__historyLists:
5108
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
411 self.saveHistory(clientType)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
413 def __bindLexer(self, language='Python3'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 Private slot to set the lexer.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 @param language lexer language to set (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 self.language = language
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 if Preferences.getShell("SyntaxHighlightingEnabled"):
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
421 from . import Lexers
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 self.lexer_ = Lexers.getLexer(self.language, self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 self.lexer_ = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 if self.lexer_ is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 self.setLexer(None)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 font = Preferences.getShell("MonospacedFont")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 self.monospacedStyles(font)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 # get the font for style 0 and set it as the default font
428
58405c24aa09 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 404
diff changeset
433 key = 'Scintilla/{0}/style0/font'.format(self.lexer_.language())
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
434 fdesc = Preferences.Prefs.settings.value(key)
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
435 if fdesc is not None:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 font = QFont(fdesc[0], int(fdesc[1]))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 self.lexer_.setDefaultFont(font)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 self.setLexer(self.lexer_)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 self.lexer_.readSettings(Preferences.Prefs.settings, "Scintilla")
6858
9d962e654978 Corrected the SubstyledLexer.hasSubStyle() method to SubstyledLexer.hasSubstyle() to be consistent.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
440 if self.lexer_.hasSubstyles():
6845
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
441 self.lexer_.readSubstyles(self)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 # initialize the lexer APIs settings
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 api = self.vm.getAPIsManager().getAPIs(self.language)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 if api is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 api = api.getQsciAPIs()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 if api is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 self.lexer_.setAPIs(api)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449
1566
0cb791cc631a Fixed the issue where a non matching background was shown in the editor for lines below the end of the text, if a lexer with a non-standard background was set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1518
diff changeset
450 self.lexer_.setDefaultColor(self.lexer_.color(0))
0cb791cc631a Fixed the issue where a non matching background was shown in the editor for lines below the end of the text, if a lexer with a non-standard background was set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1518
diff changeset
451 self.lexer_.setDefaultPaper(self.lexer_.paper(0))
0cb791cc631a Fixed the issue where a non matching background was shown in the editor for lines below the end of the text, if a lexer with a non-standard background was set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1518
diff changeset
452
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 def __setMargin0(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 Private method to configure margin 0.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 # set the settings for all margins
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458 self.setMarginsFont(Preferences.getShell("MarginsFont"))
2940
e9348df06994 Fixed an issue in the interpreter shell window causing data to be deleted if it contained the secondary prompt (sys.ps2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2640
diff changeset
459 self.setMarginsForegroundColor(
e9348df06994 Fixed an issue in the interpreter shell window causing data to be deleted if it contained the secondary prompt (sys.ps2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2640
diff changeset
460 Preferences.getEditorColour("MarginsForeground"))
e9348df06994 Fixed an issue in the interpreter shell window causing data to be deleted if it contained the secondary prompt (sys.ps2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2640
diff changeset
461 self.setMarginsBackgroundColor(
e9348df06994 Fixed an issue in the interpreter shell window causing data to be deleted if it contained the secondary prompt (sys.ps2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2640
diff changeset
462 Preferences.getEditorColour("MarginsBackground"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 # set margin 0 settings
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 linenoMargin = Preferences.getShell("LinenoMargin")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 self.setMarginLineNumbers(0, linenoMargin)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 if linenoMargin:
2640
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2474
diff changeset
468 self.__resizeLinenoMargin()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470 self.setMarginWidth(0, 0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
471
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
472 # disable margins 1 and 2
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 self.setMarginWidth(1, 0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 self.setMarginWidth(2, 0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
476 def __setTextDisplay(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 Private method to configure the text display.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 self.setTabWidth(Preferences.getEditor("TabWidth"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 if Preferences.getEditor("ShowWhitespace"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482 self.setWhitespaceVisibility(QsciScintilla.WsVisible)
943
1246bd8280a6 Added configuration options for visible whitespace (as of QScintilla 2.5) (for shell and terminal).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
483 try:
1246bd8280a6 Added configuration options for visible whitespace (as of QScintilla 2.5) (for shell and terminal).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
484 self.setWhitespaceForegroundColor(
1246bd8280a6 Added configuration options for visible whitespace (as of QScintilla 2.5) (for shell and terminal).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
485 Preferences.getEditorColour("WhitespaceForeground"))
1246bd8280a6 Added configuration options for visible whitespace (as of QScintilla 2.5) (for shell and terminal).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
486 self.setWhitespaceBackgroundColor(
1246bd8280a6 Added configuration options for visible whitespace (as of QScintilla 2.5) (for shell and terminal).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
487 Preferences.getEditorColour("WhitespaceBackground"))
1246bd8280a6 Added configuration options for visible whitespace (as of QScintilla 2.5) (for shell and terminal).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
488 self.setWhitespaceSize(
1246bd8280a6 Added configuration options for visible whitespace (as of QScintilla 2.5) (for shell and terminal).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
489 Preferences.getEditor("WhitespaceSize"))
1246bd8280a6 Added configuration options for visible whitespace (as of QScintilla 2.5) (for shell and terminal).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
490 except AttributeError:
1246bd8280a6 Added configuration options for visible whitespace (as of QScintilla 2.5) (for shell and terminal).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
491 # QScintilla before 2.5 doesn't support this
1246bd8280a6 Added configuration options for visible whitespace (as of QScintilla 2.5) (for shell and terminal).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
492 pass
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494 self.setWhitespaceVisibility(QsciScintilla.WsInvisible)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 self.setEolVisibility(Preferences.getEditor("ShowEOL"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 if Preferences.getEditor("BraceHighlighting"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 self.setBraceMatching(QsciScintilla.SloppyBraceMatch)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499 self.setBraceMatching(QsciScintilla.NoBraceMatch)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500 self.setMatchedBraceForegroundColor(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 Preferences.getEditorColour("MatchingBrace"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 self.setMatchedBraceBackgroundColor(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 Preferences.getEditorColour("MatchingBraceBack"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504 self.setUnmatchedBraceForegroundColor(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 Preferences.getEditorColour("NonmatchingBrace"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506 self.setUnmatchedBraceBackgroundColor(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 Preferences.getEditorColour("NonmatchingBraceBack"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 if Preferences.getEditor("CustomSelectionColours"):
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 536
diff changeset
509 self.setSelectionBackgroundColor(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 Preferences.getEditorColour("SelectionBackground"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 else:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 536
diff changeset
512 self.setSelectionBackgroundColor(
2084
d3f083dd0222 Made the fiveth set of Qt5 compatibility changes (some of the previous changes are backed out due to changes in PyQt4).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2077
diff changeset
513 QApplication.palette().color(QPalette.Highlight))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 if Preferences.getEditor("ColourizeSelText"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 self.resetSelectionForegroundColor()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 elif Preferences.getEditor("CustomSelectionColours"):
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 536
diff changeset
517 self.setSelectionForegroundColor(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 Preferences.getEditorColour("SelectionForeground"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 else:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 536
diff changeset
520 self.setSelectionForegroundColor(
2084
d3f083dd0222 Made the fiveth set of Qt5 compatibility changes (some of the previous changes are backed out due to changes in PyQt4).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2077
diff changeset
521 QApplication.palette().color(QPalette.HighlightedText))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 self.setSelectionToEol(Preferences.getEditor("ExtendSelectionToEol"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 self.setCaretForegroundColor(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 Preferences.getEditorColour("CaretForeground"))
3068
e2650fb5db4e Removed the highlight of the caret line from the shell window because that doesn't make sense.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
525 self.setCaretLineVisible(False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526 self.caretWidth = Preferences.getEditor("CaretWidth")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 self.setCaretWidth(self.caretWidth)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528 if Preferences.getShell("WrapEnabled"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
529 self.setWrapMode(QsciScintilla.WrapWord)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 self.setWrapMode(QsciScintilla.WrapNone)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 self.useMonospaced = Preferences.getShell("UseMonospacedFont")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 self.__setMonospaced(self.useMonospaced)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534
404
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 128
diff changeset
535 self.setCursorFlashTime(QApplication.cursorFlashTime())
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 128
diff changeset
536
1566
0cb791cc631a Fixed the issue where a non matching background was shown in the editor for lines below the end of the text, if a lexer with a non-standard background was set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1518
diff changeset
537 if Preferences.getEditor("OverrideEditAreaColours"):
0cb791cc631a Fixed the issue where a non matching background was shown in the editor for lines below the end of the text, if a lexer with a non-standard background was set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1518
diff changeset
538 self.setColor(Preferences.getEditorColour("EditAreaForeground"))
0cb791cc631a Fixed the issue where a non matching background was shown in the editor for lines below the end of the text, if a lexer with a non-standard background was set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1518
diff changeset
539 self.setPaper(Preferences.getEditorColour("EditAreaBackground"))
0cb791cc631a Fixed the issue where a non matching background was shown in the editor for lines below the end of the text, if a lexer with a non-standard background was set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1518
diff changeset
540
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 def __setMonospaced(self, on):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 Private method to set/reset a monospaced font.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 @param on flag to indicate usage of a monospace font (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 if on:
3087
fdbce259929f Changed the handling of the monospace font usage in the editor, mini editor and shell.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3068
diff changeset
548 if not self.lexer_:
fdbce259929f Changed the handling of the monospace font usage in the editor, mini editor and shell.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3068
diff changeset
549 f = Preferences.getShell("MonospacedFont")
fdbce259929f Changed the handling of the monospace font usage in the editor, mini editor and shell.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3068
diff changeset
550 self.monospacedStyles(f)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 if not self.lexer_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 self.clearStyles()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 self.__setMargin0()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 self.setFont(Preferences.getShell("MonospacedFont"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 self.useMonospaced = on
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
559 def __setAutoCompletion(self, language='Python'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 Private method to configure the autocompletion function.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 @param language of the autocompletion set to set (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 self.setAutoCompletionCaseSensitivity(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 Preferences.getEditor("AutoCompletionCaseSensitivity"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 self.setAutoCompletionThreshold(-1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 self.racEnabled = Preferences.getShell("AutoCompletionEnabled")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570
6305
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6086
diff changeset
571 self.maxLines = Preferences.getEditor("AutoCompletionMaxLines")
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6086
diff changeset
572 self.maxChars = Preferences.getEditor("AutoCompletionMaxChars")
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6086
diff changeset
573
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 943
diff changeset
574 def __setCallTips(self, language='Python'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
575 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
576 Private method to configure the calltips function.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578 @param language of the calltips set to set (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580 if Preferences.getShell("CallTipsEnabled"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 self.setCallTipsBackgroundColor(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582 Preferences.getEditorColour("CallTipsBackground"))
7536
861e46f99d65 Editor, Shell: added configuration option for the calltips foreground and highlight color.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
583 self.setCallTipsForegroundColor(
861e46f99d65 Editor, Shell: added configuration option for the calltips foreground and highlight color.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
584 Preferences.getEditorColour("CallTipsForeground"))
861e46f99d65 Editor, Shell: added configuration option for the calltips foreground and highlight color.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
585 self.setCallTipsHighlightColor(
861e46f99d65 Editor, Shell: added configuration option for the calltips foreground and highlight color.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
586 Preferences.getEditorColour("CallTipsHighlight"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
587 self.setCallTipsVisible(Preferences.getEditor("CallTipsVisible"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588 calltipsStyle = Preferences.getEditor("CallTipsStyle")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 if calltipsStyle == QsciScintilla.CallTipsNoContext:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590 self.setCallTipsStyle(QsciScintilla.CallTipsNoContext)
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
591 elif (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
592 calltipsStyle ==
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
593 QsciScintilla.CallTipsNoAutoCompletionContext
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
594 ):
2940
e9348df06994 Fixed an issue in the interpreter shell window causing data to be deleted if it contained the secondary prompt (sys.ps2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2640
diff changeset
595 self.setCallTipsStyle(
e9348df06994 Fixed an issue in the interpreter shell window causing data to be deleted if it contained the secondary prompt (sys.ps2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2640
diff changeset
596 QsciScintilla.CallTipsNoAutoCompletionContext)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598 self.setCallTipsStyle(QsciScintilla.CallTipsContext)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600 self.setCallTipsStyle(QsciScintilla.CallTipsNone)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 def setDebuggerUI(self, ui):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 Public method to set the debugger UI.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 @param ui reference to the debugger UI object (DebugUI)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 """
482
4650a72c307a Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 481
diff changeset
608 ui.exceptionInterrupt.connect(self.__writePrompt)
7408
0d58e708f57b Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7389
diff changeset
609 self.__debugUI = ui
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611 def __initialise(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613 Private method to get ready for a new remote interpreter.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615 self.buff = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
616 self.inContinue = False
7389
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
617 self.__inRawMode = False
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
618 self.__echoInput = True
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
619 self.__rawModeDebuggerId = None
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
620 self.__rawModeQueue = []
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 self.clientCapabilities = 0
1056
a3eb3c9a7e4b Fixed a bug in Shell.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
622 self.inCommandExecution = False
a3eb3c9a7e4b Fixed a bug in Shell.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
623 self.interruptCommandExecution = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
625 def __clientCapabilities(self, cap, clType, venvName):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 Private slot to handle the reporting of the clients capabilities.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
629 @param cap client capabilities
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
630 @type int
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
631 @param clType type of the debug client
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
632 @type str
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
633 @param venvName name of the virtual environment
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
634 @type str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 self.clientCapabilities = cap
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
637 self.__currentVenv = venvName
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 if clType != self.clientType:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 self.clientType = clType
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
640 self.__bindLexer(self.clientType)
2010
07ae45dc6986 Fixed an issue in the Shell window causing wrong fonts set when monospaced is active.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1965
diff changeset
641 self.__setTextDisplay()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 self.__setMargin0()
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
643 self.__setAutoCompletion(self.clientType)
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
644 self.__setCallTips(self.clientType)
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
645 self.racEnabled = (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
646 Preferences.getShell("AutoCompletionEnabled") and
2940
e9348df06994 Fixed an issue in the interpreter shell window causing data to be deleted if it contained the secondary prompt (sys.ps2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2640
diff changeset
647 (cap & HasCompleter) > 0
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
648 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
650 if self.clientType not in self.__historyLists:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 # load history list
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
652 self.loadHistory(self.clientType)
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
653 self.__history = self.__historyLists[self.clientType]
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
654 self.__setHistoryIndex()
6581
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
655
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
656 self.virtualEnvironmentChanged.emit(venvName)
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
657 Preferences.setShell("LastVirtualEnvironment", venvName)
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
658
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
659 def __setHistoryIndex(self, index=None):
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
660 """
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
661 Private method to set the initial history index.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
663 @param index index value to be set
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
664 @type int or None
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
665 """
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
666 if index is None:
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
667 # determine based on history style
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
668 if (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
669 self.clientType and
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
670 self.__historyStyle == ShellHistoryStyle.WindowsStyle
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
671 ):
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
672 idx = int(Preferences.Prefs.settings.value(
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
673 "Shell/HistoryIndexes/" + self.clientType, -1))
5799
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
674 if idx >= len(self.__history):
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
675 idx = -1
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
676 self.__histidx = idx
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
677 else:
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
678 self.__histidx = -1
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
679 else:
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
680 self.__histidx = index
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
681 if self.__histidx >= len(self.__history):
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
682 self.__histidx = -1
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
683 if (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
684 self.clientType and
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
685 self.__historyStyle == ShellHistoryStyle.WindowsStyle
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
686 ):
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
687 Preferences.Prefs.settings.setValue(
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
688 "Shell/HistoryIndexes/" + self.clientType, self.__histidx)
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
689
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
690 def __isHistoryIndexValid(self):
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
691 """
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
692 Private method to test, if the history index is valid.
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
693
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
694 @return flag indicating validity
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
695 @rtype bool
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
696 """
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
697 return (0 <= self.__histidx < len(self.__history))
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
698
5799
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
699 def getHistoryIndex(self):
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
700 """
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
701 Public method to get the current value of the history index.
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
702
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
703 @return history index
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
704 @rtype int
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
705 """
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
706 return self.__histidx
e87f52c0374a Finished improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5798
diff changeset
707
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
708 def loadHistory(self, clientType):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 Public method to load the history for the given client type.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712 @param clientType type of the debug client (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713 """
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
714 hl = Preferences.Prefs.settings.value("Shell/Histories/" + clientType)
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
715 if hl is not None:
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
716 self.__historyLists[clientType] = hl[-self.__maxHistoryEntries:]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
717 else:
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
718 self.__historyLists[clientType] = []
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720 def reloadHistory(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721 """
2940
e9348df06994 Fixed an issue in the interpreter shell window causing data to be deleted if it contained the secondary prompt (sys.ps2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2640
diff changeset
722 Public method to reload the history of the currently selected client
e9348df06994 Fixed an issue in the interpreter shell window causing data to be deleted if it contained the secondary prompt (sys.ps2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2640
diff changeset
723 type.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725 self.loadHistory(self.clientType)
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
726 self.__history = self.__historyLists[self.clientType]
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
727 self.__setHistoryIndex()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729 def saveHistory(self, clientType):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 Public method to save the history for the given client type.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 @param clientType type of the debug client (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 """
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
735 if clientType in self.__historyLists:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 536
diff changeset
736 Preferences.Prefs.settings.setValue(
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
737 "Shell/Histories/" + clientType,
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
738 self.__historyLists[clientType])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740 def getHistory(self, clientType):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742 Public method to get the history for the given client type.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 @param clientType type of the debug client (string).
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745 If it is None, the current history is returned.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
746 @return reference to the history list (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
748 if clientType is None:
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
749 return self.__history
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
750 elif clientType in self.__historyLists:
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
751 return self.__historyLists[clientType]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753 return []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
755 def clearHistory(self):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 """
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
757 Public slot to clear the current history.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758 """
5108
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
759 if self.clientType:
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
760 self.__historyLists[self.clientType] = []
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
761 self.__history = self.__historyLists[self.clientType]
5108
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
762 else:
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
763 self.__history = []
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
764 self.__setHistoryIndex(index=-1)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
766 def selectHistory(self):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 """
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
768 Public slot to select a history entry to execute.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769 """
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
770 current = self.__histidx
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
771 if current == -1:
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
772 current = len(self.__history) - 1
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 536
diff changeset
773 cmd, ok = QInputDialog.getItem(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
775 self.tr("Select History"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
776 self.tr("Select the history entry to execute"
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
777 " (most recent shown last)."),
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
778 self.__history,
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
779 current, False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 if ok:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 self.__insertHistory(cmd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
783 def showHistory(self):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 """
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
785 Public slot to show the shell history dialog.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786 """
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
787 from .ShellHistoryDialog import ShellHistoryDialog
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
788 dlg = ShellHistoryDialog(self.__history, self.vm, self)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7703
diff changeset
789 if dlg.exec() == QDialog.Accepted:
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
790 self.__historyLists[self.clientType], idx = dlg.getHistory()
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
791 self.__history = self.__historyLists[self.clientType]
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
792 self.__setHistoryIndex(index=idx)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793
5108
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
794 def clearAllHistories(self):
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
795 """
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
796 Public method to clear all available histories and sync them.
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
797 """
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
798 Preferences.Prefs.settings.beginGroup("Shell/Histories")
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
799 for clientType in Preferences.Prefs.settings.childKeys():
5798
e4f9552f7f93 Started improving the Shell window history handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
800 self.__historyLists[clientType] = []
5108
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
801 self.saveHistory(clientType)
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
802 Preferences.Prefs.settings.endGroup()
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
803
5710
b5809b948010 Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5709
diff changeset
804 self.clearHistory()
5108
f5cb9cb98e6a Added an action to clear the private data of the IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5020
diff changeset
805
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806 def getClientType(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808 Public slot to get the clients type.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810 @return client type (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812 return self.clientType
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 def __getBanner(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 Private method to get the banner for the remote interpreter.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818 It requests the interpreter version and platform running on the
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
819 debug client side.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
820 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821 if self.passive:
6639
86f10cfa3653 Shell: fixed an issue calling __writeBanner() with too few arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6633
diff changeset
822 self.__writeBanner('', '', '', '')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
823 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
824 self.dbs.remoteBanner()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
825
7412
0a995393d2ba Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7408
diff changeset
826 def __writeBanner(self, version, platform, venvName):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
827 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
828 Private method to write a banner with info from the debug client.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
829
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
830 @param version interpreter version string
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
831 @type str
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
832 @param platform platform of the remote interpreter
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
833 @type str
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
834 @param venvName name of the virtual environment
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
835 @type str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2474
diff changeset
837 super(Shell, self).clear()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838 if self.passive and not self.dbs.isConnected():
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
839 self.__write(self.tr('Passive Debug Mode'))
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
840 self.__write(self.tr('\nNot connected'))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
841 else:
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
842 self.__currentVenv = venvName
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
843 version = version.replace("#", self.tr("No."))
7412
0a995393d2ba Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7408
diff changeset
844 if platform != "":
0a995393d2ba Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7408
diff changeset
845 self.__write(self.tr('{0} on {1}').format(version, platform))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
846 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847 self.__write(version)
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
848 if venvName:
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6573
diff changeset
849 self.__write("\n[{0}]".format(venvName))
6581
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
850
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
851 self.virtualEnvironmentChanged.emit(venvName)
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6580
diff changeset
852 Preferences.setShell("LastVirtualEnvironment", venvName)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853 self.__write('\n')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 self.__write(sys.ps1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857 def __writePrompt(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
858 """
6580
082d58e2415e Shell: another attempt to properly fix the 'writing prompt' issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6578
diff changeset
859 Private method to write the prompt using a write queue.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
860 """
6580
082d58e2415e Shell: another attempt to properly fix the 'writing prompt' issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6578
diff changeset
861 self.queueText.emit(self.inContinue and sys.ps2 or sys.ps1)
082d58e2415e Shell: another attempt to properly fix the 'writing prompt' issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6578
diff changeset
862
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
863 def __clientStatement(self, more):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
864 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
865 Private method to handle the response from the debugger client.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866
7379
72a72fd56494 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
867 @param more flag indicating that more user input is required
72a72fd56494 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
868 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
869 """
7389
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
870 if not self.__inRawMode:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
871 self.inContinue = more
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
872 self.__writePrompt()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
873 self.inCommandExecution = False
6580
082d58e2415e Shell: another attempt to properly fix the 'writing prompt' issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6578
diff changeset
874
3974
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
875 def __clientException(self, exceptionType, exceptionMessage, stackTrace):
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
876 """
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
877 Private method to handle an exception of the client.
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
878
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
879 @param exceptionType type of exception raised (string)
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
880 @param exceptionMessage message given by the exception (string)
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
881 @param stackTrace list of stack entries (list of string)
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
882 """
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
883 self .__clientError()
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
884
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
885 if (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
886 not self.__windowed and
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
887 Preferences.getDebugger("ShowExceptionInShell")
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
888 ):
5126
d28b92dabc2b Fixed two little issues related to wrong parameter types.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5108
diff changeset
889 if exceptionType:
3974
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
890 if stackTrace:
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
891 self.__write(
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
892 self.tr('Exception "{0}"\n{1}\nFile: {2}, Line: {3}\n')
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
893 .format(
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
894 exceptionType,
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
895 exceptionMessage,
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
896 stackTrace[0][0],
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
897 stackTrace[0][1]
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
898 )
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
899 )
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
900 else:
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
901 self.__write(
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
902 self.tr('Exception "{0}"\n{1}\n')
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
903 .format(
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
904 exceptionType,
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
905 exceptionMessage)
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
906 )
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
907
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
908 def __clientSyntaxError(self, message, filename, lineNo, characterNo):
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
909 """
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
910 Private method to handle a syntax error in the debugged program.
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
911
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
912 @param message message of the syntax error (string)
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
913 @param filename translated filename of the syntax error position
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
914 (string)
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
915 @param lineNo line number of the syntax error position (integer)
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
916 @param characterNo character number of the syntax error position
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
917 (integer)
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
918 """
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
919 self .__clientError()
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
920
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
921 if (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
922 not self.__windowed and
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
923 Preferences.getDebugger("ShowExceptionInShell")
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
924 ):
3974
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
925 if message is None:
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
926 self.__write(self.tr("Unspecified syntax error.\n"))
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
927 else:
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
928 self.__write(
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
929 self.tr('Syntax error "{1}" in file {0} at line {2},'
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
930 ' character {3}.\n')
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
931 .format(filename, message, lineNo, characterNo)
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
932 )
01991e605ba0 Added capability to show exceptions in the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3778
diff changeset
933
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
934 def __clientSignal(self, message, filename, lineNo, funcName, funcArgs):
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
935 """
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
936 Private method to handle a signal generated on the client side.
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
937
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
938 @param message message of the syntax error
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
939 @type str
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
940 @param filename translated filename of the syntax error position
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
941 @type str
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
942 @param lineNo line number of the syntax error position
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
943 @type int
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
944 @param funcName name of the function causing the signal
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
945 @type str
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
946 @param funcArgs function arguments
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
947 @type str
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
948 """
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
949 self.__clientError()
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
950
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
951 self.__write(
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
952 self.tr("""Signal "{0}" generated in file {1} at line {2}.\n"""
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
953 """Function: {3}({4})""")
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
954 .format(message, filename, lineNo, funcName, funcArgs)
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
955 )
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
956
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
957 def __clientError(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
958 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
959 Private method to handle an error in the client.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
960 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961 self.inCommandExecution = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962 self.interruptCommandExecution = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
963 self.inContinue = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
965 def __getEndPos(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
966 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
967 Private method to return the line and column of the last character.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
968
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
969 @return tuple of two values (int, int) giving the line and column
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
970 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
971 line = self.lines() - 1
1743
4f9afcd8eb9d Fixed a unicode issue in the terminal and interpreter shell.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1588
diff changeset
972 return (line, len(self.text(line)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
973
6478
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
974 def __writeQueued(self, s):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
975 """
6478
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
976 Private method to display some text using a write queue.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
977
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
978 @param s text to be displayed (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
979 """
6335
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
980 self.queueText.emit(s)
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
981
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
982 def __concatenateText(self, text):
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
983 """
6478
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
984 Private slot to queue text and process it in one step.
6335
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
985
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
986 @param text text to be appended
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
987 @type str
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
988 """
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
989 self.__queuedText += text
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
990 if self.__blockTextProcessing:
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
991 return
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
992
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
993 self.__blockTextProcessing = True
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
994 # Get all text which is still waiting for output
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
995 QApplication.processEvents()
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
996
56d3b6722b3c Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6305
diff changeset
997 # Finally process the accumulated text
7387
2fb33905ff6b Shell: fixed the raw_input method again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7378
diff changeset
998 self.__flushQueuedText()
2fb33905ff6b Shell: fixed the raw_input method again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7378
diff changeset
999
2fb33905ff6b Shell: fixed the raw_input method again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7378
diff changeset
1000 def __flushQueuedText(self):
2fb33905ff6b Shell: fixed the raw_input method again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7378
diff changeset
1001 """
2fb33905ff6b Shell: fixed the raw_input method again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7378
diff changeset
1002 Private slot to flush the accumulated text output.
2fb33905ff6b Shell: fixed the raw_input method again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7378
diff changeset
1003 """
6478
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1004 self.__write(self.__queuedText)
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1005
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1006 self.__queuedText = ''
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1007 self.__blockTextProcessing = False
6580
082d58e2415e Shell: another attempt to properly fix the 'writing prompt' issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6578
diff changeset
1008
082d58e2415e Shell: another attempt to properly fix the 'writing prompt' issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6578
diff changeset
1009 # little trick to get the cursor position registered within QScintilla
082d58e2415e Shell: another attempt to properly fix the 'writing prompt' issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6578
diff changeset
1010 self.SendScintilla(QsciScintilla.SCI_CHARLEFT)
082d58e2415e Shell: another attempt to properly fix the 'writing prompt' issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6578
diff changeset
1011 self.SendScintilla(QsciScintilla.SCI_CHARRIGHT)
7387
2fb33905ff6b Shell: fixed the raw_input method again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7378
diff changeset
1012
6478
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1013 def __write(self, s):
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1014 """
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1015 Private method to display some text without queuing.
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1016
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1017 @param s text to be displayed
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1018 @type str
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1019 """
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1020 line, col = self.__getEndPos()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1021 self.setCursorPosition(line, col)
6478
f76f5bd81a90 Shell: fixed an issue with the redirected input() method caused by the queued output change done back in June 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6387
diff changeset
1022 self.insert(Utilities.filterAnsiSequences(s))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1023 self.prline, self.prcol = self.getCursorPosition()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1024 self.ensureCursorVisible()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1025 self.ensureLineVisible(self.prline)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1026
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1027 def __writeStdOut(self, s):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1028 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1029 Private method to display some text with StdOut label.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1030
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1031 @param s text to be displayed (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1032 """
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1033 self.__write(self.tr("StdOut: {0}").format(s))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1034
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035 def __writeStdErr(self, s):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1036 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 Private method to display some text with StdErr label.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1038
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1039 @param s text to be displayed (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1040 """
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1041 self.__write(self.tr("StdErr: {0}").format(s))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1042
7389
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1043 def __raw_input(self, prompt, echo, debuggerId):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1045 Private method to handle raw input.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1046
7389
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1047 @param prompt the input prompt
7387
2fb33905ff6b Shell: fixed the raw_input method again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7378
diff changeset
1048 @type str
7389
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1049 @param echo flag indicating an echoing of the input
7387
2fb33905ff6b Shell: fixed the raw_input method again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7378
diff changeset
1050 @type bool
7389
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1051 @param debuggerId ID of the debugger backend
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1052 @type str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1053 """
7389
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1054 if self.__inRawMode:
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1055 # we are processing another raw input event already
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1056 self.__rawModeQueue.append((debuggerId, prompt, echo))
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1057 else:
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1058 self.setFocus()
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1059 self.__inRawMode = True
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1060 self.__echoInput = echo
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1061 self.__rawModeDebuggerId = debuggerId
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1062
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1063 # Get all text which is still waiting for output
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1064 QApplication.processEvents()
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1065 self.__flushQueuedText()
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1066
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1067 self.__write(self.tr("<{0}> {1}").format(debuggerId, prompt))
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1068 line, col = self.__getEndPos()
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1069 self.setCursorPosition(line, col)
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1070 buf = self.text(line)
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1071 if buf.startswith(sys.ps1):
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1072 buf = buf.replace(sys.ps1, "")
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1073 if buf.startswith(sys.ps2):
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1074 buf = buf.replace(sys.ps2, "")
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1075 self.prompt = buf
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1076 # move cursor to end of line
770ffcb88be5 Continued with the multiprocess debugger.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7386
diff changeset
1077 self.moveCursorToEOL()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1078
7990
3b865f4b7dff Shell: corrected inserting (pasting) text via the middel mouse button.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1079 def paste(self, lines=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1080 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
1081 Public slot to handle the paste action.
7990
3b865f4b7dff Shell: corrected inserting (pasting) text via the middel mouse button.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1082
3b865f4b7dff Shell: corrected inserting (pasting) text via the middel mouse button.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1083 @param lines list of lines to be inserted
3b865f4b7dff Shell: corrected inserting (pasting) text via the middel mouse button.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1084 @type list of str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1085 """
3631
2f5169646a4a Shell: Paste at current location and a bug in using history fixed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
1086 if self.__isCursorOnLastLine():
2f5169646a4a Shell: Paste at current location and a bug in using history fixed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
1087 line, col = self.getCursorPosition()
2f5169646a4a Shell: Paste at current location and a bug in using history fixed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
1088 lastLine = self.text(line)
6029
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1089 if lastLine.startswith(sys.ps1):
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1090 lastLine = lastLine[len(sys.ps1):]
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1091 col -= len(sys.ps1)
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1092 prompt = sys.ps1
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1093 elif lastLine.startswith(sys.ps2):
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1094 lastLine = lastLine[len(sys.ps2):]
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1095 col -= len(sys.ps2)
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1096 prompt = sys.ps2
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1097 else:
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1098 prompt = ""
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1099 if col < 0:
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1100 col = 0
0ce26b97e2c0 Fixed an issue in the Python shell window executing pasted lines containing some indentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5991
diff changeset
1101 prompt = ""
3631
2f5169646a4a Shell: Paste at current location and a bug in using history fixed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
1102
2f5169646a4a Shell: Paste at current location and a bug in using history fixed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset