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
=== modified file 'ubuntuone/controlpanel/gui/qt/main/__init__.py'
--- ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-06-28 04:25:16 +0000
+++ ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-08-01 20:23:18 +0000
@@ -17,6 +17,7 @@
17"""Provide the correct ui main module."""17"""Provide the correct ui main module."""
1818
19import argparse19import argparse
20import os
20import sys21import sys
2122
22from PyQt4 import QtCore23from PyQt4 import QtCore
@@ -69,6 +70,15 @@
6970
70def main(args, install_reactor_darwin=False):71def main(args, install_reactor_darwin=False):
71 """Start the Qt mainloop and open the main window."""72 """Start the Qt mainloop and open the main window."""
73
74 # Disable the overlay-scrollbar GTK module that was
75 # added in Ubuntu 12.10 because it breaks Qt (LP:1007421)
76 gtk_mod = os.getenv('GTK_MODULES')
77 if gtk_mod is not None:
78 gtk_mod = ':'.join([mod for mod in
79 gtk_mod.split(':') if mod != 'overlay-scrollbar'])
80 os.environ['GTK_MODULES'] = gtk_mod
81
72 # The following cannot be imported outside this function82 # The following cannot be imported outside this function
73 # because u1trial already provides a reactor.83 # because u1trial already provides a reactor.
7484
7585
=== modified file 'ubuntuone/controlpanel/gui/qt/main/tests/test_main.py'
--- ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-06-28 04:14:08 +0000
+++ ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-08-01 20:23:18 +0000
@@ -16,6 +16,7 @@
1616
17"""Tests for the control panel's Qt main."""17"""Tests for the control panel's Qt main."""
1818
19import os
19import sys20import sys
2021
21from PyQt4 import QtCore22from PyQt4 import QtCore
@@ -146,6 +147,32 @@
146 (['ubuntuone-installer', sys.argv[0]],147 (['ubuntuone-installer', sys.argv[0]],
147 ('ubuntuone-control-panel',), {}))148 ('ubuntuone-control-panel',), {}))
148149
150 def _test_gtk_module_cleanup(self, modules, expected):
151 """Check if the module cleanup works."""
152 old_modules = os.environ.get('GTK_MODULES', '')
153
154 def clean_env():
155 """Reset the environment variable."""
156 os.environ['GTK_MODULES'] = old_modules
157
158 self.addCleanup(clean_env)
159 os.environ['GTK_MODULES'] = modules
160 main.main([sys.argv[0]])
161 self.assertEqual(os.environ['GTK_MODULES'], expected)
162
163 def test_gtk_module_cleanup_1(self):
164 """Test that we deactivate the overlay scrollbar GTK module."""
165 self._test_gtk_module_cleanup('aaa:overlay-scrollbar:bbb', 'aaa:bbb')
166
167 def test_gtk_module_cleanup_2(self):
168 """Test that we deactivate the overlay scrollbar GTK module."""
169 self._test_gtk_module_cleanup('overlay-scrollbar', '')
170
171 def test_gtk_module_cleanup_3(self):
172 """Test that we deactivate the overlay scrollbar GTK module."""
173 self._test_gtk_module_cleanup('overlay-scrollbar:overlay-scrollbars',
174 'overlay-scrollbars')
175
149 def test_title_not_fail(self):176 def test_title_not_fail(self):
150 """Ensure -title is removed before it gets to argparse."""177 """Ensure -title is removed before it gets to argparse."""
151 main.main([sys.argv[0], "-title"])178 main.main([sys.argv[0], "-title"])

Subscribers

People subscribed via source and target branches