Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.macro.ShowSmileys Namespace Reference

Functions

def macro_ShowSmileys

Variables

int COLUMNS = 4
list Dependencies = ['user']

Function Documentation

Definition at line 21 of file ShowSmileys.py.

00021 
00022 def macro_ShowSmileys(macro):
00023     _ = macro.request.getText
00024     fmt = macro.formatter
00025 
00026     # create data description
00027     data = TupleDataset()
00028     data.columns = []
00029     for dummy in range(COLUMNS):
00030         data.columns.extend([
00031             Column('markup', label=_('Markup')),
00032             Column('image', label=_('Display'), align='center'),
00033             Column('', label=''),
00034         ])
00035     data.columns[-1].hidden = 1
00036 
00037     # iterate over smileys, in groups of size COLUMNS
00038     smileys = config.smileys
00039     for idx in range(0, len(smileys), COLUMNS):
00040         row = []
00041         for off in range(COLUMNS):
00042             if idx+off < len(smileys):
00043                 markup = smileys[idx+off]
00044                 row.extend([fmt.code(1) + fmt.text(markup) + fmt.code(0), fmt.smiley(markup), '', ])
00045             else:
00046                 row.extend(['&nbsp;'] * 3)
00047         data.addRow(tuple(row))
00048 
00049     # display table
00050     if data:
00051         browser = DataBrowserWidget(macro.request)
00052         browser.setData(data)
00053         return browser.render(method="GET")
00054 
00055     return ''
00056 

Variable Documentation

Definition at line 17 of file ShowSmileys.py.

Definition at line 19 of file ShowSmileys.py.