npyscreen icon indicating copy to clipboard operation
npyscreen copied to clipboard

Form and ActionFormMinimal don't allow you to cancel closing the form

Open InconsolableCellist opened this issue 7 years ago • 0 comments

You can set an on_ok handler that cancels closing a form using an ActionForm, but it doesn't work with Form, ActionFormMinimal, and perhaps some others:


class MyForm(npyscreen.ActionFormMinimal):
    def on_ok(self):
        if npyscreen.notify_yes_no('Are you ready to submit your information?', title='Submit information?'):
            pass
        else:
            self.editing = True

I think it's expected behavior that you can set self.editing = True on any form that has an OK and/or Cancel button, to help prevent closing the form accidentally.

InconsolableCellist avatar Apr 09 '18 02:04 InconsolableCellist