Can't display multiple dialogs in vlc

Discuss your Lua playlist, album art and interface scripts.
aur
New Cone
New Cone
Posts: 3
Joined: 24 Aug 2014 18:36

Can't display multiple dialogs in vlc

Postby aur » 24 Aug 2014 18:45

Hi everyone,

I'm trying to make an extension script, at some point when the user clicks a button, a prompt box should appear asking him for some input text, that is then used in the script.
However, when it gets to initiating the prompt box it doesn't show up:
here's the snippet I am working on:

Code: Select all

function createGUI() main_layout = vlc.dialog("Caption tracker") -- some GUI widgets capture_moment_b = main_layout:add_button(" Capture Moment ",capture_moment,1, 4, 1, 1) end function capture_moment() --some logic statements prompt_caption() end function prompt_caption() -- vlc.msg.dbg("here") prompt_box = vlc.dialog("Moment's caption") prompt_text_input = prompt_box:add_text_input("Enter caption!") confirm_caption_b = prompt_box:add_button("caption recorder",confirm_caption) prompt_box:show() end
When I switched to debugging mode, the script made it to "here" string, then nothing happens.
I'm using VLC 2.1.5
So, is there a way to prompt some user's input ?
also, is there a way to disable text inputs, buttons, other widgets ? it should be a no brainer but , weirdly, I can't find a 'set_enabled' function.

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: Can't display multiple dialogs in vlc

Postby mederi » 25 Aug 2014 12:09

lua warning: Error while running script ... ... Only one dialog allowed per extension!
You can delete the current dialog and create another one or you can add and delete widgets in the current dialog and thus keep its position on the screen. As stated in the README document:
d:delete(): Close and delete this dialog.
d:del_widget( widget ): Delete 'widget'. It disappears from the dialog and repositioning may occur.

aur
New Cone
New Cone
Posts: 3
Joined: 24 Aug 2014 18:36

Re: Can't display multiple dialogs in vlc

Postby aur » 26 Aug 2014 19:16

thanks mederi for your reply, figured out lately that I can't have but one dialog per extension :D
so I decided to go with your advice, delete dialog and create another one, however, while trying to create the second dialog VLC suddenly crashes (actually the dialog appears in VLC, then VLC crashes immediately)
I've opened the debugger, and it seems that VLC needs some time to delete the first dialog before trying to initiate another one so it crashes, here is the log:

Code: Select all

lua debug: Deleting dialog "moments tracker" lua debug: waiting for the dialog to be deleted qt4 debug: Deleting extension dialog 'Moments and checkpoints tracker' lua debug: creating dialog 'Enter Moment's capture' qt4 debug: creating a new dialog 'Enter Moment's capture'
is there a way to halt the creation of new dialog till the first one is completely deleted or a way to check the status of the first dialog ? or I do have another problem ?

Thanks again

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: Can't display multiple dialogs in vlc

Postby mederi » 27 Aug 2014 13:12

Try this one:

Code: Select all

function descriptor() return { title = "test - Another dialog loop", } end function activate() Create_dialog() end function deactivate() end function meta_changed() end function close() vlc.deactivate() end ------------------------- function Create_dialog() if d then text=input:get_text() d:delete() --d=nil end d = vlc.dialog(descriptor().title) input = d:add_text_input(text or "Hello",1,1) d:add_button("Next dialog", Another_dialog,1,2) end function Another_dialog() text=input:get_text() d:delete() --d=nil d = vlc.dialog("Another") label = d:add_label("Previous input text:",1,1) input = d:add_text_input(text,1,2) d:add_button("Previous dialog", Create_dialog,1,3) end


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 13 guests