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

Added channel names to the LinkItems.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/canvas/scene.py

    r11180 r11181  
    66import logging 
    77from operator import attrgetter 
     8 
     9from xml.sax.saxutils import escape 
    810 
    911from PyQt4.QtGui import QGraphicsScene, QPainter, QBrush, \ 
     
    9294        self.addItem(self.__anchor_layout) 
    9395 
     96        self.__channel_names_visible = True 
     97 
    9498        self.user_interaction_handler = None 
    9599 
     
    200204        return self.__anchor_layout 
    201205 
     206    def set_channel_names_visible(self, visible): 
     207        self.__channel_names_visible = visible 
     208        for link in self.__link_items: 
     209            link.setChannelNamesVisible(visible) 
     210 
     211    def channel_names_visible(self): 
     212        return self.__channel_names_visible 
     213 
    202214    def add_node_item(self, item): 
    203215        """Add a :class:`NodeItem` instance to the scene. 
     
    359371        item.setSourceItem(source_item) 
    360372        item.setSinkItem(sink_item) 
     373        fmt = "<b>{0}</b>&nbsp;-->&nbsp;<b>{1}</b>" 
     374        item.setToolTip( 
     375            fmt.format(escape(source_channel.name), 
     376                       escape(sink_channel.name)) 
     377        ) 
     378 
     379        item.setSourceName(source_channel.name) 
     380        item.setSinkName(sink_channel.name) 
     381        item.setChannelNamesVisible(self.__channel_names_visible) 
     382 
    361383        return item 
    362384 
Note: See TracChangeset for help on using the changeset viewer.