Ejemplo n.º 1
0
def row_into_items(items, row):
    code, name = row
    c = codepoint2unichr(code)
    items[code] = to_xml_item(
        uid='r' + str(code),
        arg=c,
        title=c,
        subtitle=u'U+%04X: %s' % (code, name))
Ejemplo n.º 2
0
def do(query):
    try:
        codepoint = parse_codepoint(query)
        s = codepoint2unichr(codepoint)
    except:
        return make_xml(False, query, query, u'Type hexadecimal unicode codepoint')

    try:
        name = call_with_cursor([codepoint], get_name_by_code)
    except:
        return make_xml(False, query, query, u'Bad or unsuitable codepoint')
    else:
        return make_xml(True, s, u'{0}: {1}'.format(query, s), u'U+{0:04X}: {1}'.format(codepoint, name))
Ejemplo n.º 3
0
def do_one(query):

    if query.strip() == '':
        return make_item(None,
                         'Type hexadecimal unicode codepoint',
                         '',
                         dummy=True)

    try:
        codepoint = parse_codepoint(query)
        s = codepoint2unichr(codepoint)
        name = call_with_cursor([codepoint], get_name_by_code)
    except:
        return make_item(None,
                         query,
                         'Bad or unsuitable codepoint',
                         dummy=True)
    else:
        return make_item(s, u'{0}: {1}'.format(query, s),
                         u'U+{0:04X}: {1}'.format(codepoint, name))
Ejemplo n.º 4
0
def do_row(row):
    code, name = row
    c = codepoint2unichr(code)
    return make_item(c, c, 'U+%04X: %s' % (code, name))