Wed, 03 Jul 2024 10:39:16 +0200
Merged again with branch 'eric7' in order to prepare a new release.
--- a/eric7.epj Wed Jul 03 09:23:38 2024 +0200 +++ b/eric7.epj Wed Jul 03 10:39:16 2024 +0200 @@ -1173,6 +1173,7 @@ "src/eric7/DocumentationTools/TemplatesListsStyleCSS.py", "src/eric7/DocumentationTools/__init__.py", "src/eric7/EricCore/EricFileSystemWatcher.py", + "src/eric7/EricCore/EricStdRedirector.py", "src/eric7/EricCore/EricTreeSortFilterProxyModel.py", "src/eric7/EricCore/__init__.py", "src/eric7/EricGraphics/EricArrowItem.py",
--- a/src/eric7/APIs/Python3/eric7.api Wed Jul 03 09:23:38 2024 +0200 +++ b/src/eric7/APIs/Python3/eric7.api Wed Jul 03 10:39:16 2024 +0200 @@ -1108,6 +1108,16 @@ eric7.EricCore.EricFileSystemWatcher._EricFileSystemEventHandler?2(parent=None) eric7.EricCore.EricFileSystemWatcher._GlobalFileSystemWatcher?8 eric7.EricCore.EricFileSystemWatcher.instance?4() +eric7.EricCore.EricStdRedirector.EricStdRedirector.encoding?4() +eric7.EricCore.EricStdRedirector.EricStdRedirector.flush?4() +eric7.EricCore.EricStdRedirector.EricStdRedirector.isatty?4() +eric7.EricCore.EricStdRedirector.EricStdRedirector.readable?4() +eric7.EricCore.EricStdRedirector.EricStdRedirector.stderrString?7 +eric7.EricCore.EricStdRedirector.EricStdRedirector.stdoutString?7 +eric7.EricCore.EricStdRedirector.EricStdRedirector.writable?4() +eric7.EricCore.EricStdRedirector.EricStdRedirector.write?4(s) +eric7.EricCore.EricStdRedirector.EricStdRedirector.writelines?4(lines) +eric7.EricCore.EricStdRedirector.EricStdRedirector?1(stderr, parent=None) eric7.EricCore.EricTreeSortFilterProxyModel.EricTreeSortFilterProxyModel.filterAcceptsRow?4(sourceRow, sourceParent) eric7.EricCore.EricTreeSortFilterProxyModel.EricTreeSortFilterProxyModel.hasChildren?4(parent=None) eric7.EricCore.EricTreeSortFilterProxyModel.EricTreeSortFilterProxyModel?1(parent=None) @@ -11022,15 +11032,9 @@ eric7.UI.SymbolsWidget.SymbolsWidget.on_symbolsTable_activated?4(index) eric7.UI.SymbolsWidget.SymbolsWidget.on_tableCombo_currentIndexChanged?4(index) eric7.UI.SymbolsWidget.SymbolsWidget?1(parent=None) -eric7.UI.UserInterface.Redirector.appendStderr?7 -eric7.UI.UserInterface.Redirector.appendStdout?7 -eric7.UI.UserInterface.Redirector.encoding?4() -eric7.UI.UserInterface.Redirector.flush?4() -eric7.UI.UserInterface.Redirector.isatty?4() -eric7.UI.UserInterface.Redirector.write?4(s) -eric7.UI.UserInterface.Redirector?1(stderr, parent=None) eric7.UI.UserInterface.SSL_AVAILABLE?7 eric7.UI.UserInterface.UserInterface.ErrorLogFileName?7 +eric7.UI.UserInterface.UserInterface.ReleaseMode?7 eric7.UI.UserInterface.UserInterface.activateCodeDocumentationViewer?4(switchFocus=True) eric7.UI.UserInterface.UserInterface.activateCooperationViewer?4() eric7.UI.UserInterface.UserInterface.activateDebugViewer?4()
--- a/src/eric7/APIs/Python3/eric7.bas Wed Jul 03 09:23:38 2024 +0200 +++ b/src/eric7/APIs/Python3/eric7.bas Wed Jul 03 10:39:16 2024 +0200 @@ -332,6 +332,7 @@ EricSslErrorHandler QObject EricSslErrorState enum.Enum EricSslInfoWidget QMenu +EricStdRedirector QObject EricStretchableSpacer QWidget EricStringListCompleter QCompleter EricStringListEditWidget QWidget Ui_EricStringListEditWidget @@ -937,7 +938,6 @@ Rebase HgExtension RebaseProjectHelper HgExtensionProjectHelper RecursionError OverflowError ValueError -Redirector QObject RefactoringPreviewDialog QDialog Ui_RefactoringPreviewDialog ReloadStopButton EricToolButton RemoveBookmarksCommand QUndoCommand
--- a/src/eric7/Documentation/Help/source.qhp Wed Jul 03 09:23:38 2024 +0200 +++ b/src/eric7/Documentation/Help/source.qhp Wed Jul 03 10:39:16 2024 +0200 @@ -109,6 +109,7 @@ </section> <section title="eric7.EricCore" ref="index-eric7.EricCore.html"> <section title="eric7.EricCore.EricFileSystemWatcher" ref="eric7.EricCore.EricFileSystemWatcher.html" /> + <section title="eric7.EricCore.EricStdRedirector" ref="eric7.EricCore.EricStdRedirector.html" /> <section title="eric7.EricCore.EricTreeSortFilterProxyModel" ref="eric7.EricCore.EricTreeSortFilterProxyModel.html" /> </section> <section title="eric7.EricGraphics" ref="index-eric7.EricGraphics.html"> @@ -6381,6 +6382,18 @@ <keyword name="EricSslInfoWidget.accept" id="EricSslInfoWidget.accept" ref="eric7.EricNetwork.EricSslInfoWidget.html#EricSslInfoWidget.accept" /> <keyword name="EricSslInfoWidget.showAt" id="EricSslInfoWidget.showAt" ref="eric7.EricNetwork.EricSslInfoWidget.html#EricSslInfoWidget.showAt" /> <keyword name="EricSslUtilities (Module)" id="EricSslUtilities (Module)" ref="eric7.EricNetwork.EricSslUtilities.html" /> + <keyword name="EricStdRedirector" id="EricStdRedirector" ref="eric7.EricCore.EricStdRedirector.html#EricStdRedirector" /> + <keyword name="EricStdRedirector (Constructor)" id="EricStdRedirector (Constructor)" ref="eric7.EricCore.EricStdRedirector.html#EricStdRedirector.__init__" /> + <keyword name="EricStdRedirector (Module)" id="EricStdRedirector (Module)" ref="eric7.EricCore.EricStdRedirector.html" /> + <keyword name="EricStdRedirector.__bufferedLength" id="EricStdRedirector.__bufferedLength" ref="eric7.EricCore.EricStdRedirector.html#EricStdRedirector.__bufferedLength" /> + <keyword name="EricStdRedirector.__signalData" id="EricStdRedirector.__signalData" ref="eric7.EricCore.EricStdRedirector.html#EricStdRedirector.__signalData" /> + <keyword name="EricStdRedirector.encoding" id="EricStdRedirector.encoding" ref="eric7.EricCore.EricStdRedirector.html#EricStdRedirector.encoding" /> + <keyword name="EricStdRedirector.flush" id="EricStdRedirector.flush" ref="eric7.EricCore.EricStdRedirector.html#EricStdRedirector.flush" /> + <keyword name="EricStdRedirector.isatty" id="EricStdRedirector.isatty" ref="eric7.EricCore.EricStdRedirector.html#EricStdRedirector.isatty" /> + <keyword name="EricStdRedirector.readable" id="EricStdRedirector.readable" ref="eric7.EricCore.EricStdRedirector.html#EricStdRedirector.readable" /> + <keyword name="EricStdRedirector.writable" id="EricStdRedirector.writable" ref="eric7.EricCore.EricStdRedirector.html#EricStdRedirector.writable" /> + <keyword name="EricStdRedirector.write" id="EricStdRedirector.write" ref="eric7.EricCore.EricStdRedirector.html#EricStdRedirector.write" /> + <keyword name="EricStdRedirector.writelines" id="EricStdRedirector.writelines" ref="eric7.EricCore.EricStdRedirector.html#EricStdRedirector.writelines" /> <keyword name="EricStretchableSpacer" id="EricStretchableSpacer" ref="eric7.EricWidgets.EricStretchableSpacer.html#EricStretchableSpacer" /> <keyword name="EricStretchableSpacer (Constructor)" id="EricStretchableSpacer (Constructor)" ref="eric7.EricWidgets.EricStretchableSpacer.html#EricStretchableSpacer.__init__" /> <keyword name="EricStretchableSpacer (Module)" id="EricStretchableSpacer (Module)" ref="eric7.EricWidgets.EricStretchableSpacer.html" /> @@ -14713,14 +14726,6 @@ <keyword name="RebaseProjectHelper.initMenu" id="RebaseProjectHelper.initMenu" ref="eric7.Plugins.VcsPlugins.vcsMercurial.RebaseExtension.ProjectHelper.html#RebaseProjectHelper.initMenu" /> <keyword name="RebaseProjectHelper.menuTitle" id="RebaseProjectHelper.menuTitle" ref="eric7.Plugins.VcsPlugins.vcsMercurial.RebaseExtension.ProjectHelper.html#RebaseProjectHelper.menuTitle" /> <keyword name="RecursionError" id="RecursionError" ref="eric7.Graphics.GraphicsUtilities.html#RecursionError" /> - <keyword name="Redirector" id="Redirector" ref="eric7.UI.UserInterface.html#Redirector" /> - <keyword name="Redirector (Constructor)" id="Redirector (Constructor)" ref="eric7.UI.UserInterface.html#Redirector.__init__" /> - <keyword name="Redirector.__bufferedWrite" id="Redirector.__bufferedWrite" ref="eric7.UI.UserInterface.html#Redirector.__bufferedWrite" /> - <keyword name="Redirector.__nWrite" id="Redirector.__nWrite" ref="eric7.UI.UserInterface.html#Redirector.__nWrite" /> - <keyword name="Redirector.encoding" id="Redirector.encoding" ref="eric7.UI.UserInterface.html#Redirector.encoding" /> - <keyword name="Redirector.flush" id="Redirector.flush" ref="eric7.UI.UserInterface.html#Redirector.flush" /> - <keyword name="Redirector.isatty" id="Redirector.isatty" ref="eric7.UI.UserInterface.html#Redirector.isatty" /> - <keyword name="Redirector.write" id="Redirector.write" ref="eric7.UI.UserInterface.html#Redirector.write" /> <keyword name="RefactoringPreviewDialog" id="RefactoringPreviewDialog" ref="eric7.JediInterface.RefactoringPreviewDialog.html#RefactoringPreviewDialog" /> <keyword name="RefactoringPreviewDialog (Constructor)" id="RefactoringPreviewDialog (Constructor)" ref="eric7.JediInterface.RefactoringPreviewDialog.html#RefactoringPreviewDialog.__init__" /> <keyword name="RefactoringPreviewDialog (Module)" id="RefactoringPreviewDialog (Module)" ref="eric7.JediInterface.RefactoringPreviewDialog.html" /> @@ -21244,6 +21249,7 @@ <file>eric7.DocumentationTools.QtHelpGenerator.html</file> <file>eric7.DocumentationTools.TemplatesListsStyleCSS.html</file> <file>eric7.EricCore.EricFileSystemWatcher.html</file> + <file>eric7.EricCore.EricStdRedirector.html</file> <file>eric7.EricCore.EricTreeSortFilterProxyModel.html</file> <file>eric7.EricGraphics.EricArrowItem.html</file> <file>eric7.EricGraphics.EricGraphicsView.html</file>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.EricCore.EricStdRedirector.html Wed Jul 03 10:39:16 2024 +0200 @@ -0,0 +1,283 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.EricCore.EricStdRedirector</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.EricCore.EricStdRedirector</h1> +<p> +Module implementing a redirector for stderr and stdout to be able to send data written +to these streams via Qt signals. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#EricStdRedirector">EricStdRedirector</a></td> +<td>Class for replacement of stdout and stderr in order to send the data via Qt signals.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr><td>None</td></tr> +</table> + +<hr /> +<hr /> +<a NAME="EricStdRedirector" ID="EricStdRedirector"></a> +<h2>EricStdRedirector</h2> +<p> + Class for replacement of stdout and stderr in order to send the data via + Qt signals. +</p> + +<h3>Signals</h3> +<dl> + +<dt>stderrString(str)</dt> +<dd> +emitted to signal data written to stderr +</dd> +<dt>stdoutString(str)</dt> +<dd> +emitted to signal data written to stdout +</dd> +</dl> +<h3>Derived from</h3> +QObject +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#EricStdRedirector.__init__">EricStdRedirector</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#EricStdRedirector.__bufferedLength">__bufferedLength</a></td> +<td>Private method returning number of characters of buffered lines.</td> +</tr> +<tr> +<td><a href="#EricStdRedirector.__signalData">__signalData</a></td> +<td>Private method used to signal data written to the instance object.</td> +</tr> +<tr> +<td><a href="#EricStdRedirector.encoding">encoding</a></td> +<td>Public method to report the used encoding.</td> +</tr> +<tr> +<td><a href="#EricStdRedirector.flush">flush</a></td> +<td>Public method used to flush all buffered data.</td> +</tr> +<tr> +<td><a href="#EricStdRedirector.isatty">isatty</a></td> +<td>Public method to indicate a TTY.</td> +</tr> +<tr> +<td><a href="#EricStdRedirector.readable">readable</a></td> +<td>Public method to check, if the stream is readable.</td> +</tr> +<tr> +<td><a href="#EricStdRedirector.writable">writable</a></td> +<td>Public method to check, if a stream is writable.</td> +</tr> +<tr> +<td><a href="#EricStdRedirector.write">write</a></td> +<td>Public method used to write data.</td> +</tr> +<tr> +<td><a href="#EricStdRedirector.writelines">writelines</a></td> +<td>Public method used to write a list of strings to the file.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="EricStdRedirector.__init__" ID="EricStdRedirector.__init__"></a> +<h4>EricStdRedirector (Constructor)</h4> +<b>EricStdRedirector</b>(<i>stderr, parent=None</i>) +<p> + Constructor +</p> + +<dl> + +<dt><i>stderr</i> (bool)</dt> +<dd> +flag indicating stderr is being redirected +</dd> +<dt><i>parent</i> (QObject (optional))</dt> +<dd> +reference to the parent object (defaults to None) +</dd> +</dl> +<a NAME="EricStdRedirector.__bufferedLength" ID="EricStdRedirector.__bufferedLength"></a> +<h4>EricStdRedirector.__bufferedLength</h4> +<b>__bufferedLength</b>(<i></i>) +<p> + Private method returning number of characters of buffered lines. +</p> + +<dl> +<dt>Return:</dt> +<dd> +number of characters of buffered lines (complete lines only) +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +int +</dd> +</dl> +<a NAME="EricStdRedirector.__signalData" ID="EricStdRedirector.__signalData"></a> +<h4>EricStdRedirector.__signalData</h4> +<b>__signalData</b>(<i>n</i>) +<p> + Private method used to signal data written to the instance object. +</p> + +<dl> + +<dt><i>n</i> (int)</dt> +<dd> +max number of characters to send via a Qt signal +</dd> +</dl> +<a NAME="EricStdRedirector.encoding" ID="EricStdRedirector.encoding"></a> +<h4>EricStdRedirector.encoding</h4> +<b>encoding</b>(<i></i>) +<p> + Public method to report the used encoding. +</p> + +<dl> +<dt>Return:</dt> +<dd> +used encoding +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="EricStdRedirector.flush" ID="EricStdRedirector.flush"></a> +<h4>EricStdRedirector.flush</h4> +<b>flush</b>(<i></i>) +<p> + Public method used to flush all buffered data. +</p> + +<a NAME="EricStdRedirector.isatty" ID="EricStdRedirector.isatty"></a> +<h4>EricStdRedirector.isatty</h4> +<b>isatty</b>(<i></i>) +<p> + Public method to indicate a TTY. +</p> +<p> + Note: This always reports 'False' because the redirector class is no TTY. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating a TTY +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="EricStdRedirector.readable" ID="EricStdRedirector.readable"></a> +<h4>EricStdRedirector.readable</h4> +<b>readable</b>(<i></i>) +<p> + Public method to check, if the stream is readable. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating a readable stream +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="EricStdRedirector.writable" ID="EricStdRedirector.writable"></a> +<h4>EricStdRedirector.writable</h4> +<b>writable</b>(<i></i>) +<p> + Public method to check, if a stream is writable. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating a writable stream +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="EricStdRedirector.write" ID="EricStdRedirector.write"></a> +<h4>EricStdRedirector.write</h4> +<b>write</b>(<i>s</i>) +<p> + Public method used to write data. +</p> + +<dl> + +<dt><i>s</i> (Any)</dt> +<dd> +data to be written (it must support the str-method) +</dd> +</dl> +<a NAME="EricStdRedirector.writelines" ID="EricStdRedirector.writelines"></a> +<h4>EricStdRedirector.writelines</h4> +<b>writelines</b>(<i>lines</i>) +<p> + Public method used to write a list of strings to the file. +</p> + +<dl> + +<dt><i>lines</i> (list of str)</dt> +<dd> +list of texts to be written +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- a/src/eric7/Documentation/Source/eric7.UI.UserInterface.html Wed Jul 03 09:23:38 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.UI.UserInterface.html Wed Jul 03 10:39:16 2024 +0200 @@ -19,10 +19,6 @@ <h3>Classes</h3> <table> <tr> -<td><a href="#Redirector">Redirector</a></td> -<td>Helper class used to redirect stdout and stderr to the log window.</td> -</tr> -<tr> <td><a href="#UserInterface">UserInterface</a></td> <td>Class implementing the main user interface.</td> </tr> @@ -39,190 +35,6 @@ <hr /> <hr /> -<a NAME="Redirector" ID="Redirector"></a> -<h2>Redirector</h2> -<p> - Helper class used to redirect stdout and stderr to the log window. -</p> - -<h3>Signals</h3> -<dl> - -<dt>appendStderr(str)</dt> -<dd> -emitted to write data to stderr logger -</dd> -<dt>appendStdout(str)</dt> -<dd> -emitted to write data to stdout logger -</dd> -</dl> -<h3>Derived from</h3> -QObject -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#Redirector.__init__">Redirector</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#Redirector.__bufferedWrite">__bufferedWrite</a></td> -<td>Private method returning number of characters to write.</td> -</tr> -<tr> -<td><a href="#Redirector.__nWrite">__nWrite</a></td> -<td>Private method used to write data.</td> -</tr> -<tr> -<td><a href="#Redirector.encoding">encoding</a></td> -<td>Public method to report the used encoding.</td> -</tr> -<tr> -<td><a href="#Redirector.flush">flush</a></td> -<td>Public method used to flush the buffered data.</td> -</tr> -<tr> -<td><a href="#Redirector.isatty">isatty</a></td> -<td>Public method to indicate a tty.</td> -</tr> -<tr> -<td><a href="#Redirector.write">write</a></td> -<td>Public method used to write data.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="Redirector.__init__" ID="Redirector.__init__"></a> -<h4>Redirector (Constructor)</h4> -<b>Redirector</b>(<i>stderr, parent=None</i>) -<p> - Constructor -</p> - -<dl> - -<dt><i>stderr</i> (bool)</dt> -<dd> -flag indicating stderr is being redirected -</dd> -<dt><i>parent</i> (QObject)</dt> -<dd> -reference to the parent object -</dd> -</dl> -<a NAME="Redirector.__bufferedWrite" ID="Redirector.__bufferedWrite"></a> -<h4>Redirector.__bufferedWrite</h4> -<b>__bufferedWrite</b>(<i></i>) -<p> - Private method returning number of characters to write. -</p> - -<dl> -<dt>Return:</dt> -<dd> -number of characters buffered or length of buffered line -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -int -</dd> -</dl> -<a NAME="Redirector.__nWrite" ID="Redirector.__nWrite"></a> -<h4>Redirector.__nWrite</h4> -<b>__nWrite</b>(<i>n</i>) -<p> - Private method used to write data. -</p> - -<dl> - -<dt><i>n</i> (int)</dt> -<dd> -max number of bytes to write -</dd> -</dl> -<a NAME="Redirector.encoding" ID="Redirector.encoding"></a> -<h4>Redirector.encoding</h4> -<b>encoding</b>(<i></i>) -<p> - Public method to report the used encoding. -</p> - -<dl> -<dt>Return:</dt> -<dd> -used encoding -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<a NAME="Redirector.flush" ID="Redirector.flush"></a> -<h4>Redirector.flush</h4> -<b>flush</b>(<i></i>) -<p> - Public method used to flush the buffered data. -</p> - -<a NAME="Redirector.isatty" ID="Redirector.isatty"></a> -<h4>Redirector.isatty</h4> -<b>isatty</b>(<i></i>) -<p> - Public method to indicate a tty. -</p> -<p> - Note: This always reports 'False'. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating a tty -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="Redirector.write" ID="Redirector.write"></a> -<h4>Redirector.write</h4> -<b>write</b>(<i>s</i>) -<p> - Public method used to write data. -</p> - -<dl> - -<dt><i>s</i> (Any)</dt> -<dd> -data to be written (it must support the str-method) -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> <a NAME="UserInterface" ID="UserInterface"></a> <h2>UserInterface</h2> <p> @@ -269,6 +81,7 @@ <h3>Class Attributes</h3> <table> <tr><td>ErrorLogFileName</td></tr> +<tr><td>ReleaseMode</td></tr> <tr><td>maxFilePathLen</td></tr> <tr><td>maxMenuFilePathLen</td></tr> </table>
--- a/src/eric7/Documentation/Source/index-eric7.EricCore.html Wed Jul 03 09:23:38 2024 +0200 +++ b/src/eric7/Documentation/Source/index-eric7.EricCore.html Wed Jul 03 10:39:16 2024 +0200 @@ -23,6 +23,10 @@ <td>Module implementing a QFileSystemWatcher replacement based on the 'watchdog' package.</td> </tr> <tr> +<td><a href="eric7.EricCore.EricStdRedirector.html">EricStdRedirector</a></td> +<td>Module implementing a redirector for stderr and stdout to be able to send data written to these streams via Qt signals.</td> +</tr> +<tr> <td><a href="eric7.EricCore.EricTreeSortFilterProxyModel.html">EricTreeSortFilterProxyModel</a></td> <td>Module implementing a modified QSortFilterProxyModel.</td> </tr>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/EricCore/EricStdRedirector.py Wed Jul 03 10:39:16 2024 +0200 @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing a redirector for stderr and stdout to be able to send data written +to these streams via Qt signals. +""" + +import locale +import os + +from PyQt6.QtCore import QObject, pyqtSignal + + +class EricStdRedirector(QObject): + """ + Class for replacement of stdout and stderr in order to send the data via + Qt signals. + + @signal stderrString(str) emitted to signal data written to stderr + @signal stdoutString(str) emitted to signal data written to stdout + """ + + stderrString = pyqtSignal(str) + stdoutString = pyqtSignal(str) + + def __init__(self, stderr, parent=None): + """ + Constructor + + @param stderr flag indicating stderr is being redirected + @type bool + @param parent reference to the parent object (defaults to None) + @type QObject (optional) + """ + super().__init__(parent) + + self.mode = "w" # only writable stream (i.e. stdout, stderr) + + self.__isStderr = stderr + self.__buffer = "" + self.__encoding = locale.getencoding() + + def __signalData(self, n): + """ + Private method used to signal data written to the instance object. + + @param n max number of characters to send via a Qt signal + @type int + """ + if n: + line = self.__buffer[:n].replace("\n", os.linesep) + if self.__isStderr: + self.stderrString.emit(line) + else: + self.stdoutString.emit(line) + self.__buffer = self.__buffer[n:] + + def __bufferedLength(self): + """ + Private method returning number of characters of buffered lines. + + @return number of characters of buffered lines (complete lines only) + @rtype int + """ + return self.__buffer.rfind("\n") + 1 + + def flush(self): + """ + Public method used to flush all buffered data. + """ + self.__signalData(len(self.__buffer)) + + def write(self, s): + """ + Public method used to write data. + + @param s data to be written (it must support the str-method) + @type Any + """ + self.__buffer += str(s).replace("\r\n", "\n").replace("\r", "\n") + self.__signalData(self.__bufferedLength()) + + def writelines(self, lines): + """ + Public method used to write a list of strings to the file. + + @param lines list of texts to be written + @type list of str + """ + self.write("".join(lines)) + + def isatty(self): + """ + Public method to indicate a TTY. + + Note: This always reports 'False' because the redirector class is no TTY. + + @return flag indicating a TTY + @rtype bool + """ + return False + + @property + def encoding(self): + """ + Public method to report the used encoding. + + @return used encoding + @rtype str + """ + return self.__encoding + + def readable(self): + """ + Public method to check, if the stream is readable. + + @return flag indicating a readable stream + @rtype bool + """ + return self.mode == "r" + + def writable(self): + """ + Public method to check, if a stream is writable. + + @return flag indicating a writable stream + @rtype bool + """ + return self.mode == "w"
--- a/src/eric7/UI/UserInterface.py Wed Jul 03 09:23:38 2024 +0200 +++ b/src/eric7/UI/UserInterface.py Wed Jul 03 10:39:16 2024 +0200 @@ -24,7 +24,6 @@ from PyQt6.QtCore import ( PYQT_VERSION_STR, QDate, - QObject, QProcess, QSize, Qt, @@ -65,6 +64,7 @@ from eric7.Debugger.DebugServer import DebugServer from eric7.Debugger.DebugUI import DebugUI from eric7.EricCore import EricFileSystemWatcher +from eric7.EricCore.EricStdRedirector import EricStdRedirector from eric7.EricGui import EricPixmapCache from eric7.EricGui.EricAction import EricAction, createActionGroup from eric7.EricNetwork.EricNetworkIcon import EricNetworkIcon @@ -115,92 +115,6 @@ SSL_AVAILABLE = False -class Redirector(QObject): - """ - Helper class used to redirect stdout and stderr to the log window. - - @signal appendStderr(str) emitted to write data to stderr logger - @signal appendStdout(str) emitted to write data to stdout logger - """ - - appendStderr = pyqtSignal(str) - appendStdout = pyqtSignal(str) - - def __init__(self, stderr, parent=None): - """ - Constructor - - @param stderr flag indicating stderr is being redirected - @type bool - @param parent reference to the parent object - @type QObject - """ - super().__init__(parent) - self.stderr = stderr - self.buffer = "" - - def __nWrite(self, n): - """ - Private method used to write data. - - @param n max number of bytes to write - @type int - """ - if n: - line = self.buffer[:n] - if self.stderr: - self.appendStderr.emit(line) - else: - self.appendStdout.emit(line) - self.buffer = self.buffer[n:] - - def __bufferedWrite(self): - """ - Private method returning number of characters to write. - - @return number of characters buffered or length of buffered line - @rtype int - """ - return self.buffer.rfind("\n") + 1 - - def flush(self): - """ - Public method used to flush the buffered data. - """ - self.__nWrite(len(self.buffer)) - - def write(self, s): - """ - Public method used to write data. - - @param s data to be written (it must support the str-method) - @type Any - """ - self.buffer += str(s) - self.__nWrite(self.__bufferedWrite()) - - def isatty(self): - """ - Public method to indicate a tty. - - Note: This always reports 'False'. - - @return flag indicating a tty - @rtype bool - """ - return False - - @property - def encoding(self): - """ - Public method to report the used encoding. - - @return used encoding - @rtype str - """ - return Preferences.getSystem("IOEncoding") - - class UserInterfaceSide(enum.Enum): """ Class defining the supported sides of the user interface. @@ -341,10 +255,10 @@ logging.getLogger(__name__).debug("Initializing Basic Services...") # Generate the redirection helpers - self.stdout = Redirector(False, self) - self.stdout.appendStdout.connect(self.appendToStdout) - self.stderr = Redirector(True, self) - self.stderr.appendStderr.connect(self.appendToStderr) + self.stdout = EricStdRedirector(False, self) + self.stdout.stdoutString.connect(self.appendToStdout) + self.stderr = EricStdRedirector(True, self) + self.stderr.stderrString.connect(self.appendToStderr) # Redirect sys.stdout and/or sys.stderr if those are None if sys.stdout is None or UserInterface.ReleaseMode: sys.stdout = self.stdout