Button bounce issue

Discuss your Lua playlist, album art and interface scripts.
destroyedlolo
Blank Cone
Blank Cone
Posts: 15
Joined: 19 Jan 2014 18:10

Button bounce issue

Postby destroyedlolo » 24 Jan 2014 23:01

Hello,

With the following code :

Code: Select all

function descriptor() return { title = "Test"; version = "0.1"; author = "Destroyedlolo"; shortdesc = "Test"; capabilities = {} } end widgets={} function activate() vlc.msg.info("Starting Test") -- go go go ! createDlg() ReadCamera() updateDlg() end function updateDlg() widgets.preview:set_text('N/A') end function ReadCamera() local s, msg = vlc.stream('http://10.5.5.9/camera/se?t=') end function deactivate() dlg:delete() end function createDlg() dlg = vlc.dialog("Test") dlg:add_label("Preview :", 1,3) widgets.preview = dlg:add_button("N/A", changePreview, 2,3) dlg:update() dlg:show() end function changePreview() vlc.msg.info("ChPrv") end
If I click on the button, I got changePreview() called twice which obviously it's not what is expected :D
If I remove vlc.stream() call or widgets.preview:set_text('N/A'), the problem is gone.

I'm using VLC 2.0.7 which is the latest stable version on Gentoo. Can you please tell me if you have the same behaviors with other version ?
Any tips to avoid this nasty bounce ?

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: Button bounce issue

Postby mederi » 25 Jan 2014 11:32

Code: Select all

widgets.preview:set_text('N/A')
Try to avoid setting text for the button widget.

destroyedlolo
Blank Cone
Blank Cone
Posts: 15
Joined: 19 Jan 2014 18:10

Re: Button bounce issue

Postby destroyedlolo » 26 Jan 2014 11:39

For sure ... but it's on purpose : the button's text changes as per camera status.

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: Button bounce issue

Postby mederi » 27 Jan 2014 19:50

If you cannot fix VLC code, then use some workaroud. For example, display a status in a label widget next to the button.

destroyedlolo
Blank Cone
Blank Cone
Posts: 15
Joined: 19 Jan 2014 18:10

Re: Button bounce issue

Postby destroyedlolo » 31 Jan 2014 21:48

well well well : I give up :roll:
w/o notifications on dropdown, the interface looks like terribly ugly.
w/o timer, the application is only a CPU hog
and now, with this bug, my code will become rapidly totally unmaintainable and will not be reliable ...

So, I'll create a pure Lua apps and try to control VLC thru it's DBus interface ...

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: Button bounce issue

Postby mederi » 19 Jan 2015 18:11



Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 9 guests