This commit is contained in:
Gergely Polonkai 2015-11-04 17:30:48 +01:00
parent 1dfc4601d7
commit 8806876046
4 changed files with 23 additions and 1 deletions

View File

@ -95,3 +95,13 @@ class Formatter(object):
if c.type == INT_ARG or c.type == STRING_ARG or c.type == FLOAT_ARG or c.type == DOUBLE_ARG:
no = c.data
args[no - 1] = c.type
self.__commands = commands
def getMessage(self):
ret = ''
for command in self.__commands:
ret += command['data']
return repr(ret)

View File

@ -82,11 +82,15 @@ def loadResources(selfPath):
resources = ResourcesCollection(dirs)
msg.load(resources)
return resources
def main(script, *args):
ensureDirExists(os.environ["HOME"] + "/.einstein")
loadResources(sys.argv[0])
resources = loadResources(sys.argv[0])
initScreen()
initAudio()
# menu()
# getStorage().flush()
resources.dump()

View File

@ -60,6 +60,8 @@ class Messages(object):
"message": Formatter(data, msgOffset),
}
print("{}: {}".format(name, self.__messages[name]['message'].getMessage()))
offset += sz + 4

View File

@ -216,4 +216,10 @@ class ResourcesCollection:
for resource in self.__groups[group]:
func(resource)
def dump(self):
for name, resource in self.__resources.items():
for variant in resource.variants:
with open('resources/' + name, 'wb') as f:
f.write(variant.getData())
resources = None