Skip to content

Commit

Permalink
Don't polute top namespace with configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
avian2 committed Mar 13, 2014
1 parent 19ada4b commit 648974a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions eagle_automation/export.py
@@ -1,4 +1,4 @@
from eagle_automation.config import *
from eagle_automation import config
import os
import subprocess
import tempfile
Expand Down Expand Up @@ -29,7 +29,7 @@ def export(self, in_path, layers, out_paths):

script_string = ';'.join(script)

cmd = [EAGLE, "-C" + script_string, in_path]
cmd = [config.EAGLE, "-C" + script_string, in_path]
subprocess.call(cmd)

self.clean()
Expand All @@ -56,7 +56,7 @@ def write_script(self, extension, layers, out_paths):

script += [ "DISPLAY None",
"DISPLAY %s" % (' '.join(layer['layers']),),
"EXPORT IMAGE %s MONOCHROME %d" % (out_path, DPI)
"EXPORT IMAGE %s MONOCHROME %d" % (out_path, config.DPI)
]

return script
Expand All @@ -75,7 +75,7 @@ def write_script(self, extension, layers, out_paths):

for layer, out_path in zip(layers, out_paths):

ll = set(layer['layers']) | set(DOCUMENT_LAYERS)
ll = set(layer['layers']) | set(config.DOCUMENT_LAYERS)

script += [ "DISPLAY None",
"DISPLAY %s" % (' '.join(ll),),
Expand Down Expand Up @@ -180,7 +180,7 @@ def export(self, in_path, layers, out_paths):
options = ["-X", "-d" + self.DEVICE, "-o" + out_path]
if layer.get('mirror'):
options.append("-m")
cmd = [EAGLE] + options + [in_path] + layer['layers']
cmd = [config.EAGLE] + options + [in_path] + layer['layers']
subprocess.call(cmd)

class EagleGerberExport(EagleCAMExport):
Expand Down
6 changes: 3 additions & 3 deletions eaglediff
@@ -1,7 +1,7 @@
#!/usr/bin/python

import os
from eagle_automation.config import *
from eagle_automation import config
from eagle_automation.export import BadExtension, EaglePNGExport
import sys
import tempfile
Expand All @@ -13,9 +13,9 @@ def to_png(in_path):

extension = in_path.split('.')[-1].lower()
if extension == 'brd':
layers = LAYERS.values()
layers = config.LAYERS.values()
out_paths = [ os.path.join(workdir, layer + '.png')
for layer in LAYERS.iterkeys() ]
for layer in config.LAYERS.iterkeys() ]
elif extension == 'sch':
layers = [{'layers': ['ALL']}]
out_paths = [os.path.join(workdir, 'all.png')]
Expand Down
6 changes: 3 additions & 3 deletions eagleexport
@@ -1,7 +1,7 @@
#!/usr/bin/python

import os
from eagle_automation.config import *
from eagle_automation import config
from eagle_automation.export import EaglePNGExport, \
EaglePDFExport, \
EagleGerberExport, \
Expand All @@ -25,7 +25,7 @@ type can be any of %s
layer can be any of %s""" % (
', '.join(out_types.iterkeys()),
', '.join(LAYERS.iterkeys()) )
', '.join(config.LAYERS.iterkeys()) )

sys.exit(1)

Expand All @@ -51,7 +51,7 @@ def main():
sys.exit(1)

try:
layer = LAYERS[layer_name]
layer = config.LAYERS[layer_name]
except KeyError:
print "Unknown layer: " + layer_name
sys.exit(1)
Expand Down

0 comments on commit 648974a

Please sign in to comment.