Merge lp:~diegosarmentero/ubuntuone-client/menu-separator into lp:ubuntuone-client

Proposed by Diego Sarmentero
Status: Merged
Approved by: Roberto Alsina
Approved revision: 1323
Merged at revision: 1322
Proposed branch: lp:~diegosarmentero/ubuntuone-client/menu-separator
Merge into: lp:ubuntuone-client
Diff against target: 118 lines (+24/-9)
2 files modified
tests/platform/sync_menu/test_linux.py (+17/-9)
ubuntuone/platform/sync_menu/linux.py (+7/-0)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-client/menu-separator
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
dobey (community) Approve
Review via email: mp+126006@code.launchpad.net

Commit message

- Adding separator between current and recent transfers (LP: #1054259).

To post a comment you must log in.
dobey (dobey) :
review: Approve
Roberto Alsina (ralsina) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/platform/sync_menu/test_linux.py'
2--- tests/platform/sync_menu/test_linux.py 2012-09-21 14:09:05 +0000
3+++ tests/platform/sync_menu/test_linux.py 2012-09-24 13:12:20 +0000
4@@ -163,6 +163,9 @@
5 self.assertTrue(self._paused)
6 self.sync_menu.app.data['connect'][1]()
7 self.assertFalse(self._paused)
8+ self.sync_menu.transfers.update_progress()
9+ self.assertIsInstance(self.sync_menu.transfers.separator,
10+ linux.Dbusmenu.Menuitem)
11
12 def test_open_u1(self):
13 """Check that the proper action is executed."""
14@@ -206,7 +209,7 @@
15 self.status_frontend.recent_transfers_data = data
16 self.sync_menu.transfers.update_progress()
17 children = self.sync_menu.transfers.get_children()
18- self.assertEqual(len(children), 3)
19+ self.assertEqual(len(children), 4)
20 data.reverse()
21 for itemM, itemD in zip(children, data):
22 self.assertEqual(itemM.property_get(
23@@ -224,10 +227,12 @@
24 self.status_frontend.uploading_data = data
25 self.sync_menu.transfers.update_progress()
26 children = self.sync_menu.transfers.get_children()
27- self.assertEqual(len(children), 3)
28+ self.assertEqual(len(children), 4)
29 data.reverse()
30 for item in children:
31 text = item.property_get(linux.Dbusmenu.MENUITEM_PROP_LABEL)
32+ if text is None:
33+ continue
34 self.assertIn(text, uploading_data)
35 size, written = uploading_data[text]
36 percentage = written * 100 / size
37@@ -243,7 +248,7 @@
38 data_recent
39 self.sync_menu.transfers.update_progress()
40 children = self.sync_menu.transfers.get_children()
41- self.assertEqual(len(children), 5)
42+ self.assertEqual(len(children), 6)
43 data_recent.reverse()
44 for itemM, itemD in zip(children, data_recent):
45 self.assertEqual(itemM.property_get(
46@@ -263,9 +268,9 @@
47 self.sync_menu.transfers.update_progress()
48 children = self.sync_menu.transfers.get_children()
49 # The menu should only show 5 current transfers.
50- self.assertEqual(len(children), 10)
51+ self.assertEqual(len(children), 11)
52 data_current.reverse()
53- for item in children[5:]:
54+ for item in children[6:]:
55 text = item.property_get(linux.Dbusmenu.MENUITEM_PROP_LABEL)
56 self.assertIn(text, uploading_data)
57 size, written = uploading_data[text]
58@@ -288,10 +293,12 @@
59 self.sync_menu.transfers.update_progress()
60 children = self.sync_menu.transfers.get_children()
61 # The menu should only show 5 current transfers.
62- self.assertEqual(len(children), 4)
63+ self.assertEqual(len(children), 5)
64 data_current.reverse()
65 for item in children:
66 text = item.property_get(linux.Dbusmenu.MENUITEM_PROP_LABEL)
67+ if text is None:
68+ continue
69 self.assertIn(text, uploading_data)
70 size, written = uploading_data[text]
71 percentage = written * 100 / size
72@@ -303,7 +310,7 @@
73 self.status_frontend.recent_transfers_data = data_recent
74 self.sync_menu.transfers.update_progress()
75 children = self.sync_menu.transfers.get_children()
76- self.assertEqual(len(children), 5)
77+ self.assertEqual(len(children), 6)
78 data_recent.reverse()
79 for itemM, itemD in zip(children, data_recent):
80 self.assertEqual(itemM.property_get(
81@@ -320,9 +327,10 @@
82 self.sync_menu.transfers.update_progress()
83 children = self.sync_menu.transfers.get_children()
84 # The menu should only show 5 current transfers.
85- self.assertEqual(len(children), 4)
86+ self.assertEqual(len(children), 5)
87 data_current.reverse()
88- for item in children[5:]:
89+ for item in children[6:]:
90+ print repr(item)
91 text = item.property_get(linux.Dbusmenu.MENUITEM_PROP_LABEL)
92 self.assertIn(text, uploading_data)
93 size, written = uploading_data[text]
94
95=== modified file 'ubuntuone/platform/sync_menu/linux.py'
96--- ubuntuone/platform/sync_menu/linux.py 2012-09-21 12:39:52 +0000
97+++ ubuntuone/platform/sync_menu/linux.py 2012-09-24 13:12:20 +0000
98@@ -161,6 +161,7 @@
99 self.previous_transfers = []
100 self._transfers_items = {}
101 self._uploading_items = {}
102+ self.separator = None
103
104 def start_timer(self):
105 """Trigger an update in one second."""
106@@ -187,6 +188,12 @@
107 temp_transfers[item] = recent_file
108 self._transfers_items = temp_transfers
109
110+ if self.separator is None:
111+ self.separator = Dbusmenu.Menuitem()
112+ self.separator.property_set(Dbusmenu.MENUITEM_PROP_TYPE,
113+ Dbusmenu.CLIENT_TYPES_SEPARATOR)
114+ self.child_append(self.separator)
115+
116 items_added = 0
117 remove = []
118 for item in self._uploading_items:

Subscribers

People subscribed via source and target branches