Access clipboard data in Glyphs3

I followed the code in schriftgestalt/Clipboard.py to access clipboard data. But it doesn’t work any more in Glyphs3. Particularly, I tried to use GSShape instead of GSPath or GSComponent, but there’s no such initWith...Dict_ . So please update the code demo or provide some solution. Thank you!

The init method is now called:

- (instancetype)initWithDict:(NSDictionary *)dict format:(GSFormatVersion)formatVersion;

formatVersion is defined like this:

typedef NS_ENUM(uint8_t, GSFormatVersion) {
	GSFormatVersion1 = 1,
	GSFormatVersion3 = 3,
	GSFormatVersionCurrent = 3,
};

You can check the headers in Glyphs 3.app/Contents/Frameworks/GlyphsCore.framework/Versions/A/Headers to find details about the API.

I now try

shape = GSShape.alloc().initWithDict_format_(shapeDict, 0)

but it gives an error like:

Traceback (most recent call last):
  File "<macro panel>", line 21
objc.error: GSNotImplemented - 56 -[GSShape initWithDict:format:]

So how to access this API in python?

You need to call use the actual class:
So either

path = GSPath.alloc().initWithDict_format_(shapeDict, GSFormatVersion3)

or

component = GSComponent.alloc().initWithDict_format_(shapeDict, GSFormatVersion3)

and use the right format.