CoffeeScript validation for Dialog widget content property

Hi,

In trying to use the Dialog widget, I’m running into javascript errors in the console. The documentation at http://bokeh.pydata.org/en/latest/docs/reference/models/widgets.dialogs.html states that the content property of the widget can take Either(String, Instance(Box)), and the code below bears that out:

from bokeh.layouts import Column
from bokeh.models.widgets.dialogs import Dialog
from bokeh.plotting import output_file, show

output_file(‘test.html’)

column = Column()
dialog_column = Column()
dialog = Dialog()
dialog.content = dialog_column
column.children = [dialog]

show(column)

``

I don’t run into any validation errors in dialog.content = dialog_column (as I do if, say, I try to assign a plot to that property), but when I try to display the above in the browser, I get the following error in the console:

Uncaught Error: String property 'content' given invalid value: Column(19d85509-e019-4128-b71d-f57dddc67b5b)

``

When I look at https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/widgets/dialog.coffee, it looks like the CoffeeScript validation for the content property does not match the Python validation:

@define {
visible: [ p.Bool, false ]
closable: [ p.Bool, true ]
title: [ p.String, “” ]
content: [ p.String, “” ]
buttons: [ p.Array, ]
buttons_box: [ p.Instance ]
}

``

I don’t know much about CoffeeScript, but it seems like the definition of the content property should read something like:

content: [p.Either(p.Instance, p.String)]

``

Am I on the right track? If the change I guessed at above would work, I’m happy to submit a pull request.

Many thanks,

Schaun

Just Submitted an issue on Github as well:

···

On Saturday, July 9, 2016 at 8:04:51 AM UTC-4, [email protected] wrote:

Hi,

In trying to use the Dialog widget, I’m running into javascript errors in the console. The documentation at http://bokeh.pydata.org/en/latest/docs/reference/models/widgets.dialogs.html states that the content property of the widget can take Either(String, Instance(Box)), and the code below bears that out:

from bokeh.layouts import Column
from bokeh.models.widgets.dialogs import Dialog
from bokeh.plotting import output_file, show

output_file(‘test.html’)

column = Column()
dialog_column = Column()
dialog = Dialog()
dialog.content = dialog_column
column.children = [dialog]

show(column)

``

I don’t run into any validation errors in dialog.content = dialog_column (as I do if, say, I try to assign a plot to that property), but when I try to display the above in the browser, I get the following error in the console:

Uncaught Error: String property 'content' given invalid value: Column(19d85509-e019-4128-b71d-f57dddc67b5b)

``

When I look at https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/widgets/dialog.coffee, it looks like the CoffeeScript validation for the content property does not match the Python validation:

@define {
visible: [ p.Bool, false ]
closable: [ p.Bool, true ]
title: [ p.String, “” ]
content: [ p.String, “” ]
buttons: [ p.Array, ]
buttons_box: [ p.Instance ]
}

``

I don’t know much about CoffeeScript, but it seems like the definition of the content property should read something like:

content: [p.Either(p.Instance, p.String)]

``

Am I on the right track? If the change I guessed at above would work, I’m happy to submit a pull request.

Many thanks,

Schaun