Commits

Senthil Kumaran committed ce89270

py3kify container.py

  • Participants
  • Parent commits c9cf77c

Comments (0)

Files changed (1)

File urwid/container.py

         return False
 
     def __reversed__(self):
-        for i in reversed(range(len(self))):
+        for i in reversed(list(range(len(self)))):
             yield self[i]
 
     def index(self, value):
                 self.item_types.append((f,height))
                 w = widget
             else:
-                raise PileError, "widget list item invalid %r" % (w,)
+                raise PileError("widget list item invalid %r" % (w,))
             if focus_item is None and w.selectable():
                 focus_item = i
         self.widget_list.set_modified_callback(self._invalidate)
                 wtotal += height
 
         if wtotal == 0:
-            raise PileError, "No weighted widgets found for Pile treated as a box widget"
+            raise PileError("No weighted widgets found for Pile treated as a box widget")
 
         if remaining < 0:
             remaining = 0
                 return key
 
         if command_map[key] == 'cursor up':
-            candidates = range(i-1, -1, -1) # count backwards to 0
+            candidates = list(range(i-1, -1, -1)) # count backwards to 0
         else: # command_map[key] == 'cursor down'
-            candidates = range(i+1, len(self.widget_list))
+            candidates = list(range(i+1, len(self.widget_list)))
 
         if not item_rows:
             item_rows = self.get_item_rows( size, focus=True )
             f, height = self.item_types[j]
             rows = item_rows[j]
             if command_map[key] == 'cursor up':
-                rowlist = range(rows-1, -1, -1)
+                rowlist = list(range(rows-1, -1, -1))
             else: # command_map[key] == 'cursor down'
-                rowlist = range(rows)
+                rowlist = list(range(rows))
             for row in rowlist:
                 tsize=self.get_item_size(size,j,True,item_rows)
                 if self.focus_item.move_cursor_to_coords(
                 self.column_types.append((f,width))
                 w = widget
             else:
-                raise ColumnsError, "widget list item invalid: %r" % (w,)
+                raise ColumnsError("widget list item invalid: %r" % (w,))
             if focus_column is None and w.selectable():
                 focus_column = i
 
             return key
 
         if command_map[key] == 'cursor left':
-            candidates = range(i-1, -1, -1) # count backwards to 0
+            candidates = list(range(i-1, -1, -1)) # count backwards to 0
         else: # key == 'right'
-            candidates = range(i+1, len(widths))
+            candidates = list(range(i+1, len(widths)))
 
         for j in candidates:
             if not self.widget_list[j].selectable():