Reading gEDA schematic/symbol files. More...
Classes | |
class | FileFormat |
Describes the properties of a gEDA schematic/symbol file format version. More... | |
Functions | |
def | parse_token |
Helper function for sscanf. More... | |
def | sscanf |
Parse a string of space-separated values. More... | |
def | strip_carriage_return |
Replace "\r\n" line endings with "\n" line endings. More... | |
def | read_file |
Read a symbol or schematic file in libgeda format from a file object. More... | |
def | pin_update_whichend |
Guess the orientation of pins. More... | |
def | read_circle |
Read a circle object from a string in gEDA format. More... | |
def | read_arc |
Read an arc object from a string in gEDA format. More... | |
def | read_box |
Read a box object from a string in gEDA format. More... | |
def | read_bus |
Read a bus object from a string in gEDA format. More... | |
def | read_complex |
Read a component object from a string in gEDA format. More... | |
def | read_line |
Read a line object from a string in gEDA format. More... | |
def | read_net |
Read a net object from a string in gEDA format. More... | |
def | read_path |
Read a path object from a string and a file in gEDA format. More... | |
def | read_picture |
Read a picture object from a string and a file in gEDA format. More... | |
def | read_pin |
Read a pin object from a string in gEDA format. More... | |
def | read_text |
Read a text object from a string and a file in gEDA format. More... | |
Reading gEDA schematic/symbol files.
The gEDA file format is a space separated list of characters and numbers in plain ASCII. The meaning of each item is described in the file format documentation which can be found in doc/geda/file_format_spec
or here.
def xorn.geda.plainread.parse_token | ( | s, | |
fmt | |||
) |
Helper function for sscanf.
Definition at line 91 of file plainread.py.
def xorn.geda.plainread.pin_update_whichend | ( | rev, | |
force_boundingbox, | |||
log | |||
) |
Guess the orientation of pins.
Calculates the bounding box of all pins in the revision. The end of a pin that is closer to the boundary of the box is set as the active end.
None
.Definition at line 375 of file plainread.py.
def xorn.geda.plainread.read_arc | ( | buf, | |
origin_x, | |||
origin_y, | |||
format, | |||
log | |||
) |
Read an arc object from a string in gEDA format.
A negative or null radius is not allowed.
xorn.geda.read.ParseError | if the string could not be parsed |
ValueError | if buf doesn't describe a arc object |
Definition at line 449 of file plainread.py.
def xorn.geda.plainread.read_box | ( | buf, | |
origin_x, | |||
origin_y, | |||
format, | |||
log | |||
) |
Read a box object from a string in gEDA format.
xorn.geda.read.ParseError | if the string could not be parsed |
ValueError | if buf doesn't describe a box object |
Definition at line 500 of file plainread.py.
def xorn.geda.plainread.read_bus | ( | buf, | |
origin_x, | |||
origin_y, | |||
format, | |||
log | |||
) |
Read a bus object from a string in gEDA format.
xorn.geda.read.ParseError | if the string could not be parsed |
ValueError | if buf doesn't describe a bus object |
Definition at line 568 of file plainread.py.
def xorn.geda.plainread.read_circle | ( | buf, | |
origin_x, | |||
origin_y, | |||
format, | |||
log | |||
) |
Read a circle object from a string in gEDA format.
xorn.geda.read.ParseError | if the string could not be parsed |
ValueError | if buf doesn't describe a circle object |
Definition at line 384 of file plainread.py.
def xorn.geda.plainread.read_complex | ( | buf, | |
origin_x, | |||
origin_y, | |||
format, | |||
log, | |||
load_symbol | |||
) |
Read a component object from a string in gEDA format.
If the symbol is not embedded, use the function load_symbol to load it from the component library.
xorn.geda.read.ParseError | if the string could not be parsed |
ValueError | if buf doesn't describe a component object |
Definition at line 615 of file plainread.py.
def xorn.geda.plainread.read_file | ( | f, | |
name, | |||
log, | |||
load_symbol, | |||
load_pixmap, | |||
force_boundingbox = False |
|||
) |
Read a symbol or schematic file in libgeda format from a file object.
[in] | f | A file-like object from which to read |
[in] | name | The file name displayed in warning and error messages |
[in] | log | An object to which errors are logged |
[in] | load_symbol | Function for loading referenced symbol files |
[in] | load_pixmap | Function for loading referenced pixmap files |
[in] | force_boundingbox | currently unused |
xorn.geda.read.ParseError | if the file is not a valid gEDA schematic/symbol file |
Definition at line 172 of file plainread.py.
def xorn.geda.plainread.read_line | ( | buf, | |
origin_x, | |||
origin_y, | |||
format, | |||
log | |||
) |
Read a line object from a string in gEDA format.
xorn.geda.read.ParseError | if the string could not be parsed |
ValueError | if buf doesn't describe a line object |
Definition at line 656 of file plainread.py.
def xorn.geda.plainread.read_net | ( | buf, | |
origin_x, | |||
origin_y, | |||
format, | |||
log | |||
) |
Read a net object from a string in gEDA format.
xorn.geda.read.ParseError | if the string could not be parsed |
ValueError | if buf doesn't describe a net object |
Definition at line 704 of file plainread.py.
def xorn.geda.plainread.read_path | ( | first_line, | |
f, | |||
origin_x, | |||
origin_y, | |||
format, | |||
log | |||
) |
Read a path object from a string and a file in gEDA format.
Creates a path object from the string first_line and reads as many lines describing the path as specified there from f.
xorn.geda.read.ParseError | if the string could not be parsed |
xorn.geda.read.ParseError | if not enough lines could be read from the file |
ValueError | if first_line doesn't describe a path object |
Definition at line 743 of file plainread.py.
def xorn.geda.plainread.read_picture | ( | first_line, | |
f, | |||
origin_x, | |||
origin_y, | |||
format, | |||
log, | |||
load_pixmap | |||
) |
Read a picture object from a string and a file in gEDA format.
Creates a picture object from the string first_line. If the pixmap is not embedded, uses the function load_pixmap to load it from an external file. If the pixmap is embedded, reads its data in base64 encoding from f.
xorn.geda.read.ParseError | if the string could not be parsed |
xorn.geda.read.ParseError | if the picture data could be read from the file |
ValueError | if first_line doesn't describe a picture object |
Definition at line 808 of file plainread.py.
def xorn.geda.plainread.read_pin | ( | buf, | |
origin_x, | |||
origin_y, | |||
format, | |||
log | |||
) |
Read a pin object from a string in gEDA format.
xorn.geda.read.ParseError | if the string could not be parsed |
ValueError | if buf doesn't describe a pin object |
Definition at line 875 of file plainread.py.
def xorn.geda.plainread.read_text | ( | first_line, | |
f, | |||
origin_x, | |||
origin_y, | |||
format, | |||
log | |||
) |
Read a text object from a string and a file in gEDA format.
Creates a text object from the string first_line and reads as many lines of text as specified there from f.
xorn.geda.read.ParseError | if the string could not be parsed |
xorn.geda.read.ParseError | if not enough lines could be read from the file |
ValueError | if first_line doesn't describe a text object |
Definition at line 939 of file plainread.py.
def xorn.geda.plainread.sscanf | ( | s, | |
fmt | |||
) |
Parse a string of space-separated values.
This is a mock-up version of the standard sscanf(3)
. The format string must consist of zero or more tokens separated by a space, optionally followed by a newline character. The format string must exactly match this pattern. Only the tokens %c
, %d
, %s
, and %u
are allowed.
ValueError | if the string does not match the format |
ValueError | if an invalid format token is passed |
Definition at line 124 of file plainread.py.
def xorn.geda.plainread.strip_carriage_return | ( | f | ) |
Replace "\r\n" line endings with "\n" line endings.
Definition at line 148 of file plainread.py.