示例#1
0
    def _get_isinfo(self):
        # qty = electronics_qty.get_compliant_qty(self.ident, self.quantity)
        if self.ident.startswith("PCB"):
            from tendril.entityhub.modules import get_pcb_lib

            pcblib = get_pcb_lib()
            ident = self.ident[len("PCB ") :]
            if ident in pcblib.keys():
                symbol = pcblib[ident]
            else:
                self._isinfo = None
                self._sourcing_exception = SourcingIdentNotRecognized(
                    self.parent.sourcing_policy, self.ident, self.refdeslist
                )
                return
        else:
            try:
                symbol = get_symbol(self.ident)
            except NoGedaSymbolException:
                self._isinfo = None
                self._sourcing_exception = SourcingIdentNotRecognized(
                    self.parent.sourcing_policy, self.ident, self.refdeslist
                )
                return
        try:
            self._isinfo = symbol.indicative_sourcing_info[0]
        except IndexError:
            self._isinfo = None
            self._sourcing_exception = SourcingIdentNotSourceable(
                self.parent.sourcing_policy, self.ident, self.refdeslist
            )
示例#2
0
文件: views.py 项目: SayCV/tendril
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))
示例#3
0
文件: views.py 项目: chintal/tendril
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))