Closed Zackaroni closed 6 years ago
Good catch. Yeah the generator expression is just relying on the underlying list, which we are rather wrongfully mutating during iteration.
hey @bob-white do we have test coverage for that behavior? it not it would be a good addition
Good call.
Do we have a a decent way of representing the controls and the control hierarchy in unit tests? Or would we need to mock up some of the ui cmds to not return False?
Generally I have been relying on mocks by replacing the cmds call with a dummy object that does what we need.
reclosing
I'm dynamically generating controls under a VerticalForm. I've been trying to use the form's clear() method when I need to refresh the UI, but some of the controls aren't removed. I tried poking around in the code, and it looks to me like the culprit is the generator expression in mgui/core/init.py line 350. It looks like it's removing controls from the list as it's reading from the list, and some controls get skipped as a result. Replacing the generator expression with a list seems to work. I'll create a pull request with that change.