Problems with dialog for custom Export plugin

Hi there,

I am currently working on a plugin for exporting into a custom file format. So far so good, things run fine. However, as I soon as I tried to make things a bit more customisable, I ran into problems. The xib/nib dialog doesn’t go as I want it to.

#1: The dialog window (during export) does not resize automatically. It only resizes when I select the predefined options (like OpenType, UFO etc.) but not when I select my plugin. Is this a known bug?

#2: I can’t get the IBOutlets to work. I’ve basically extended the plugin template, customised the xib (including the File Owner’s class name) and written my Python code accordingly. The plugin class has the variable definitions instantiating the IBOutlet class for all elements, “dialog” first. However, when I try to use them, “dialog” works (it contains a NSView object), but the other variables only contain “None” (instead of the object that should have been referenced).
I feel like there is something obvious that I am missing but I can’t seem to find the problem … any ideas?

Thanks in advance!

I actually found the problem for #2, although I don’t understand how it is a problem.

I checked if the template xib worked as expected in my plugin (only changing the class name), and it did. So it really had to be something about the things I had changed in the xib.

After a few tries and incorrect assumptions that I had solved the mystery, I finally found that my variable and function names were problematic. I had named the IBActions functions similar to my variables holding the reference to the IBOutlet.

checkboxBeVerbose = IBOutlet()
…
@objc.IBAction
def setCheckboxBeVerbose_(self, sender):
  …

This seems to have caused confusion. When I had one object with an IBOutlet and another with an IBAction things worked smooth. When one object had both an IBOutlet and IBAction assigned, things went down the river.

After changing the names slightly (checkboxBeVerbose & setBeVerboseCheckbox), things now work as expected.

For the resizing to work, you need to use auto layout in the xib. It can be quite confusing (specially at the beginning). But if it works, it is great.

1 Like

That’s indeed a bit tricky; especially when one overlooks the obvious and forgets to fixate the height of the view …

However, it now works. Thanks!

I can have a look if you like to see if it is done well.