Merge lp:~diegosarmentero/ubuntuone-control-panel/clickshare into lp:ubuntuone-control-panel

Proposed by Diego Sarmentero on 2012-10-11
Status: Merged
Approved by: dobey on 2012-10-15
Approved revision: 365
Merged at revision: 366
Proposed branch: lp:~diegosarmentero/ubuntuone-control-panel/clickshare
Merge into: lp:ubuntuone-control-panel
Diff against target: 70 lines (+36/-6)
2 files modified
ubuntuone/controlpanel/gui/qt/share_links.py (+18/-6)
ubuntuone/controlpanel/gui/qt/tests/test_share_links.py (+18/-0)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-control-panel/clickshare
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve on 2012-10-11
Roberto Alsina (community) 2012-10-11 Approve on 2012-10-11
Review via email: mp+129199@code.launchpad.net

Commit Message

- Allow double click in the list items to see the detailed information (LP: #1065190).

To post a comment you must log in.
Roberto Alsina (ralsina) wrote :

code review only

review: Approve
Manuel de la Peña (mandel) wrote :

Tests pass on Q and code looks good. The only problem I see are the lint errors I get in Q, I'll approve because tarmac should block it if lint fails.

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.py'
2--- ubuntuone/controlpanel/gui/qt/share_links.py 2012-09-28 20:26:35 +0000
3+++ ubuntuone/controlpanel/gui/qt/share_links.py 2012-10-11 13:42:43 +0000
4@@ -83,6 +83,8 @@
5 self.ui.line_search.itemSelected.connect(self.share_file)
6 self.ui.back_to_file_list.clicked.connect(self._move_to_main_list)
7 self.ui.open_in_browser.clicked.connect(self._open_in_browser)
8+ self.ui.tree_shared_files.itemDoubleClicked.connect(
9+ self._open_properties_selected_file)
10
11 # Connect backend signals
12 self.backend.set_public_files_list_handler(self._load_public_files)
13@@ -108,12 +110,22 @@
14 yield self.backend.change_public_access(
15 full_path, True)
16 else:
17- share_file_widget = ShareFileWidget(file_path)
18- self.ui.hbox_share_file.addWidget(share_file_widget)
19- share_file_widget.linkDisabled.connect(
20- lambda: self.ui.line_copy_link.setText(''))
21- self.ui.line_copy_link.setText(self._shared_files[full_path])
22- self.ui.stacked_widget.setCurrentIndex(1)
23+ self.open_file_properties(file_path, full_path)
24+
25+ def _open_properties_selected_file(self, item):
26+ """Open the file properties on double click."""
27+ file_path = unicode(item.toolTip(FILE_NAME_COL))
28+ full_path = expand_user(file_path.encode('utf-8')).decode('utf-8')
29+ self.open_file_properties(file_path, full_path)
30+
31+ def open_file_properties(self, file_path, full_path):
32+ """Move the stacked widget to the properties section."""
33+ share_file_widget = ShareFileWidget(file_path)
34+ self.ui.hbox_share_file.addWidget(share_file_widget)
35+ share_file_widget.linkDisabled.connect(
36+ lambda: self.ui.line_copy_link.setText(''))
37+ self.ui.line_copy_link.setText(self._shared_files[full_path])
38+ self.ui.stacked_widget.setCurrentIndex(1)
39
40 def _file_shared(self, info):
41 """Receive the notification that the file has been published."""
42
43=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_share_links.py'
44--- ubuntuone/controlpanel/gui/qt/tests/test_share_links.py 2012-09-26 20:47:46 +0000
45+++ ubuntuone/controlpanel/gui/qt/tests/test_share_links.py 2012-10-11 13:42:43 +0000
46@@ -173,6 +173,24 @@
47 actions = self.ui.ui.tree_shared_files.itemWidget(item, 2)
48 self.assertIsInstance(actions, gui.ActionsButtons)
49
50+ def test_tree_item_clicked(self):
51+ """Check if the proper info is displayed when the item is clicked."""
52+ publicfiles = [
53+ {'path': '/home/file1', 'public_url': 'http:ubuntuone.com/asd123'},
54+ {'path': '/home/file2', 'public_url': 'http:ubuntuone.com/qwe456'},
55+ ]
56+ self.ui._load_public_files(publicfiles)
57+ item = self.ui.ui.tree_shared_files.topLevelItem(1)
58+ self.ui.ui.tree_shared_files.itemDoubleClicked.emit(item, 0)
59+ widget = self.ui.ui.hbox_share_file.itemAt(0).widget()
60+
61+ file_path = unicode(item.toolTip(gui.FILE_NAME_COL))
62+ full_path = gui.expand_user(file_path.encode('utf-8')).decode('utf-8')
63+ self.assertEqual(widget.file_path, full_path)
64+ self.assertEqual(widget.ui.lbl_filename.text(),
65+ os.path.basename(file_path))
66+ self.assertEqual(widget.ui.lbl_path.text(), file_path)
67+
68
69 class ActionsButtonsTestCase(BaseTestCase):
70 """Test the Actions Buttons."""

Subscribers

People subscribed via source and target branches