예제 #1
0
파일: acquire.py 프로젝트: SayCV/tendril
def gen_canonical_transform(elec_inven_data_idx, regen=True):
    # TODO Support Unified Transforms?
    reader = get_reader(elec_inven_data_idx)
    if not reader:
        return
    outp = reader.tf_path
    outf = fsutils.VersionedOutputFile(outp)
    outw = csv.writer(outf)
    outw.writerow(
        ('Current', 'gEDA Current', 'Ideal', 'Status', 'In Symlib')
    )
    for line in reader.row_gen:
        if regen and reader.tf.has_contextual_repr(line[0]):
            if gsymlib.is_recognized(reader.tf.get_canonical_repr(line[0])):
                in_symlib = 'YES'
            else:
                in_symlib = ''
            outw.writerow((line[0],
                           reader.tf.get_canonical_repr(line[0]),
                           reader.tf.get_ideal_repr(line[0]),
                           reader.tf.get_status(line[0]),
                           in_symlib,))
        else:
            if gsymlib.is_recognized(line[0]):
                in_symlib = True
            else:
                in_symlib = False
            outw.writerow((line[0], line[0], line[0], 'NEW', in_symlib))
    outf.close()
예제 #2
0
파일: acquire.py 프로젝트: chintal/tendril
def gen_canonical_transform(elec_inven_data_idx, regen=True):
    sdict = config.ELECTRONICS_INVENTORY_DATA[elec_inven_data_idx]
    if sdict['type'] == 'QuazarStockXLS':
        fpath = sdict['fpath']
        if not os.path.isabs(fpath):
            fpath = config.get_svn_path(fpath)
        sname = sdict['sname']
        location = sdict['location']
        tfpath = sdict['tfpath']

        rdr = get_stockxlsreader(fpath, sname, location, tfpath)

        outp = tfpath
        outf = fsutils.VersionedOutputFile(outp)
        outw = csv.writer(outf)
        outw.writerow(
            ('Current', 'gEDA Current', 'Ideal', 'Status', 'In Symlib')
        )
        for line in rdr.row_gen:
            if regen and rdr.tf.has_contextual_repr(line[0]):
                if gsymlib.is_recognized(rdr.tf.get_canonical_repr(line[0])):
                    in_symlib = 'YES'
                else:
                    in_symlib = ''
                outw.writerow((line[0],
                               rdr.tf.get_canonical_repr(line[0]),
                               rdr.tf.get_ideal_repr(line[0]),
                               rdr.tf.get_status(line[0]),
                               in_symlib,))
            else:
                if gsymlib.is_recognized(line[0]):
                    in_symlib = True
                else:
                    in_symlib = False
                outw.writerow((line[0], line[0], line[0], 'NEW', in_symlib))
        outf.close()
예제 #3
0
 def update_on_disk(self):
     # TODO this function makes the implementation somewhat specific
     # to inventory transforms. Consider refactoring.
     outf = fsutils.VersionedOutputFile(self._tfpath)
     outw = csv.writer(outf)
     outw.writerow(
         ('Current', 'gEDA Current', 'Ideal', 'Status', 'In Symlib')
     )
     for name in self.names:
         canonical = self.get_canonical_repr(name)
         if gsymlib.is_recognized(canonical):
             in_symlib = 'YES'
         else:
             in_symlib = ''
         outw.writerow((name,
                        canonical,
                        self.get_ideal_repr(name),
                        self.get_status(name),
                        in_symlib,))
     outf.close()
예제 #4
0
파일: views.py 프로젝트: chintal/tendril
def update_transform(location_idx):
    loc = invelectronics.get_inventory_location(idx=location_idx)
    form = TransformUpdateForm(names=loc.tf.names)
    if form.validate_on_submit():
        contextual = form.contextual.data
        if contextual in loc.tf.names:
            canonical = form.canonical.data
            status = form.status.data
            loc.tf.set_canonical_repr(contextual, canonical)
            loc.tf.set_status(contextual, status)
            loc.tf.update_on_disk()
            return jsonify({
                'success': True,
                'contextual': contextual,
                'canonical': canonical,
                'status': status,
                'in_symlib': gsymlib.is_recognized(canonical)
            })
        else:
            return jsonify({'success': False})
예제 #5
0
 def update_on_disk(self):
     # TODO this function makes the implementation somewhat specific
     # to inventory transforms. Consider refactoring.
     outf = fsutils.VersionedOutputFile(self._tfpath)
     outw = csv.writer(outf)
     outw.writerow(
         ('Current', 'gEDA Current', 'Ideal', 'Status', 'In Symlib'))
     for name in self.names:
         canonical = self.get_canonical_repr(name)
         if gsymlib.is_recognized(canonical):
             in_symlib = 'YES'
         else:
             in_symlib = ''
         outw.writerow((
             name,
             canonical,
             self.get_ideal_repr(name),
             self.get_status(name),
             in_symlib,
         ))
     outf.close()
예제 #6
0
def in_gsymlib(ident):
    return gsymlib.is_recognized(ident)
예제 #7
0
def is_recognized(ident):
    if gsymlib.is_recognized(ident):
        return True
    if ident in pcblib:
        return True
    return False
예제 #8
0
파일: orders.py 프로젝트: chintal/tendril
 def in_gsymlib(self):
     if gsymlib.is_recognized(self.ident):
         return "YES"
     return None
예제 #9
0
파일: orders.py 프로젝트: chintal/tendril
 def in_gsymlib(self):
     if gsymlib.is_recognized(self.ident):
         return "YES"
     return None
예제 #10
0
def in_gsymlib(ident):
    return gsymlib.is_recognized(ident)
예제 #11
0
파일: projects.py 프로젝트: chintal/tendril
def is_recognized(ident):
    if gsymlib.is_recognized(ident):
        return True
    if ident in pcblib:
        return True
    return False