Changeset 10947:65cc61e515a6 in orange


Ignore:
Timestamp:
07/06/12 19:24:49 (22 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Handle open ended slices in delslice.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/OWItemModels.py

    r10725 r10947  
    215215 
    216216    def __delslice__(self, i, j): 
    217         if j > i: 
     217        max_i = len(self) 
     218        i = max(0, min(i, max_i)) 
     219        j = max(0, min(j, max_i)) 
     220 
     221        if j > i and i < max_i: 
    218222            self.beginRemoveRows(QModelIndex(), i, j - 1) 
    219223            del self._list[i:j] 
Note: See TracChangeset for help on using the changeset viewer.