SOLVED Glyph window became active/inactive event
-
Hi,
Is there any event that indicates if the glyph window has become active/inactive? Actually becoming inactive is more important in my case.
Thanks
-
@gferreira Thank you Gustavo. I had no idea those notifications are also for the glyph window focus. Great!
-
hello @bahman,
I think you’re looking for
viewDidChangeGlyph
andviewWillChangeGlyph
. (I found them using the EventObserver extension)here’s an example:
from vanilla import FloatingWindow from mojo.events import addObserver, removeObserver from defconAppKit.windows.baseWindow import BaseWindowController class TestWindow(BaseWindowController): def __init__(self): self.w = FloatingWindow((123, 123)) addObserver(self, 'viewDidChangeGlyphCallback', "viewDidChangeGlyph") addObserver(self, 'viewWillChangeGlyphCallback', "viewWillChangeGlyph") self.setUpBaseWindowBehavior() self.w.open() def windowCloseCallback(self, sender): removeObserver(self, 'viewDidChangeGlyph') removeObserver(self, 'viewWillChangeGlyph') super(TestWindow, self).windowCloseCallback(sender) def viewDidChangeGlyphCallback(self, notification): glyph = notification['glyph'] print(f'entering glyph window ({glyph.name})') def viewWillChangeGlyphCallback(self, notification): glyph = notification['glyph'] print(f'exiting glyph window ({glyph.name})') TestWindow()
cheers!