I’m wondering if anyone can point me in the right direction with something:
I’m working on a palette plugin that reads data from a plaintext file next to the source, and am trying to figure out how to change the displayed text to reflect this when a source in a different directory (with a different text file) is activated. At the moment I have to close all files before the change is pulled in.
I’m guessing it’s to the with the callbacks? I currently have this set in start(self): Glyphs.addCallback(self.updatetext, DOCUMENTACTIVATED), where updatetext is the function that reads the textfile. Where would I likely be going wrong?
I’m doing something similar and had pretty much the same issue, but I haven’t had time to look into it.
In testing I also noticed that DOCUMENTACTIVATED gets called twice when I switch documents. If I have them opened side by side and just click on another font it gets called once usually, but if I select a different font from the Window menu it gets called twice. I made a simple test of GeneralPlugin without a window or palette just to test the callback. I also just tried this in the Macro window to see what happens and the results are inconsistent. Sometimes it just says currentFont or currentDocument is the previous font, not the one that has just been activated. So Font #1 is selected and then I select Font #2 and what I see printed is Font #1.