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

Remove the last screen and leave ScreenManager in a valid state #4111

Merged
merged 2 commits into from Mar 21, 2016

Conversation

dessant
Copy link
Contributor

@dessant dessant commented Mar 21, 2016

#4107 interferes with transitions, removing the current widget too soon, this pr fixes that.

clear_widgets is also overridden to ensure proper cleaning, fixes #2655.

def real_add_widget(self, screen, *args):
# ensure screen is removed from its previous parent
if screen.parent:
screen.parent.real_remove_widget(screen)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Screen can be added to any Widget not just ScreenManager, it's probably better to check if screen.parent is a ScreenManager instance and call remove_widget if it's not the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, nice find! 👍

@tshirtman
Copy link
Member

LGTM

dessant added a commit that referenced this pull request Mar 21, 2016
Remove the last screen and leave ScreenManager in a valid state
@dessant dessant merged commit a29e468 into master Mar 21, 2016
@dessant dessant deleted the rmscreen branch March 21, 2016 16:43
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

Successfully merging this pull request may close these issues.

ScreenManager.clear_widgets()
2 participants