Refactor a little

pulled all rendering stuff out of the pcb/layer objects
This commit is contained in:
Hamilton Kibbe 2016-01-01 12:25:38 -05:00
parent 5430fa6738
commit 6a005436b4
5 changed files with 68 additions and 74 deletions

View file

@ -16,6 +16,8 @@
# limitations under the License.
from .render import RenderSettings
COLORS = {
'black': (0.0, 0.0, 0.0),
'white': (1.0, 1.0, 1.0),
@ -33,14 +35,6 @@ COLORS = {
}
class RenderSettings(object):
def __init__(self, color, alpha=1.0, invert=False, mirror=False):
self.color = color
self.alpha = alpha
self.invert = invert
self.mirror = mirror
class Theme(object):
def __init__(self, name=None, **kwargs):
self.name = 'Default' if name is None else name
@ -57,8 +51,13 @@ class Theme(object):
def __getitem__(self, key):
return getattr(self, key)
def get(self, key, noneval=None):
val = getattr(self, key)
return val if val is not None else noneval
THEMES = {
'Default': Theme(),
'default': Theme(),
'OSH Park': Theme(name='OSH Park',
top=RenderSettings(COLORS['enig copper']),
bottom=RenderSettings(COLORS['enig copper']),