GSFont.newTab bug

This method is supposed to return a GSEditViewController, but it seems to be broken when the parameter is a list of layers. The tab opens, but it is not returned.

print(Glyphs.font.newTab("abc"))
print(Glyphs.font.newTab([Layer]))

Result:

<GSEditViewController: 0x7fa83b1a2db0>abc
None

ETA: I am running 3.1.2.

I also discovered that newTab throws an error if I include any control layers.

Glyphs.font.newTab([Layer,GSControlLayer(10),Layer])

Error:

Traceback (most recent call last):
  File "<macro panel>", line 1
  File "GlyphsApp/GlyphsApp/__init__.py", line 4369, in __GSFont__addTab__
ValueError: NSInvalidArgumentException - *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]

Thanks for the report. I fixed it.

1 Like

Thanks! That was quick.

Hi, I get an error relating to tabs. If I run this code;

for t in Glyphs.font.tabs:
	print(t.layers)

It says “NoneType’ object is not iterable”. Is the error related to this bug that you fixed?

I’m not able to reproduce @Tosche’s issue. It works as expected for me in 3.1.2 and 3.2.

But I’m finding more bugs with tabs. How can I clear the contents of a tab? tab.layers.clear() throws an error, and tab.text = "" seems to have no effect, even though setting it to other non-empty string values works.

Have you tried tab.layers=None or setting it to an empty list.

works for me after the changes I made earlier.