Added "excellon_zeros" application default. It get propagated to the Excellon class.

This commit is contained in:
Juan Pablo Caram
2015-01-18 21:10:19 -05:00
parent 34a6b60053
commit 670dd48127
2 changed files with 24 additions and 6 deletions

View File

@@ -242,7 +242,8 @@ class App(QtCore.QObject):
"zoom_in_key": '3',
"zoom_ratio": 1.5,
"point_clipboard_format": "(%.4f, %.4f)",
"zdownrate": None #
"zdownrate": None,
"excellon_zeros": "L"
})
###############################
@@ -1765,13 +1766,26 @@ class App(QtCore.QObject):
def propagate_defaults(self):
self.log.debug("propagate_defaults()")
# Which objects to update the given parameters.
routes = {
"zdownrate": CNCjob
"zdownrate": CNCjob,
"excellon_zeros": Excellon
}
for param in routes:
routes[param].defaults[param] = self.defaults[param]
if param in routes[param].defaults:
routes[param].defaults[param] = self.defaults[param]
self.log.debug(" " + param + " OK")
else:
# Try extracting the name:
# classname_param here is param in the object
if param.find(routes[param].__name__.lower() + "_") == 0:
p = param[len(routes[param].__name__) + 1:]
if p in routes[param].defaults:
routes[param].defaults[p] = self.defaults[param]
self.log.debug(" " + param + " OK!")
def plot_all(self):
"""
@@ -2239,7 +2253,7 @@ class App(QtCore.QObject):
if param in self.defaults:
self.defaults[param] = value
self.propagate_defaults()
return
return "Ok"
return "ERROR: No such system parameter."

View File

@@ -1778,7 +1778,11 @@ class Excellon(Geometry):
================ ====================================
"""
def __init__(self, zeros="L"):
defaults = {
"zeros": "L"
}
def __init__(self, zeros=None):
"""
The constructor takes no parameters.
@@ -1797,7 +1801,7 @@ class Excellon(Geometry):
# Trailing "T" or leading "L" (default)
#self.zeros = "T"
self.zeros = zeros
self.zeros = zeros or self.defaults["zeros"]
# Attributes to be included in serialization
# Always append to it because it carries contents