61b7482c649a — Alain Leufroy 2 years ago
widget: coding-style, use constant symbols
2 files changed, 8 insertions(+), 5 deletions(-)

M lairucrem/config.py
M lairucrem/widgets/mainwidget.py
M lairucrem/config.py +3 -0
@@ 331,6 331,9 @@ COLOR_REGEXP = re.compile('\x01(.*?)\x02
 TOPIC_NAME_REGEXP = re.compile('.*\x02(.*?)\x03+')
 
 
+HORIZONTAL = 'horizontal'
+VERTICAL = 'vertical'
+
 CMD_FILTER = 'filter'
 CMD_SEARCH = 'search'
 CMD_REFRESH = 'refresh'

          
M lairucrem/widgets/mainwidget.py +5 -5
@@ 148,15 148,15 @@ class packer(delegate_to_widget_mixin('_
     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 @@ class packer(delegate_to_widget_mixin('_
         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: