YearProgress

Plasma 5 Calendars plasma plasmoid

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

1
Score 58.0%
Description:

A simple progress bar, in pure QML, indicating the time elapsed since the beginning of the year, as a percentage (inspired by https://twitter.com/ProgressBar201X)
Last changelog:

Less CPU intensive 1 year ago

Date check done only when the day actually changes

9

avlas

1 year ago

It doesn't seem to update the percentage automatically, does it? I mean, if plasma is running for days, one needs to restart plasma manually to get the % updated...

Report

C

Refused

1 year ago

Yes it does: the day is checked one every hour.

You can try it by yourself (don't forget to revert the canges, rebuild and reinstall):

- edit src/yearprogressplasmoid.cpp replacing 60000 with 2000 at row 47, so it will be updated every two seconds,

- make && sudo make install && plasmoidviewer -a org.kde.yearprogressplasmoid.

- change the system date by some weeks ahead and you will see the percentage changing.

Report

Zren

1 year ago

Every 2 seconds seems excessive. The "time" dataengine, which the Digital Clock, Fuzzy Clock, etc uses, has a property to show the current time. It also has the ability to AlignToHour, which means it only updates when the hour changes.

You ought to look into the fuzzyclock widget for a simple example.
https://github.com/KDE/kdeplasma-addons/blob/master/applets/fuzzy-clock/package/contents/ui/main.qml

Here's where AlignToSecond, AlignToMinute, and AlignToHour is defined if you're interested in that enum.
https://github.com/KDE/plasma-framework/blob/38431eebfa1286c11d5bb716f7d65c1a660b535d/src/plasma/plasma.h#L207

You could bind to:
onCurrentDateTimeChanged: {
updateYearProgressSlider()
}

Report

C

Refused

1 year ago

Thanks for your feedback!
2 seconds were suggested just for testing. It is actually one hour.
I've already tried the time dataengine but I could not find the currentDateTimeChanged signal: I believe that just newData is available and I should do the "date check" manually.
I could anyway use the current timer and correct just the first cycle.

Hints are welcome!

Report

Zren

1 year ago

Notice how fuzzyclock has a property named currentDateTime? Every property you define has a on_____Changed signal you can bind to. Since currentDateTime has a binding to dataSource.data.Local.DateTime, every time the dataengine updates, it will update currentDateTime too.

Here's an example you can use to test the differences between AlignToHour, AlignToMinute and AlignToSecond.
https://gist.github.com/Zren/01d81eb74037fd038358b0fa426243c4

Report

C

Refused

1 year ago

Oh well, it was quite easy :D Thanks for your support!

Report

9

avlas

1 year ago

Sounds great! It was few days since I used my laptop last time, and realized of this. Now I understand that less than an hour passed and that explains it wasn't updated (yet).

Report

9

avlas

1 year ago

9 + Nice minimalistic year progress bar!

Report

C

Refused

1 year ago

Thank you!

Report

9

avlas

1 year ago

Thanks! Very nice and minimalistic plasmoid :)

May I suggest a tiny improvement? Please add +0.5 to properly round l_result -> in yearprogressplasmoid.cpp (line 69) -> l_result = ((qreal)l_days_elapsed/(qreal)l_days_total) * 100 + 0.5;

Report

C

Refused

1 year ago

Thanks for your feedback. Actually, the value was just truncated to integer, now it shows the first digit as well (so, no need to add 0.5)

Report

Less CPU intensive 1 year ago

Date check done only when the day actually changes

12345678910
1
product-maker avlas Aug 10 2018 9 excellent
+ Nice minimalistic year progress bar!
product-maker Base: 4 x 5.0 Ratings
xiaoyan
Jun 27 2019
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
GPLv2 or later
version
1.0.4
updated Sep 13 2018
added Aug 08 2018
downloads 24h
1
pageviews 24h 1