diff options
author | John Willis | 2009-06-08 14:47:38 +0000 |
---|---|---|
committer | John Willis | 2009-06-08 14:47:38 +0000 |
commit | e78edd8ef6450a61f89a40ae6d8f7e9656a28237 (patch) | |
tree | 2ab7a8cc8c1a347fcbef826beece87cfb34221be /backends/vkeybd/packs/vkeybdpack.py | |
parent | 87db37316c6d2cd410592cea278727d700cbc2f5 (diff) | |
download | scummvm-rg350-e78edd8ef6450a61f89a40ae6d8f7e9656a28237.tar.gz scummvm-rg350-e78edd8ef6450a61f89a40ae6d8f7e9656a28237.tar.bz2 scummvm-rg350-e78edd8ef6450a61f89a40ae6d8f7e9656a28237.zip |
Virtual Keyboard: Move vkeybd.zip into packs folder and rename default keyboard pack to vkeybd_default(.zip) with updates to default-events.cpp. Also update vkeybdpack.py to use zlib compression if Python zlib is found. Update GP2X and GP2XWiz bundle files to get new vkeybd_default.zip.
svn-id: r41373
Diffstat (limited to 'backends/vkeybd/packs/vkeybdpack.py')
-rwxr-xr-x | backends/vkeybd/packs/vkeybdpack.py | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/backends/vkeybd/packs/vkeybdpack.py b/backends/vkeybd/packs/vkeybdpack.py index e7b1c63543..130e4b737b 100755 --- a/backends/vkeybd/packs/vkeybdpack.py +++ b/backends/vkeybd/packs/vkeybdpack.py @@ -4,6 +4,11 @@ import sys import re import os import zipfile +try: + import zlib + compression = zipfile.ZIP_DEFLATED +except: + compression = zipfile.ZIP_STORED PACK_FILE_EXTENSIONS = ('.xml', '.bmp') @@ -14,12 +19,14 @@ def buildPack(packName): zf = zipfile.ZipFile(packName + ".zip", 'w') + zf.compress_type = zipfile.ZIP_DEFLATED + print ("Building '" + packName + "' pack:") os.chdir(packName) for filename in os.listdir('.'): if os.path.isfile(filename) and not filename[0] == '.' and filename.endswith(PACK_FILE_EXTENSIONS): - zf.write(filename, './' + filename) + zf.write(filename, './' + filename, compress_type=compression) print (" Adding file: " + filename) os.chdir('../') @@ -30,24 +37,7 @@ def buildAllPacks(): for f in os.listdir('.'): if os.path.isdir(os.path.join('.', f)) and not f[0] == '.': buildPack(f) - -def parseSTX(pack_file, def_file): - comm = re.compile("<!--(.*?)-->", re.DOTALL) - head = re.compile("<\?(.*?)\?>") - output = "" - for line in pack_file: - output += line.rstrip("\r\n\t ").lstrip() + " \n" - - output = re.sub(comm, "", output) - output = re.sub(head, "", output) - output = output.replace("\t", " ").replace(" ", " ").replace("\"", "'") - output = output.replace(" = ", "=").replace(", ", ",") - - for line in output.splitlines(): - if line and not line.isspace(): - def_file.write("\"" + line + "\"\n") - def printUsage(): print ("===============================================") print ("ScummVM Virtual Keyboard Pack Generation Script") |