add more checks, for fonts, and for missing stuff
This commit is contained in:
parent
48cc1758e4
commit
a32fffbb6c
1 changed files with 31 additions and 16 deletions
|
@ -3,6 +3,7 @@
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
|
valid = True
|
||||||
|
|
||||||
def out(str):
|
def out(str):
|
||||||
sys.stderr.write(str)
|
sys.stderr.write(str)
|
||||||
|
@ -21,14 +22,15 @@ def getkeyval(line):
|
||||||
key = value = None
|
key = value = None
|
||||||
return key, value
|
return key, value
|
||||||
|
|
||||||
def find_key(data, keysubstr):
|
def find_key(data, keysubstr, exact = False):
|
||||||
i = 0
|
i = 0
|
||||||
n = len(data)
|
n = len(data)
|
||||||
while i < n:
|
while i < n:
|
||||||
l = data[i]
|
l = data[i]
|
||||||
key, value = getkeyval(l)
|
key, value = getkeyval(l)
|
||||||
if key and value:
|
if key and value:
|
||||||
if key.find(keysubstr) != -1:
|
if (exact and key == keysubstr) or \
|
||||||
|
(not exact and key.find(keysubstr) != -1):
|
||||||
return i, key, value
|
return i, key, value
|
||||||
i += 1
|
i += 1
|
||||||
return -1, None, None
|
return -1, None, None
|
||||||
|
@ -72,12 +74,13 @@ def remove(data):
|
||||||
break
|
break
|
||||||
|
|
||||||
def pressed(data):
|
def pressed(data):
|
||||||
i, nul, nul = find_key(data, 'window.button.pressed')
|
i, nul, nul = find_key(data, 'window.button.pressed', True)
|
||||||
if i >= 0:
|
if i >= 0:
|
||||||
out('The window.button.pressed option has been replaced by ' +
|
out('The window.button.pressed option has been replaced by ' +
|
||||||
'window.button.pressed.focus and ' +
|
'window.button.pressed.focus and ' +
|
||||||
'window.button.pressed.unfocus.\nUpdate (Y/n)? ')
|
'window.button.pressed.unfocus.\nUpdate (Y/n)? ')
|
||||||
if read_bool():
|
if read_bool():
|
||||||
|
l = data[i]
|
||||||
out('Removing "window.button.pressed"\n')
|
out('Removing "window.button.pressed"\n')
|
||||||
data.pop(i)
|
data.pop(i)
|
||||||
out('Adding "window.button.pressed.unfocus"\n')
|
out('Adding "window.button.pressed.unfocus"\n')
|
||||||
|
@ -162,17 +165,25 @@ def xft_fonts(data):
|
||||||
out('Removing ' + key + '\n')
|
out('Removing ' + key + '\n')
|
||||||
data.pop(i)
|
data.pop(i)
|
||||||
|
|
||||||
|
def warn_missing(data):
|
||||||
|
need = ('window.button.hover.focus', 'window.button.hover.unfocus',
|
||||||
|
'menuOverlap')
|
||||||
|
for n in need:
|
||||||
|
i, nul, nul = find_key(data, n)
|
||||||
|
if i < 0:
|
||||||
|
out('The ' + n + ' value was not found in the theme, but it '
|
||||||
|
'can optionally be set.\n')
|
||||||
|
|
||||||
|
def err_missing(data):
|
||||||
|
need = ('window.button.disabled.focus', 'window.button.disabled.unfocus',
|
||||||
|
'window.frame.focusColor', 'window.frame.unfocusColor')
|
||||||
|
for n in need:
|
||||||
|
i, nul, nul = find_key(data, n)
|
||||||
|
if i < 0:
|
||||||
|
out('*** ERROR *** The ' + n + ' value was not found in the '
|
||||||
|
'theme, but it is required to be set.\n')
|
||||||
|
global valid
|
||||||
|
valid = False
|
||||||
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
|
@ -194,10 +205,14 @@ for i in range(len(data)):
|
||||||
data[i] = data[i].strip()
|
data[i] = data[i].strip()
|
||||||
|
|
||||||
simple_replace(data)
|
simple_replace(data)
|
||||||
#remove(data)
|
remove(data)
|
||||||
#pressed(data)
|
pressed(data)
|
||||||
#x_fonts(data)
|
x_fonts(data)
|
||||||
xft_fonts(data)
|
xft_fonts(data)
|
||||||
|
warn_missing(data)
|
||||||
|
err_missing(data)
|
||||||
|
|
||||||
for l in data:
|
for l in data:
|
||||||
print l
|
print l
|
||||||
|
|
||||||
|
sys.exit(not valid)
|
||||||
|
|
Loading…
Reference in a new issue