Changeset 7879:65aa6fb818ae in orange


Ignore:
Timestamp:
04/22/11 17:48:59 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
0e95d23ade168207510ecfd6a371edafde14a495
Message:

Show item strings from the matrix.items.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Unsupervised/OWHierarchicalClustering.py

    r7029 r7879  
    279279            self.metaLabels=items.domain.getmetas().values() 
    280280            self.matrixSource="Example Distance" 
    281         elif isinstance(items, list):   #Structured data files from Data Distance 
    282             self.labels=["None", "Default", "Name", "Strain"] 
     281        elif isinstance(items, list): 
     282            self.labels=["None", "Default", "Label"] 
    283283            self.Annotation=0 
    284             self.matrixSource="Data Distance" 
     284            self.matrixSource="List" 
    285285        else:   #From Attribute Distance 
    286286            self.labels=["None", "Attribute Name"] 
     
    308308 
    309309    def updateLabel(self): 
    310 #        self.rootCluster.mapping.setattr("objects", self.matrix.items) 
    311 #        self.dendrogram.updateLabel() 
    312 #        return 
    313310     
    314311        if self.matrix is None: 
     
    320317 
    321318        elif self.Annotation==1: 
    322             if self.matrixSource=="Example Distance" or self.matrixSource=="Data Distance": 
     319            if self.matrixSource=="Example Distance" or self.matrixSource=="List": 
    323320                self.rootCluster.mapping.setattr("objects", range(len(items))) 
    324321            elif self.matrixSource=="Attribute Distance": 
    325                 self.rootCluster.mapping.setattr("objects", [a.name for a in items]) 
     322                self.rootCluster.mapping.setattr("objects", [getattr(a, "name", " ") for a in items]) 
    326323        elif self.matrixSource=="Example Distance": 
    327324            try: 
     
    331328                self.Annotation=0 
    332329                self.rootCluster.mapping.setattr("objects", [str(e[0]) for e in items]) 
    333         elif self.matrixSource=="Data Distance": 
     330        elif self.matrixSource=="List": 
    334331            if self.Annotation==2: 
    335                 self.rootCluster.mapping.setattr("objects", [getattr(a, "name", "") for a in items]) 
     332                self.rootCluster.mapping.setattr("objects", [getattr(a, "name", str(a)) for a in items]) 
    336333            else: 
    337                 self.rootCluster.mapping.setattr("objects", [getattr(a, "strain", "") for a in items]) 
     334                self.rootCluster.mapping.setattr("objects", [getattr(a, "strain", str(a)) for a in items]) 
    338335        self.dendrogram.updateLabel() 
    339336 
     
    467464            self.send("Centroids", self.centroids)     
    468465             
    469         elif self.matrixSource=="Data Distance": 
     466        elif self.matrixSource=="List": 
    470467            names=list(set([d.strain for d in self.selection])) 
    471468            data=[(name, [d for d in filter(lambda a:a.strain==name, self.selection)]) for name in names] 
Note: See TracChangeset for help on using the changeset viewer.