Changeset 5033:c202765a29be in orange


Ignore:
Timestamp:
07/30/08 20:50:28 (6 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
cf320003ed6c2a19d1eff171af08a9ed6ea0fc52
Message:
  • probably fixed problem with meta attributes suddenly moving back to available sometimes (trac ticket #283)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Data/OWDataDomain.py

    r4977 r5033  
    147147            if self.receivedAttrList: 
    148148                self.chosenAttributes = [(a.name, a.varType) for a in self.receivedAttrList] 
    149                 self.addToUsed(self.receivedAttrList) 
     149                cas = set(chosenAttributes) 
     150                self.inputAttributes = [(a.name, a.varType) for a in domain.attirbutes if (a.name, a.varType) not in cas] 
    150151            else: 
    151152                self.chosenAttributes = [(a.name, a.varType) for a in domain.attributes] 
     
    162163            self.allAttributes = [] 
    163164 
     165        print len(self.inputAttributes), len(self.chosenAttributes) 
    164166        self.openContext("", data) 
    165167 
    166         self.usedAttributes = dict.fromkeys(self.chosenAttributes + self.classAttribute + self.metaAttributes, 1) 
     168        self.usedAttributes = set(self.chosenAttributes + self.classAttribute + self.metaAttributes) 
    167169#        self.setInputAttributes() 
    168170 
     
    279281        self.selectedInput = [] 
    280282        if self.data: 
    281             self.inputAttributes = filter(lambda x:not self.usedAttributes.has_key(x), self.allAttributes) 
     283            self.inputAttributes = filter(lambda x:x not in self.usedAttributes, self.allAttributes) 
    282284        else: 
    283285            self.inputAttributes = [] 
     
    286288    def removeFromUsed(self, attributes): 
    287289        for attr in attributes: 
    288             del self.usedAttributes[attr] 
     290            self.usedAttributes.remove(attr) 
    289291        self.setInputAttributes() 
    290292 
    291293    def addToUsed(self, attributes): 
    292         self.usedAttributes.update(dict.fromkeys(attributes)) 
     294        self.usedAttributes.update(attributes) 
    293295        self.setInputAttributes() 
    294296 
Note: See TracChangeset for help on using the changeset viewer.