GTK4-based (gtk-ruby) UI components for browsing MetaRuby model hierarchies, as used by Syskit.
The package is part of the TideWise autoproj workspace. The gtk4 gem is
declared as an osdeps dependency through autoproj/Gemfile.
require "syskit/ui"
require "gtk4"
browser = Syskit::UI::ModelBrowser.new(MyModelRoot)
browser.on_selection_changed { |model| puts "selected #{model}" }
window = Gtk::Window.new
window.child = browser
window.show
Gtk.init
Gtk.mainSyskit::UI::ModelBrowser is a Gtk::Box widget that, given a model root
(a class/module that includes MetaRuby::Registration, typically through
MetaRuby::ModelAsClass or MetaRuby::ModelAsModule), displays all registered
submodels as a tree.
The tree is organized by the models' constant-name hierarchy, not by the
model parent-child relationship. For instance, a model named
Seabots::Compositions::SomeComposition will appear under the Seabots
namespace node, then Compositions, and finally as a leaf node
SomeComposition, regardless of what its parent model is.
It uses MetaRuby::Registration#each_submodel to recursively collect all
submodels, then builds a Gtk::TreeStore from their names.