Changeset 11210:bb3860029714 in orange


Ignore:
Timestamp:
11/28/12 17:58:51 (17 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixed some errors caught by failing uniitests.

Location:
Orange/OrangeCanvas
Files:
3 edited

Legend:

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

    r11207 r11210  
    375375        item.setSourceItem(source_item) 
    376376        item.setSinkItem(sink_item) 
    377         fmt = "<b>{0}</b>&nbsp;-->&nbsp;<b>{1}</b>" 
     377 
     378        def channel_name(channel): 
     379            if isinstance(channel, basestring): 
     380                return channel 
     381            else: 
     382                return channel.name 
     383 
     384        source_name = channel_name(source_channel) 
     385        sink_name = channel_name(sink_channel) 
     386 
     387        fmt = u"<b>{0}</b>&nbsp; \u2192 &nbsp;<b>{1}</b>" 
    378388        item.setToolTip( 
    379             fmt.format(escape(source_channel.name), 
    380                        escape(sink_channel.name)) 
     389            fmt.format(escape(source_name), 
     390                       escape(sink_name)) 
    381391        ) 
    382392 
    383         item.setSourceName(source_channel.name) 
    384         item.setSinkName(sink_channel.name) 
     393        item.setSourceName(source_name) 
     394        item.setSinkName(sink_name) 
    385395        item.setChannelNamesVisible(self.__channel_names_visible) 
    386396 
  • Orange/OrangeCanvas/scheme/readwrite.py

    r11204 r11210  
    372372        pretty_xml = dom.toprettyxml(encoding="utf-8") 
    373373        buffer = StringIO.StringIO(pretty_xml) 
     374    else: 
     375        buffer.seek(0) 
    374376 
    375377    shutil.copyfileobj(buffer, stream) 
  • Orange/OrangeCanvas/scheme/tests/test_scheme.py

    r11111 r11210  
    1313class TestScheme(test.QCoreAppTestCase): 
    1414    def test_scheme(self): 
    15         import Orange 
    1615        reg = small_testing_registry() 
    1716        base = "Orange.OrangeWidgets" 
     
    2221        scheme = Scheme() 
    2322 
    24         self.assertEqual(scheme.title, "untitled") 
     23        self.assertEqual(scheme.title, "") 
    2524        self.assertEqual(scheme.description, "") 
    2625        self.assertEqual(scheme.path, "") 
     
    101100        self.assertSequenceEqual(annotations_added, [arrow_annot]) 
    102101        self.assertSequenceEqual(scheme.annotations, annotations_added) 
    103  
Note: See TracChangeset for help on using the changeset viewer.