Weiß jemand wie man eine Progressbar mit Kdialog erstellen kann? Ich finde immer nur veraltete Anleitungen im Netz.
Hoffentlich kann mir jemand helfen. ☺
kdialog progressbar
![]() Anmeldungsdatum: Beiträge: 144 Wohnort: Berlin |
|
||
Anmeldungsdatum: Beiträge: 5792 |
|
||
(Themenstarter)
![]() Anmeldungsdatum: Beiträge: 144 Wohnort: Berlin |
Vielen Dank, dass ist genau as was ich gesucht habe. dialog=$(kdialog --progressbar 'Doing something') # set maximum value, used to calculate filling level set_dialog_property "${dialog}" maximum 100 # enable automatical closing, once maximum value is reached. If not # enabled, the dialog must be closed manually using the # org.kde.kdialog.ProgressDialog.close method. set_dialog_property "${dialog}" autoClose false # enable cancel button. Note, that this button is *not* affected by the # autoClose property. The dialog *never* closes automatically, if the # cancel button is pressed. qdbus ${dialog} org.kde.kdialog.ProgressDialog.showCancelButton true > /dev/null for counter in $(seq 100); do # check if the dialog was cancelled, and exit the loop in this case cancelled=$(qdbus $dialog org.kde.kdialog.ProgressDialog.wasCancelled) if [ "${cancelled}" = "true" ]; then echo "cancelled" # manually close the dialog qdbus ${dialog} org.kde.kdialog.ProgressDialog.close > /dev/null exit 1 fi sleep 1 # refresh value and label set_dialog_property "${dialog}" value "${counter}" qdbus ${dialog} org.kde.kdialog.ProgressDialog.setLabelText \ "Step ${counter}" > /dev/null done Gruß Dan ☺ |
||
Anmeldungsdatum: Beiträge: 5792 |
Wenn ich das nicht getestet hätte, hätte ich das dazu geschrieben. Mein Beispiel läuft, wenn du aber versuchst, es in einer Shell auszuführen, für die es nicht geschrieben wurde, ist das dein Problem, der Shebang zeigt nicht grundlos auf die bash. Im Übrigen erhöht die Aktivierung der Syntaxhervorhebung die Lesbarkeit. |
« Vorherige1Nächste »
Antworten |