Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mx classes not recognized by ClutterScript #93

Open
piwaniuk opened this issue May 6, 2014 · 2 comments
Open

Mx classes not recognized by ClutterScript #93

piwaniuk opened this issue May 6, 2014 · 2 comments

Comments

@piwaniuk
Copy link

piwaniuk commented May 6, 2014

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();
*/
@djdeath
Copy link
Contributor

djdeath commented May 6, 2014

Could it be because the mx library isn't loaded yet, so ClutterScript can't find them?

@piwaniuk
Copy link
Author

piwaniuk commented May 7, 2014

Yes, referencing to Mx in other ways works too. So it is an undocumented GI repository importer feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants