Changeset 11274:601a5a575e52 in orange


Ignore:
Timestamp:
01/24/13 13:40:52 (15 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Emit normalized control rectangles.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/canvas/items/controlpoints.py

    r11192 r11274  
    149149 
    150150    def controlPoint(self, anchor): 
    151         """Return the anchor point at anchor position if not set. 
     151        """ 
     152        Return the anchor point (:class:`ControlPoint`) at anchor position 
     153        or `None` if an anchor point is not set. 
     154 
    152155        """ 
    153156        return self.__points.get(anchor) 
    154157 
    155158    def setRect(self, rect): 
     159        """ 
     160        Set the control point rectangle (:class:`QRectF`) 
     161        """ 
    156162        if self.__rect != rect: 
    157163            self.__rect = QRectF(rect) 
    158164            self.__pointsLayout() 
    159165            self.prepareGeometryChange() 
    160             self.rectChanged.emit(rect) 
     166            self.rectChanged.emit(rect.normalized()) 
    161167 
    162168    def rect(self): 
    163         """Return the control rect 
     169        """ 
     170        Return the control point rectangle. 
    164171        """ 
    165172        # Return the rect normalized. During the control point move the 
    166173        # rect can change to an invalid size, but the layout must still 
    167         # know to which point does an unnormalized rect side belong. 
     174        # know to which point does an unnormalized rect side belong, 
     175        # so __rect is left unnormalized. 
     176        # NOTE: This means all signal emits (rectChanged/Edited) must 
     177        #       also emit normalized rects 
    168178        return self.__rect.normalized() 
    169179 
     
    188198 
    189199    def setConstraints(self, constraints): 
    190         pass 
     200        raise NotImplementedError 
    191201 
    192202    def isControlActive(self): 
     
    295305 
    296306        if changed: 
    297             self.rectEdited.emit(rect) 
     307            self.rectEdited.emit(rect.normalized()) 
    298308 
    299309    def boundingRect(self): 
Note: See TracChangeset for help on using the changeset viewer.