Conversation
|
This is a basic implementation that allows to set a background image and alpha blend the "normal" icons on top. Since this is a computational overhead I thought about adding some code that allows to update the widget-image only once at @muesli what are your thoughts on these changes? |
b4ea944 to
548e405
Compare
|
Just a heads up, I'll take the liberty to play with this a bit and potentially simplify a few things. I like the idea of custom update intervals, but I think this should probably be a separate PR, as I can already see a few more cleanups/changes coming along with it. I may drop this commit from the branch, but we can easily rescue it and move it to a separate PR 😃 |
|
Yes definetly 👍 , I'm sorry for this "raw" code but I'm just starting to wrap my head around the way go works. I would have created two PRs but then thought to add it right away since the bare implementation does increase the cpu footprint by up to 100%. Whether it stays in this PR or gets moved here are some things that should be thought about:
|
Nothing to apologize for, I can already see you picking up a few Go idioms, and your code improving!
Understood! I have guarded the background image from being repainted unnecessarily in my latest changes. Let me know if I missed something and you can still see an increased CPU footprint.
We need to be careful tho, as the communication with the device itself is strictly synchronous.
Agreed!
😆 |
|
Heads up: I removed the separate |
| if err != nil { | ||
| return | ||
| } |
There was a problem hiding this comment.
I'm not certain if that is what you wanted to achieve with these changes. But in case you define a button without an icon (not impossible) this results in the following not much saying error message (and deckmaster exits):
2021/06/02 18:17:44 error: open : no such file or directory
There was a problem hiding this comment.
Good catch! This is indeed just a side-effect of the missing error handling. I'll address this in a separate PR, which will improve the rendering in a few ways.
Ohh yes I think I hade something planned there and aimed for a clean config files ... but yes without additional settings this is better |
If you can already envision some additional settings right now, we may as well keep it in a separate |
The motivation of this PR was mainly to get rid of the need to jump into your favourite image editor and create custom buttons (with background). |
Thank you!
Looks great! Love the way u adapted the changes in
Is this the reason spamming an 'empty' button does block the update of other widgets? 🤔 |
Not quite. Check out the This will cause the program to sleep and wait until one of its cases below occur:
If you keep spamming a button, the timer never gets a chance to timeout, as it gets restarted after each key event. |
|
Forgot to drop a big "thank you" for your contribution here: great stuff, thank you @zMoooooritz! |
Contains the changes described in #21