allow curly after grid in layout macro
This commit is contained in:
parent
c651be7a12
commit
1f7043e02a
@ -503,6 +503,12 @@ function build_layout(layout::GridLayout, n::Integer)
|
|||||||
i += 1
|
i += 1
|
||||||
elseif isa(l, GridLayout)
|
elseif isa(l, GridLayout)
|
||||||
# sub-grid
|
# sub-grid
|
||||||
|
if get(l.attr, :width, :auto) != :auto
|
||||||
|
layout.widths[c] = attr(l,:width)
|
||||||
|
end
|
||||||
|
if get(l.attr, :height, :auto) != :auto
|
||||||
|
layout.heights[r] = attr(l,:height)
|
||||||
|
end
|
||||||
l, sps, m = build_layout(l, n-i)
|
l, sps, m = build_layout(l, n-i)
|
||||||
append!(subplots, sps)
|
append!(subplots, sps)
|
||||||
merge!(spmap, m)
|
merge!(spmap, m)
|
||||||
@ -539,6 +545,12 @@ function build_layout(layout::GridLayout, numsp::Integer, plts::AVec{Plot})
|
|||||||
i += length(plt.subplots)
|
i += length(plt.subplots)
|
||||||
elseif isa(l, GridLayout)
|
elseif isa(l, GridLayout)
|
||||||
# sub-grid
|
# sub-grid
|
||||||
|
if get(l.attr, :width, :auto) != :auto
|
||||||
|
layout.widths[c] = attr(l,:width)
|
||||||
|
end
|
||||||
|
if get(l.attr, :height, :auto) != :auto
|
||||||
|
layout.heights[r] = attr(l,:height)
|
||||||
|
end
|
||||||
l, sps, m = build_layout(l, numsp-i, plts)
|
l, sps, m = build_layout(l, numsp-i, plts)
|
||||||
append!(subplots, sps)
|
append!(subplots, sps)
|
||||||
merge!(spmap, m)
|
merge!(spmap, m)
|
||||||
@ -635,12 +647,18 @@ function create_grid_vcat(expr::Expr)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function create_grid_curly(expr::Expr)
|
function create_grid_curly(expr::Expr)
|
||||||
s = expr.args[1]
|
|
||||||
kw = KW()
|
kw = KW()
|
||||||
for (i,arg) in enumerate(expr.args[2:end])
|
for (i,arg) in enumerate(expr.args[2:end])
|
||||||
add_layout_pct!(kw, arg, i, length(expr.args)-1)
|
add_layout_pct!(kw, arg, i, length(expr.args)-1)
|
||||||
end
|
end
|
||||||
:(EmptyLayout(label = $(QuoteNode(s)), width = $(get(kw, :w, QuoteNode(:auto))), height = $(get(kw, :h, QuoteNode(:auto)))))
|
s = expr.args[1]
|
||||||
|
if isa(s, Expr) && s.head == :call && s.args[1] == :grid
|
||||||
|
create_grid(:(grid($(s.args[2:end]...), width = $(get(kw, :w, QuoteNode(:auto))), height = $(get(kw, :h, QuoteNode(:auto))))))
|
||||||
|
elseif isa(s, Symbol)
|
||||||
|
:(EmptyLayout(label = $(QuoteNode(s)), width = $(get(kw, :w, QuoteNode(:auto))), height = $(get(kw, :h, QuoteNode(:auto)))))
|
||||||
|
else
|
||||||
|
error("Unknown use of curly brackets: $expr")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function create_grid(s::Symbol)
|
function create_grid(s::Symbol)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user