When a layer contains both paths and components, a Python FilterWithDialog plugin will fail to work if any of the elements are selected. This problem can always be reproduced, so long as the filter is written in Python. This appears to be a bug in GlyphsSDK.
Traceback (most recent call last):
File "GlyphsApp/GlyphsApp/plugins.py", line 604, in process_
File "GlyphsApp/GlyphsApp/__init__.py", line 522, in GSProxyShapes__getitem__
IndexError: list index out of range
The problem still exists in v3.1.2, with a new error:
Traceback (most recent call last):
File "GlyphsApp/GlyphsApp/plugins.py", line 613, in process_
AttributeError: 'GSComponent' object has no attribute 'nodes'
It appears to happen to all python FilterWithDialog plugins. I tried a plugin of mine under development, and BroadNibber, both of them encounters the identical problem.
Thank you Georg. I can verify that the bug has been fixed in v3.2.
But one more problem, layer.components seem to be unselected when the function filter is called. This behavior is very different to layer.paths, from which I can still read the selection state of the paths.
A minimal example:
@objc.python_method
def filter(self, layer, inEditView, customParameters):
print([ path.selected for path in layer.paths ]) # 1
print([ comp.selected for comp in layer.components ]) # 2
When all the paths and components are selected, the first line will print all True s, while the second line will print all False s.