Ejemplo n.º 1
0
def get_content_categories():
    file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "fa5-categories.json")
    with io.open(file, 'r') as json_file:
        cats = json.load(json_file, object_pairs_hook=OrderedDict)

        for key, value in cats.iteritems():
            catname = value["label"].replace("&", "and")
            symbols = []
            for ico in value["icons"]:
                icon = all_icons[ico]
                for font in icon["styles"]:
                    symbol = (font_name_hash[font],
                              unichr(int(icon['unicode'], 16)), icon["label"],
                              "{} > {}\n{}".format(
                                  font_name_hash[font], catname,
                                  ", ".join(icon["search"]["terms"])))
                    symbols.append(symbol)

            categories.append(
                PPTSymbolsGallery(label="{} ({})".format(
                    catname, len(symbols)),
                                  symbols=symbols,
                                  columns=16))

    return bkt.ribbon.Menu(
        xmlns="http://schemas.microsoft.com/office/2009/07/customui",
        id=None,
        children=categories)
Ejemplo n.º 2
0
def get_content_categories():
    # Automatically generate categories from json file (based on yaml file provided by fontawesome)
    file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "fontawesome4.json")
    with io.open(file, 'r') as json_file:
        chars = json.load(json_file, object_pairs_hook=OrderedDict)

    # categories = OrderedDict()
    categories = defaultdict(list)
    for char in chars['icons']:
        uc = unichr(int(char['unicode'], 16))
        for cat in char['categories']:
            try:
                supertip = "Font Awesome 4 > {}\n{}".format(
                    cat, ", ".join(char['filter']))
            except:
                supertip = "Font Awesome 4 > {}".format(cat)
            categories[cat].append(("FontAwesome", uc, char['name'], supertip))

    return bkt.ribbon.Menu(
        xmlns="http://schemas.microsoft.com/office/2009/07/customui",
        id=None,
        children=[
            PPTSymbolsGallery(label="{} ({})".format(cat,
                                                     len(categories[cat])),
                              symbols=categories[cat],
                              columns=16) for cat in sorted(categories.keys())
        ])
Ejemplo n.º 3
0
def get_content_categories():
    # Automatically generate categories from json file from https://gist.github.com/AmirOfir/daee915574b1ba0d877da90777dc2181
    file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "materialicons.json")
    with io.open(file, 'r') as json_file:
        chars = json.load(json_file, object_pairs_hook=OrderedDict)

    # categories = OrderedDict()
    categories = defaultdict(list)
    for char in chars['categories']:
        for ico in char['icons']:
            t = ("Material Icons", unichr(int(ico['codepoint'], 16)),
                 ico['name'], "Material Icons > {}\n{}".format(
                     char['name'].capitalize(),
                     ", ".join(ico.get('keywords', []))))
            categories[char['name'].capitalize()].append(t)

    return bkt.ribbon.Menu(
        xmlns="http://schemas.microsoft.com/office/2009/07/customui",
        id=None,
        children=[
            PPTSymbolsGallery(label="{} ({})".format(cat,
                                                     len(categories[cat])),
                              symbols=categories[cat],
                              columns=16) for cat in sorted(categories.keys())
        ])
Ejemplo n.º 4
0
    fabric_symbols3 = []
    fabric_symbols4 = []
    # fabric_symbols_mono = []
    chunk_size = ceil(len(chars)/4.0)
    for i,char in enumerate(chars):
        if not "unicode" in char:
            continue
        if 0 < i <= chunk_size:
            fabric_symbols1.append(("Fabric MDL2 Assets", unichr(int(char['unicode'], 16)), char['name'], "Fabric MDL2 Assets > 1"))
        elif chunk_size < i <= 2*chunk_size:
            fabric_symbols2.append(("Fabric MDL2 Assets", unichr(int(char['unicode'], 16)), char['name'], "Fabric MDL2 Assets > 2"))
        elif 2*chunk_size < i <= 3*chunk_size:
            fabric_symbols3.append(("Fabric MDL2 Assets", unichr(int(char['unicode'], 16)), char['name'], "Fabric MDL2 Assets > 3"))
        else:
            fabric_symbols4.append(("Fabric MDL2 Assets", unichr(int(char['unicode'], 16)), char['name'], "Fabric MDL2 Assets > 4"))
        # if char['name'] in mono_icons:
        #     fabric_symbols_mono.append(t)


# define the menu parts
menu_title = "Fabric MDL2 Assets"

menus = [
    PPTSymbolsGallery(label="Fabric MDL2 Assets 1 ({})".format(len(fabric_symbols1)), symbols=fabric_symbols1, columns=16),
    PPTSymbolsGallery(label="Fabric MDL2 Assets 2 ({})".format(len(fabric_symbols2)), symbols=fabric_symbols2, columns=16),
    PPTSymbolsGallery(label="Fabric MDL2 Assets 3 ({})".format(len(fabric_symbols3)), symbols=fabric_symbols3, columns=16),
    PPTSymbolsGallery(label="Fabric MDL2 Assets 4 ({})".format(len(fabric_symbols4)), symbols=fabric_symbols4, columns=16),
    # PPTSymbolsGallery(label="Fabric MDL2 Assets Mono ({})".format(len(fabric_symbols_mono)), symbols=fabric_symbols_mono, columns=16),
]

Ejemplo n.º 5
0
    # # hash for fa5-icons
    # # { icon_name: symbol-gallery-item, ...}
    # # symbol-gallery-item = [fontname, character-id, label]
    # fa5_icons_hash = {
    #     icon_name: [ [ font_name_hash[style], uid, "%s, unicode character %s, %s" % (font_name_hash[style], format(ord(uid), '02x'), icon_name)  ] for style in styles]
    #     for (icon_name, uid, styles) in fa5_icons
    # }


# define the menu parts

menu_title = 'Font Awesome 5 Free'

menu_settings = [
    # menu label,          list of symbols,       icons per row
    ('All Regular', all_fonts['regular'], 16),
    ('All Solid', all_fonts['solid'], 16),
    ('All Brands', all_fonts['brands'], 16),
]

menus = [
    PPTSymbolsGallery(label="{} ({})".format(label, len(symbollist)),
                      symbols=symbollist,
                      columns=columns)
    for (label, symbollist, columns) in menu_settings
] + [
    # submenu for categories
    bkt.ribbon.DynamicMenu(label="All Categories",
                           get_content=bkt.Callback(get_content_categories))
]
Ejemplo n.º 6
0
segoe_symbols1 = []
segoe_symbols2 = []
segoe_symbols3 = []
segoe_symbols4 = []

chunk_size = ceil(len(segoe_symbols)/4.0)
for i,char in enumerate(segoe_symbols):
    if 0 < i <= chunk_size:
        segoe_symbols1.append(("Segoe MDL2 Assets", char[0], char[1], "Segoe MDL2 Assets > 1"))
    elif chunk_size < i <= 2*chunk_size:
        segoe_symbols2.append(("Segoe MDL2 Assets", char[0], char[1], "Segoe MDL2 Assets > 2"))
    elif 2*chunk_size < i <= 3*chunk_size:
        segoe_symbols3.append(("Segoe MDL2 Assets", char[0], char[1], "Segoe MDL2 Assets > 3"))
    else:
        segoe_symbols4.append(("Segoe MDL2 Assets", char[0], char[1], "Segoe MDL2 Assets > 4"))


# define the menu parts
menu_title = "Segoe MDL2 Assets"


menus = [
    PPTSymbolsGallery(label="Segoe MDL2 Assets 1 ({})".format(len(segoe_symbols1)), symbols=segoe_symbols1, columns=16),
    PPTSymbolsGallery(label="Segoe MDL2 Assets 2 ({})".format(len(segoe_symbols2)), symbols=segoe_symbols2, columns=16),
    PPTSymbolsGallery(label="Segoe MDL2 Assets 3 ({})".format(len(segoe_symbols3)), symbols=segoe_symbols3, columns=16),
    PPTSymbolsGallery(label="Segoe MDL2 Assets 4 ({})".format(len(segoe_symbols4)), symbols=segoe_symbols4, columns=16),
]


Ejemplo n.º 7
0
    ("Segoe UI Emoji", u"🙁", "SLIGHTLY FROWNING FACE", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙂", "SLIGHTLY SMILING FACE", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙃", "UPSIDE-DOWN FACE", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙄", "FACE WITH ROLLING EYES", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙅", "FACE WITH NO GOOD GESTURE", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙆", "FACE WITH OK GESTURE", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙇", "PERSON BOWING DEEPLY", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙈", "SEE-NO-EVIL MONKEY", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙉", "HEAR-NO-EVIL MONKEY", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙊", "SPEAK-NO-EVIL MONKEY", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙋", "HAPPY PERSON RAISING ONE HAND",
     "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙌", "PERSON RAISING BOTH HANDS IN CELEBRATION",
     "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙍", "PERSON FROWNING", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙎", "PERSON WITH POUTING FACE", "Segoe UI Emoji"),
    ("Segoe UI Emoji", u"🙏", "PERSON WITH FOLDED HANDS", "Segoe UI Emoji"),
]

# define the menu parts
menu_title = "Segoe UI"

menus = [
    PPTSymbolsGallery(label="Segoe UI Symbol ({})".format(len(symbols_symbol)),
                      symbols=symbols_symbol,
                      columns=16),
    PPTSymbolsGallery(label="Segoe UI Emoji ({})".format(len(symbols_emoji)),
                      symbols=symbols_emoji,
                      columns=16),
]