Changeset 7883:e072d051572f in orange


Ignore:
Timestamp:
04/28/11 14:25:11 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Children:
7884:8aaa0ebb72aa, 9432:c20592691934
Convert:
4bd912a69095d025f1788a2a890a96f223cdfdfe
Message:

Fixed hint sorting (hints that start with the text are displayed first).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/OWGUIEx.py

    r7083 r7883  
    246246                tuples = zip(self.itemsAsStrings, self.itemsAsItems)        # in case we make regular expressions crash we show all items 
    247247        else: 
    248             if self.matchAnywhere:  tuples = [(text, item) for (text, item) in tuples if last in text] 
    249             else:                   tuples = [(text, item) for (text, item) in tuples if text.startswith(last)] 
     248            if self.matchAnywhere: 
     249                tuples = [(text, item) for (text, item) in tuples if last in text] 
     250                tuples = sorted(tuples, key=lambda t: 0 if t[0].startswith(last) else 1)  
     251            else: 
     252                tuples = [(text, item) for (text, item) in tuples if text.startswith(last)] 
    250253         
    251254        items = [tup[1] for tup in tuples] 
Note: See TracChangeset for help on using the changeset viewer.