Merge lp:~mikemc/ubuntuone-control-panel/fix-close-popup into lp:ubuntuone-control-panel

Proposed by Mike McCracken
Status: Merged
Approved by: Roberto Alsina
Approved revision: 403
Merged at revision: 401
Proposed branch: lp:~mikemc/ubuntuone-control-panel/fix-close-popup
Merge into: lp:ubuntuone-control-panel
Diff against target: 129 lines (+61/-3)
4 files modified
ubuntuone/controlpanel/gui/qt/controlpanel.py (+5/-0)
ubuntuone/controlpanel/gui/qt/share_links.py (+6/-1)
ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py (+42/-2)
ubuntuone/controlpanel/gui/qt/tests/test_share_links.py (+8/-0)
To merge this branch: bzr merge lp:~mikemc/ubuntuone-control-panel/fix-close-popup
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
dobey (community) Approve
Review via email: mp+152782@code.launchpad.net

Commit message

- Work around Qt issue where search files popup frame was not hidden after switching to another tab. (LP: #1152388)

Description of the change

- Work around Qt issue where search files popup frame was not hidden after switching to another tab. (LP: #1152388)

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

Testable?

review: Needs Information
401. By Mike McCracken

- Add new test for Qt connections set up inside ControlPanel's init. Requires patching before testcase setUp, so duplicates some code from UbuntuOneBinTestCase.

402. By Mike McCracken

update copyrights

403. By Mike McCracken

add test for hiding popup in handle_current_tab_changed

Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Roberto Alsina (ralsina) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone/controlpanel/gui/qt/controlpanel.py'
--- ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-10-18 21:45:05 +0000
+++ ubuntuone/controlpanel/gui/qt/controlpanel.py 2013-03-12 20:03:19 +0000
@@ -79,6 +79,11 @@
79 self.ui.tab_widget.setTabText(79 self.ui.tab_widget.setTabText(
80 self.ui.tab_widget.indexOf(self.ui.share_links_tab),80 self.ui.tab_widget.indexOf(self.ui.share_links_tab),
81 MAIN_SHARE_LINKS_TAB)81 MAIN_SHARE_LINKS_TAB)
82
83 # Workaround for bug LP: 1152388
84 handler = self.ui.share_links_tab.handle_current_tab_changed
85 self.ui.tab_widget.currentChanged.connect(handler)
86
82 self.ui.tab_widget.setTabText(87 self.ui.tab_widget.setTabText(
83 self.ui.tab_widget.indexOf(self.ui.devices_tab), MAIN_DEVICES_TAB)88 self.ui.tab_widget.indexOf(self.ui.devices_tab), MAIN_DEVICES_TAB)
84 self.ui.tab_widget.setTabText(89 self.ui.tab_widget.setTabText(
8590
=== modified file 'ubuntuone/controlpanel/gui/qt/share_links.py'
--- ubuntuone/controlpanel/gui/qt/share_links.py 2012-11-02 17:15:15 +0000
+++ ubuntuone/controlpanel/gui/qt/share_links.py 2013-03-12 20:03:19 +0000
@@ -1,6 +1,6 @@
1# -*- coding: utf-8 *-*1# -*- coding: utf-8 *-*
22
3# Copyright 2012 Canonical Ltd.3# Copyright 2012-2013 Canonical Ltd.
4#4#
5# This program is free software: you can redistribute it and/or modify it5# This program is free software: you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 3, as published6# under the terms of the GNU General Public License version 3, as published
@@ -107,6 +107,11 @@
107 self.get_public_files()107 self.get_public_files()
108 self._enhanced_line.btn_operation.hide()108 self._enhanced_line.btn_operation.hide()
109109
110 def handle_current_tab_changed(self, index):
111 """Workaround for bug LP: 1152388"""
112 self.ui.line_search.clearFocus()
113 self.ui.line_search.popup.hide()
114
110 @inlineCallbacks115 @inlineCallbacks
111 def share_file(self, file_path):116 def share_file(self, file_path):
112 """Clean the previous file share details and publish file_path."""117 """Clean the previous file share details and publish file_path."""
113118
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-10-17 07:21:28 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2013-03-12 20:03:19 +0000
@@ -1,6 +1,6 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2#2#
3# Copyright 2011-2012 Canonical Ltd.3# Copyright 2011-2013 Canonical Ltd.
4#4#
5# This program is free software: you can redistribute it and/or modify it5# This program is free software: you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 3, as published6# under the terms of the GNU General Public License version 3, as published
@@ -19,10 +19,17 @@
19from __future__ import division19from __future__ import division
2020
21from twisted.internet import defer21from twisted.internet import defer
22from PyQt4 import QtCore
23
24from ubuntuone.controlpanel import backend, cache
25from ubuntuone.controlpanel.tests import TestCase
26from mock import call, Mock
27
28from ubuntuone.controlpanel.gui.qt import share_links
2229
23from ubuntuone.controlpanel.gui.qt import controlpanel as gui30from ubuntuone.controlpanel.gui.qt import controlpanel as gui
24from ubuntuone.controlpanel.gui.qt.tests import (31from ubuntuone.controlpanel.gui.qt.tests import (
25 SAMPLE_ACCOUNT_INFO, SAMPLE_NAME,32 FakedControlPanelBackend, SAMPLE_ACCOUNT_INFO, SAMPLE_NAME,
26)33)
27from ubuntuone.controlpanel.gui.qt.tests.test_ubuntuonebin import (34from ubuntuone.controlpanel.gui.qt.tests.test_ubuntuonebin import (
28 UbuntuOneBinTestCase,35 UbuntuOneBinTestCase,
@@ -204,6 +211,39 @@
204 self.ui.ui.wizard.pages[self.ui.ui.wizard.license_page])211 self.ui.ui.wizard.pages[self.ui.ui.wizard.license_page])
205212
206213
214class ControlPanelConnectionTestCase(TestCase):
215 """Test qt signal connections from controlpanel."""
216
217 @defer.inlineCallbacks
218 def setUp(self):
219 cache.Cache._shared_objects = {}
220 yield super(ControlPanelConnectionTestCase, self).setUp()
221 self.patch(backend, 'ControlBackend', FakedControlPanelBackend)
222
223 self.mock_handler = Mock(name='handle_current_tab_changed')
224 self.patch(share_links.ShareLinksPanel, 'handle_current_tab_changed',
225 self.mock_handler)
226
227 self.ui = gui.ControlPanel()
228 self.ui.show()
229 self.addCleanup(self.ui.hide)
230 #self.addCleanup(self.ui.deleteLater)
231 self.addCleanup(QtCore.QCoreApplication.instance().processEvents)
232
233 if getattr(self.ui, 'backend', None) is not None:
234 self.addCleanup(self.ui.backend._called.clear)
235
236 def test_popup_hides_when_switching_tab(self):
237 """Test that the share_links_tab gets the signal for changed tabs"""
238 folders_index = self.ui.ui.tab_widget.indexOf(self.ui.ui.folders_tab)
239 share_index = self.ui.ui.tab_widget.indexOf(self.ui.ui.share_links_tab)
240 self.ui.ui.tab_widget.setCurrentIndex(share_index)
241 self.ui.ui.tab_widget.setCurrentIndex(folders_index)
242
243 self.assertEqual(self.mock_handler.mock_calls,
244 [call(share_index), call(folders_index)])
245
246
207class ExternalLinkButtonsTestCase(ControlPanelTestCase):247class ExternalLinkButtonsTestCase(ControlPanelTestCase):
208 """The link in the go-to-web buttons are correct."""248 """The link in the go-to-web buttons are correct."""
209249
210250
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_share_links.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_share_links.py 2012-11-02 17:15:15 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_share_links.py 2013-03-12 20:03:19 +0000
@@ -254,6 +254,14 @@
254 os.path.basename(file_path))254 os.path.basename(file_path))
255 self.assertEqual(widget.ui.lbl_path.text(), file_path)255 self.assertEqual(widget.ui.lbl_path.text(), file_path)
256256
257 def test_hide_popup_on_tab_changed(self):
258 """Test that the popup is hidden by the tab changed signal."""
259
260 self.ui.ui.line_search.popup.show()
261 self.ui.handle_current_tab_changed(0)
262 self.assertFalse(self.ui.ui.line_search.popup.isVisible())
263 self.assertFalse(self.ui.ui.line_search.hasFocus())
264
257265
258class ActionsButtonsTestCase(BaseTestCase):266class ActionsButtonsTestCase(BaseTestCase):
259 """Test the Actions Buttons."""267 """Test the Actions Buttons."""

Subscribers

People subscribed via source and target branches