Merge lp:~brandontschaefer/autopilot/move-ibus-over-to-unity into lp:autopilot

Proposed by Brandon Schaefer on 2013-08-05
Status: Merged
Approved by: Thomi Richards on 2014-02-10
Approved revision: 424
Merged at revision: 424
Proposed branch: lp:~brandontschaefer/autopilot/move-ibus-over-to-unity
Merge into: lp:autopilot
Diff against target: 165 lines (+0/-150)
2 files modified
autopilot/ibus.py (+0/-149)
debian/control (+0/-1)
To merge this branch: bzr merge lp:~brandontschaefer/autopilot/move-ibus-over-to-unity
Reviewer Review Type Date Requested Status
Thomi Richards (community) 2013-08-05 Approve on 2014-02-10
PS Jenkins bot continuous-integration Approve on 2013-08-05
Review via email: mp+178612@code.launchpad.net

Commit message

Remove ibus.py from autopilot, as it should live in lp:unity.

Description of the change

Remove ibus.py from autopilot, as it should live in lp:unity.

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

The ibus code has landed in unity7, we can now remove this from autopilot.

review: Approve

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'autopilot/ibus.py'
2--- autopilot/ibus.py 2013-09-05 09:38:04 +0000
3+++ autopilot/ibus.py 1970-01-01 00:00:00 +0000
4@@ -1,149 +0,0 @@
5-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
6-#
7-# Autopilot Functional Test Tool
8-# Copyright (C) 2012-2013 Canonical
9-#
10-# This program is free software: you can redistribute it and/or modify
11-# it under the terms of the GNU General Public License as published by
12-# the Free Software Foundation, either version 3 of the License, or
13-# (at your option) any later version.
14-#
15-# This program is distributed in the hope that it will be useful,
16-# but WITHOUT ANY WARRANTY; without even the implied warranty of
17-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18-# GNU General Public License for more details.
19-#
20-# You should have received a copy of the GNU General Public License
21-# along with this program. If not, see <http://www.gnu.org/licenses/>.
22-#
23-
24-
25-"""Functions to deal with ibus service."""
26-
27-from __future__ import absolute_import
28-
29-from gi.repository import IBus, GLib
30-import os
31-import logging
32-import subprocess
33-from gi.repository import GConf
34-
35-
36-logger = logging.getLogger(__name__)
37-
38-
39-def get_ibus_bus():
40- """Get the ibus bus object, possibly starting the ibus daemon if it's
41- not already running.
42-
43- :raises: **RuntimeError** in the case of ibus-daemon being unavailable.
44-
45- """
46- bus = IBus.Bus()
47- if bus.is_connected():
48- return bus
49-
50- main_loop = GLib.MainLoop()
51-
52- timeout = 5
53- GLib.timeout_add_seconds(timeout, lambda *args: main_loop.quit())
54- bus.connect("connected", lambda *args: main_loop.quit())
55-
56- os.spawnlp(os.P_NOWAIT, "ibus-daemon", "ibus-daemon", "--xim")
57-
58- main_loop.run()
59-
60- if not bus.is_connected():
61- raise RuntimeError(
62- "Could not start ibus-daemon after %d seconds." % (timeout))
63- return bus
64-
65-
66-def get_available_input_engines():
67- """Get a list of available input engines."""
68- bus = get_ibus_bus()
69- return [e.get_name() for e in bus.list_engines()]
70-
71-
72-def get_active_input_engines():
73- """Get the list of input engines that have been activated."""
74- bus = get_ibus_bus()
75- return [e.get_name() for e in bus.list_active_engines()]
76-
77-
78-def set_active_engines(engine_list):
79- """Installs the engines in *engine_list* into the list of active iBus
80- engines.
81-
82- The specified engines must appear in the return list from
83- get_available_input_engines().
84-
85- .. note:: This function removes all other engines.
86-
87- This function returns the list of engines installed before this function
88- was called. The caller should pass this list to set_active_engines to
89- restore ibus to it's old state once the test has finished.
90-
91- :param engine_list: List of engine names
92- :type engine_list: List of strings
93- :raises: **TypeError** on invalid *engine_list* parameter.
94- :raises: **ValueError** when engine_list contains invalid engine name.
95-
96- """
97- if type(engine_list) is not list:
98- raise TypeError("engine_list must be a list of valid engine names.")
99- available_engines = get_available_input_engines()
100- for engine in engine_list:
101- if not isinstance(engine, str):
102- raise TypeError("Engines in engine_list must all be strings.")
103- if engine not in available_engines:
104- raise ValueError(
105- "engine_list contains invalid engine name: '%s'", engine)
106-
107- bus = get_ibus_bus()
108- config = bus.get_config()
109-
110- config.set_value("general",
111- "preload_engine_mode",
112- GLib.Variant.new_int32(IBus.PreloadEngineMode.USER))
113-
114- old_engines = get_active_input_engines()
115- config.set_value(
116- "general", "preload_engines", GLib.Variant("as", engine_list))
117-
118- return old_engines
119-
120-
121-def set_gconf_option(path, value):
122- """Set the gconf setting on `path` to the defined `value`"""
123- _set_gconf_list(path, value)
124-
125-
126-def get_gconf_option(path):
127- """Get the gconf setting on `path`"""
128- client = GConf.Client.get_default()
129- value = client.get(path)
130- return _get_native_gconf_value(value)
131-
132-
133-def _set_gconf_list(path, values):
134- gconf_value = '[%s]' % ','.join(values)
135- subprocess.check_output(
136- ["gconftool-2", "--set", "--type=list", "--list-type=string", path,
137- gconf_value])
138-
139-
140-def _get_native_gconf_value(value):
141- """Translates a GConfValue to a native one"""
142- if value.type is GConf.ValueType.STRING:
143- return value.get_string()
144- elif value.type is GConf.ValueType.INT:
145- return value.get_int()
146- elif value.type is GConf.ValueType.FLOAT:
147- return value.get_float()
148- elif value.type is GConf.ValueType.BOOL:
149- return value.get_bool()
150- elif value.type is GConf.ValueType.LIST:
151- return [_get_native_gconf_value(val) for val in value.get_list()]
152- else:
153- raise TypeError("Invalid gconf value type")
154
155=== modified file 'debian/control'
156--- debian/control 2014-01-29 20:48:43 +0000
157+++ debian/control 2014-02-10 20:07:11 +0000
158@@ -146,7 +146,6 @@
159 gir1.2-gconf-2.0,
160 gir1.2-glib-2.0,
161 gir1.2-gtk-3.0,
162- gir1.2-ibus-1.0,
163 python-autopilot,
164 python-xlib,
165 bamfdaemon,

Subscribers

People subscribed via source and target branches