MousetrapMakie.jl

Allows for integrating Makie Plots into Mousetrap.jl Applications
Author Clemapfel
Popularity
14 Stars
Updated Last
5 Months Ago
Started In
September 2023

MousetrapMakie.jl

Experimental package that adds GLMakieArea, a Mousetrap widget that allows displaying GLMakie plots, similar to how Gtk4Makie.jl allows the same for GTK4.jl.

This package is not production ready and should be considered in early alpha. The following features are still missing:

  • Applying a post-processing config is not yet implemented
  • Modifying the screen after it is realized remains untested
  • Setups with multiple GLMakie.Screens remain untested
  • runtests.jl is unimplemented, meaning CI through GitHub actions is not yet set up
  • The Makie event model is ignored completely, only Mousetraps event controllers allow for user input

If you are experienced with Makie, consider opening a PR to fully implement this package and extend its functionalities. Any significant contributor will be credited as an author. See src/MousetrapMakie.jl, which is heavily commented to make understanding and extending the package easier.

See the Mousetrap.jl manual chapter on OpenGL integration for more information.

Installation

import Pkg
begin
    Pkg.add(url="https://github.com/clemapfel/mousetrap_jll")
    Pkg.add(url="https://github.com/clemapfel/Mousetrap.jl")
    Pkg.add(url="https://github.com/clemapfel/MousetrapMakie.jl")
end

Showcase

using Mousetrap, MousetrapMakie, GLMakie
main() do app::Application
    window = Window(app)
    canvas = GLMakieArea()
    set_child!(window, canvas)
    set_size_request!(canvas, Vector2f(200, 200))

    screen = Ref{Union{Nothing, GLMakie.Screen{GLMakieArea}}}(nothing)
    connect_signal_realize!(canvas) do self
        screen[] = create_glmakie_screen(canvas)
        display(screen[], scatter(rand(123)))
        return nothing
    end
    present!(window)
end

Credits & Contribution

MousetrapMakie was created by Mousetrap.jls main developer, C. Cords.

License

Licensed lGPL-3.0, meaning it available for both open-source, as well as closed-source, commercial use.