Re: [kde] Displaying input streams using Kdialog
- Date: Wed, 18 May 2016 11:01:32 +0000 (UTC)
- From: Duncan <1i5t5.duncan@xxxxxxx>
- Subject: Re: [kde] Displaying input streams using Kdialog
max+kde posted on Wed, 18 May 2016 10:37:16 +0200 as excerpted:
> I have a script which uses kdialog to present some information or
> dialogs to the user. Now I want to present continous information in a
> Kdialog box. Specifically, it will be the progress output of a rsync
> Is there a way to pipe the output to kdialog? Alternatively, is there a
> way to convince kdialog to display information which are not fully
> avaliable yet?
The only kdialog type that I'm aware of that can do dynamic updating like
that is the --progressbar dialog. When you create it with the
kdialog --progressbar invocation, a dbus reference ID is printed on
STDOUT. If this is saved to a variable, then you can call qdbus to
update the text and the progress value, and eventually close the progress
bar dialog if desired.
There's a kdialog tutorial on techbase that has a couple nice examples,
one without a cancel button that shows text and progress updates, and a
second with a cancel button that doesn't show text updates, only progress
(Link will wrap here as posted and I'm not going to bother unwrapping it
so do that manually, should be one long link line.)
You could either figure out the number of progress updates ahead of time,
or maybe if the rsync is local, do a dry-run first, counting the lines or
something, and then do the real rsync, updating progress based on the
number of lines.
Or don't actually update the progress value at all, and just use the
output from rsync to update the text to show what dir it's working on at
Another alternative would be not to use kdialog to follow the progress at
all, but instead, use a customized konsole invocation, setting title,
size, perhaps hiding the menubar and tabbar, and invoking the command
direct from your script, something like:
konsole --hide-menubar --hide-tabbar --title whatever (a qt option) -e
tail -f .bashrc
You may or may not want the --noclose option as well. Without it, as
soon as the command exits, the konsole window closes.
With noclose, if you actually ran your rsync as the command (or put it in
a script and simply invoked the now nested script), you could background
the initial konsole call, let it output the normal rsync output to the
konsole window, monitor it via tee or waiting for the rsync command to
complete in the script, and close the konsole window when appropriate
from the script.
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
This message is from the kde mailing list.
Account management: https://mail.kde.org/mailman/listinfo/kde.
More info: http://www.kde.org/faq.html.