Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redid Folder Structure and added readmes
- Loading branch information
DDC
committed
Feb 14, 2012
1 parent
ef654e0
commit bf8d7e5
Showing
12 changed files
with
115 additions
and
710 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
""" | ||
Holds all information about a board | ||
in list format. | ||
""" | ||
from Eagle import Drawing | ||
|
||
class Board(Drawing): | ||
__slots__=() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
""" | ||
Eagle.py | ||
Describes an instance of an eagle File | ||
""" | ||
from xml.etree.ElementTree import ElementTree | ||
from Board import Board | ||
from Schematic import Schematic | ||
from Library import Library | ||
|
||
class Eagle(): | ||
__slots__=('version','compatability','drawing') | ||
|
||
def __init__(self,root): | ||
self.version=root.get('version') | ||
self.drawing=Drawing(root.find('drawing')) | ||
|
||
class Drawing(): | ||
__slots__=('settings','grid','layers','EdaDoc') | ||
|
||
def __init__(self,Node): | ||
self.settings={} | ||
self.grid={} | ||
self.layers={} | ||
self.getSettings(Node.find('settings')) | ||
self.getGrid(Node.find('grid')) | ||
self.getLayers(Node.find('layers')) | ||
self.getEDA(Node) | ||
|
||
def getGrid(self,gridNode): | ||
# <!ELEMENT grid EMPTY> | ||
# <!ATTLIST grid | ||
# distance %Real; #IMPLIED | ||
# unitdist %GridUnit; #IMPLIED | ||
# unit %GridUnit; #IMPLIED | ||
# style %GridStyle; "lines" | ||
# multiple %Int; "1" | ||
# display %Bool; "no" | ||
# altdistance %Real; #IMPLIED | ||
# altunitdist %GridUnit; #IMPLIED | ||
# altunit %GridUnit; #IMPLIED | ||
self.grid=gridNode.attrib | ||
|
||
def getSettings(self,settingsNode): | ||
for setting in settingsNode.findall('setting'): | ||
for key in setting.keys(): | ||
self.settings[key]=setting.get(key) | ||
|
||
def getLayers(self,layersNode): | ||
for layer in list(layersNode):#._children: | ||
self.layers[layer.get('number')]=Layer(layer) | ||
|
||
def getEDA(self,drawingRoot): | ||
if not drawingRoot.find('library')==None: | ||
self.EdaDoc=Library(drawingRoot.find('library')) | ||
elif not drawingRoot.find('schematic'): | ||
self.EdaDoc=Schematic(drawingRoot.find('schematic')) | ||
elif not drawingRoot.find('board'): | ||
self.EdaDoc=Board(drawingRoot.find('board')) | ||
|
||
class Layer(): | ||
__slots__=('attributes') | ||
def __init__(self,LayerNode): | ||
self.attributes=LayerNode.attrib | ||
|
||
|
||
if __name__ == '__main__': | ||
""" Parse an Eagle XML file into a design """ | ||
xmltree = ElementTree(file='test.xml') | ||
root = xmltree.getroot() | ||
eagle=Eagle(root) | ||
print('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
''' | ||
Created on Jan 23, 2012 | ||
@author: Dan | ||
''' | ||
|
||
class Library(object): | ||
''' | ||
classdocs | ||
''' | ||
|
||
|
||
def __init__(self,schematicNode): | ||
''' | ||
Constructor | ||
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
''' | ||
Created on Jan 23, 2012 | ||
@author: Dan | ||
''' | ||
|
||
class Schematic(object): | ||
''' | ||
classdocs | ||
''' | ||
|
||
|
||
def __init__(self,schematicNode): | ||
''' | ||
Constructor | ||
''' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Note that these files are not implemented yet |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Note that these files are not implemented yet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Note that these files are not implemented yet |
File renamed without changes.