Use generator expression rather than list comprehension
Define selectedWidget in openToc