Sat, 09 Jun 2018 12:08:47 +0200
Shell.py: Added a patch provided by Tobias Rzepka to avoid freeze of eric when printing a lot. Original patch with some modifications and added source docu.
--- a/APIs/Python3/eric6.api Fri Jun 08 19:34:28 2018 +0200 +++ b/APIs/Python3/eric6.api Sat Jun 09 12:08:47 2018 +0200 @@ -9164,6 +9164,7 @@ eric6.QScintilla.Shell.Shell.loadHistory?4(clientType) eric6.QScintilla.Shell.Shell.mousePressEvent?4(event) eric6.QScintilla.Shell.Shell.paste?4() +eric6.QScintilla.Shell.Shell.queueText?7 eric6.QScintilla.Shell.Shell.reloadHistory?4() eric6.QScintilla.Shell.Shell.saveHistory?4(clientType) eric6.QScintilla.Shell.Shell.searchNext?4(txt, caseSensitive, wholeWord)
--- a/Documentation/Help/source.qhp Fri Jun 08 19:34:28 2018 +0200 +++ b/Documentation/Help/source.qhp Sat Jun 09 12:08:47 2018 +0200 @@ -14153,6 +14153,7 @@ <keyword name="Shell.__clientStatement" id="Shell.__clientStatement" ref="eric6.QScintilla.Shell.html#Shell.__clientStatement" /> <keyword name="Shell.__clientSyntaxError" id="Shell.__clientSyntaxError" ref="eric6.QScintilla.Shell.html#Shell.__clientSyntaxError" /> <keyword name="Shell.__completionListSelected" id="Shell.__completionListSelected" ref="eric6.QScintilla.Shell.html#Shell.__completionListSelected" /> + <keyword name="Shell.__concatenateText" id="Shell.__concatenateText" ref="eric6.QScintilla.Shell.html#Shell.__concatenateText" /> <keyword name="Shell.__configure" id="Shell.__configure" ref="eric6.QScintilla.Shell.html#Shell.__configure" /> <keyword name="Shell.__executeCommand" id="Shell.__executeCommand" ref="eric6.QScintilla.Shell.html#Shell.__executeCommand" /> <keyword name="Shell.__find" id="Shell.__find" ref="eric6.QScintilla.Shell.html#Shell.__find" />
--- a/Documentation/Source/eric6.QScintilla.Shell.html Fri Jun 08 19:34:28 2018 +0200 +++ b/Documentation/Source/eric6.QScintilla.Shell.html Sat Jun 09 12:08:47 2018 +0200 @@ -58,6 +58,9 @@ <dd> emitted to indicate a change of the history style +</dd><dt>queueText(str)</dt> +<dd> +emitted to queue some text for processing </dd><dt>searchStringFound(bool)</dt> <dd> emitted to indicate the search @@ -191,6 +194,9 @@ <td><a href="#Shell.__completionListSelected">__completionListSelected</a></td> <td>Private slot to handle the selection from the completion list.</td> </tr><tr> +<td><a href="#Shell.__concatenateText">__concatenateText</a></td> +<td>Private slot to get all available text and process it in one step.</td> +</tr><tr> <td><a href="#Shell.__configure">__configure</a></td> <td>Private method to open the configuration dialog.</td> </tr><tr> @@ -765,6 +771,16 @@ <dd> the selected text (string) </dd> +</dl><a NAME="Shell.__concatenateText" ID="Shell.__concatenateText"></a> +<h4>Shell.__concatenateText</h4> +<b>__concatenateText</b>(<i>text</i>) +<p> + Private slot to get all available text and process it in one step. +</p><dl> +<dt><i>text</i> (str)</dt> +<dd> +text to be appended +</dd> </dl><a NAME="Shell.__configure" ID="Shell.__configure"></a> <h4>Shell.__configure</h4> <b>__configure</b>(<i></i>)
--- a/QScintilla/Shell.py Fri Jun 08 19:34:28 2018 +0200 +++ b/QScintilla/Shell.py Sat Jun 09 12:08:47 2018 +0200 @@ -108,9 +108,11 @@ result @signal historyStyleChanged(ShellHistoryStyle) emitted to indicate a change of the history style + @signal queueText(str) emitted to queue some text for processing """ searchStringFound = pyqtSignal(bool) historyStyleChanged = pyqtSignal(ShellHistoryStyle) + queueText = pyqtSignal(str) def __init__(self, dbs, vm, windowedVariant, parent=None): """ @@ -343,6 +345,10 @@ self.__historyNavigateByCursor = \ Preferences.getShell("HistoryNavigateByCursor") + self.__queuedText = '' + self.__blockTextProcessing = False + self.queueText.connect(self.__concatenateText, Qt.QueuedConnection) + self.grabGesture(Qt.PinchGesture) def __showLanguageMenu(self): @@ -904,13 +910,34 @@ @param s text to be displayed (string) """ + self.queueText.emit(s) + + def __concatenateText(self, text): + """ + Private slot to get all available text and process it in one step. + + @param text text to be appended + @type str + """ + self.__queuedText += text + if self.__blockTextProcessing: + return + + self.__blockTextProcessing = True + # Get all text which is still waiting for output + QApplication.processEvents() + + # Finally process the accumulated text line, col = self.__getEndPos() self.setCursorPosition(line, col) - self.insert(Utilities.filterAnsiSequences(s)) + self.insert(Utilities.filterAnsiSequences(self.__queuedText)) self.prline, self.prcol = self.getCursorPosition() self.ensureCursorVisible() self.ensureLineVisible(self.prline) + self.__queuedText = '' + self.__blockTextProcessing = False + def __writeStdOut(self, s): """ Private method to display some text with StdOut label.