Merge lp:~ralsina/ubuntuone-control-panel/no-scroll-overlay into lp:ubuntuone-control-panel

Proposed by Roberto Alsina
Status: Merged
Approved by: Roberto Alsina
Approved revision: 342
Merged at revision: 338
Proposed branch: lp:~ralsina/ubuntuone-control-panel/no-scroll-overlay
Merge into: lp:ubuntuone-control-panel
Diff against target: 72 lines (+37/-0)
2 files modified
ubuntuone/controlpanel/gui/qt/main/__init__.py (+10/-0)
ubuntuone/controlpanel/gui/qt/main/tests/test_main.py (+27/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-control-panel/no-scroll-overlay
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
dobey (community) Approve
Review via email: mp+117757@code.launchpad.net

Commit message

 - Prevented loading of the scrollbar overlay (Fix LP:1007421).

Description of the change

Manipulate GTK_MODULES so that the scrollbar overlay that breaks Qt apps is not loaded.

To test IRL, start u1cp on Quantal and see if you can see any devices or folders. If you can, the fix worked.

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

Can you please add a comment why we're doing this here, and include the LP:BUGNO for the bug?

review: Needs Fixing
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Please add tests, and move this code inside the main module.

review: Needs Fixing
Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Looks good; tests pass on Precise and Windows 7.

review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/gui/qt/main/__init__.py'
2--- ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-06-28 04:25:16 +0000
3+++ ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-08-01 20:23:18 +0000
4@@ -17,6 +17,7 @@
5 """Provide the correct ui main module."""
6
7 import argparse
8+import os
9 import sys
10
11 from PyQt4 import QtCore
12@@ -69,6 +70,15 @@
13
14 def main(args, install_reactor_darwin=False):
15 """Start the Qt mainloop and open the main window."""
16+
17+ # Disable the overlay-scrollbar GTK module that was
18+ # added in Ubuntu 12.10 because it breaks Qt (LP:1007421)
19+ gtk_mod = os.getenv('GTK_MODULES')
20+ if gtk_mod is not None:
21+ gtk_mod = ':'.join([mod for mod in
22+ gtk_mod.split(':') if mod != 'overlay-scrollbar'])
23+ os.environ['GTK_MODULES'] = gtk_mod
24+
25 # The following cannot be imported outside this function
26 # because u1trial already provides a reactor.
27
28
29=== modified file 'ubuntuone/controlpanel/gui/qt/main/tests/test_main.py'
30--- ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-06-28 04:14:08 +0000
31+++ ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-08-01 20:23:18 +0000
32@@ -16,6 +16,7 @@
33
34 """Tests for the control panel's Qt main."""
35
36+import os
37 import sys
38
39 from PyQt4 import QtCore
40@@ -146,6 +147,32 @@
41 (['ubuntuone-installer', sys.argv[0]],
42 ('ubuntuone-control-panel',), {}))
43
44+ def _test_gtk_module_cleanup(self, modules, expected):
45+ """Check if the module cleanup works."""
46+ old_modules = os.environ.get('GTK_MODULES', '')
47+
48+ def clean_env():
49+ """Reset the environment variable."""
50+ os.environ['GTK_MODULES'] = old_modules
51+
52+ self.addCleanup(clean_env)
53+ os.environ['GTK_MODULES'] = modules
54+ main.main([sys.argv[0]])
55+ self.assertEqual(os.environ['GTK_MODULES'], expected)
56+
57+ def test_gtk_module_cleanup_1(self):
58+ """Test that we deactivate the overlay scrollbar GTK module."""
59+ self._test_gtk_module_cleanup('aaa:overlay-scrollbar:bbb', 'aaa:bbb')
60+
61+ def test_gtk_module_cleanup_2(self):
62+ """Test that we deactivate the overlay scrollbar GTK module."""
63+ self._test_gtk_module_cleanup('overlay-scrollbar', '')
64+
65+ def test_gtk_module_cleanup_3(self):
66+ """Test that we deactivate the overlay scrollbar GTK module."""
67+ self._test_gtk_module_cleanup('overlay-scrollbar:overlay-scrollbars',
68+ 'overlay-scrollbars')
69+
70 def test_title_not_fail(self):
71 """Ensure -title is removed before it gets to argparse."""
72 main.main([sys.argv[0], "-title"])

Subscribers

People subscribed via source and target branches