Macros making glyphs unresponsive

if macros applied to a large set of glyphs computing can take a while and glyphs becomes unresponsive for the duration, is this behaviour normal? could this be improved somehow?
also a progress indication could be great

If you change glyphs in a look, wrap that loop like this:

for g in font.glyphs:
    do stuff

that will usually speed up the computation quite a bit.

The script runs in the main thread and blocks the UI from updating. It was causing to many problems when I run the script in a background thread by default. You can run the script in the background yourself if you like. But that might cause some unintended side effects.

1 Like

is it possible to update interface every nth interval of the forloop?

Not if you are in the main thread. Otherwise you can call the Update methods mentioned in the docu.

The name of the disableUpdateInterface() method is a bit misleading. It does not prevent the UI from updating but stops the notifications that would cause an UI update.

Sorry for resurrecting this thread, but I am having the same problem in trying to implement a cancel button in Vanilla for a long running process (Cancel button for scripts with long runtime)

Is there a way to update or poll a Vanilla control from Glyphs? The GUI freezes if I run a long process, even if the process is in its own thread. And attempting to open a Vanilla window in a separate thread causes Glyphs to crash.

When the work is done in another thread, let the script return to give back the control to Glyphs. Then the UI should be responsive again. From the other thread, you should be able to poll the state of the Cancel button (or a property that is set when the button is pressed).