diff --git a/corrscope/gui/model_bind.py b/corrscope/gui/model_bind.py index 0bb24c9..71769d3 100644 --- a/corrscope/gui/model_bind.py +++ b/corrscope/gui/model_bind.py @@ -195,14 +195,6 @@ class BoundWidget(QWidget): if updater != self.cfg2gui: updater() - def __bool__(self): - """ - qw.QComboBox().__bool__ does not exist, - yet bool(qw.QComboBox()) == False. - I suspect https://docs.python.org/3/c-api/bool.html is involved. - """ - return True - def blend_colors( color1: QColor, color2: QColor, ratio: float, gamma: float = 2 diff --git a/corrscope/gui/view_stack.py b/corrscope/gui/view_stack.py index 292ae9c..8f707ff 100644 --- a/corrscope/gui/view_stack.py +++ b/corrscope/gui/view_stack.py @@ -218,8 +218,7 @@ Right = TypeVar("Right", bound=Union[QWidget, QLayout]) # same as WidgetOrLayou class _Both: - def __bool__(self): - return False + pass Both = _Both() @@ -233,18 +232,18 @@ def widget_pair_inserter(append_widgets: Callable): if right_type is Both: left = create_element(left_type, parent, kwargs) right = Both - push = left + child = left else: left = create_element(left_type, parent) right = create_element(right_type, parent, kwargs) - push = right + child = right if name: - (right or left).setObjectName(name) + child.setObjectName(name) left_is_label = isinstance(left, QLabel) - with stack.push(push): + with stack.push(child): if right is Both: yield left elif left_is_label: