src/eric7/QScintilla/Shell.py

branch
eric7
changeset 10556
b4a75c77f9cd
parent 10554
cfcfba945421
child 10559
64db35c6e335
child 10619
bd15b5b625cb
equal deleted inserted replaced
10554:cfcfba945421 10556:b4a75c77f9cd
263 self.lexer_ = None 263 self.lexer_ = None
264 self.completionText = "" 264 self.completionText = ""
265 self.__shuttingDown = False 265 self.__shuttingDown = False
266 266
267 self.clientType = "" 267 self.clientType = ""
268
269 self.__commandExecutionTimeout = Preferences.getShell("CommandExecutionTimeout")
268 270
269 # Initialize history 271 # Initialize history
270 self.__historyLists = {} 272 self.__historyLists = {}
271 self.__maxHistoryEntries = Preferences.getShell("MaxHistoryEntries") 273 self.__maxHistoryEntries = Preferences.getShell("MaxHistoryEntries")
272 self.__historyStyle = Preferences.getShell("HistoryStyle") 274 self.__historyStyle = Preferences.getShell("HistoryStyle")
1977 self.__clientStatement(False) 1979 self.__clientStatement(False)
1978 self.setFocus(Qt.FocusReason.OtherFocusReason) 1980 self.setFocus(Qt.FocusReason.OtherFocusReason)
1979 else: 1981 else:
1980 self.dbs.remoteStatement(self.__getSelectedDebuggerId(), cmd) 1982 self.dbs.remoteStatement(self.__getSelectedDebuggerId(), cmd)
1981 now = time.monotonic() 1983 now = time.monotonic()
1982 while self.inCommandExecution and time.monotonic() - now < 10: 1984 timeDelta = 0
1983 # 10 seconds timeout 1985 while (
1986 self.inCommandExecution
1987 and timeDelta <= self.__commandExecutionTimeout
1988 ):
1989 timeDelta = time.monotonic() - now
1990 # configurable timeout
1984 with contextlib.suppress(KeyboardInterrupt): 1991 with contextlib.suppress(KeyboardInterrupt):
1985 QApplication.processEvents() 1992 QApplication.processEvents()
1993 self.inCommandExecution = False
1994 if timeDelta > self.__commandExecutionTimeout:
1995 # timeout -> write a hint into the shell window
1996 s = self.tr(
1997 "Execution of the interpreter statement timed out after"
1998 " {0} seconds.\n"
1999 ).format(self.__commandExecutionTimeout)
2000 self.__write(s)
2001 self.__clientStatement(False)
1986 else: 2002 else:
1987 if not self.__echoInput: 2003 if not self.__echoInput:
1988 cmd = self.buff 2004 cmd = self.buff
1989 self.buff = "" 2005 self.buff = ""
1990 elif cmd: 2006 elif cmd:
2186 self.dbs.clientProcessStderr.connect(self.__writeStdErr) 2202 self.dbs.clientProcessStderr.connect(self.__writeStdErr)
2187 else: 2203 else:
2188 self.dbs.clientProcessStdout.disconnect(self.__writeStdOut) 2204 self.dbs.clientProcessStdout.disconnect(self.__writeStdOut)
2189 self.dbs.clientProcessStderr.disconnect(self.__writeStdErr) 2205 self.dbs.clientProcessStderr.disconnect(self.__writeStdErr)
2190 self.__showStdOutErr = showStdOutErr 2206 self.__showStdOutErr = showStdOutErr
2207
2208 # do some additional configuration parameters
2209 self.__commandExecutionTimeout = Preferences.getShell("CommandExecutionTimeout")
2191 2210
2192 @pyqtSlot(list, str) 2211 @pyqtSlot(list, str)
2193 def __showCompletions(self, completions, text): 2212 def __showCompletions(self, completions, text):
2194 """ 2213 """
2195 Private method to display the possible completions. 2214 Private method to display the possible completions.

eric ide

mercurial