[Eric] Log-viewer in Eric4: how implemented?

Detlev Offenbach detlev at die-offenbachs.de
Fri Mar 20 17:16:40 GMT 2009


On Freitag, 20. März 2009, Geert Vancompernolle wrote:
> Hi,
>
> I have a Python application (written in PyQt) that starts an external
> app (calls a batch file using subprocess.Popen()).  That external app is
> normally sending its output to the console (DOS command box).
> I would like to capture that output (both stdout and stderr) in real
> time and send it to a log window in my Python application (QTextBrowser
> window).
>
> I've seen that, when I use the Eric4 debugger while running/debugging my
> Python application, all my external application output is nicely and in
> real time captured and shown in the Log-viewer window of the Eric4 IDE.
> That's exactly the behaviour that I want, but then to send that info to
> my log window in my application.
>
> - How is this done in Eric4?  I've looked into the source codes, but
> without a bit of explanation it's hard to grasp...
> - What's the best strategy to implement that log-viewer behaviour into
> my own log window of my application?

First of all, I am using QProcess instead of subprocess because QProcess works 
with the Qt event loop and subprocess doesn't. The captured output from 
QProcess is send to the logviewer using some methods.

Please see UserInterface.py and LogView.py for details.

If you are more interested in the output of the debugger backend, that is a 
lot more complicated because the IDE acts as a server for the debugger 
backend. The debug server receives the output from the debugger via a network 
connection and publishes it via a SIGNAL. That is connected to the shell 
window, which displays it. The debug client is started using QProcess as 
well.

If you have more specific questions please contact me directly. And please 
observe the license, if you take code from eric4.

Regards,
Detlev
-- 
Detlev Offenbach
detlev at die-offenbachs.de



More information about the Eric mailing list