Ignore:
Timestamp:
Feb 24, 2012 10:15:53 AM (8 years ago)
Author:
kroman0
Message:

Implemented max. number of tags to be displayed (Suresh V)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus/cumulusportlet.py

    r1041 r3361  
    9898        required=True, 
    9999        default=u'pt') 
     100 
     101    max_tags = schema.Int( 
     102        title=_(u'Maximum number of tags to display'), 
     103        description=_(u'Used when too many tags make the display ugly.'), 
     104        required=True, 
     105        default=50) 
    100106 
    101107class Assignment(base.Assignment): 
     
    122128    largest  = 22 
    123129    unit     = u'pt' 
     130    max_tags = 50 
    124131 
    125132    def __init__(self, **kw): 
     
    209216            return [] 
    210217 
     218        tags.sort(lambda x,y: (x[1]<y[1] and 1) or (x[1]>y[1] and -1) or 0) 
     219        tags = tags[:self.data.max_tags] 
     220 
    211221        number_of_entries = [i[1] for i in tags] 
    212222 
Note: See TracChangeset for help on using the changeset viewer.