Esempio n. 1
0
def get_geda_symbol_context(ident):
    symbol = tendril.gedaif.gsymlib.get_symbol(ident, get_all=True)
    symbol = [x for x in symbol if x.status != 'Generator']

    navpath = os.path.relpath(symbol[0].fpath, GEDA_SYMLIB_ROOT)
    navpath = os.path.join('browse', navpath)
    breadcrumbs = get_path_breadcrumbs(navpath, rootst="gEDA Symbol Library")
    if symbol[0].is_virtual:
        breadcrumbs.insert(-1, Crumb(name=os.path.splitext(symbol[0].fname)[0] + '.gen',  # noqa
                                     path='detail/' + os.path.splitext(symbol[0].fname)[0] + '.gen'))  # noqa

    stage = {'ident': ident,
             'symbol': symbol[0],
             'sympaths': [os.path.relpath(sym.fpath, GEDA_SYMLIB_ROOT) for sym in symbol],  # noqa
             'imgpaths': [sym.img_repr_fname for sym in symbol],
             'inclusion': supersets.get_symbol_inclusion(ident),
             'breadcrumbs': breadcrumbs}

    stage.update(get_inventory_stage(ident))
    return stage
Esempio n. 2
0
def get_geda_symbol_context(ident):
    symbol = tendril.gedaif.gsymlib.get_symbol(ident, get_all=True)
    symbol = [x for x in symbol if x.status != 'Generator']

    navpath = os.path.relpath(symbol[0].fpath, GEDA_SYMLIB_ROOT)
    navpath = os.path.join('browse', navpath)
    breadcrumbs = get_path_breadcrumbs(navpath, rootst="gEDA Symbol Library")
    if symbol[0].is_virtual:
        breadcrumbs.insert(-1, Crumb(name=os.path.splitext(symbol[0].fname)[0] + '.gen',  # noqa
                                     path='detail/' + os.path.splitext(symbol[0].fname)[0] + '.gen'))  # noqa

    cobom = supersets.get_bom_superset()
    line = cobom.find_by_ident(ident)
    cards = None
    if line:
        cards = []
        for idx, column in enumerate(line.columns):
            if column > 0:
                cardname = cobom.descriptors[idx].configname
                configs = cobom.descriptors[idx].configurations
                carddesc = configs.description(cardname)
                pcbstatus = configs.status_config(cardname)
                proj = configs.pcbname
                projdesc = configs.description()
                projstatus = configs.status
                cards.append(context_cardlisting(
                    cardname, carddesc, pcbstatus, column,
                    proj, projdesc, projstatus))

    cards = _status_filter(cards)
    inclusion = _group_by_pcbname(cards)

    stage = {'ident': ident,
             'symbol': symbol[0],
             'sympaths': [os.path.relpath(sym.fpath, GEDA_SYMLIB_ROOT) for sym in symbol],  # noqa
             'imgpaths': [sym.img_repr_fname for sym in symbol],
             'inclusion': inclusion,
             'breadcrumbs': breadcrumbs}

    stage.update(get_inventory_stage(ident))
    return stage
Esempio n. 3
0
def pcbs(pcbname=None):
    pcblib = get_pcb_lib()
    if pcbname is None:
        stage_pcbs = [v for k, v in viewitems(pcblib)]
        stage = {
            'pcbs':
            sorted([x for x in stage_pcbs], key=lambda y: (y.status, y.ident)),
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Bare PCBs", path="pcbs/")
            ]
        }
        return render_template('entityhub_pcbs.html',
                               stage=stage,
                               pagetitle="Bare PCBs")
    else:
        prototype = pcblib[pcbname]
        stage = {
            'prototype':
            prototype,
            'imgs':
            get_img_list(prototype.projfolder),
            'costing':
            get_pcb_costing_chart(prototype.projfolder),
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Bare PCBs", path="pcbs/"),
                Crumb(name=pcbname, path="pcbs/" + pcbname)
            ]
        }
        ident = 'PCB ' + pcbname
        stage.update(get_inventory_stage(ident))
        return render_template('entityhub_pcb_detail.html',
                               stage=stage,
                               pagetitle="PCB Detail {0}".format(pcbname))
Esempio n. 4
0
def pcbs(pcbname=None):
    pcblib = get_pcb_lib()
    if pcbname is None:
        stage_pcbs = [v for k, v in viewitems(pcblib)]
        stage = {'pcbs': sorted([x for x in stage_pcbs],
                                key=lambda y: (y.status, y.ident)),
                 'crumbroot': '/entityhub',
                 'breadcrumbs': [Crumb(name="Entity Hub", path=""),
                                 Crumb(name="Bare PCBs", path="pcbs/")]}
        return render_template('entityhub_pcbs.html', stage=stage,
                               pagetitle="Bare PCBs")
    else:
        prototype = pcblib[pcbname]
        stage = {'prototype': prototype,
                 'imgs': get_img_list(prototype.projfolder),
                 'costing': get_pcb_costing_chart(prototype.projfolder),
                 'crumbroot': '/entityhub',
                 'breadcrumbs': [Crumb(name="Entity Hub", path=""),
                                 Crumb(name="Bare PCBs", path="pcbs/"),
                                 Crumb(name=pcbname, path="pcbs/" + pcbname)]}
        ident = 'PCB ' + pcbname
        stage.update(get_inventory_stage(ident))
        return render_template('entityhub_pcb_detail.html', stage=stage,
                               pagetitle="PCB Detail {0}".format(pcbname))