﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	notify_on_close	platform	project
835	Order of events on ToolInstance deletion	Tristan Croll	Conrad Huang	"From the ChimeraX programming guide under ToolInstance:



 delete()

    Delete this tool instance.

    This method should be overridden to clean up tool data structures. This base method should be called as the last step of tool deletion.


In ISOLDE I have a function _on_close() which needs to be run when ISOLDE is closed to clean up a range of trigger handlers etc. In tool.py I have:

{{{
class ISOLDE_ToolUI(ToolInstance):
    SESSION_ENDURING = False
    def __init__(self, session, tool_name):
        # Lots of other setup stuff
        from . import isolde
        self.isolde = isolde.Isolde(self)

    def delete(self):
        self.isolde._on_close()
        super().delete()
}}}

Everything else works, but on closing the ISOLDE window I get:

{{{
  File ""/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/core/ui/gui.py"", line 1048, in <lambda>
    dw.closeEvent = lambda e, tw=tool_window, mw=mw: mw.close_request(tw, e)
  File ""/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/core/ui/gui.py"", line 428, in close_request
    tool_instance.delete()
  File ""/home/tic20/.local/share/ChimeraX/0.1/site-packages/chimerax/isolde/tool.py"", line 172, in delete
    self.isolde._on_close()
AttributeError: 'ISOLDE_ToolUI' object has no attribute 'isolde'
}}}

... which is really rather odd."	defect	closed	major		Tool Shed		invalid						all	ChimeraX
