Changeset 8655:3d52902eb8aa in orange


Ignore:
Timestamp:
08/10/11 17:02:22 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
be8f7cef043b44c2526fae38a42c1333bbb4eeab
Message:

Animations can be configure per plot, with no more global variables

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/plot/owlegend.py

    r8642 r8655  
    66from owpoint import * 
    77from owcurve import OWCurve 
    8 from owtools import move_item, move_item_xy 
     8from owtools import move_item_xy 
    99 
    1010PointColor = 1 
     
    123123                        x = x + item.boundingRect().width() 
    124124                    self.box_rect = self.box_rect | item.boundingRect().translated(0, y) 
    125                     move_item_xy(item, x, y) 
     125                    move_item_xy(item, x, y, self.graph.use_animations) 
    126126                    y = y + item.boundingRect().height() 
    127127        elif self._orientation == Qt.Horizontal: 
     
    132132                        y = y + item.boundingRect().height() 
    133133                    self.box_rect = self.box_rect | item.boundingRect().translated(x, y) 
    134                     move_item_xy(item, x, y) 
     134                    move_item_xy(item, x, y, self.graph.use_animations) 
    135135                    x = x + item.boundingRect().width() 
    136136        else: 
  • orange/OrangeWidgets/plot/owplot.py

    r8645 r8655  
    13441344        orangeplot.Point.clear_cache() 
    13451345         
    1346     def update_animations(self, use_antialiasing=None): 
    1347         if use_antialiasing is not None: 
    1348             self.use_antialiasing = use_antialiasing 
    1349          
    1350         #use_animations = self.use_antialiasing 
     1346    def update_animations(self, use_animations=None): 
     1347        if use_animations is not None: 
     1348            self.use_animations = use_animations 
    13511349         
    13521350    def animate(self, target, prop_name, end_val, duration = None): 
  • orange/OrangeWidgets/plot/owtools.py

    r8638 r8655  
    7575        lst.extend(item_type(parent) for i in range(size - n)) 
    7676         
    77 use_animations = True 
    78 _animations = [] 
    79  
    80 def move_item(item, pos, duration = None): 
     77def move_item(item, pos, animate = True, duration = None): 
    8178    ''' 
    8279        Animates ``item`` to move to position ``pos``.  
     
    9289        :type duration: int 
    9390    ''' 
    94     if use_animations: 
    95         if not duration: 
    96             duration = 250 
    97         orangeplot.PlotItem.move_item(item, pos, duration) 
    98     else: 
    99         item.setPos(x, y) 
    100  
    101 def move_item_xy(item, x, y, duration = None): 
     91    if not duration: 
     92        duration = 250 
     93    orangeplot.PlotItem.move_item(item, pos, animate, duration) 
     94     
     95def move_item_xy(item, x, y, animate = True, duration = None): 
    10296    ''' 
    10397        Same as  
    10498        move_item(item, QPointF(x, y), duration) 
    10599    ''' 
    106     move_item(item, QPointF(x, y), duration) 
     100    move_item(item, QPointF(x, y), animate, duration) 
    107101         
    108102class TooltipManager: 
  • source/orangeplot/plotitem.cpp

    r8633 r8655  
    113113} 
    114114 
    115 void PlotItem::move_item(QGraphicsObject* item, const QPointF& pos, int duration) 
     115void PlotItem::move_item(QGraphicsObject* item, const QPointF& pos, bool animate, int duration) 
    116116{ 
    117117    QPropertyAnimation* a = new QPropertyAnimation(); 
  • source/orangeplot/plotitem.h

    r8633 r8655  
    3333     
    3434    static QRectF rect_from_data(const QList<double>& x_data, const QList<double>& y_data); 
    35     static void move_item(QGraphicsObject* item, const QPointF& pos, int duration = 250); 
     35    static void move_item(QGraphicsObject* item, const QPointF& pos, bool animate = true, int duration = 250); 
    3636     
    3737    bool is_auto_scale() const; 
  • source/orangeplot/plotitem.sip

    r8633 r8655  
    3333     
    3434    static QRectF rect_from_data(const QList<double>& x_data, const QList<double>& y_data); 
    35     static void move_item(QGraphicsObject* item, const QPointF& pos, int duration = 250); 
     35    static void move_item(QGraphicsObject* item, const QPointF& pos, bool animate = true, int duration = 250); 
    3636     
    3737    bool is_auto_scale() const; 
Note: See TracChangeset for help on using the changeset viewer.