Changeset 11148:929e91b9fa00 in orange


Ignore:
Timestamp:
10/24/12 15:19:45 (18 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Bug fixes in the CanvasScene.

Location:
Orange/OrangeCanvas
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/application/schemedocument.py

    r11139 r11148  
    215215        selected = self.scene.selected_node_items() 
    216216        nodes = map(self.scene.node_for_item, selected) 
     217 
    217218        for node in nodes: 
    218219            self.scheme.remove_node(node) 
     220 
     221        # Also remove any selected annotations. 
     222        annotations = self.scene.selected_annotation_items() 
     223        annotations = map(self.scene.annotation_for_item, annotations) 
     224 
     225        for annot in annotations: 
     226            self.scheme.remove_annotation(annot) 
    219227 
    220228    def select_all(self): 
  • Orange/OrangeCanvas/canvas/scene.py

    r11115 r11148  
    3838        def __init__(self, parent=None): 
    3939            QSignalMapper.__init__(self, parent) 
    40             self._mapping = {} 
     40            self.__mapping = {} 
    4141 
    4242        def setPyMapping(self, sender, mapped): 
    43             self._mapping[sender] = mapped 
     43            self.__mapping[sender] = mapped 
     44            sender.destroyed.connect(self.removeMappings) 
    4445 
    4546        def removePyMappings(self, sender): 
    46             del self._mapping[sender] 
     47            del self.__mapping[sender] 
     48            sender.destroyed.disconnect(self.removeMappings) 
    4749 
    4850        def pyMap(self, sender=None): 
    4951            if sender is None: 
    5052                sender = self.sender() 
    51             mapped = self._mapping[sender] 
     53            mapped = self.__mapping[sender] 
    5254            self.pyMapped.emit(mapped) 
    5355 
     
    9799    def __init__(self, *args, **kwargs): 
    98100        QGraphicsScene.__init__(self, *args, **kwargs) 
     101 
    99102        self.scheme = None 
    100103        self.registry = None 
     
    439442 
    440443        """ 
    441         self.__annotation_item.remove(annotation) 
     444        self.__annotation_items.remove(annotation) 
    442445        self.removeItem(annotation) 
    443446        self.annotation_removed.emit(annotation) 
    444447 
    445448    def remove_annotation(self, scheme_annotation): 
    446         item = self.__item_for_annotation[scheme_annotation] 
     449        item = self.__item_for_annotation.pop(scheme_annotation) 
    447450        self.remove_annotation_item(item) 
    448451 
     
    523526        """ 
    524527        return [item for item in self.__node_items if item.isSelected()] 
     528 
     529    def selected_annotation_items(self): 
     530        """Return the selected :class:`Annotation`'s 
     531        """ 
     532        return [item for item in self.__annotation_items if item.isSelected()] 
    525533 
    526534    def on_widget_state_change(self, widget, state): 
Note: See TracChangeset for help on using the changeset viewer.