Is there a maximum number of items that can be added to a Menu? I’m experimenting with GLMakie and Observable
s. My program watches a folder for new files. Both the data and Menu options
are Observable
s, so when a new file appears it is plotted and a new item is added to the Menu options
so a user can select this and all previous data. My code works, but crashes whenever I add a 7th item. I’m having difficulty parsing the error message, but my first guess is that there is some upper limit to the number of items a Menu can have based on the GLMakie screen size or something?
julia> GUIMakie.run("./data/")
New file: notworking.lvm
New file: sig_220607_121211.lvm
New file: sig_220607_154155.lvm
New file: sig_220607_174053.lvm
New file: sig_220607_174239.lvm
New file: three_stacks.lvm
New file: two_stacks_noxdata.lvm
ERROR: InexactError: trunc(UInt8, 256)
Stacktrace:
[1] throw_inexacterror(f::Symbol, #unused#::Type{UInt8}, val::Int64)
@ Core ./boot.jl:612
[2] checked_trunc_uint
@ ./boot.jl:642 [inlined]
[3] toUInt8
@ ./boot.jl:704 [inlined]
[4] UInt8
@ ./boot.jl:764 [inlined]
[5] convert
@ ./number.jl:7 [inlined]
[6] cvt1
@ ./essentials.jl:343 [inlined]
[7] ntuple
@ ./ntuple.jl:49 [inlined]
[8] convert
@ ./essentials.jl:344 [inlined]
[9] push!
@ ./array.jl:994 [inlined]
[10] #117
@ ~/.julia/packages/GLMakie/SJcSR/src/screen.jl:259 [inlined]
[11] get!(default::GLMakie.var"#117#119"{GLMakie.Screen, Makie.Scene}, h::Dict{WeakRef, UInt8}, key::WeakRef)
@ Base ./dict.jl:464
[12] push!(screen::GLMakie.Screen, scene::Makie.Scene, robj::GLMakie.GLAbstraction.RenderObject{GLMakie.GLAbstraction.StandardPrerender})
@ GLMakie ~/.julia/packages/GLMakie/SJcSR/src/screen.jl:257
[13] cached_robj!(robj_func::GLMakie.var"#245#246"{Makie.Scene, MakieCore.Mesh{Tuple{GeometryBasics.Mesh{2, Float32, GeometryBasics.Ngon{2, Float32, 3, GeometryBasics.Point{2, Float32}}, GeometryBasics.SimpleFaceView{2, Float32, 3, GeometryBasics.OffsetInteger{-1, UInt32}, GeometryBasics.Point{2, Float32}, GeometryBasics.NgonFace{3, GeometryBasics.OffsetInteger{-1, UInt32}}}}}}}, screen::GLMakie.Screen, scene::Makie.Scene, x::MakieCore.Mesh{Tuple{GeometryBasics.Mesh{2, Float32, GeometryBasics.Ngon{2, Float32, 3, GeometryBasics.Point{2, Float32}}, GeometryBasics.SimpleFaceView{2, Float32, 3, GeometryBasics.OffsetInteger{-1, UInt32}, GeometryBasics.Point{2, Float32}, GeometryBasics.NgonFace{3, GeometryBasics.OffsetInteger{-1, UInt32}}}}}})
@ GLMakie ~/.julia/packages/GLMakie/SJcSR/src/drawing_primitives.jl:113
[14] draw_atomic
@ ~/.julia/packages/GLMakie/SJcSR/src/drawing_primitives.jl:493 [inlined]
[15] insert!
@ ~/.julia/packages/GLMakie/SJcSR/src/drawing_primitives.jl:121 [inlined]
[16] (::GLMakie.var"#177#178"{GLMakie.Screen, Makie.Scene})(x::MakieCore.Mesh{Tuple{GeometryBasics.Mesh{2, Float32, GeometryBasics.Ngon{2, Float32, 3, GeometryBasics.Point{2, Float32}}, GeometryBasics.SimpleFaceView{2, Float32, 3, GeometryBasics.OffsetInteger{-1, UInt32}, GeometryBasics.Point{2, Float32}, GeometryBasics.NgonFace{3, GeometryBasics.OffsetInteger{-1, UInt32}}}}}})
@ GLMakie ~/.julia/packages/GLMakie/SJcSR/src/drawing_primitives.jl:126
[17] foreach(f::GLMakie.var"#177#178"{GLMakie.Screen, Makie.Scene}, itr::Vector{MakieCore.AbstractPlot})
@ Base ./abstractarray.jl:2712
[18] insert!
@ ~/.julia/packages/GLMakie/SJcSR/src/drawing_primitives.jl:123 [inlined]
[19] (::GLMakie.var"#177#178"{GLMakie.Screen, Makie.Scene})(x::MakieCore.Mesh{Tuple{Vector{GeometryBasics.Mesh{2, Float32, GeometryBasics.Ngon{2, Float32, 3, GeometryBasics.Point{2, Float32}}, GeometryBasics.SimpleFaceView{2, Float32, 3, GeometryBasics.OffsetInteger{-1, UInt32}, GeometryBasics.Point{2, Float32}, GeometryBasics.NgonFace{3, GeometryBasics.OffsetInteger{-1, UInt32}}}}}}})
@ GLMakie ~/.julia/packages/GLMakie/SJcSR/src/drawing_primitives.jl:126
[20] foreach(f::GLMakie.var"#177#178"{GLMakie.Screen, Makie.Scene}, itr::Vector{MakieCore.AbstractPlot})
@ Base ./abstractarray.jl:2712
[21] insert!(screen::GLMakie.Screen, scene::Makie.Scene, x::MakieCore.Combined)
@ GLMakie ~/.julia/packages/GLMakie/SJcSR/src/drawing_primitives.jl:123
[22] push!(scene::Makie.Scene, plot::MakieCore.Combined{Makie.poly, Tuple{Vector{Vector{GeometryBasics.Point{2, Float32}}}}})
@ Makie ~/.julia/packages/Makie/Ws9gB/src/scenes.jl:409
[23] plot!(scene::Makie.Scene, P::Type{MakieCore.Combined{Makie.poly, Tuple{GeometryBasics.HyperRectangle{2, Int64}}}}, attributes::MakieCore.Attributes, input::Tuple{Observables.Observable{GeometryBasics.HyperRectangle{2, Int64}}}, args::Observables.Observable{Tuple{Vector{Vector{GeometryBasics.Point{2, Float32}}}}})
@ Makie ~/.julia/packages/Makie/Ws9gB/src/interfaces.jl:403
[24] plot!(scene::Makie.Scene, P::Type{MakieCore.Combined{Makie.poly}}, attributes::MakieCore.Attributes, args::Observables.Observable{GeometryBasics.HyperRectangle{2, Int64}}; kw_attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Makie ~/.julia/packages/Makie/Ws9gB/src/interfaces.jl:320
[25] plot!
@ ~/.julia/packages/Makie/Ws9gB/src/interfaces.jl:288 [inlined]
[26] #plot!#132
@ ~/.julia/packages/Makie/Ws9gB/src/interfaces.jl:271 [inlined]
[27] poly!(::Makie.Scene, ::Vararg{Any}; attributes::Base.Pairs{Symbol, Any, NTuple{5, Symbol}, NamedTuple{(:color, :visible, :strokecolor, :strokewidth, :inspectable), Tuple{Observables.Observable{Any}, Observables.Observable{Any}, Observables.Observable{ColorTypes.RGB{Float32}}, Observables.Observable{Any}, Bool}}})
@ Makie ~/.julia/packages/MakieCore/C4HO7/src/recipes.jl:37
[28] initialize_block!(box::Makie.Box)
@ Makie ~/.julia/packages/Makie/Ws9gB/src/makielayout/blocks/box.jl:11
[29] _block(::Type{Makie.Box}, ::Makie.Scene; bbox::Nothing, kwargs::Base.Pairs{Symbol, Any, NTuple{5, Symbol}, NamedTuple{(:width, :height, :color, :strokewidth, :visible), Tuple{Nothing, Nothing, ColorTypes.RGB{Float32}, Int64, Observables.Observable{Any}}}})
@ Makie ~/.julia/packages/Makie/Ws9gB/src/makielayout/blocks.jl:393
[30] #_#996
@ ~/.julia/packages/Makie/Ws9gB/src/makielayout/blocks.jl:269 [inlined]
[31] _reassemble_menu(m::Makie.Menu, scene::Makie.Scene, selectionrect::Makie.Box, selectiontext::Makie.Label, allrects::Vector{Makie.Box}, alltexts::Vector{Makie.Label}, mouseeventhandles::Vector{Makie.MouseEventHandle}, contentgrid::GridLayoutBase.GridLayout, optionstrings::Base.RefValue{Vector{String}})
@ Makie ~/.julia/packages/Makie/Ws9gB/src/makielayout/blocks/menu.jl:251
[32] (::Makie.var"#1667#1679"{Makie.Menu, Vector{Makie.MouseEventHandle}, Vector{Makie.Label}, Vector{Makie.Box}, Makie.Label, Observables.Observable{String}, Base.RefValue{Vector{String}}, Makie.Box, GridLayoutBase.GridLayout, Makie.Scene})(options::Vector{String})
@ Makie ~/.julia/packages/Makie/Ws9gB/src/makielayout/blocks/menu.jl:116
[33] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[34] invokelatest
@ ./essentials.jl:714 [inlined]
[35] notify
@ ~/.julia/packages/Observables/ynr7h/src/Observables.jl:143 [inlined]
[36] setindex!(observable::Observables.Observable, val::Any)
@ Observables ~/.julia/packages/Observables/ynr7h/src/Observables.jl:86
[37] #15
@ ~/.julia/packages/Observables/ynr7h/src/Observables.jl:393 [inlined]
[38] (::Observables.var"#callback#13"{Observables.var"#15#16"{Makie.var"#1009#1010"{DataType}, Observables.Observable{Any}}, Tuple{Observables.Observable{Vector{String}}}})(x::Any)
@ Observables ~/.julia/packages/Observables/ynr7h/src/Observables.jl:339
[39] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[40] invokelatest
@ ./essentials.jl:714 [inlined]
[41] notify
@ ~/.julia/packages/Observables/ynr7h/src/Observables.jl:143 [inlined]
[42] setindex!(observable::Observables.Observable, val::Any)
@ Observables ~/.julia/packages/Observables/ynr7h/src/Observables.jl:86
[43] run(datadir::String, extension::String)
@ GUIMakie ~/Documents/projects/GUIMakie/src/gui.jl:90
[44] run(datadir::String)
@ GUIMakie ~/Documents/projects/GUIMakie/src/gui.jl:32
[45] top-level scope
@ REPL[3]:1