tag:infinitekind.tenderapp.com,2009-01-14:/discussions/moneydance-development/4936-request-pass-handleevent-cleanup-unload-methods-through-to-python-extensions-from-the-pythonextension-containerInfinite Kind: Discussion 2021-03-22T10:12:18Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/490612912021-03-20T12:36:31Z2021-03-20T12:36:31ZREQUEST: Pass .handleEvent() .cleanup() .unload() methods through to Python extensions from the PythonExtension container<div><p>This should be in build 3055. I will test and advise..</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/490612912021-03-22T10:12:11Z2021-03-22T10:12:11ZREQUEST: Pass .handleEvent() .cleanup() .unload() methods through to Python extensions from the PythonExtension container<div><p>These methods are now available in build 3056 onwards - there are two options:</p>
<p>1/ in script_info.dict define {"type" = "method", "method" = "handle_event", "script_file" = "handle_event.py"} for example. The methods are handle_event, invoke, cleanup and unload. Within these method scripts, look for the global variable moneydance_extension_parameter for the passed parameter on invoke and handle_event.</p>
<p>2/ .. or instead define and execute an initialisation script when MD loads by defining the following in script_info.dict. {"type" = "initializer", "script_file" = "scriptname.py"} and within your script, define and execute your ExtensionClass and call the class, setting the global variable moneydance_extension=ExtensionClass(). Within this class define .invoke(), .handle_event(), .cleanup(), unload().</p>
<p>NOTE - I don't think .cleanup() actually is used anywhere in MD...</p>
<p>NOTE - There are some 'older' methods of tricking MD to load a Py Extension, some work, some don't now; contact me if you want further details....</p></div>Stuart Beesley (Mr Toolbox)