M lairucrem/widgets/mainwidget.py +6 -1
@@ 224,8 224,13 @@ class packer(delegate_to_widget_mixin('_
self._pile_widget.contents.toggle_maximize(value)
def _guess_orientation(self, size):
+ old_cols = self._previous_size[0] if self._previous_size else ANY
cols = size[0]
- self._orientation = config.HORIZONTAL if cols > 160 else config.VERTICAL
+ # Note: `not (x <= y)` because of Any which always answers True
+ if cols > 160 and cols > old_cols:
+ self._orientation = config.HORIZONTAL
+ if cols <= 160 and cols < old_cols:
+ self._orientation = config.VERTICAL
def keypress(self, size, key):
"""Process pressed key"""
M lairucrem/widgets/utils.py +12 -0
@@ 97,4 97,16 @@ class Any:
def __eq__(self, _dummy):
return True
+ __le__ = __eq__
+ __lt__ = __eq__
+ __gt__ = __eq__
+ __ge__ = __eq__
+
+ def __getitem__(self, _dummy):
+ return self
+
+ def __getattr__(self, _dummy):
+ return self
+
+
ANY = Any()