-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Mx classes seem to be not registered after import. When ClutterScript tries to load a JSON file with an Mx object, it prints an error message and the object is missing from the object list. However when any (even empty) MxStyle is loaded before, ClutterScript recognizes Mx classes correcly.
GJS script showing the problem:
#!/usr/bin/env gjs
/*
* Load a MxButton from JSON.
*/
const Clutter = imports.gi.Clutter;
const Mx = imports.gi.Mx;
CSS_DATA = "MxButton {}\n";
JSON_DATA =
'[{"type": "ClutterStage", "id": "stage", "children": [{ "type": "MxButton", "label": "click me", "id": "panic"}]}]';
Clutter.init(null);
// Uncomment this to load JSON correctly
//Mx.Style.get_default().load_from_data("dummy.css", CSS_DATA);
let script = new Clutter.Script();
script.load_from_data(JSON_DATA, JSON_DATA.length)
objects = script.list_objects()
for (var i = 0; i < objects.length; ++i) {
print(objects[i]);
}
//Uncomment this to show the loaded stage
/*
let stage = script.get_object("stage");
stage.connect("destroy", Clutter.main_quit);
stage.show();
Clutter.main();
*/
Metadata
Metadata
Assignees
Labels
No labels