Menu

Question about a script and labels

2013-01-07
2013-01-15
  • Hombremaledicto

    Hombremaledicto - 2013-01-07

    Hi,
    Currently i'm working with a friend on a script to display cover + info for the current track in amarok & clementine.
    I took part of the code from your weather script, and since now no problems. What i wanted to understand is if it's possible to use buttons to play/pause or to change to next or previous track.
    I tested these commands only for clementine, referring to the qdbus calls as
    < a href="command"> Pause< / a> (without spaces ofc)
    This provoked a pause/play loop, considering the PollInterval, the command repeats itself every 2 sec.
    If it's possible, do you have any tip on how to get the buttons work?

    Here's the script: http://pastebin.com/hdK1h0pp

    You can see the button part is commented.

     

    Last edit: Hombremaledicto 2013-01-07
  • Thomas Luebking

    Thomas Luebking - 2013-01-07

    QLabel will run QDesktopService::openUrl() when you click a link (and that is enabled, what's the case) - it's not supposed and does not call applications or processes.
    (Also you need to specify "Active=true" in the label definition)

    What happens with the present code is that whenever the PREV/NEXT variables get expanded the bash script (not the label!) executes the dbus call (thus on every update call you get a play and a pause call)

    There basically two options here:
    a) don't do that with a link bug put the label together with to Button's into a Type=Panel subpanel (of vertical alignment, thus 2 or 3 Position)
    b) i'd have to add a UrlHandler to the labels which can eg. interpret an "exec://kwrite" url and executes the "path"

    Where i'm frankly not very fond of option (b) because you will unlikely ever write "rm -rf ~/*" into a button description, but it could end up as result in a script (eg. where the data input comes from outside) - so there must be some level of protection if one would follow that path
    like you can execute command1 and command2 which are both defined in the label description what however results in a split between the execution definition and invocation - eww. :-\

     
  • Hombremaledicto

    Hombremaledicto - 2013-01-08

    I think option (a) would be sufficient =)
    Why i didn't thought about it in the firstplace? (too much wine?)
    Here's a shot: http://ompldr.org/vZ3pqNw
    Script + Buttons + Tooltip (a TipLabel + another script)

    Last question: my friend is trying to make the text scrolling
    (would be very useful with long titles).
    Didn't worked with html marquee tag. You think it's possible through javascript? (again, don't know if it's possible or not)

     

    Last edit: Hombremaledicto 2013-01-08
  • Thomas Luebking

    Thomas Luebking - 2013-01-08

    No. The document renderer in QtGui (used by QLabel and others) only provides basic richtext support for an html subset.
    Neither javascript (there's no engine) nor sprcialities like marquee (while i'm actually not sure about that, but given your findings ...:-) are supported.

    Scrolling would require a custom implementation in be.shell to activate scrollbars, hide them and then autoscroll the text (horizontally or vertically) forth and back.

    Lars has asked for scrollbar support before - major problem is that you then also have to control ("hardcode") the element size (fixed) from either config or css.

    Needs a brainstorm on requirements, ie. figure how to support configuration best.

     
  • Hombremaledicto

    Hombremaledicto - 2013-01-15

    Yep, i've tried with marquee different times, never worked.
    So i hope for scrollbars then.

     

    Last edit: Hombremaledicto 2013-01-16

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.