Commit 0ca1209c authored by Nathan/Eilisha Shiraini's avatar Nathan/Eilisha Shiraini
Browse files

Implemented the interface between the code builder and image builder

parent 4fc3b325
......@@ -25,6 +25,44 @@ class AztecBuilder(object):
from the building blocks defined in all the other packages.
"""
def __init__(self, data):
self.__data = data
self.__size = None
self.__prepared = None
self.__wordcount = None
@property
def size(self):
if self.__size is None:
self.prepare()
return self.__size
@size.setter
def size(self, value):
self.__prepared = None
self.__size = value
@property
def data(self):
return self.__data
@data.setter
def data(self, value):
self.__init__(value)
def prepare(self):
prepared, layers, compact, wordcount = self.prepareData(self.__data, *self.__size)
self.__prepared = prepared
self.__size = (layers, compact)
self.__wordcount = wordcount
def encode(self):
if self.__prepared is None:
self.prepare()
matrix, _, _, _ = self.prepareDataMatrix(self.__prepared, self.__size[0], self.__size[1], self.__wordcount)
self.applyRefGrid(matrix, self.__size[0], self.__size[1], self.__wordcount)
return matrix
@staticmethod
def prepareData(data, forceLayers = None, forceCompact = None):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment