Merge lp:~ralsina/ubuntuone-control-panel/disable-enable into lp:ubuntuone-control-panel

Proposed by Roberto Alsina
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 356
Merged at revision: 354
Proposed branch: lp:~ralsina/ubuntuone-control-panel/disable-enable
Merge into: lp:ubuntuone-control-panel
Diff against target: 58 lines (+16/-0)
2 files modified
ubuntuone/controlpanel/gui/qt/share_links_search.py (+10/-0)
ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py (+6/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-control-panel/disable-enable
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
Alejandro J. Cura (community) Approve
Review via email: mp+121691@code.launchpad.net

Commit message

- Disabled search box until it's ready to work (Fixes LP: 1042885)

Description of the change

Disables the file share tab search box until the list of files is obtained.

To test IRL, assuming you have a few dozen thousand files in U1, i you go to that tab quickly, it should
be disabled.

Also added some logging to mark start and end of file list collection.

To post a comment you must log in.
355. By Roberto Alsina

beter logging

356. By Roberto Alsina

Link bug

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

Looks good, and provides a decent workaround.

review: Approve
Revision history for this message
Manuel de la Peña (mandel) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/gui/qt/share_links_search.py'
2--- ubuntuone/controlpanel/gui/qt/share_links_search.py 2012-08-27 20:02:55 +0000
3+++ ubuntuone/controlpanel/gui/qt/share_links_search.py 2012-08-28 19:49:20 +0000
4@@ -22,6 +22,9 @@
5 from twisted.internet.defer import inlineCallbacks
6
7 from ubuntuone.controlpanel import cache
8+from ubuntuone.controlpanel.logger import setup_logging
9+
10+logger = setup_logging('qt.share_links_search')
11
12
13 def get_system_icon_for_filename(file_path):
14@@ -41,6 +44,9 @@
15
16 def __init__(self, parent=None):
17 super(SearchBox, self).__init__(parent)
18+ # The search box should be disabled until
19+ # the file list is obtained
20+ self.setEnabled(False)
21 self.popup = FilesPopup()
22 self.home_dir = ''
23 self.temp_u1_files = []
24@@ -67,6 +73,7 @@
25 def _get_volumes_info(self):
26 """Get the volumes info."""
27 self.home_dir = yield self.backend.get_home_dir()
28+ logger.info('Starting file list collection')
29 self._thread_explore = ThreadExploreFolder(self.home_dir)
30 info = yield self.backend.volumes_info()
31 self._process_volumes_info(info)
32@@ -90,6 +97,9 @@
33 def _folder_content_obtained(self):
34 """Receive the content of the folders from the thread."""
35 files = self._get_filtered_list(self._thread_explore.u1_files)
36+ logger.info('Finished file list collection, found %d files.',
37+ len(self._thread_explore.u1_files))
38+ self.setEnabled(True)
39 self.popup.load_items(files)
40 text = self.text()
41 self.filter(text)
42
43=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py'
44--- ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py 2012-08-28 00:32:41 +0000
45+++ ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py 2012-08-28 19:49:20 +0000
46@@ -65,6 +65,12 @@
47 self.assertEqual(self.ui.items_per_page, 0)
48 self.assertEqual(self.ui.items_step, 20)
49 self.assertEqual(self.ui.prefix, '')
50+ self.assertFalse(self.ui.isEnabled())
51+
52+ def test_folder_content_obtained_enables(self):
53+ """Check that _folder_content_obtained enables the widget."""
54+ self.ui._folder_content_obtained()
55+ self.assertTrue(self.ui.isEnabled())
56
57 def test_key_down_pressed(self):
58 """Check the proper action are executed on key down pressed."""

Subscribers

People subscribed via source and target branches