Replies: 1 comment
-
Refer to: #514 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I've just started with EWW and I'm creating a small widget which interacts with an API to dynamically list out data. I have a few questions as I've hit some roadblocks.
Dynamically Creating Revealers
So for a basic toggle button revealer, I can use:
However, if I define a widget, so I can add it to a literal, the toggle doesn't seem to work the way I want.
So the problem I'm having is that the revadd attribute used by onclick is evaluating to false, rather than the variable name. I can't seem to add the variable name I'm looking for in order to get the click working correctly. Something like
:onclick "eww update ${revaddname}=${ revadd ? false : true }"
But then defining the variable name is becoming problematic. I need to define it as:
:revaddname revadd
And then add the reveal top evaluate the variable name, and then the value it's been set to, something like:
:reveal ${${revaddname}}
I can't find the structure to create dynamic variables in this way, instead I can only define the values accepted by predefined variables.
Listener Not Working As Expected
The literal I'm using interacts with an API to pull information. The script is written in Python. When I define the variable as a poll, the script works fine. Here's the script (approximately)
However, I want a listener instead, for the reason that if I'm adding in revealers, expanders etc, then I want the values for them initially set to false, and I don't want the poll to reload the widgets and set the values to false every time it polls the server. Instead, I want to use a listener, so I've modified the script. I'll be adding in conditionals later to check whether there's been any changes on the API. However, for now, I've just added an infinite loop to to the Python script, which continuosly prints, so in theory it should act exactly the same as a poll.
The generated widgets, although completely the same as the ones made when polling, just don't render at all when used in this way.
Is there a reason why and a workaround? I've tried using a bash script to call the Python instead, and I've tried using an os.system to echo the value of genbox instead of using python's print.
Beta Was this translation helpful? Give feedback.
All reactions