Ignore:
Timestamp:
01/21/13 20:07:37 (15 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Make sure widgetStateChanged signals are connected when setting a new scheme, added focusNode method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/document/schemeedit.py

    r11264 r11266  
    521521            self.__scene.set_scheme(scheme) 
    522522 
     523            if self.__scheme: 
     524                for node in self.__scheme.nodes: 
     525                    self.__onNodeAdded(node) 
     526 
    523527    def scheme(self): 
    524528        """Return the :class:`Scheme` edited by the widget. 
     
    682686 
    683687            self.__undoStack.endMacro() 
     688 
     689    def focusNode(self): 
     690        """Return the current focused `SchemeNode` or None if no 
     691        node has focus. 
     692 
     693        """ 
     694        focus = self.__scene.focusItem() 
     695        node = None 
     696        if isinstance(focus, items.NodeItem): 
     697            try: 
     698                node = self.__scene.node_for_item(focus) 
     699            except KeyError: 
     700                # in case the node has been removed but the scene was not 
     701                # yet fully updated. 
     702                node = None 
     703        return node 
    684704 
    685705    def selectedNodes(self): 
     
    10011021            self.__removeSelectedAction.setText(self.tr("Remove")) 
    10021022 
    1003         focus = self.__scene.focusItem() 
    1004         if isinstance(focus, items.NodeItem): 
    1005             node = self.__scene.node_for_item(focus) 
    1006             desc = node.description 
     1023        focus = self.focusNode() 
     1024        if focus is not None: 
     1025            desc = focus.description 
    10071026            tip = whats_this_helper(desc) 
    10081027        else: 
Note: See TracChangeset for help on using the changeset viewer.