Skip to content

Commit

Permalink
Allow pairs as options
Browse files Browse the repository at this point in the history
Makes the demo in the README work
  • Loading branch information
JobJob committed Dec 28, 2016
1 parent 4556606 commit 7af219f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/widgets.jl
Expand Up @@ -365,7 +365,7 @@ function getoptions(options)
optdict = OptionDict(opts) optdict = OptionDict(opts)
end end


addoption!(opts, v::NTuple{2}) = opts[string(v[1])] = v[2] addoption!(opts, v::Union{Pair, NTuple{2}}) = opts[string(v[1])] = v[2]
addoption!(opts, v) = opts[string(v)] = v addoption!(opts, v) = opts[string(v)] = v


""" """
Expand Down
15 changes: 15 additions & 0 deletions test/notebooks/Interact Manual Tests.ipynb
Expand Up @@ -479,6 +479,21 @@
"@show typeof.([sin,cos]);" "@show typeof.([sin,cos]);"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#Demo on README, was broken because option Pairs didn't work\n",
"using Gadfly\n",
"@manipulate for Φ=0:π/16:4π, f=[:sin => sin, :cos => cos]\n",
" plot(θ -> f(θ+Φ ), 0, 25)\n",
"end"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
Expand Down

0 comments on commit 7af219f

Please sign in to comment.