]> Dogcows Code - chaz/openbox/blobdiff - tools/themeupdate/themeupdate.py
rename back the app_selected appearances to app_hilite
[chaz/openbox] / tools / themeupdate / themeupdate.py
index ba41ae269d2bc4e131067ffc06c8fa6b53faee53..171be0b9595d3ea73f6bb37fd98f7fd3d2150a46 100755 (executable)
@@ -41,7 +41,6 @@ def simple_replace(data):
     pairs['window.unfocus.font'] = 'window.label.unfocus.font'
     pairs['window.justify'] = 'window.label.justify'
     pairs['menu.frame.disableColor'] = 'menu.disabled.textColor'
-    pairs['style.']  = 'info.'
     pairs['menu.frame'] = 'menu.items'
     pairs['menu.hilite'] = 'menu.selected'
     pairs['.picColor'] = '.imageColor'
@@ -60,11 +59,22 @@ def simple_replace(data):
 def remove(data):
     invalid = []
     invalid.append('toolbar')
+    for inv in invalid:
+        while 1:
+            i, key, nul = find_key(data, inv)
+            if i >= 0:
+                out(key + ' is no longer supported.\nRemove (Y/n)? ')
+                if read_bool():
+                    out('Removing "' + key + '"\n')
+                    data.pop(i)
+            else:
+                break
     invalid.append('rootCommand')
+    invalid.append('menu.bullet')
     invalid.append('menu.frame.justify')
     for inv in invalid:
         while 1:
-            i, key, nul = find_key(data, inv)
+            i, key, nul = find_key(data, inv, True)
             if i >= 0:
                 out(key + ' is no longer supported.\nRemove (Y/n)? ')
                 if read_bool():
@@ -165,6 +175,21 @@ def xft_fonts(data):
             out('Removing ' + key + '\n')
             data.pop(i)
 
+def pixelsize(data):
+    fonts = ('window.label.focus.font',
+             'menu.items.font',
+             'menu.title.font')
+    for f in fonts:
+        i, key, value = find_key(data, f, True)
+        if value:
+            if value.find('pixelsize') == -1:
+                out('*** ERROR *** The ' + key + ' font size is not being '
+                    'specified by pixelsize. It is recommended that you use '
+                    'pixelsize instead of pointsize for specifying theme '
+                    'fonts. e.g. "sans:pixelsize=12"\n')
+                global valid
+                valid = False
+
 def warn_missing(data):
     need = ('window.button.hover.focus',  'window.button.hover.unfocus',
             'menuOverlap')
@@ -187,8 +212,7 @@ def err_missing(data):
 
 
 def usage():
-    print 'Usage: ' + sys.argv[0] + ' /path/to/themerc > newthemerc'
-    print
+    out('Usage: themupdate.py /path/to/themerc > newthemerc\n\n')
     sys.exit()
 
 try:
@@ -196,8 +220,7 @@ try:
 except IndexError:
     usage()
 except IOError:
-    print 'Unable to open file "' + sys.argv[1] + '"'
-    print
+    out('Unable to open file "' + sys.argv[1] + '"\n\n')
     usage()
 
 data = file.readlines()
@@ -209,6 +232,7 @@ remove(data)
 pressed(data)
 x_fonts(data)
 xft_fonts(data)
+pixelsize(data)
 warn_missing(data)
 err_missing(data)
 
This page took 0.023862 seconds and 4 git commands to generate.