Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not use functions #143

Closed
f2n-aramayo opened this issue Apr 17, 2020 · 5 comments
Closed

Can not use functions #143

f2n-aramayo opened this issue Apr 17, 2020 · 5 comments
Assignees
Labels
Milestone

Comments

@f2n-aramayo
Copy link

f2n-aramayo commented Apr 17, 2020

Hi

I'm trying to use function inside the widget. If I try for example the one you use in https://arcanis.me/projects/awesome-widgets, I get this error:

${{
function colorCpu()
{
    if ($cpu > 90.0)
        return "<span style=\"color:#ff0000;\">$cpu</span>"
    else
        return "$cpu"
}
colorCpu()
}}

[ 511.729][WW][org.kde.plasma.awesomewidget][unknown] Uncaught exception at line 4 : "SyntaxError: Unexpected token `&'"

Even if I try this simple example, also get an error:

${{
$down - $up
}}

[ 796.231][WW][org.kde.plasma.awesomewidget][unknown] Uncaught exception at line 2 : "SyntaxError: Unexpected token `&'"

If I don't use variables, everything works:

${{
function three()
{
    return 1+2;
}
three()
}}
@arcan1s
Copy link
Owner

arcan1s commented Apr 17, 2020

🤔

@arcan1s
Copy link
Owner

arcan1s commented Apr 17, 2020

i can confirm the bug, thank you, will check it

@arcan1s arcan1s self-assigned this Apr 17, 2020
@arcan1s arcan1s added the bug label Apr 17, 2020
@arcan1s arcan1s added this to the Release 3.4 milestone Apr 17, 2020
@arcan1s
Copy link
Owner

arcan1s commented Apr 17, 2020

oh, i got it. Issue is that $cpu expands into something like &nbsp;40 which is obviously not valid number. Not sure if it has been introduced by me or just qt has changed something (there is another issue which has been reported about nbsp in preview). Will fix it soon, thanks again

@f2n-aramayo
Copy link
Author

Thanks, I'll keep an eye out for updates

@arcan1s
Copy link
Owner

arcan1s commented Jan 7, 2021

should be fixed with 3.4.2

@arcan1s arcan1s closed this as completed Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants