src/eric7/QScintilla/Shell.py

branch
server
changeset 10559
64db35c6e335
parent 10555
08e853c0c77b
parent 10556
b4a75c77f9cd
child 10597
fbe93720ee9f
equal deleted inserted replaced
10555:08e853c0c77b 10559:64db35c6e335
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")
1983 self.__clientStatement(False) 1985 self.__clientStatement(False)
1984 self.setFocus(Qt.FocusReason.OtherFocusReason) 1986 self.setFocus(Qt.FocusReason.OtherFocusReason)
1985 else: 1987 else:
1986 self.dbs.remoteStatement(self.__getSelectedDebuggerId(), cmd) 1988 self.dbs.remoteStatement(self.__getSelectedDebuggerId(), cmd)
1987 now = time.monotonic() 1989 now = time.monotonic()
1988 while self.inCommandExecution and time.monotonic() - now < 10: 1990 timeDelta = 0
1989 # 10 seconds timeout 1991 while (
1992 self.inCommandExecution
1993 and timeDelta <= self.__commandExecutionTimeout
1994 ):
1995 timeDelta = time.monotonic() - now
1996 # configurable timeout
1990 with contextlib.suppress(KeyboardInterrupt): 1997 with contextlib.suppress(KeyboardInterrupt):
1991 QApplication.processEvents() 1998 QApplication.processEvents()
1992 self.inCommandExecution = False 1999 self.inCommandExecution = False
2000 if timeDelta > self.__commandExecutionTimeout:
2001 # timeout -> write a hint into the shell window
2002 s = self.tr(
2003 "Execution of the interpreter statement timed out after"
2004 " {0} seconds.\n"
2005 ).format(self.__commandExecutionTimeout)
2006 self.__write(s)
2007 self.__clientStatement(False)
1993 else: 2008 else:
1994 if not self.__echoInput: 2009 if not self.__echoInput:
1995 cmd = self.buff 2010 cmd = self.buff
1996 self.buff = "" 2011 self.buff = ""
1997 elif cmd: 2012 elif cmd:
2195 self.dbs.clientProcessStderr.connect(self.__writeStdErr) 2210 self.dbs.clientProcessStderr.connect(self.__writeStdErr)
2196 else: 2211 else:
2197 self.dbs.clientProcessStdout.disconnect(self.__writeStdOut) 2212 self.dbs.clientProcessStdout.disconnect(self.__writeStdOut)
2198 self.dbs.clientProcessStderr.disconnect(self.__writeStdErr) 2213 self.dbs.clientProcessStderr.disconnect(self.__writeStdErr)
2199 self.__showStdOutErr = showStdOutErr 2214 self.__showStdOutErr = showStdOutErr
2215
2216 # do some additional configuration parameters
2217 self.__commandExecutionTimeout = Preferences.getShell("CommandExecutionTimeout")
2200 2218
2201 @pyqtSlot(list, str) 2219 @pyqtSlot(list, str)
2202 def __showCompletions(self, completions, text): 2220 def __showCompletions(self, completions, text):
2203 """ 2221 """
2204 Private method to display the possible completions. 2222 Private method to display the possible completions.

eric ide

mercurial