def addnamebars(lines, horiz, vert): for line in lines: m = area.add_module('Name', name=toascii(line)) m.horiz = horiz m.vert = vert vert += 1 return vert
def __init__(self, nmarea, g2area, nmmodule, options): '''Convert(nmarea, g2area, nmmodule, options) -> Convert create a convert object from a nm1 module in nmarea to g2area. ''' self.nmarea = nmarea self.g2area = g2area nmm = self.nmmodule = nmmodule nmm.conv = self # to get back here when needed (cables) self.options = options # use for cabling for output in nmmodule.outputs: output.conv = self for input in nmmodule.inputs: input.conv = self self.g2modules = [] self.params = [] self.outputs = [] self.inputs = [] # create main module and setup size requirements g2m = self.g2module = g2area.add_module(self.maing2module) g2m.name = toascii(nmm.name) self.horiz = g2m.horiz = nmm.horiz self.height = g2m.type.height # setup parameters from parammap static member of convert module class self.params = [None] * len(self.parammap) for i, param in enumerate(self.parammap): if type(param) == type(''): setv(getattr(g2m.params, param), getv(getattr(nmm.params, param))) self.params[i] = getattr(g2m.params, param) elif type(param) == type([]): setv(getattr(g2m.params, param[0]), getv(getattr(nmm.params, param[1]))) self.params[i] = getattr(g2m.params, param[0]) else: self.params[ i] = param # None: placeholder for other parameters # setup inputs from inputmap static member of convert module class self.inputs = [getattr(g2m.inputs, i, None) for i in self.inputmap] # setup outputs from outputmap static member of convert module class self.outputs = [getattr(g2m.outputs, o, None) for o in self.outputmap]
def __init__(self, nmarea, g2area, nmmodule, options): """Convert(nmarea, g2area, nmmodule, options) -> Convert create a convert object from a nm1 module in nmarea to g2area. """ self.nmarea = nmarea self.g2area = g2area nmm = self.nmmodule = nmmodule nmm.conv = self # to get back here when needed (cables) self.options = options # use for cabling for output in nmmodule.outputs: output.conv = self for input in nmmodule.inputs: input.conv = self self.g2modules = [] self.params = [] self.outputs = [] self.inputs = [] # create main module and setup size requirements g2m = self.g2module = g2area.add_module(self.maing2module) g2m.name = toascii(nmm.name) self.horiz = g2m.horiz = nmm.horiz self.height = g2m.type.height # setup parameters from parammap static member of convert module class self.params = [None] * len(self.parammap) for i, param in enumerate(self.parammap): if type(param) == type(""): setv(getattr(g2m.params, param), getv(getattr(nmm.params, param))) self.params[i] = getattr(g2m.params, param) elif type(param) == type([]): setv(getattr(g2m.params, param[0]), getv(getattr(nmm.params, param[1]))) self.params[i] = getattr(g2m.params, param[0]) else: self.params[i] = param # None: placeholder for other parameters # setup inputs from inputmap static member of convert module class self.inputs = [getattr(g2m.inputs, i, None) for i in self.inputmap] # setup outputs from outputmap static member of convert module class self.outputs = [getattr(g2m.outputs, o, None) for o in self.outputmap]