This forum has been archived. All content is frozen. Please use KDE Discuss instead.

dcop progress bar with kdialog

Tags: None
(comma "," separated)
Calgarian
Registered Member
Posts
16
Karma
0
OS

dcop progress bar with kdialog

Sat Nov 15, 2008 9:54 pm
I've written the following test script after trying to get a dcop progress bar to work with kdialog under Kubuntu 8.10 and KDE4 in a much longer and more complex script.

#! /bin/bash
dcopRef=$(kdialog --title "DCOP Progress" --progressbar "Initializing . . ." 12)
echo $dcopRef
dcop $dcopRef setProgress 1
dcop $dcopRef setLabel "Step 1"
sleep 3
dcop $dcopRef setProgress 2
dcop $dcopRef setLabel "Step 2"
sleep 3
dcop $dcopRef close

Upon executing the script I get the following output. The dialog for the progress bar is created with the title shown above.

org.kde.kdialog-7234 /ProgressDialog
object not accessible
object not accessible
object not accessible
object not accessible
call failed

I can get along without the progress bar, but it looks neater with it. Any thoughts greatly appreciated? TIA


Calgarian, proud to be a member of KDE forums since 2008-Nov.
User avatar
neverendingo
Administrator
Posts
2136
Karma
17
OS

RE: dcop progress bar with kdialog

Sat Nov 15, 2008 10:38 pm
There is no such method as setProgress in kdialog.

Code: Select all
qdbus org.kde.kdialog-31398 /ProgressDialog


shows me this:
Code: Select all
property readwrite bool org.kde.kdialog.ProgressDialog.autoClose
property readwrite int org.kde.kdialog.ProgressDialog.maximum
property readwrite int org.kde.kdialog.ProgressDialog.value
method void org.kde.kdialog.ProgressDialog.close()
method void org.kde.kdialog.ProgressDialog.setLabelText(QString label)
method void org.kde.kdialog.ProgressDialog.showCancelButton(bool value)
method bool org.kde.kdialog.ProgressDialog.wasCancelled()
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface_name, QString property_name)
method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()


New to KDE Software? - get help from Userbase or ask questions on the Forums
Communicate.
Image
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS

RE: dcop progress bar with kdialog

Sun Nov 16, 2008 3:09 pm
neverendingo wrote:There is no such method as setProgress in kdialog.


And the command should be qdbus, not dcop

I guess it could be something like this
Code: Select all
qdbus $dcopRef org.kde.kdialog.ProgressDialog.setValue 1
qdbus $dcopRef org.kde.kdialog.ProgressDialog.setLabelText "Step 1"


Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

RE: dcop progress bar with kdialog

Mon Nov 17, 2008 4:20 am
Properties are not methods thus setting the progress will not work.
Try this instead:
Code: Select all
 
qdbus $dcopRef org.freedesktop.DBus.Properties.Set org.kde.kdialog.ProgressDialog value 1


As you can see you write properties by calling org.freedesktop.DBus.Properties.Set with the property path, name, and new value. You may wish to set the maximum property as well, so your script would end up looking like this:
Code: Select all
 #! /bin/bash
 dcopRef=$(kdialog --title "DCOP Progress" --progressbar "Initializing . . ." 12)
 echo $dcopRef
 qdbus $dcopRef org.freedesktop.DBus.Properties.Set org.kde.kdialog.ProgressDialog maximum 3
 qdbus $dcopRef org.freedesktop.DBus.Properties.Set org.kde.kdialog.ProgressDialog value 1
 qdbus $dcopRef org.kde.kdialog.ProgressDialog.setLabelText "Step 1"
 sleep 3
 qdbus $dcopRef org.freedesktop.DBus.Properties.Set org.kde.kdialog.ProgressDialog value 2
 qdbus $dcopRef org.kde.kdialog.ProgressDialog.setLabelText "Step 2"
 sleep 3
 qdbus $dcopRef org.freedesktop.DBus.Properties.Set org.kde.kdialog.ProgressDialog value 3
 qdbus $dcopRef org.kde.kdialog.ProgressDialog.close


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell