Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to change forms in beforeEditing() method #113

Open
grasshopper139 opened this issue Feb 23, 2021 · 1 comment
Open

Unable to change forms in beforeEditing() method #113

grasshopper139 opened this issue Feb 23, 2021 · 1 comment

Comments

@grasshopper139
Copy link

grasshopper139 commented Feb 23, 2021

I have a form that does some API calls before calling the editing loop. If an exception is thrown, I want the parentApp to immediately switch to the MAIN form, however, it simply ignores the form switch and continues on with the method.

def beforeEditing(self):
    try:
        some_API_call()
    except something:
        self.parentApp.switchForm('MAIN')
@jbrunner
Copy link

jbrunner commented Aug 31, 2021

As a workaround I solved this by overriding the edit method:

def beforeEditing(self):
    try:
        some_API_call()
        self._destroyMe = False
    except something:
        self.parentApp.setNextForm('MAIN')
        self._destroyMe = True

def edit(self):
    if not self._destroyMe:
        return super().edit()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants