Issue with alignment zones sripting and masters

set AlignmentZones by size (@GitHub)

I got several problems with this one

(try with a font that has e.g. 3 masters)

  • the disable update interface is commented out, because it does not
    work in glyphs2 anymore like that?
  • super weird: the AZ get set up properly for the first master, but are kinda upside down when set for the second one

thanks in advance

… had a lot of indenting issues, since the switching between macro window and proper editors is kinda uncomfortable. just fwimc, the problems still occur

apparently for each loop through the masters, it switches the variable »size« (+/-), but i cannot see why

My guess is that master.setAlignmentZones_(newZones) is shaky because newZones is a Python list, and setAlignmentZones_ expects an ObjC class.

Instead of collecting zones in a list, you can add them right away with master.addAlignmentZone_(a) where a is your alignment zone.

thank you, mekkablue! I will try.

and do you have a hint for how the font.disableUpdateInterface() and enabling should be implemented to make undo possible? I am confused where to put them both.

unfortunately it only adds the zones on top of the existing ones and still doesn’t get rid of the upside down thing. (this might be solvable of course, but: -->) i have a hard time to debug, since Glyphs 2 always (!) crashes as soon as i want to print something in or after the for d in dimensions loop, and Glyphs 1 puts the AZ in the Font Info, but doesn’t show them in the editor pane.

[newest versions of both Glyphsapps]

I made a few minor bugfixes, and it works as expected for me. I made a pull request on GitHub.

Thanks so much for this, you are incredibly helpful!

Unfortunately still every other master gets the zones ± switched. I cannot see any part in the code which could cause that. Is it working for you, if you have more than one master?

[please don’t answer this, if it’s too offtopic:]
Did you do this directly on GitHub? I ask because I edited the script in sublime and the indentation was shown as being ok, only on GitHub it displays it wrong. It was totally confusing, and apparently – since you changed it – it was actually really off.

Most code editors have a setting to use spaces or tabs. And TextMate (I’m not sure about others) can display tab and space characters so it’s easy to spot problems.

yes i know, and everything is set up properly in sublime text here. tab=4, not using spaces but real tabs. anyway, that’s offtopic, nevermind :slight_smile:

You overwrite the size variable that stores the value from the dialog. Change ‘size’ to ‘inputSize’ in line 37 and 50.

Aaah, you genius! Thanks so much for spotting this, Georg! Sorry for the trouble.