Skip to content

Mx classes not recognized by ClutterScript #93

@piwaniuk

Description

@piwaniuk

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions