Node.selected = True

Layer.paths[0].nodes[0].selected = True

suddenly returns

Traceback (most recent call last):
  File "<string>", line 41, in <module>
  File "GlyphsApp/", line 3142, in <lambda>
  File "GlyphsApp/", line 2173, in SetObjectInLayer_selected
AttributeError: '__LayerSelectionProxy' object has no attribute 'append'

Version 2.4.1 (973), but also some CE versions before, I just made an update after seeing this error.

Yesterday it worked on another machine (probably the latest or pre last cutting edge), cannot check it there now.

BTW: do you have a style policy concerning the potential confusion between get and set methods? In some cases one cannot »reassign« by calling = xyz and sometimes like here you can. I got no particular examples ready except for .setKerningForPair(), but it sometimes appears at least when working with pyobjc, where there is a rather straight distinction. Makes me expect to have something like .setSelected()… But I must admit, having just .selected for getting and setting is way easier.

Yes, that would be the most pythonesque way. If it is wrapped nicely, that is usually how it will work. Of course work on the wrapper is a work in progress.

More complicated things, like setting kerning, require multiple arguments and will still have a method.

That’s for sure, and a great thing to follow the progress :slight_smile:

Regarding the Error: Can you reproduce that?

If you find a property that doesn’t allow assignment, file an issue in the GlyphsSDK repo or better, send a pull request. :wink:

I’ll do, if so. Thanks. Don’t know if it has been a Glyphs property at all :slight_smile:

I had a look at the selection problem and it works fine for me in 973.

So here’s my setup:

Glyphs 973, Mac 10.11.4
New, empty file with a single oval drawn into letter /A. If nothing or at least any amount of nodes is selected, I get that error each time.
If all nodes are selected, nothing happens (as expected, it cannot do more selection. But now, if calling Glyphs.font.selectedLayers[0].paths[0].nodes[0].selected = False it returns:

Traceback (most recent call last):
  File "<string>", line 41, in <module>
  File "GlyphsApp/", line 3142, in <lambda>
  File "GlyphsApp/", line 2177, in SetObjectInLayer_selected
AttributeError: '__LayerSelectionProxy' object has no attribute 'remove'

Thanks for letting me know that you don’t have that. This made me remove plugins one by one and test. I found out that the DrawBot Plugin is causing it. I got the one installed via the Plugin Manager.
I checked the github repo, but couldn’t find anything that interferes with layer and/or selection …

Thanks for the update. I’ll have a look.

one small side node:
Glyphs.font.selectedLayers[0] can be written: Layer.

1 Like

Ah thanks. You mentioned this once. It’s so new … Macht der Gewohnheit :slight_smile:

Even with drawbot installed, it works fine for me.

How can we debug? I tried again, and it is indeed just drawbot causing this. I even reinstalled drawbot completely. The console doesn’t help.