Ignore:
Timestamp:
11/13/12 18:08:32 (18 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Showing the dynamic link state in the canvas.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/scheme/widgetsscheme.py

    r11135 r11182  
    22from functools import partial 
    33 
    4 from PyQt4.QtCore import QTimer 
     4from PyQt4.QtCore import QTimer, SIGNAL 
    55 
    66from .. import orngSignalManager 
     
    112112        widget.processingStateChanged.connect(node.set_processing_state) 
    113113 
     114        # TODO: Change how the signal is emitted in signal manager (should 
     115        # notify the SchemeLink directly). 
     116        widget.connect( 
     117           widget, 
     118           SIGNAL("dynamicLinkEnabledChanged(PyQt_PyObject, bool)"), 
     119           self.__on_dynamic_link_enabled_changed 
     120        ) 
     121 
    114122        return widget 
     123 
     124    def __on_dynamic_link_enabled_changed(self, link, enabled): 
     125        rev = dict(map(reversed, self.widget_for_node.items())) 
     126 
     127        source_node = rev[link.widgetFrom] 
     128        sink_node = rev[link.widgetTo] 
     129        source_channel = source_node.output_channel(link.signalNameFrom) 
     130        sink_channel = sink_node.input_channel(link.signalNameTo) 
     131 
     132        links = self.find_links(source_node, source_channel, 
     133                                sink_node, sink_channel) 
     134 
     135        if links: 
     136            link = links[0] 
     137            link.set_dynamic_enabled(enabled) 
    115138 
    116139    def close_all_open_widgets(self): 
Note: See TracChangeset for help on using the changeset viewer.