Пример #1
0
def msnplus_to_list(txt, do_parse_emotes=True):
    '''parte text to a DictObj and return a list of strings and
    gtk.gdk.Pixbufs'''

    ########################################
    # Mohrtutchy hax, it works (not sure how)
    parser = bigparser.getParser(Parser.unescape(txt), Parser.PangoDataType)
    parsed_stuff = parser.get(smileys=True)

    list_stuff = []
    for item in parsed_stuff:
        if type(item) is Parser.Smiley:
            list_stuff.append(item.pixbuf)
        else:
            list_stuff.append(replace_markup(item))
    return list_stuff

    ########################################
    # boyska's implementation, quite incomplete.
    dct = Plus.msnplus(txt, do_parse_emotes)

    if not do_parse_emotes:
        return dct.to_xml()

    items = flatten_tree(dct, [], [])

    temp = []
    accum = []
    for item in items:
        if type(item) in (str, unicode):
            temp.append(item)
        else:
            text = replace_markup("".join(temp))
            accum.append(text)
            accum.append(item)
            temp = []

    accum.append(replace_markup("".join(temp)))

    return accum
Пример #2
0
def msnplus_to_list(txt, do_parse_emotes=True):
    '''parte text to a DictObj and return a list of strings and
    gtk.gdk.Pixbufs'''
    dct = Plus.msnplus(txt, do_parse_emotes)

    if not do_parse_emotes:
        return dct.to_xml()

    items = flatten_tree(dct, [], [])

    temp = []
    accum = []
    for item in items:
        if type(item) in (str, unicode):
            temp.append(item)
        else:
            text = replace_markup("".join(temp))
            accum.append(text)
            accum.append(item)
            temp = []

    accum.append(replace_markup("".join(temp)))

    return accum
Пример #3
0
def msnplus_to_list(txt, do_parse_emotes=True):
    '''parte text to a DictObj and return a list of strings and
    gtk.gdk.Pixbufs'''
    dct = Plus.msnplus(txt, do_parse_emotes)

    if not do_parse_emotes:
        return dct.to_xml()

    items = flatten_tree(dct, [], [])

    temp = []
    accum = []
    for item in items:
        if type(item) in (str, unicode):
            temp.append(item)
        else:
            text = replace_markup("".join(temp))
            accum.append(text)
            accum.append(item)
            temp = []

    accum.append(replace_markup("".join(temp)))

    return accum
Пример #4
0
 def __init__(self):
     CellRendererFunction.__init__(self, lambda txt: Plus.msnplus(txt).to_xml())
Пример #5
0
def plus(markup):
    '''parse msnplus markup and replace the markup'''
    return replace_markup(Plus.msnplus(markup))
Пример #6
0
def plus(markup):
    '''parse msnplus markup and replace the markup'''
    return replace_markup(Plus.msnplus(markup))