File format dialog using vanilla

i’m trying to create a new plugin using .glyphsFileFormat template
but i don’t prefer to use .xib files for interface,
how to convert

.self.loadNib('IBdialog', __file__)

to vanilla code?


Ha, I ran into exactly the same question today. My solution was to download the 13GB of XCode and start building the plugin there. Would also prefer to stick with vanilla :wink:

@SCarewe i really don’t have any problem of using Xcode, BTW i already installed it and tried to build s simple interface but it didn’t work for me
i will be thankful if you share any course that helps

These should help:

Hi again, what exactly didn’t work? I also ran into issues yesterday, see here: Cannot link to xib in Xcode

I just added a new template for the file format plugin that uses vanilla.

1 Like

Thank you very much! Looks really good! Nice to finally see auto-positioning in vanilla used somewhere :grin:

Took it for a spin and it works perfectly.

Hi, one question, the only issue I am running into is window resizing and auto positioning. Is there a callback for when the tabs of the main export window are switched? I have written my visual format language code to layout the checkboxes correctly, but I would also like to call the window.resize() method once the tab is switched. Currently, when switching from the “OTF” window (which is much larger) to my own plugin, the window stays the same size and the layout gets stretched.


In Auto Layout, this issue is addressed by Content-Hugging- and Compression-Resistance Priorities. If you increase the vertical hugging priority, Auto Layout will ensure that no such gaps can exist and will automatically resize the window. It can be finicky to get those priorities right, but there are guides online that help explain the details.

Humm. That sounds rather daunting. Is there no way to trigger the resize function with a callback when the tabs are switched?

I fixed those vertical gaps with the (20@999).
Normally you would set the contentHugging to 999 or 1000

The visual format can’t handle this so you need to set it directly. The method calls are quite long so I didn’t like to clutter the code too much.

Alright, thanks!

I have another issue I am running into. I have checkboxes, and in the export() function, I query their state with, for example, print( But that always returns 0, no matter whether the checkbox is checked or not.

I added a function self.cff_checkbox_callback in order to test whether the callback itself works. It works, so I declared a variable self.exportCFF and set it to sender.get(). This works, it is set to True when the box checked.

Querying the variable in the exprot function gives me an AttributeError: 'ExportPlugin' object has no attribute 'exportCFF'. What is going on?

I would always use the user defaults as demonstrated in the new template.

And in the export function, you get the value from the defaults. You could use a local variable instead (as your described above) but the user defaults keep the value for the next time the app runs.

Thanks, that worked. Still don’t understand why my approach before didn’t work, but oh well.

Thanks @GeorgSeifert