Changeset 8638:d4d31b608977 in orange


Ignore:
Timestamp:
08/09/11 13:25:48 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
8fd26ada9f2c895f3d2c68a7911110601197706c
Message:

owtools.resize_plot_item_list now really removes extra items.

This fixes leftover items in axes and curves

Location:
orange/OrangeWidgets
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Prototypes/OWDistributionsQt.py

    r8467 r8638  
    4343            d = self.data() 
    4444            n = len(d)/3 
    45             self._items = resize_plot_item_list(self._items, n, QGraphicsPathItem, self) 
     45            resize_plot_item_list(self._items, n, QGraphicsPathItem, self) 
    4646            for i in range(n): 
    4747                p = QPainterPath() 
  • orange/OrangeWidgets/plot/owaxis.py

    r8632 r8638  
    182182         
    183183        n = len(self._ticks) 
    184         self.label_items = resize_plot_item_list(self.label_items, n, QGraphicsTextItem, self) 
    185         self.tick_items = resize_plot_item_list(self.tick_items, n, QGraphicsLineItem, self) 
     184        resize_plot_item_list(self.label_items, n, QGraphicsTextItem, self) 
     185        resize_plot_item_list(self.tick_items, n, QGraphicsLineItem, self) 
    186186         
    187187        if self.scale: 
  • orange/OrangeWidgets/plot/owtools.py

    r8630 r8638  
    5151        as their parent item. 
    5252         
     53        The list is resized in place, this function returns nothing.  
     54         
    5355        :param lst: The list to be resized 
    5456        :type lst: list of QGraphicsItem 
     
    6264        :param parent: Any new items will have this as their parent item 
    6365        :type parent: QGraphicsItem 
    64          
    65         :rtype: list of QGraphicsItem 
    66         :returns: The resized list 
    6766    """ 
    6867    n = len(lst) 
    6968    if n > size: 
    70         for i in lst[n:]: 
     69        for i in lst[size:]: 
    7170            i.setParentItem(None) 
    72         return lst[:n] 
     71            if i.scene(): 
     72                i.scene().removeItem(i) 
     73        del lst[size:] 
    7374    elif n < size: 
    74         return lst + [item_type(parent) for i in range(size - n)] 
    75     else: 
    76         return lst 
     75        lst.extend(item_type(parent) for i in range(size - n)) 
    7776         
    7877use_animations = True 
Note: See TracChangeset for help on using the changeset viewer.