27 from gettext
import gettext
as _
34 if instance
in netsY_by_instance:
38 netsY_by_instance[instance] = netY
40 for other_instance
in cmap.connected_to(instance):
41 traverse_net(cmap, other_instance, netsY_by_instance, netY)
46 def __init__(self, rev, filename, netlister_run):
47 if rev.is_transient():
57 for ob
in rev.toplevel_objects():
62 if data.symbol.prim_objs
is None:
64 ob, _(
"%s: symbol not found") % data.symbol.basename)
71 netsY_by_instance = {}
75 if instance
not in netsY_by_instance:
86 sys.stderr.write(_(
"%s: error: %s\n") % (self.
filename, msg))
87 self.netlister_run.failed =
True
90 sys.stderr.write(_(
"%s: warning: %s\n") % (self.
filename, msg))
94 sys.stderr.write(_(
"%s:%sx%s: error: %s\n") % (
96 self.netlister_run.failed =
True
100 sys.stderr.write(_(
"%s:%sx%s: warning: %s\n") % (
114 return '%d' % (coord / 100, )
116 return '%d.%d' % (coord / 100, (coord % 100) / 10)
117 return '%d.%02d' % (coord / 100, coord % 100)
139 self.
error =
lambda msg: self.schematic.error_object(self.
ob, msg)
140 self.
warn =
lambda msg: self.schematic.warn_object(self.
ob, msg)
142 schematic.components.append(self)
143 schematic.components_by_ob[ob] = self
151 'refdes', search_inherited =
False)
155 'uref', search_inherited =
False)
159 self.
warn(_(
"Found uref=%s. uref= is deprecated, please use "
166 assert data.symbol.prim_objs
is not None
169 data.symbol.prim_objs).toplevel_objects():
170 pin_data = pin_ob.data()
174 assert pin_data.is_pin
177 pin =
Pin(self, pin_ob)
193 if not values
and search_inherited:
219 for value
in raw_values:
220 if value
not in values:
224 self.
error(_(
"inconsistent values for \"%s\": %s") % (
225 name, _(
" vs. ").join(_(
"\"%s\"") % value
226 for value
in values)))
228 elif len(raw_values) > 1:
229 self.
warn(_(
"multiple definitions of \"%s=%s\"")
232 if not values
or values[0] ==
'unknown':
233 if default != KeyError:
240 attribs = self.ob.attached_objects()
246 for attrib
in attribs:
250 found_name, found_value = \
252 except xorn.geda.attrib.MalformedAttributeException:
255 if found_value !=
'unknown':
256 if found_name
not in l:
280 component.pins.append(self)
308 for value
in raw_values:
309 if value
not in values:
313 self.
error(_(
"inconsistent values for \"%s\": %s") % (
314 name, _(
" vs. ").join(_(
"\"%s\"") % value
315 for value
in values)))
317 elif len(raw_values) > 1:
318 self.
warn(_(
"multiple definitions of \"%s=%s\"")
322 if self.
ob is None and name ==
'pintype':
325 if default != KeyError:
333 refdes = self.component.refdes
335 refdes =
'<no refdes>'
336 data = self.component.ob.data()
337 sys.stderr.write(_(
"%s:%s-%s(%sx%s): error: %s\n") % (
338 self.component.schematic.filename, refdes, self.
number,
340 self.component.schematic.netlister_run.failed =
True
344 refdes = self.component.refdes
346 refdes =
'<no refdes>'
347 data = self.component.ob.data()
348 sys.stderr.write(_(
"%s:%s-%s(%sx%s): warning: %s\n") % (
349 self.component.schematic.filename, refdes, self.
number,
360 self.
is_bus = instances
and instances[0][1].data().is_bus
363 for path, ob
in instances:
364 assert ob.data().is_bus == self.
is_bus
366 self.net_segments.append(ob)
369 schematic.components_by_ob[path[0]].pins_by_ob[ob])
372 self.net_segments.sort(key =
lambda ob: ob.location()[1])
373 self.pins.sort(key =
lambda pin: (pin.component.ob.location()[1],
374 pin.ob.location()[1]))
382 self.schematic.warn_object(ob,
383 _(
"label= is deprecated, please use netname="))
386 if len(self.
names) > 1:
388 _(
"multiple names on a single net: %s")
389 % _(
" vs. ").join(_(
"\"%s\"") % name
for name
in self.
names))
391 schematic.nets.append(self)
Attribute parsing and lookup.
Find and track the connections between net segments.
Schematic net segment, bus segment, or pin.
Pin in a single schematic's netlist.
Visually connected net piece in a single schematic's netlist.
High-level revision proxy class.
refdes
Determine the refdes to use for a particular object.
def get_attribute
Get the value of an attached or inherited attribute.
def find_inherited_attribs
Return the attributes inherited by a component via its symbol.
def format_coord
Format an integer coordinate for printing in an error message.
def search_inherited
Search attributes inherited by a component for an attribute name and return matching values...
def search_attached
Search attributes attached to a net or component for an attribute name and return matching values...
number
The "identifier" of the pin.
Schematic text or attribute.
High-level proxy classes for the storage backend.
A netlist for a single schematic.
Tracks the connections of the net segments in a revision at a time.
def get_attributes
Get all attribute values for a given attribute name.
def get_attributes
Get all attribute values for a given attribute name.
def all_net_instances_in_revision
Returns all net instances in a given revision.
Component in a single schematic's netlist.
def parse_string
Parse an attribute string of the form name=value into its name and value parts.
def get_attribute
Get the value of an attribute.