Ignore:
Timestamp:
01/27/12 23:39:05 (2 years ago)
Author:
Matija Polajnar <matija.polajnar@…>
Branch:
default
Message:

Multi-label classificaiton widgets. Merged in from Wencan Luo's work with some modifications.

File:
1 edited

Legend:

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

    r9546 r9599  
    284284        warnings = "" 
    285285        metas = data.domain.getmetas() 
    286         for status, messageUsed, messageNotUsed in [ 
    287                                 (orange.Variable.MakeStatus.Incompatible, 
    288                                  "", 
    289                                  "The following attributes already existed but had a different order of values, so new attributes needed to be created"), 
    290                                 (orange.Variable.MakeStatus.NoRecognizedValues, 
    291                                  "The following attributes were reused although they share no common values with the existing attribute of the same names", 
    292                                  "The following attributes were not reused since they share no common values with the existing attribute of the same names"), 
    293                                 (orange.Variable.MakeStatus.MissingValues, 
    294                                  "The following attribute(s) were reused although some values needed to be added", 
    295                                  "The following attribute(s) were not reused since they miss some values") 
    296                                 ]: 
    297             if self.createNewOn > status: 
    298                 message = messageUsed 
    299             else: 
    300                 message = messageNotUsed 
    301             if not message: 
    302                 continue 
    303             attrs = [attr.name for attr, stat in zip(data.domain, data.attributeLoadStatus) if stat == status] \ 
    304                   + [attr.name for id, attr in metas.items() if data.metaAttributeLoadStatus.get(id, -99) == status] 
    305             if attrs: 
    306                 jattrs = ", ".join(attrs) 
    307                 if len(jattrs) > 80: 
    308                     jattrs = jattrs[:80] + "..." 
    309                 if len(jattrs) > 30:  
    310                     warnings += "<li>%s:<br/> %s</li>" % (message, jattrs) 
     286        if hasattr(data, "attribute_load_status"):  # For some file formats, this is not populated 
     287            for status, messageUsed, messageNotUsed in [ 
     288                                    (orange.Variable.MakeStatus.Incompatible, 
     289                                     "", 
     290                                     "The following attributes already existed but had a different order of values, so new attributes needed to be created"), 
     291                                    (orange.Variable.MakeStatus.NoRecognizedValues, 
     292                                     "The following attributes were reused although they share no common values with the existing attribute of the same names", 
     293                                     "The following attributes were not reused since they share no common values with the existing attribute of the same names"), 
     294                                    (orange.Variable.MakeStatus.MissingValues, 
     295                                     "The following attribute(s) were reused although some values needed to be added", 
     296                                     "The following attribute(s) were not reused since they miss some values") 
     297                                    ]: 
     298                if self.createNewOn > status: 
     299                    message = messageUsed 
    311300                else: 
    312                     warnings += "<li>%s: %s</li>" % (message, jattrs) 
     301                    message = messageNotUsed 
     302                if not message: 
     303                    continue 
     304                attrs = [attr.name for attr, stat in zip(data.domain, data.attributeLoadStatus) if stat == status] \ 
     305                      + [attr.name for id, attr in metas.items() if data.metaAttributeLoadStatus.get(id, -99) == status] 
     306                if attrs: 
     307                    jattrs = ", ".join(attrs) 
     308                    if len(jattrs) > 80: 
     309                        jattrs = jattrs[:80] + "..." 
     310                    if len(jattrs) > 30:  
     311                        warnings += "<li>%s:<br/> %s</li>" % (message, jattrs) 
     312                    else: 
     313                        warnings += "<li>%s: %s</li>" % (message, jattrs) 
    313314 
    314315        self.warnings.setText(warnings) 
Note: See TracChangeset for help on using the changeset viewer.