SOLVED BaseEventTool setup vs. becomeActive

  • Hi,

    What is the real purpose for the method setup in BaseEventTool ? I just realized it gets executed on glyph switch. It seems to me the description of this method is not clear. When it gets executed and how it should be used as opposed to becomeActive method? Please check this following example:

    from import BaseEventTool
    from vanilla import FloatingWindow
    from import BaseWindowController
    from import installTool, uninstallTool, getToolOrder
    class MyTool(BaseEventTool):
        def setup(self):
        def becomeActive(self):
            print("tool became active")
        def becomeInactive(self):
            print("tool became inactive")
    class ToolActivator(BaseWindowController):
        def __init__(self, tool):
            self.w = FloatingWindow((123, 44), 'Test tool')
            self.tool = tool
            # install the tool
            # initialize the window
        def windowCloseCallback(self, sender):
            # if the tool is active, remove it
            tools = getToolOrder()
            if self.tool.__class__.__name__ in tools:
            super(ToolActivator, self).windowCloseCallback(sender)


  • hello @bahman,

    the Simple example tool shows both setup and becomeActive in action.

    according to the docs, setup() should be used to set the necessary attributes for the tool.

    hope this makes sense… cheers

  • admin

    setup is called when a glyph is switched inside the glyph view (fe by the jump to glyph popup window) cause maybe you need to setup your tool differently with the new glyph data.

    setup is also called when you jump back from on other window or an other app.

  • Thank you, this makes it more clear.

Log in to reply