Merge lp:~brandontschaefer/unity/get-real-ibus-activate-shortcut into lp:unity

Proposed by Brandon Schaefer on 2013-09-18
Status: Merged
Approved by: Christopher Townsend on 2013-09-18
Approved revision: 3495
Merged at revision: 3517
Proposed branch: lp:~brandontschaefer/unity/get-real-ibus-activate-shortcut
Merge into: lp:unity
Diff against target: 35 lines (+24/-2)
1 file modified
tests/autopilot/unity/tests/test_ibus.py (+24/-2)
To merge this branch: bzr merge lp:~brandontschaefer/unity/get-real-ibus-activate-shortcut
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve on 2013-09-18
Christopher Townsend 2013-09-18 Approve on 2013-09-18
Review via email: mp+186406@code.launchpad.net

Commit message

Get the real shortcut to activate ibus.

Description of the change

Use ibus config to get the list of shortcuts to activate ibus. Use the first one, we have to do some simple string manipulation. As IBus uses <mod><mod><mod>key for its string, and autopilot uses mod+mod+mod+key, so just replace all '>' with a +, and ignore all '<'.

To post a comment you must log in.
Christopher Townsend (townsend) wrote :

LGTM +1

review: Approve
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity/tests/test_ibus.py'
2--- tests/autopilot/unity/tests/test_ibus.py 2013-08-12 22:59:42 +0000
3+++ tests/autopilot/unity/tests/test_ibus.py 2013-09-18 17:58:34 +0000
4@@ -118,8 +118,30 @@
5 This method adds a cleanUp to reset the old keys once the test is done.
6
7 """
8- # FIXME Need to set this using gsettings...removed old gconf code for now
9- self.activate_binding = 'Control+space'
10+ bus = get_ibus_bus()
11+ config = bus.get_config()
12+
13+ variant = config.get_value('general/hotkey', 'triggers')
14+ shortcuts = []
15+
16+ # If none, assume default
17+ if variant != None:
18+ shortcuts = variant.unpack()
19+ else:
20+ shortcuts = ['<Super>space']
21+
22+ # IBus uses the format '<mod><mod><mod>key'
23+ # Autopilot uses the format 'mod+mod+mod+key'
24+ # replace all > with a +, and ignore the < char
25+
26+ shortcut = ""
27+ for c in shortcuts[0]:
28+ if c == '>':
29+ shortcut += '+'
30+ elif c != '<':
31+ shortcut += c
32+
33+ self.activate_binding = shortcut
34 activate_release_binding_option = 'Alt+Release+Control_L'
35 self.activate_release_binding = 'Alt+Control_L'
36