community icon indicating copy to clipboard operation
community copied to clipboard

ScreenManager.clear_widgets()

Open cropleyb opened this issue 12 years ago • 8 comments

What should ScreenManager.clear_widgets() do? At the moment, it can change its "current" attribute as it is iterating through the screens: https://gist.github.com/cropleyb/b3f65d29fddc579ce741 (unless the current screen is the last screen to be iterated over)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

cropleyb avatar Nov 09 '14 02:11 cropleyb

Good find. I think it should remove all screens and set current to None.

dessant avatar Nov 14 '14 09:11 dessant

Looking into this one. @dessant if we make it remove all screens than will it not violate the removes all children rule that is given in documentation?

rastogiachyut avatar Apr 02 '15 21:04 rastogiachyut

@rastogiachyut could you link and quote? I'm not sure which rule that is.

dessant avatar Apr 02 '15 21:04 dessant

I meant this -> http://kivy.org/docs/api-kivy.uix.widget.html?highlight=clear_widget#kivy.uix.widget.Widget.clear_widgets Did I misinterpret it? "added to this widget" means all children of this widget right.

rastogiachyut avatar Apr 03 '15 05:04 rastogiachyut

It means with no arguments, all children are removed, but only the specified widgets are removed if you pass a list to that method.

dessant avatar Apr 03 '15 19:04 dessant

from your first comment I understood that you want to delete the current screen too(along with all the children) which I think strays from its regular implementation, is that what you think it should do?. should I ask other devs for their opinions?

rastogiachyut avatar Apr 03 '15 20:04 rastogiachyut

I really don't see the problem there, an empty screenmanager is a legit use case, by calling sm.clear_widgets(), we should achieve the same state that a newly initialized screenmanager has, without any children.

Can you explain exactly what do you find problematic in this behavior?

dessant avatar Apr 03 '15 20:04 dessant

Yes, it is a valid use case. I was confusing theory with implementation cause when i set screenmanager.current = None it throws an exception. I think I understand the problem now,when we do ScreenManager.clear_widgets() it removes only the current screen(which should be behavior shown by Screen.clear_widgets()) instead of all screens. I can delete all screens but that would mean doing screenmanager.current = None which is not possible, so should I instead remove the screenmanager after creating one identical to it(identical except the screens).

rastogiachyut avatar Apr 05 '15 19:04 rastogiachyut