Changeset 8283:e8509ce33288 in orange


Ignore:
Timestamp:
05/29/11 14:17:51 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
74319176b6113e04d547edbc8e91ffd12924aa74
Message:

Fix a mistake with loops, make drowing discrete points much faster

Location:
orange/OrangeWidgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Graph/curve.py

    r8282 r8283  
    1919         
    2020    .. attribute:: continuous 
    21         A boolean value that determines whether the curve is continuous or discrete 
     21        If true, the curve is drawn as a continuous line. Otherwise, it's drawn as a series of points 
     22         
    2223""" 
    2324 
     
    2930        self.graph = graph 
    3031        self.continuous = False 
    31         self.update() 
     32        self.path_item = None 
     33        self.point_items = [] 
    3234     
    3335    def __setattr__(self, name, value): 
     
    3537         
    3638    def update(self): 
    37         self.items = [] 
    38         self.path = QPainterPath() 
     39        del self.point_items[:] 
     40        if self.path_item: 
     41            del self.path_item 
    3942        if not self.data: 
    4043            return 
    4144        if self.continuous: 
     45            self.path = QPainterPath() 
    4246            (start_x, start_y) = self.graph.map_to_graph(self.data[0]) 
    4347            self.path.moveTo(start_x, start_y) 
  • orange/OrangeWidgets/QtGraph.py

    r8282 r8283  
    290290        for i in range(len(xData)): 
    291291            data.append( (xData[i], yData[i]) ) 
    292             c = curve.Curve(data, self.palette.line_styles[0], self) 
    293             c.setPos(self.graph_area.bottomLeft()) 
    294             self.canvas.addItem(c) 
    295             self.curves.append(c) 
     292        c = curve.Curve(data, self.palette.line_styles[0], self) 
     293        c.setPos(self.graph_area.bottomLeft()) 
     294        c.continuous = (style is not Qt.NoPen) 
     295        c.update() 
     296        self.canvas.addItem(c) 
     297        self.curves.append(c) 
    296298        return c 
    297299         
Note: See TracChangeset for help on using the changeset viewer.