eric6/Debugger/DebuggerInterfacePython.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7840
9c5ffa877ce0
child 8043
0acf98cd089a
permissions
-rw-r--r--

Updated copyright for 2021.

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
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7840
diff changeset
3 # Copyright (c) 2009 - 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 the Python3 debugger interface for the debug server.
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 os
6584
33ea6f430eb8 DebuggerInterfacePython: added a logging statement to see, what is sent by the debug backend. Activate it with '--debug'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6581
diff changeset
12 import logging
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
14 from PyQt5.QtCore import (
7840
9c5ffa877ce0 DebuggerInterfacePython: changed code to not use QTextCodec anymore to prepare for Qt6 transition.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7803
diff changeset
15 QObject, QProcess, QProcessEnvironment, QTimer
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
16 )
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3640
diff changeset
17 from PyQt5.QtWidgets import QInputDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
19 from E5Gui.E5Application import e5App
537
72b32daeb8d6 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 482
diff changeset
20 from E5Gui import E5MessageBox
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
22 from . import DebugClientCapabilities
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
27 from eric6config import getConfig
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
27
1018a0347ae9 Set the Python3 debugger to have all capabilities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
30 ClientDefaultCapabilities = DebugClientCapabilities.HasAll
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
32
5850
7fae79975686 Unified the Python2 and Python3 debugger interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5848
diff changeset
33 class DebuggerInterfacePython(QObject):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 """
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
35 Class implementing the debugger interface for the debug server for
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
36 Python 3.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 """
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
38 def __init__(self, debugServer, passive):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
5850
7fae79975686 Unified the Python2 and Python3 debugger interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5848
diff changeset
42 @param debugServer reference to the debug server
7fae79975686 Unified the Python2 and Python3 debugger interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5848
diff changeset
43 @type DebugServer
7fae79975686 Unified the Python2 and Python3 debugger interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5848
diff changeset
44 @param passive flag indicating passive connection mode
7fae79975686 Unified the Python2 and Python3 debugger interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5848
diff changeset
45 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
5850
7fae79975686 Unified the Python2 and Python3 debugger interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5848
diff changeset
47 super(DebuggerInterfacePython, self).__init__()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 self.__isNetworked = True
3640
2bf828881e86 Fixed stop at sys.breakpoint() in run mode under Python3 and on first run (Py2 and 3).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3484
diff changeset
50 self.__autoContinue = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 self.debugServer = debugServer
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 self.passive = passive
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.process = None
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
55 self.__startedVenv = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.qsock = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 self.queue = []
3926
6492acd0a352 Fixed an issue in the debugger interfaces setting an initial translate function. and changed the Python default extensions '.py' and '.pyw' depending on used interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
59
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 # set default values for capabilities of clients
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.clientCapabilities = ClientDefaultCapabilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62
3926
6492acd0a352 Fixed an issue in the debugger interfaces setting an initial translate function. and changed the Python default extensions '.py' and '.pyw' depending on used interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
63 # set translation function
6492acd0a352 Fixed an issue in the debugger interfaces setting an initial translate function. and changed the Python default extensions '.py' and '.pyw' depending on used interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
64 self.translate = self.__identityTranslation
6492acd0a352 Fixed an issue in the debugger interfaces setting an initial translate function. and changed the Python default extensions '.py' and '.pyw' depending on used interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
65
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 if passive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 # set translation function
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 if Preferences.getDebugger("PathTranslation"):
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
69 self.translateRemote = Preferences.getDebugger(
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
70 "PathTranslationRemote")
6822
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
71 self.translateRemoteWindows = "\\" in self.translateRemote
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
72 self.translateLocal = Preferences.getDebugger(
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
73 "PathTranslationLocal")
6822
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
74 self.translateLocalWindows = "\\" in self.translateLocal
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 self.translate = self.__remoteTranslation
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 self.translate = self.__identityTranslation
1171
1ffefa5ca226 Improved handling of debugger sending "<string>".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1166
diff changeset
78
1ffefa5ca226 Improved handling of debugger sending "<string>".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1166
diff changeset
79 # attribute to remember the name of the executed script
1ffefa5ca226 Improved handling of debugger sending "<string>".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1166
diff changeset
80 self.__scriptName = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
82 def __identityTranslation(self, fn, remote2local=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 Private method to perform the identity path translation.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 @param fn filename to be translated (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 @param remote2local flag indicating the direction of translation
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 (False = local to remote, True = remote to local [default])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 @return translated filename (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 return fn
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
93 def __remoteTranslation(self, fn, remote2local=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 Private method to perform the path translation.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 @param fn filename to be translated (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 @param remote2local flag indicating the direction of translation
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 (False = local to remote, True = remote to local [default])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 @return translated filename (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 if remote2local:
6822
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
103 path = fn.replace(self.translateRemote, self.translateLocal)
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
104 if self.translateLocalWindows:
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
105 path = path.replace("/", "\\")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 else:
6822
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
107 path = fn.replace(self.translateLocal, self.translateRemote)
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
108 if not self.translateRemoteWindows:
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
109 path = path.replace("\\", "/")
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
110
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
111 return path
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
113 def __startProcess(self, program, arguments, environment=None,
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
114 workingDir=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 Private method to start the debugger client process.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
118 @param program name of the executable to start
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
119 @type str
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
120 @param arguments arguments to be passed to the program
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
121 @type list of str
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
122 @param environment dictionary of environment settings to pass
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
123 @type dict of str
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
124 @param workingDir directory to start the debugger client in
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
125 @type str
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
126 @return the process object
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
127 @rtype QProcess or None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 proc = QProcess()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 if environment is not None:
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3640
diff changeset
131 env = QProcessEnvironment()
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
132 for key, value in list(environment.items()):
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3640
diff changeset
133 env.insert(key, value)
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3640
diff changeset
134 proc.setProcessEnvironment(env)
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
135 args = arguments[:]
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
136 if workingDir:
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
137 proc.setWorkingDirectory(workingDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 proc.start(program, args)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 if not proc.waitForStarted(10000):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 proc = None
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 return proc
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
144 def startRemote(self, port, runInConsole, venvName, originalPathString,
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
145 workingDir=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 Public method to start a remote Python interpreter.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148
6352
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
149 @param port port number the debug server is listening on
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
150 @type int
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
151 @param runInConsole flag indicating to start the debugger in a
6352
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
152 console window
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
153 @type bool
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
154 @param venvName name of the virtual environment to be used
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
155 @type 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: 6576
diff changeset
156 @param originalPathString original PATH environment variable
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: 6576
diff changeset
157 @type str
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
158 @param workingDir directory to start the debugger client in
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
159 @type str
6352
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
160 @return client process object, a flag to indicate a network connection
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
161 and the name of the interpreter in case of a local execution
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
162 @rtype tuple of (QProcess, bool, str)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 """
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: 6576
diff changeset
164 global origPathEnv
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: 6576
diff changeset
165
6352
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
166 if not venvName:
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
167 venvName = Preferences.getDebugger("Python3VirtualEnv")
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
168 venvManager = e5App().getObject("VirtualEnvManager")
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
169 interpreter = venvManager.getVirtualenvInterpreter(venvName)
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
170 execPath = venvManager.getVirtualenvExecPath(venvName)
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
171 if interpreter == "":
6376
201067699041 Debugger: fixed some more cases, where the debugger is not supported or configured.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6352
diff changeset
172 # use the interpreter used to run eric for identical variants
201067699041 Debugger: fixed some more cases, where the debugger is not supported or configured.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6352
diff changeset
173 interpreter = sys.executable.replace("w.exe", ".exe")
2573
71837b5366d5 Search for interpreter on startup, avoid 'not found' message and switch to opposite interpreter.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2525
diff changeset
174 if interpreter == "":
3065
070b35dde35e Fixed a bunch of indentation issues.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
175 E5MessageBox.critical(
070b35dde35e Fixed a bunch of indentation issues.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
176 None,
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3357
diff changeset
177 self.tr("Start Debugger"),
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3357
diff changeset
178 self.tr(
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
179 """<p>No suitable Python3 environment configured.</p>""")
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
180 )
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3357
diff changeset
181 return None, False, ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
183 debugClientType = Preferences.getDebugger("DebugClientType3")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 if debugClientType == "standard":
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
185 debugClient = os.path.join(getConfig('ericDir'),
5179
5f56410e7624 Combined version of the Python debugger.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5162
diff changeset
186 "DebugClients", "Python",
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
187 "DebugClient.py")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 else:
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
189 debugClient = Preferences.getDebugger("DebugClient3")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 if debugClient == "":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 debugClient = os.path.join(sys.path[0],
5179
5f56410e7624 Combined version of the Python debugger.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5162
diff changeset
192 "DebugClients", "Python",
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
193 "DebugClient.py")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
195 redirect = str(Preferences.getDebugger("Python3Redirect"))
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
196 noencoding = (Preferences.getDebugger("Python3NoEncoding") and
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
197 '--no-encoding' or '')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 if Preferences.getDebugger("RemoteDbgEnabled"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 ipaddr = self.debugServer.getHostAddress(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 rexec = Preferences.getDebugger("RemoteExecution")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 rhost = Preferences.getDebugger("RemoteHost")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 if rhost == "":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 rhost = "localhost"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 if rexec:
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
206 args = Utilities.parseOptionString(rexec) + [
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
207 rhost, interpreter, debugClient, noencoding, str(port),
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
208 redirect, ipaddr]
6848
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
209 if Utilities.isWindowsPlatform():
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
210 if not os.path.splitext(args[0])[1]:
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
211 for ext in [".exe", ".com", ".cmd", ".bat"]:
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
212 prog = Utilities.getExecutablePath(args[0] + ext)
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
213 if prog:
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
214 args[0] = prog
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
215 break
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
216 else:
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
217 args[0] = Utilities.getExecutablePath(args[0])
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
218 process = self.__startProcess(args[0], args[1:],
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
219 workingDir=workingDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 if process is None:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
221 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
222 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
223 self.tr("Start Debugger"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
224 self.tr(
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
225 """<p>The debugger backend could not be"""
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
226 """ started.</p>"""))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 # set translation function
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 if Preferences.getDebugger("PathTranslation"):
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
230 self.translateRemote = Preferences.getDebugger(
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
231 "PathTranslationRemote")
6822
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
232 self.translateRemoteWindows = "\\" in self.translateRemote
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
233 self.translateLocal = Preferences.getDebugger(
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
234 "PathTranslationLocal")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 self.translate = self.__remoteTranslation
6822
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
236 self.translateLocalWindows = "\\" in self.translateLocal
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 self.translate = self.__identityTranslation
3357
2390df6f42ba Started to change the file browser model such, that the sys.path entry is dependent on the running interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
239 return process, self.__isNetworked, ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 # set translation function
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 self.translate = self.__identityTranslation
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 # setup the environment for the debugger
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 if Preferences.getDebugger("DebugEnvironmentReplace"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 clientEnv = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 clientEnv = os.environ.copy()
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: 6576
diff changeset
249 if originalPathString:
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: 6576
diff changeset
250 clientEnv["PATH"] = originalPathString
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
251 envlist = Utilities.parseEnvironmentString(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 Preferences.getDebugger("DebugEnvironment"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 for el in envlist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 key, value = el.split('=', 1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 if value.startswith('"') or value.startswith("'"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 value = value[1:-1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 clientEnv[str(key)] = str(value)
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1079
diff changeset
259 except ValueError:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 pass
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
261 if execPath:
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
262 if "PATH" in clientEnv:
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
263 clientEnv["PATH"] = os.pathsep.join(
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
264 [execPath, clientEnv["PATH"]])
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
265 else:
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
266 clientEnv["PATH"] = execPath
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 ipaddr = self.debugServer.getHostAddress(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 if runInConsole or Preferences.getDebugger("ConsoleDbgEnabled"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 ccmd = Preferences.getDebugger("ConsoleDbgCommand")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 if ccmd:
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
272 args = Utilities.parseOptionString(ccmd) + [
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
273 interpreter, os.path.abspath(debugClient), noencoding,
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
274 str(port), '0', ipaddr]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 args[0] = Utilities.getExecutablePath(args[0])
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
276 process = self.__startProcess(args[0], args[1:], clientEnv,
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
277 workingDir=workingDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 if process is None:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
279 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
280 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
281 self.tr("Start Debugger"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
282 self.tr(
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
283 """<p>The debugger backend could not be"""
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
284 """ started.</p>"""))
3357
2390df6f42ba Started to change the file browser model such, that the sys.path entry is dependent on the running interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
285 return process, self.__isNetworked, interpreter
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
287 process = self.__startProcess(
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
288 interpreter,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
289 [debugClient, noencoding, str(port), redirect, ipaddr],
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
290 clientEnv,
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
291 workingDir=workingDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 if process is None:
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
293 self.__startedVenv = ""
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
294 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
295 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
296 self.tr("Start Debugger"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
297 self.tr(
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
298 """<p>The debugger backend could not be started.</p>"""))
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
299 else:
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
300 self.__startedVenv = venvName
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
301
3357
2390df6f42ba Started to change the file browser model such, that the sys.path entry is dependent on the running interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
302 return process, self.__isNetworked, interpreter
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303
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: 6576
diff changeset
304 def startRemoteForProject(self, port, runInConsole, venvName,
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
305 originalPathString, workingDir=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 Public method to start a remote Python interpreter for a project.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308
6352
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
309 @param port port number the debug server is listening on
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
310 @type int
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
311 @param runInConsole flag indicating to start the debugger in a
6352
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
312 console window
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
313 @type bool
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
314 @param venvName name of the virtual environment to be used
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
315 @type 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: 6576
diff changeset
316 @param originalPathString original PATH environment variable
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: 6576
diff changeset
317 @type str
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
318 @param workingDir directory to start the debugger client in
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
319 @type str
6352
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
320 @return client process object, a flag to indicate a network connection
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
321 and the name of the interpreter in case of a local execution
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
322 @rtype tuple of (QProcess, bool, str)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 """
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: 6576
diff changeset
324 global origPathEnv
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: 6576
diff changeset
325
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 40
diff changeset
326 project = e5App().getObject("Project")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 if not project.isDebugPropertiesLoaded():
3357
2390df6f42ba Started to change the file browser model such, that the sys.path entry is dependent on the running interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
328 return None, self.__isNetworked, ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 # start debugger with project specific settings
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
331 debugClient = project.getDebugProperty("DEBUGCLIENT")
6352
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
332 if not venvName:
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
333 venvName = project.getDebugProperty("VIRTUALENV")
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
334 if not venvName:
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
335 if project.getProjectLanguage() == "Python3":
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
336 venvName = Preferences.getDebugger("Python3VirtualEnv")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 redirect = str(project.getDebugProperty("REDIRECT"))
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
339 noencoding = (
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
340 project.getDebugProperty("NOENCODING") and '--no-encoding' or '')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
342 venvManager = e5App().getObject("VirtualEnvManager")
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
343 interpreter = venvManager.getVirtualenvInterpreter(venvName)
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
344 execPath = venvManager.getVirtualenvExecPath(venvName)
7639
422fd05e9c91 Removed some more Python2 related code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7637
diff changeset
345 if (
422fd05e9c91 Removed some more Python2 related code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7637
diff changeset
346 interpreter == "" and
422fd05e9c91 Removed some more Python2 related code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7637
diff changeset
347 project.getProjectLanguage().startswith("Python")
422fd05e9c91 Removed some more Python2 related code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7637
diff changeset
348 ):
6376
201067699041 Debugger: fixed some more cases, where the debugger is not supported or configured.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6352
diff changeset
349 interpreter = sys.executable.replace("w.exe", ".exe")
201067699041 Debugger: fixed some more cases, where the debugger is not supported or configured.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6352
diff changeset
350 if interpreter == "":
201067699041 Debugger: fixed some more cases, where the debugger is not supported or configured.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6352
diff changeset
351 E5MessageBox.critical(
201067699041 Debugger: fixed some more cases, where the debugger is not supported or configured.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6352
diff changeset
352 None,
201067699041 Debugger: fixed some more cases, where the debugger is not supported or configured.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6352
diff changeset
353 self.tr("Start Debugger"),
201067699041 Debugger: fixed some more cases, where the debugger is not supported or configured.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6352
diff changeset
354 self.tr(
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
355 """<p>No suitable Python3 environment configured.</p>""")
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7429
diff changeset
356 )
6376
201067699041 Debugger: fixed some more cases, where the debugger is not supported or configured.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6352
diff changeset
357 return None, self.__isNetworked, ""
6352
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6348
diff changeset
358
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 if project.getDebugProperty("REMOTEDEBUGGER"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 ipaddr = self.debugServer.getHostAddress(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 rexec = project.getDebugProperty("REMOTECOMMAND")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 rhost = project.getDebugProperty("REMOTEHOST")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 if rhost == "":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 rhost = "localhost"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 if rexec:
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
366 args = Utilities.parseOptionString(rexec) + [
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
367 rhost, interpreter, debugClient, noencoding, str(port),
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
368 redirect, ipaddr]
6848
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
369 if Utilities.isWindowsPlatform():
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
370 if not os.path.splitext(args[0])[1]:
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
371 for ext in [".exe", ".com", ".cmd", ".bat"]:
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
372 prog = Utilities.getExecutablePath(args[0] + ext)
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
373 if prog:
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
374 args[0] = prog
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
375 break
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
376 else:
7682182a0f0f DebuggerInterfacePython: search common extensions on Windows platforms for the remote execution program (e.g. entered ssh will result in ssh.exe).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6822
diff changeset
377 args[0] = Utilities.getExecutablePath(args[0])
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
378 process = self.__startProcess(args[0], args[1:],
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
379 workingDir=workingDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 if process is None:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
381 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
382 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
383 self.tr("Start Debugger"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
384 self.tr(
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
385 """<p>The debugger backend could not be"""
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
386 """ started.</p>"""))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 # set translation function
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 if project.getDebugProperty("PATHTRANSLATION"):
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
389 self.translateRemote = project.getDebugProperty(
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
390 "REMOTEPATH")
6822
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
391 self.translateRemoteWindows = "\\" in self.translateRemote
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
392 self.translateLocal = project.getDebugProperty("LOCALPATH")
6822
f34e48fdfd92 DebuggerInterfacePython: amended the path translation function to cope with situation where local and remote machine has different path separators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6821
diff changeset
393 self.translateLocalWindows = "\\" in self.translateLocal
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 self.translate = self.__remoteTranslation
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 self.translate = self.__identityTranslation
3357
2390df6f42ba Started to change the file browser model such, that the sys.path entry is dependent on the running interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
397 return process, self.__isNetworked, ""
6716
1c9d3b369ea8 VirtualEnv Manager: extended the environment definition by a flag indicating a remotely accessed environment.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
398 else:
1c9d3b369ea8 VirtualEnv Manager: extended the environment definition by a flag indicating a remotely accessed environment.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
399 # remote shell command is missing
1c9d3b369ea8 VirtualEnv Manager: extended the environment definition by a flag indicating a remotely accessed environment.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
400 return None, self.__isNetworked, ""
1c9d3b369ea8 VirtualEnv Manager: extended the environment definition by a flag indicating a remotely accessed environment.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
401
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 # set translation function
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 self.translate = self.__identityTranslation
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 # setup the environment for the debugger
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 if project.getDebugProperty("ENVIRONMENTOVERRIDE"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 clientEnv = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 clientEnv = os.environ.copy()
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: 6576
diff changeset
410 if originalPathString:
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: 6576
diff changeset
411 clientEnv["PATH"] = originalPathString
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
412 envlist = Utilities.parseEnvironmentString(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 project.getDebugProperty("ENVIRONMENTSTRING"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 for el in envlist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 key, value = el.split('=', 1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 if value.startswith('"') or value.startswith("'"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 value = value[1:-1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 clientEnv[str(key)] = str(value)
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1079
diff changeset
420 except ValueError:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 pass
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
422 if execPath:
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
423 if "PATH" in clientEnv:
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
424 clientEnv["PATH"] = os.pathsep.join(
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
425 [execPath, clientEnv["PATH"]])
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
426 else:
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
427 clientEnv["PATH"] = execPath
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 ipaddr = self.debugServer.getHostAddress(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 if runInConsole or project.getDebugProperty("CONSOLEDEBUGGER"):
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
431 ccmd = (project.getDebugProperty("CONSOLECOMMAND") or
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
432 Preferences.getDebugger("ConsoleDbgCommand"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 if ccmd:
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
434 args = Utilities.parseOptionString(ccmd) + [
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
435 interpreter, os.path.abspath(debugClient), noencoding,
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7249
diff changeset
436 str(port), '0', ipaddr]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 args[0] = Utilities.getExecutablePath(args[0])
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
438 process = self.__startProcess(args[0], args[1:], clientEnv,
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
439 workingDir=workingDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 if process is None:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
441 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
442 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
443 self.tr("Start Debugger"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
444 self.tr(
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
445 """<p>The debugger backend could not be"""
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
446 """ started.</p>"""))
3357
2390df6f42ba Started to change the file browser model such, that the sys.path entry is dependent on the running interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
447 return process, self.__isNetworked, interpreter
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
449 process = self.__startProcess(
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
450 interpreter,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
451 [debugClient, noencoding, str(port), redirect, ipaddr],
6633
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
452 clientEnv,
c5aab2ede19a Debugger, Shell: start the shell in the project directory if one is open ([issue290]).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6631
diff changeset
453 workingDir=workingDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 if process is None:
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
455 self.__startedVenv = ""
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
456 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
457 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
458 self.tr("Start Debugger"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
459 self.tr(
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
460 """<p>The debugger backend could not be started.</p>"""))
6576
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
461 else:
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
462 self.__startedVenv = venvName
ea60ea85067a VitualEnv Manager:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6503
diff changeset
463
3357
2390df6f42ba Started to change the file browser model such, that the sys.path entry is dependent on the running interpreter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
464 return process, self.__isNetworked, interpreter
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 def getClientCapabilities(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
468 Public method to retrieve the debug clients capabilities.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470 @return debug client capabilities (integer)
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 return self.clientCapabilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 def newConnection(self, sock):
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 Public slot to handle a new connection.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477
859
029eb068fd7b Fixed a source docu typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
478 @param sock reference to the socket object (QTcpSocket)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479 @return flag indicating success (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 # If we already have a connection, refuse this one. It will be closed
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482 # automatically.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 if self.qsock is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
486 sock.disconnected.connect(self.debugServer.startClient)
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
487 sock.readyRead.connect(self.__parseClientLine)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 self.qsock = sock
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491 # Get the remote clients capabilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492 self.remoteCapabilities()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 return True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 def flush(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 Public slot to flush the queue.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 """
7429
6983c461550f DebuggerInterfacePython: added a check to handle a situation where flush() is called while the socket is still unknown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
499 if self.qsock is not None:
6983c461550f DebuggerInterfacePython: added a check to handle a situation where flush() is called while the socket is still unknown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
500 # Send commands that were waiting for the connection.
6983c461550f DebuggerInterfacePython: added a check to handle a situation where flush() is called while the socket is still unknown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
501 for cmd in self.queue:
6983c461550f DebuggerInterfacePython: added a check to handle a situation where flush() is called while the socket is still unknown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
502 self.__writeJsonCommandToSocket(cmd)
6983c461550f DebuggerInterfacePython: added a check to handle a situation where flush() is called while the socket is still unknown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
503
6983c461550f DebuggerInterfacePython: added a check to handle a situation where flush() is called while the socket is still unknown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
504 self.queue = []
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506 def shutdown(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 Public method to cleanly shut down.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 It closes our socket and shuts down
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 the debug client. (Needed on Win OS)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 if self.qsock is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 # do not want any slots called during shutdown
482
4650a72c307a Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 481
diff changeset
517 self.qsock.disconnected.disconnect(self.debugServer.startClient)
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
518 self.qsock.readyRead.disconnect(self.__parseClientLine)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 # close down socket, and shut down client as well.
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
521 self.__sendJsonCommand("RequestShutdown", {})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 self.qsock.flush()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 self.qsock.close()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 # reinitialize
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526 self.qsock = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 self.queue = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
529 def isConnected(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 Public method to test, if a debug client has connected.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 @return flag indicating the connection status (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
535 return self.qsock is not None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
536
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 def remoteEnvironment(self, env):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539 Public method to set the environment for a program to debug, run, ...
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 @param env environment settings (dictionary)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 """
5119
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
543 self.__sendJsonCommand("RequestEnvironment", {"environment": env})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
545 def remoteLoad(self, fn, argv, wd, traceInterpreter=False,
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
546 autoContinue=True, autoFork=False, forkChild=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 Public method to load a new program to debug.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 @param fn the filename to debug (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 @param argv the commandline arguments to pass to the program (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 @param wd the working directory for the program (string)
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
553 @keyparam traceInterpreter flag indicating if the interpreter library
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
554 should be traced as well (boolean)
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
555 @keyparam autoContinue flag indicating, that the debugger should not
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
556 stop at the first executable line (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 @keyparam autoFork flag indicating the automatic fork mode (boolean)
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
558 @keyparam forkChild flag indicating to debug the child after forking
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
559 (boolean)
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 self.__autoContinue = autoContinue
1171
1ffefa5ca226 Improved handling of debugger sending "<string>".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1166
diff changeset
562 self.__scriptName = os.path.abspath(fn)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564 wd = self.translate(wd, False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 fn = self.translate(os.path.abspath(fn), False)
5119
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
566 self.__sendJsonCommand("RequestLoad", {
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
567 "workdir": wd,
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
568 "filename": fn,
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
569 "argv": Utilities.parseOptionString(argv),
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
570 "traceInterpreter": traceInterpreter,
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
571 "autofork": autoFork,
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
572 "forkChild": forkChild,
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
573 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
574
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
575 def remoteRun(self, fn, argv, wd, autoFork=False, forkChild=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
576 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577 Public method to load a new program to run.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579 @param fn the filename to run (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580 @param argv the commandline arguments to pass to the program (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 @param wd the working directory for the program (string)
112
16893e193e9d Added the auto fork options to the run dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
582 @keyparam autoFork flag indicating the automatic fork mode (boolean)
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
583 @keyparam forkChild flag indicating to debug the child after forking
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
584 (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 """
1171
1ffefa5ca226 Improved handling of debugger sending "<string>".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1166
diff changeset
586 self.__scriptName = os.path.abspath(fn)
1ffefa5ca226 Improved handling of debugger sending "<string>".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1166
diff changeset
587
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588 wd = self.translate(wd, False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 fn = self.translate(os.path.abspath(fn), False)
5120
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
590 self.__sendJsonCommand("RequestRun", {
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
591 "workdir": wd,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
592 "filename": fn,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
593 "argv": Utilities.parseOptionString(argv),
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
594 "autofork": autoFork,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
595 "forkChild": forkChild,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
596 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
598 def remoteCoverage(self, fn, argv, wd, erase=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600 Public method to load a new program to collect coverage data.
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 @param fn the filename to run (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 @param argv the commandline arguments to pass to the program (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 @param wd the working directory for the program (string)
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
605 @keyparam erase flag indicating that coverage info should be
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 cleared first (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 """
1171
1ffefa5ca226 Improved handling of debugger sending "<string>".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1166
diff changeset
608 self.__scriptName = os.path.abspath(fn)
1ffefa5ca226 Improved handling of debugger sending "<string>".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1166
diff changeset
609
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 wd = self.translate(wd, False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611 fn = self.translate(os.path.abspath(fn), False)
5120
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
612 self.__sendJsonCommand("RequestCoverage", {
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
613 "workdir": wd,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
614 "filename": fn,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
615 "argv": Utilities.parseOptionString(argv),
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
616 "erase": erase,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
617 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
618
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
619 def remoteProfile(self, fn, argv, wd, erase=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 Public method to load a new program to collect profiling data.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 @param fn the filename to run (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624 @param argv the commandline arguments to pass to the program (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 @param wd the working directory for the program (string)
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
626 @keyparam erase flag indicating that timing info should be cleared
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
627 first (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 """
1171
1ffefa5ca226 Improved handling of debugger sending "<string>".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1166
diff changeset
629 self.__scriptName = os.path.abspath(fn)
1ffefa5ca226 Improved handling of debugger sending "<string>".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1166
diff changeset
630
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 wd = self.translate(wd, False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 fn = self.translate(os.path.abspath(fn), False)
5120
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
633 self.__sendJsonCommand("RequestProfile", {
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
634 "workdir": wd,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
635 "filename": fn,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
636 "argv": Utilities.parseOptionString(argv),
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
637 "erase": erase,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
638 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 def remoteStatement(self, stmt):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
642 Public method to execute a Python statement.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 @param stmt the Python statement to execute (string). It
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 should not have a trailing newline.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 """
5120
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
647 self.__sendJsonCommand("ExecuteStatement", {
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
648 "statement": stmt,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
649 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
650
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 def remoteStep(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653 Public method to single step the debugged program.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 """
5120
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
655 self.__sendJsonCommand("RequestStep", {})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657 def remoteStepOver(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
658 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659 Public method to step over the debugged program.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 """
5120
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
661 self.__sendJsonCommand("RequestStepOver", {})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 def remoteStepOut(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 Public method to step out the debugged program.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 """
5120
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
667 self.__sendJsonCommand("RequestStepOut", {})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 def remoteStepQuit(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 Public method to stop the debugged program.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 """
5120
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
673 self.__sendJsonCommand("RequestStepQuit", {})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
675 def remoteContinue(self, special=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 Public method to continue the debugged program.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679 @param special flag indicating a special continue operation
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
680 """
5120
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
681 self.__sendJsonCommand("RequestContinue", {
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
682 "special": special,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
683 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684
5658
e5f6fe5855fd move the instruction pointer within the current function (Hotkey: F12)
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5587
diff changeset
685 def remoteMoveIP(self, line):
e5f6fe5855fd move the instruction pointer within the current function (Hotkey: F12)
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5587
diff changeset
686 """
e5f6fe5855fd move the instruction pointer within the current function (Hotkey: F12)
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5587
diff changeset
687 Public method to move the instruction pointer to a different line.
e5f6fe5855fd move the instruction pointer within the current function (Hotkey: F12)
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5587
diff changeset
688
e5f6fe5855fd move the instruction pointer within the current function (Hotkey: F12)
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5587
diff changeset
689 @param line the new line, where execution should be continued
e5f6fe5855fd move the instruction pointer within the current function (Hotkey: F12)
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5587
diff changeset
690 """
e5f6fe5855fd move the instruction pointer within the current function (Hotkey: F12)
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5587
diff changeset
691 self.__sendJsonCommand("RequestMoveIP", {
e5f6fe5855fd move the instruction pointer within the current function (Hotkey: F12)
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5587
diff changeset
692 "newLine": line,
e5f6fe5855fd move the instruction pointer within the current function (Hotkey: F12)
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5587
diff changeset
693 })
e5f6fe5855fd move the instruction pointer within the current function (Hotkey: F12)
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5587
diff changeset
694
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
695 def remoteBreakpoint(self, fn, line, setBreakpoint, cond=None, temp=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 Public method to set or clear a breakpoint.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 @param fn filename the breakpoint belongs to (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700 @param line linenumber of the breakpoint (int)
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
701 @param setBreakpoint flag indicating setting or resetting a
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
702 breakpoint (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
703 @param cond condition of the breakpoint (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
704 @param temp flag indicating a temporary breakpoint (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
705 """
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
706 self.__sendJsonCommand("RequestBreakpoint", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
707 "filename": self.translate(fn, False),
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
708 "line": line,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
709 "temporary": temp,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
710 "setBreakpoint": setBreakpoint,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
711 "condition": cond,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
712 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714 def remoteBreakpointEnable(self, fn, line, enable):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716 Public method to enable or disable a breakpoint.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
717
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 @param fn filename the breakpoint belongs to (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719 @param line linenumber of the breakpoint (int)
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
720 @param enable flag indicating enabling or disabling a breakpoint
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
721 (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
722 """
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
723 self.__sendJsonCommand("RequestBreakpointEnable", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
724 "filename": self.translate(fn, False),
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
725 "line": line,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
726 "enable": enable,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
727 })
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 remoteBreakpointIgnore(self, fn, line, count):
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 ignore a breakpoint the next couple of occurrences.
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 fn filename the breakpoint belongs to (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 @param line linenumber of the breakpoint (int)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 @param count number of occurrences to ignore (int)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 """
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
737 self.__sendJsonCommand("RequestBreakpointIgnore", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
738 "filename": self.translate(fn, False),
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
739 "line": line,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
740 "count": count,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
741 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
743 def remoteWatchpoint(self, cond, setWatch, temp=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745 Public method to set or clear a watch expression.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
746
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747 @param cond expression of the watch expression (string)
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
748 @param setWatch flag indicating setting or resetting a watch expression
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
749 (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 @param temp flag indicating a temporary watch expression (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 # cond is combination of cond and special (s. watch expression viewer)
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
753 self.__sendJsonCommand("RequestWatch", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
754 "temporary": temp,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
755 "setWatch": setWatch,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
756 "condition": cond,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
757 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 def remoteWatchpointEnable(self, cond, enable):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 Public method to enable or disable a watch expression.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763 @param cond expression of the watch expression (string)
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
764 @param enable flag indicating enabling or disabling a watch expression
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
765 (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 # cond is combination of cond and special (s. watch expression viewer)
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
768 self.__sendJsonCommand("RequestWatchEnable", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
769 "condition": cond,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
770 "enable": enable,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
771 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 def remoteWatchpointIgnore(self, cond, count):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 """
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
775 Public method to ignore a watch expression the next couple of
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
776 occurrences.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 @param cond expression of the watch expression (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 @param count number of occurrences to ignore (int)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 # cond is combination of cond and special (s. watch expression viewer)
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
782 self.__sendJsonCommand("RequestWatchIgnore", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
783 "condition": cond,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
784 "count": count,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
785 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 859
diff changeset
787 def remoteRawInput(self, s):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 Public method to send the raw input to the debugged program.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 @param s the raw input (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 """
5120
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
793 self.__sendJsonCommand("RawInput", {
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
794 "input": s,
c5189d404cc7 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5119
diff changeset
795 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797 def remoteThreadList(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
799 Public method to request the list of threads from the client.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
800 """
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
801 self.__sendJsonCommand("RequestThreadList", {})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
802
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803 def remoteSetThread(self, tid):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
804 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805 Public method to request to set the given thread as current thread.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807 @param tid id of the thread (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808 """
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
809 self.__sendJsonCommand("RequestThreadSet", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
810 "threadID": tid,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
811 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812
5964
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
813 def remoteClientVariables(self, scope, filterList, framenr=0, maxSize=0):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 Public method to request the variables of the debugged program.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 @param scope the scope of the variables (0 = local, 1 = global)
5964
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
818 @type int
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
819 @param filterList list of variable types to filter out
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
820 @type list of int
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
821 @param framenr framenumber of the variables to retrieve
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
822 @type int
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
823 @param maxSize maximum size the formatted value of a variable will
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
824 be shown. If it is bigger than that, a 'too big' indication will
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
825 be given (@@TOO_BIG_TO_SHOW@@).
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
826 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
827 """
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
828 self.__sendJsonCommand("RequestVariables", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
829 "frameNumber": framenr,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
830 "scope": scope,
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
831 "filters": filterList,
5964
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
832 "maxSize": maxSize,
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
833 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
834
5964
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
835 def remoteClientVariable(self, scope, filterList, var, framenr=0,
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
836 maxSize=0):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838 Public method to request the variables of the debugged program.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
839
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
840 @param scope the scope of the variables (0 = local, 1 = global)
5964
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
841 @type int
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
842 @param filterList list of variable types to filter out
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
843 @type list of int
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
844 @param var list encoded name of variable to retrieve
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
845 @type list of str
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
846 @param framenr framenumber of the variables to retrieve
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
847 @type int
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
848 @param maxSize maximum size the formatted value of a variable will
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
849 be shown. If it is bigger than that, a 'too big' indication will
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
850 be given (@@TOO_BIG_TO_SHOW@@).
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
851 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852 """
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
853 self.__sendJsonCommand("RequestVariable", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
854 "variable": var,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
855 "frameNumber": framenr,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
856 "scope": scope,
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
857 "filters": filterList,
5964
066e6c78a367 Introduced a configuration option for the debugger variables viewers to limit the variables shown by the variables viewers depending on their size (in order to avoid overload situations on low power or low memory machines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
858 "maxSize": maxSize,
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
859 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
860
7707
6abcf4275d0e Added a viewer to visualize Python byte code generated from a Python traceback of an exception as an additional tab of the debug viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7639
diff changeset
861 def remoteClientDisassembly(self):
6abcf4275d0e Added a viewer to visualize Python byte code generated from a Python traceback of an exception as an additional tab of the debug viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7639
diff changeset
862 """
6abcf4275d0e Added a viewer to visualize Python byte code generated from a Python traceback of an exception as an additional tab of the debug viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7639
diff changeset
863 Public method to ask the client for the latest traceback disassembly.
6abcf4275d0e Added a viewer to visualize Python byte code generated from a Python traceback of an exception as an additional tab of the debug viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7639
diff changeset
864 """
6abcf4275d0e Added a viewer to visualize Python byte code generated from a Python traceback of an exception as an additional tab of the debug viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7639
diff changeset
865 self.__sendJsonCommand("RequestDisassembly", {})
6abcf4275d0e Added a viewer to visualize Python byte code generated from a Python traceback of an exception as an additional tab of the debug viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7639
diff changeset
866
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
867 def remoteClientSetFilter(self, scope, filterStr):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
868 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
869 Public method to set a variables filter list.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
871 @param scope the scope of the variables (0 = local, 1 = global)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
872 @param filterStr regexp string for variable names to filter out
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
873 (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
874 """
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
875 self.__sendJsonCommand("RequestSetFilter", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
876 "scope": scope,
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
877 "filter": filterStr,
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
878 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
879
2170
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
880 def setCallTraceEnabled(self, on):
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
881 """
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
882 Public method to set the call trace state.
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
883
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
884 @param on flag indicating to enable the call trace function (boolean)
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
885 """
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
886 self.__sendJsonCommand("RequestCallTrace", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
887 "enable": on,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
888 })
2170
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
889
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
890 def remoteBanner(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
892 Public slot to get the banner info of the remote client.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 """
5119
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
894 self.__sendJsonCommand("RequestBanner", {})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
895
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
896 def remoteCapabilities(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
897 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
898 Public slot to get the debug clients capabilities.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
899 """
5119
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
900 self.__sendJsonCommand("RequestCapabilities", {})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
901
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
902 def remoteCompletion(self, text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
903 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904 Public slot to get the a list of possible commandline completions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
905 from the remote client.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
906
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 @param text the text to be completed (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 """
5124
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
909 self.__sendJsonCommand("RequestCompletion", {
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
910 "text": text,
1ba8ee313b57 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5120
diff changeset
911 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912
6901
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
913 def remoteUTDiscover(self, syspath, workdir, discoveryStart):
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
914 """
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
915 Public method to perform a test case discovery.
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
916
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
917 @param syspath list of directories to be added to sys.path on the
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
918 remote side
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
919 @type list of str
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
920 @param workdir path name of the working directory
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
921 @type str
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
922 @param discoveryStart directory to start auto-discovery at
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
923 @type str
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
924 """
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
925 self.__sendJsonCommand("RequestUTDiscover", {
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
926 "syspath": [] if syspath is None else syspath,
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
927 "workdir": workdir,
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
928 "discoverystart": discoveryStart,
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
929 })
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
930
6892
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
931 def remoteUTPrepare(self, fn, tn, tfn, failed, cov, covname, coverase,
6904
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
932 syspath, workdir, discover, discoveryStart, testCases,
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
933 debug):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935 Public method to prepare a new unittest run.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936
6892
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
937 @param fn name of file to load
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
938 @type str
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
939 @param tn name of test to load
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
940 @type str
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
941 @param tfn test function name to load tests from
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
942 @type str
1499
b4d0457afb15 Extended the unit test module to allow to rerun only failed tests of the last.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1171
diff changeset
943 @param failed list of failed test, if only failed test should be run
6892
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
944 @type list of str
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
945 @param cov flag indicating collection of coverage data is requested
6892
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
946 @type bool
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
947 @param covname name of file to be used to assemble the coverage caches
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
948 filename
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
949 @type str
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
950 @param coverase flag indicating erasure of coverage data is requested
6892
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
951 @type bool
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
952 @param syspath list of directories to be added to sys.path on the
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
953 remote side
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
954 @type list of str
6894
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
955 @param workdir path name of the working directory
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
956 @type str
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
957 @param discover flag indicating to discover the tests automatically
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
958 @type bool
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
959 @param discoveryStart directory to start auto-discovery at
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
960 @type str
6901
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
961 @param testCases list of test cases to be loaded
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
962 @type list of str
6904
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
963 @param debug flag indicating to run unittest with debugging
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
964 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
965 """
6894
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
966 if fn:
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
967 self.__scriptName = os.path.abspath(fn)
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
968
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
969 fn = self.translate(os.path.abspath(fn), False)
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
970 else:
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
971 self.__scriptName = "unittest discover"
1171
1ffefa5ca226 Improved handling of debugger sending "<string>".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1166
diff changeset
972
5125
eb1b3e0577e4 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5124
diff changeset
973 self.__sendJsonCommand("RequestUTPrepare", {
eb1b3e0577e4 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5124
diff changeset
974 "filename": fn,
eb1b3e0577e4 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5124
diff changeset
975 "testname": tn,
eb1b3e0577e4 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5124
diff changeset
976 "testfunctionname": tfn,
eb1b3e0577e4 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5124
diff changeset
977 "failed": failed,
eb1b3e0577e4 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5124
diff changeset
978 "coverage": cov,
eb1b3e0577e4 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5124
diff changeset
979 "coveragefile": covname,
eb1b3e0577e4 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5124
diff changeset
980 "coverageerase": coverase,
6892
c147620313c5 UnittestDialog: fixed an issue running tests for a project and removed the (obsolete) 'local' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6848
diff changeset
981 "syspath": [] if syspath is None else syspath,
6894
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
982 "workdir": workdir,
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
983 "discover": discover,
df83ac87e0db UnittestDialog: added capability to auto-discover tests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6892
diff changeset
984 "discoverystart": discoveryStart,
6901
f2c774c8db7e UnittestDialog: implemented the remote part fo 'discover only'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6894
diff changeset
985 "testcases": [] if testCases is None else testCases,
6904
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
986 "debug": debug,
5125
eb1b3e0577e4 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5124
diff changeset
987 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
988
6904
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
989 def remoteUTRun(self, debug, failfast):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
990 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
991 Public method to start a unittest run.
6904
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
992
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
993 @param debug flag indicating to run unittest with debugging
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
994 @type bool
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
995 @param failfast flag indicating to stop at the first error
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
996 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
997 """
6904
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
998 if debug:
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
999 self.__autoContinue = True
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
1000 self.__sendJsonCommand("RequestUTRun", {
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
1001 "debug": debug,
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
1002 "failfast": failfast,
3f35037a08d4 Unit Test: added capability to run test with debugger support and to stop the test on the first error or failure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6901
diff changeset
1003 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1004
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1005 def remoteUTStop(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1006 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1007 Public method to stop a unittest run.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1008 """
5128
b6cbdba69967 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5125
diff changeset
1009 self.__sendJsonCommand("RequestUTStop", {})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1010
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1011 def __askForkTo(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1012 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1013 Private method to ask the user which branch of a fork to follow.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1014 """
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1015 selections = [self.tr("Parent Process"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1016 self.tr("Child process")]
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
1017 res, ok = QInputDialog.getItem(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1018 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1019 self.tr("Client forking"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1020 self.tr("Select the fork branch to follow."),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1021 selections,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1022 0, False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1023 if not ok or res == selections[0]:
5128
b6cbdba69967 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5125
diff changeset
1024 self.__sendJsonCommand("ResponseForkTo", {
b6cbdba69967 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5125
diff changeset
1025 "target": "parent",
b6cbdba69967 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5125
diff changeset
1026 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1027 else:
5128
b6cbdba69967 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5125
diff changeset
1028 self.__sendJsonCommand("ResponseForkTo", {
b6cbdba69967 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5125
diff changeset
1029 "target": "child",
b6cbdba69967 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5125
diff changeset
1030 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1031
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1032 def __parseClientLine(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1033 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1034 Private method to handle data from the client.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1036 while self.qsock and self.qsock.canReadLine():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 qs = self.qsock.readLine()
7840
9c5ffa877ce0 DebuggerInterfacePython: changed code to not use QTextCodec anymore to prepare for Qt6 transition.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7803
diff changeset
1038 line = bytes(qs).decode(
9c5ffa877ce0 DebuggerInterfacePython: changed code to not use QTextCodec anymore to prepare for Qt6 transition.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7803
diff changeset
1039 encoding=Preferences.getSystem("StringEncoding"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1040
6584
33ea6f430eb8 DebuggerInterfacePython: added a logging statement to see, what is sent by the debug backend. Activate it with '--debug'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6581
diff changeset
1041 logging.debug("<Debug-Server> %s", line)
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1042 ## print("Server: ", line) ##debug
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1043
5128
b6cbdba69967 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5125
diff changeset
1044 self.__handleJsonCommand(line)
b6cbdba69967 Continued modernizing the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5125
diff changeset
1045 continue
5119
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
1046
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
1047 def __handleJsonCommand(self, jsonStr):
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
1048 """
5129
e4ab234cf071 Cleaned up the modified code for the modernized debugger interface (Python3 variant).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5128
diff changeset
1049 Private method to handle a command or response serialized as a
e4ab234cf071 Cleaned up the modified code for the modernized debugger interface (Python3 variant).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5128
diff changeset
1050 JSON string.
e4ab234cf071 Cleaned up the modified code for the modernized debugger interface (Python3 variant).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5128
diff changeset
1051
e4ab234cf071 Cleaned up the modified code for the modernized debugger interface (Python3 variant).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5128
diff changeset
1052 @param jsonStr string containing the command or response received
e4ab234cf071 Cleaned up the modified code for the modernized debugger interface (Python3 variant).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5128
diff changeset
1053 from the debug backend
e4ab234cf071 Cleaned up the modified code for the modernized debugger interface (Python3 variant).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5128
diff changeset
1054 @type str
5119
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
1055 """
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
1056 import json
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
1057
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
1058 try:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5059
diff changeset
1059 commandDict = json.loads(jsonStr.strip())
5162
bbf2bb2d533c Fixed an issue in the new debugger protocol because JSONDecodeError is defined for Python 3.5 and newer only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5140
diff changeset
1060 except (TypeError, ValueError) as err:
5137
089401c122c5 Added reporting for JSON decoding errors in the debugger interfaces and updated translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5136
diff changeset
1061 E5MessageBox.critical(
089401c122c5 Added reporting for JSON decoding errors in the debugger interfaces and updated translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5136
diff changeset
1062 None,
089401c122c5 Added reporting for JSON decoding errors in the debugger interfaces and updated translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5136
diff changeset
1063 self.tr("Debug Protocol Error"),
089401c122c5 Added reporting for JSON decoding errors in the debugger interfaces and updated translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5136