當前位置: 首頁>>代碼示例>>Python>>正文


Python ComponentInstance.conns方法代碼示例

本文整理匯總了Python中upconvert.core.component_instance.ComponentInstance.conns方法的典型用法代碼示例。如果您正苦於以下問題:Python ComponentInstance.conns方法的具體用法?Python ComponentInstance.conns怎麽用?Python ComponentInstance.conns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在upconvert.core.component_instance.ComponentInstance的用法示例。


在下文中一共展示了ComponentInstance.conns方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: parse_inst

# 需要導入模塊: from upconvert.core.component_instance import ComponentInstance [as 別名]
# 或者: from upconvert.core.component_instance.ComponentInstance import conns [as 別名]
    def parse_inst(self, args):
        """ Returns a parsed component instance. """
        inst, libname, libnum, x, y, rot, _scale, _b = args.split()
        # scale is a floating point scaling constant. Also, evil.
        thisinst = ComponentInstance(inst, self.lookup(libname, libnum), 0)
        if int(rot) > 3:
            # part is flipped around y-axis. When applying transforms, flip it
            # first, then rotate it.
            rot = str(int(rot) - 4)
            # flip = True

        thisinst.add_symbol_attribute(SymbolAttribute(int(x), int(y),
                                                      float(rot) / 2))
        subdata = defaultdict(list)
        for phrase in self.stream:
            cmd, _sep, args = phrase.partition(' ')
            if cmd not in ('|R', 'A', 'C'):
                self.stream.push(phrase)
                break
            k, v = self.parsenode(cmd)(args)
            subdata[k].append(v)
        for annot in subdata['annot']:
            thisinst.symbol_attributes[0].add_annotation(annot)
            if '=' in annot.value:
                thisinst.add_attribute(*(annot.value.split('=', 1)))

        # Turns out C can reference a net before it's been created via
        # the N command. Really don't like passing stuff inband like this. Ugh.
        thisinst.conns = subdata['conn']
        return ('inst', thisinst)
開發者ID:ch3ka,項目名稱:schematic-file-converter,代碼行數:32,代碼來源:viewdraw.py

示例2: parse_inst

# 需要導入模塊: from upconvert.core.component_instance import ComponentInstance [as 別名]
# 或者: from upconvert.core.component_instance.ComponentInstance import conns [as 別名]
    def parse_inst(self, args):
        """ Returns a parsed component instance. """
        inst, libname, libnum, x, y, rot, _scale, _unknown = args.split()
        # scale is a floating point scaling constant. Also, evil.
        thisinst = ComponentInstance(inst, self.lookup(libname, libnum), 0)
        flip = False
        if int(rot) > 3:
            # part is flipped around y-axis. When applying transforms, flip it
            # first, then rotate it.
            rot = str(int(rot) - 4)
            flip = True

        thisinst.add_symbol_attribute(SymbolAttribute(int(x), int(y),
                                                      (2 - float(rot) / 2) % 2,
                                                      flip))
        subdata = self.sub_nodes('|R A C'.split())
        for annot in subdata['annot']:
            thisinst.symbol_attributes[0].add_annotation(annot)
            if '=' in annot.value:
                thisinst.add_attribute(*(annot.value.split('=', 1)))

        # Turns out C can reference a net before it's been created via
        # the N command. Really don't like passing stuff inband like this. Ugh.
        thisinst.conns = subdata['conn']
        return ('inst', thisinst)
開發者ID:ncsaba,項目名稱:schematic-file-converter,代碼行數:27,代碼來源:viewdraw.py

示例3: parse_inst

# 需要導入模塊: from upconvert.core.component_instance import ComponentInstance [as 別名]
# 或者: from upconvert.core.component_instance.ComponentInstance import conns [as 別名]
    def parse_inst(self, args):
        """ Returns a parsed component instance. """
        inst, libname, libnum, x, y, rot, scale, _unknown = args.split()
        # scale is a floating point scaling constant. Also, evil.
        if scale != '1':
            libkey = self.scaled_component(libname, libnum, scale)
        else:
            libkey = self.lookup(libname, libnum)
        thisinst = ComponentInstance(inst, libkey, 0)
        rot, flip = self.rot_and_flip(rot)
        thisinst.add_symbol_attribute(SymbolAttribute(int(x), int(y),
                                                      rot, flip))
        subdata = self.sub_nodes('|R A C'.split())
        for annot in subdata['annot']:
            thisinst.symbol_attributes[0].add_annotation(annot)
            if '=' in annot.value:
                thisinst.add_attribute(*(annot.value.split('=', 1)))

        # Turns out C can reference a net before it's been created via
        # the N command. Really don't like passing stuff inband like this. Ugh.
        thisinst.conns = subdata['conn']
        return ('inst', thisinst)
開發者ID:patrickyeon,項目名稱:schematic-file-converter,代碼行數:24,代碼來源:viewdraw.py


注:本文中的upconvert.core.component_instance.ComponentInstance.conns方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。