@contextmanager
def size_hint_guard(obj):
    old_hint = obj.widget_item.sizeHint()
    yield
    new_hint = obj.widget_item.sizeHint()
    if old_hint != new_hint:
        obj.size_hint_updated()
A contenxt manager for guarding the size hint of a widget.
dataset/ETHPy150Open ContinuumIO/ashiba/enaml/enaml/qt/qt_constraints_widget.py/size_hint_guard