It looks like you're new here. If you want to get involved, click one of these buttons!
Hi, how can I handle an exit action, i.e. user decided to close KLayout and so script has to close some files etc ?
Files should be closed automatically. Script objects will receive a finalization event. As far as I remember there is not direct hook to plug in your own exit handler.
In some cases I also have active QProcess object, and on exit KLayout prints
"Warning: QProcess: Destroyed while process is still running."
Do I have to perform any additional cleanup actions ?
that's right - killing a QProcess object while the process is stilling running maybe isn't a good idea. On the other hand, I have not experienced bad issues with such a situation myself.
Nevertheless, I agree that shutting down cleanly is a good idea. I did some experimenting, found a few options not working (see https://github.com/KLayout/klayout/issues/251), but there is a really good solution:
RBA::MessageBox::info("It's Over!", "The main window was destroyed", RBA::MessageBox::Ok)