# HG changeset patch # User Alain Leufroy # Date 1639836494 -3600 # Sat Dec 18 15:08:14 2021 +0100 # Node ID 61b7482c649aa034ac9ed25998aecb24c23eeceb # Parent 8c0f25c2623b56c9aee451c13581d7233acc1a2d widget: coding-style, use constant symbols diff --git a/lairucrem/config.py b/lairucrem/config.py --- a/lairucrem/config.py +++ b/lairucrem/config.py @@ -331,6 +331,9 @@ TOPIC_NAME_REGEXP = re.compile('.*\x02(.*?)\x03+') +HORIZONTAL = 'horizontal' +VERTICAL = 'vertical' + CMD_FILTER = 'filter' CMD_SEARCH = 'search' CMD_REFRESH = 'refresh' diff --git a/lairucrem/widgets/mainwidget.py b/lairucrem/widgets/mainwidget.py --- a/lairucrem/widgets/mainwidget.py +++ b/lairucrem/widgets/mainwidget.py @@ -148,15 +148,15 @@ def _update_container(self): """update the main container depending on the given size""" assert self._orientation - if self._orientation == 'horizontal': + if self._orientation == config.HORIZONTAL: self._original_widget = urwid.Columns(self._widgets) - elif self._orientation == 'vertical': + elif self._orientation == config.VERTICAL: self._original_widget = urwid.Pile(self._widgets) self._invalidate() def _guess_orientation(self, size): cols = size[0] - self._orientation = 'horizontal' if cols > 160 else 'vertical' + self._orientation = config.HORIZONTAL if cols > 160 else config.VERTICAL def keypress(self, size, key): """Process pressed key""" @@ -165,11 +165,11 @@ widget = self._original_widget command = self._command_map[key] if command == config.CMD_SPLIT_HORIZONTALLY: - self._orientation = 'vertical' + self._orientation = config.VERTICAL self._update_container() return if command == config.CMD_SPLIT_VERTICALLY: - self._orientation = 'horizontal' + self._orientation = config.HORIZONTAL self._update_container() return if command == CURSOR_LEFT: