summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-26 03:13:24 +0000
committermazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-26 03:13:24 +0000
commit193583a1d99a1a0e784821b34060f5f8bf45c90d (patch)
tree3217a410d0f150919cc95e855835ea12b5120467
parent92c376630a160d4aee6d76191f97d2b7cebfce09 (diff)
downloadchromium_src-193583a1d99a1a0e784821b34060f5f8bf45c90d.zip
chromium_src-193583a1d99a1a0e784821b34060f5f8bf45c90d.tar.gz
chromium_src-193583a1d99a1a0e784821b34060f5f8bf45c90d.tar.bz2
Remove the part of generating xkeyboard_data.h from gen_keyboard_overlay_data.py.
xkeyboard_data.h is no longer necessary. BUG=None TEST=The scripts runs as before Review URL: https://chromiumcodereview.appspot.com/10823020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148501 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xtools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py74
1 files changed, 5 insertions, 69 deletions
diff --git a/tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py b/tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py
index 683e949..6272240 100755
--- a/tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py
+++ b/tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py
@@ -17,9 +17,6 @@ and output the data depending on the option.
--js: Rewrites the entire JavaScript code in
chrome/browser/resources/keyboard_overlay/keyboard_overlay_data.js
- --altgr: Rewrites a list of layouts in
- chrome/browser/chromeos/input_method/xkeyboard.cc
-
These options can be specified at the same time.
e.g.
@@ -27,8 +24,8 @@ python gen_keyboard_overlay_data.py --cc --grd --js
The output directory of the generated files can be changed with --outdir.
-e.g. (This will generate tmp/xkeyboard.cc)
-python gen_keyboard_overlay_data.py --outdir=tmp --altgr
+e.g. (This will generate tmp/keyboard_overlay.js)
+python gen_keyboard_overlay_data.py --outdir=tmp --js
"""
import cStringIO
@@ -53,8 +50,6 @@ GRD_OUTDIR = 'chrome/app'
GRD_FILENAME = 'generated_resources.grd'
JS_OUTDIR = 'chrome/browser/resources/chromeos'
JS_FILENAME = 'keyboard_overlay_data.js'
-ALTGR_OUTDIR = 'chrome/browser/chromeos/input_method'
-ALTGR_FILENAME = 'xkeyboard_data.h'
CC_START = r'IDS_KEYBOARD_OVERLAY_INSTRUCTIONS_HIDE },'
CC_END = r'};'
GRD_START = """Escape to hide
@@ -176,30 +171,6 @@ GRD_SNIPPET_TEMPLATE=""" <message name="%s" desc="%s">
CC_SNIPPET_TEMPLATE=""" { "%s", %s },
"""
-ALTGR_TEMPLATE=(
-"""// This file was generated by 'gen_keyboard_overlay_data.py --altgr'
-
-#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_XKEYBOARD_DATA_H_
-#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_XKEYBOARD_DATA_H_
-
-namespace chromeos {
-namespace input_method {
-
-// These are the input method IDs that shouldn't remap the right alt key.
-const char* kKeepRightAltInputMethods[] = {
-%s
-};
-
-// These are the overlay names with caps lock remapped
-const char* kCapsLockRemapped[] = {
-%s
-};
-
-} // input_method
-} // chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_XKEYBOARD_DATA_H_
-""")
def SplitBehavior(behavior):
"""Splits the behavior to compose a message or i18n-content value.
@@ -285,8 +256,6 @@ def ParseOptions():
help='Output resource file.')
parser.add_option('--cc', dest='cc', default=False, action='store_true',
help='Output cc file.')
- parser.add_option('--altgr', dest='altgr', default=False, action='store_true',
- help='Output altgr file.')
parser.add_option('--outdir', dest='outdir', default=None,
help='Specify the directory files are generated.')
(options, unused_args) = parser.parse_args()
@@ -295,8 +264,8 @@ def ParseOptions():
print 'google.com account is necessary to use this script.'
sys.exit(-1)
- if (not (options.js or options.grd or options.cc or options.altgr)):
- print 'Either --js, --grd, --cc or --altgr needs to be specified.'
+ if (not (options.js or options.grd or options.cc)):
+ print 'Either --js, --grd, or --cc needs to be specified.'
sys.exit(-1)
# Get the password from the terminal, if needed.
@@ -535,43 +504,12 @@ def OutputCC(hotkey_data, outdir):
outdir)
-def OutputAltGr(keyboard_glyph_data, outdir):
- """Outputs the keyboard overlay data as a JSON file."""
- altgr_output = []
- caps_lock_output = []
-
- for input_method_id, layout in INPUT_METHOD_ID_TO_OVERLAY_ID.iteritems():
- try:
- # If left and right alt have different values, this layout to the list of
- # layouts that don't remap the right alt key.
- right_alt = keyboard_glyph_data[layout]["keys"]["E0 38"]["label"].strip()
- left_alt = keyboard_glyph_data[layout]["keys"]["38"]["label"].strip()
- if right_alt.lower() != left_alt.lower():
- altgr_output.append(' "%s",' % input_method_id)
- except KeyError:
- pass
-
- try:
- caps_lock = keyboard_glyph_data[layout]["keys"]["E0 5B"]["label"].strip()
- if caps_lock.lower() != "search":
- caps_lock_output.append(' "%s",' % input_method_id)
- except KeyError:
- pass
-
- if not outdir:
- outdir = ALTGR_OUTDIR
- outpath = GetPath(os.path.join(outdir, ALTGR_FILENAME))
- snippet = ALTGR_TEMPLATE % ("\n".join(sorted(altgr_output)),
- "\n".join(sorted(caps_lock_output)))
- OutputFile(outpath, snippet)
-
-
def main():
options = ParseOptions()
client = InitClient(options)
hotkey_data = FetchHotkeyData(client)
- if options.js or options.altgr:
+ if options.js:
keyboard_glyph_data = FetchKeyboardGlyphData(client)
if options.js:
@@ -582,8 +520,6 @@ def main():
OutputGrd(hotkey_data, options.outdir)
if options.cc:
OutputCC(hotkey_data, options.outdir)
- if options.altgr:
- OutputAltGr(keyboard_glyph_data, options.outdir)
if __name__ == '__main__':