Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Performing exit actions

Hi, how can I handle an exit action, i.e. user decided to close KLayout and so script has to close some files etc ?

Comments

  • Hi Yaroslav,

    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.

    Matthias

  • 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 ?

  • Hi Yaroslav,

    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::Application::instance.aboutToQuit do 
      RBA::MessageBox::info("It's Over!", "The main window was destroyed", RBA::MessageBox::Ok)
    end
    

    Regards,

    Matthias

Sign In or Register to comment.