Merge lp:~dobey/ubuntuone-client/prefs-sync-status into lp:ubuntuone-client

Proposed by dobey
Status: Merged
Approved by: Natalia Bidart
Approved revision: 447
Merged at revision: not available
Proposed branch: lp:~dobey/ubuntuone-client/prefs-sync-status
Merge into: lp:ubuntuone-client
Diff against target: 148 lines (+48/-32)
2 files modified
bin/ubuntuone-preferences (+36/-18)
ubuntuone/syncdaemon/dbus_interface.py (+12/-14)
To merge this branch: bzr merge lp:~dobey/ubuntuone-client/prefs-sync-status
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Facundo Batista (community) Approve
Review via email: mp+22075@code.launchpad.net

Commit message

Add status info to the preferences dialog

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

You shouldn't use Unicode characters in a non-Unicode string.

The easiest to do is to replace "…" per "...".

review: Needs Fixing
446. By dobey

Mark the string as a unicode object, since we use utf-8 characters inside it

Revision history for this message
Facundo Batista (facundo) wrote :

Looks ok now.

review: Approve
447. By dobey

Refactor the current_status/StatusChanged code to send the same dict

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

When testing the ubuntuone-preferences, the window gets resized when changing the state legend.

I think that the status should be on a separated row and with a fixed wide, to avoid resizing.

review: Needs Fixing
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

> When testing the ubuntuone-preferences, the window gets resized when changing
> the state legend.
>
> I think that the status should be on a separated row and with a fixed wide, to
> avoid resizing.

Another thing to fix is the following:

 * Even after the IDLE status was emitted as per this log:

2010-03-26 10:42:52,301 - ubuntuone.SyncDaemon.EQ - DEBUG - push_event: SYS_STATE_CHANGED, args:(), kw:{'state': QUEUE_MANAGER (error=False connected=True online=True) Queue: IDLE Connection: With User With Network}

The u1-preferences status keeps sayins "Synchronization in progress..."
Only after a restart of the application, the status is "Synchronization complete"

448. By dobey

Move the status text to a second line, to avoid resizing the window

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Issues fixed, approving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/ubuntuone-preferences'
2--- bin/ubuntuone-preferences 2010-03-25 18:30:27 +0000
3+++ bin/ubuntuone-preferences 2010-03-26 19:03:26 +0000
4@@ -1,4 +1,5 @@
5 #!/usr/bin/python
6+# -*- coding: utf-8 -*-
7
8 # ubuntuone-client-applet - Tray icon applet for managing Ubuntu One
9 #
10@@ -483,12 +484,13 @@
11 # Timeout ID to avoid spamming DBus from spinbutton changes
12 self.__update_id = 0
13
14+ # Build the dialog
15+ self.__construct()
16+
17 # SD Tool object
18 self.sdtool = SyncDaemonTool(self.__bus)
19- self.sdtool.get_status().addCallbacks(lambda _: self.__got_state,
20+ self.sdtool.get_status().addCallbacks(self.__got_state,
21 self.__sd_error)
22- # Build the dialog
23- self.__construct()
24 logger.debug("starting")
25
26 def quit(self):
27@@ -505,6 +507,21 @@
28
29 def __got_state(self, state):
30 """Got the state of syncdaemon."""
31+ if not state['is_connected']:
32+ self.status_label.set_text(_("Disconnected"))
33+ else:
34+ try:
35+ status = state['name']
36+ queues = state['queues']
37+ except KeyError:
38+ status = None
39+ queues = None
40+ if status == u'QUEUE_MANAGER' and queues == u'IDLE':
41+ self.status_label.set_text(_("Synchronization complete"))
42+ else:
43+ self.status_label.set_text(_(u"Synchronization in progress…"))
44+
45+ # Update the stuff in the devices tab
46 self.devices.handle_state_change(state)
47
48 def __got_limits(self, limits):
49@@ -684,29 +701,30 @@
50 vbox.show()
51
52 # Usage text/progress bar
53- hbox = gtk.HBox(homogeneous=True)
54- vbox.pack_start(hbox, False, False)
55+ rbox = gtk.VBox(spacing=12)
56+ vbox.pack_start(rbox, False, False)
57+ rbox.show()
58+
59+ hbox = gtk.HBox(spacing=6)
60+ rbox.pack_start(hbox, False, False)
61 hbox.show()
62
63- label = gtk.Label("")
64- hbox.add(label)
65- label.show()
66-
67- rbox = gtk.VBox(spacing=2)
68- hbox.pack_end(rbox)
69- rbox.show()
70+ self.usage_graph = gtk.ProgressBar()
71+ hbox.pack_start(self.usage_graph, False, False)
72+ self.usage_graph.show()
73
74 self.usage_label = gtk.Label("")
75- self.usage_label.set_alignment(0.5, 0.5)
76- rbox.add(self.usage_label)
77+ self.usage_label.set_alignment(0.0, 0.5)
78+ hbox.pack_start(self.usage_label, True, True)
79 self.usage_label.show()
80
81- self.usage_graph = gtk.ProgressBar()
82- rbox.add(self.usage_graph)
83- self.usage_graph.show()
84-
85 self.update_quota_display(0, 2)
86
87+ self.status_label = gtk.Label("")
88+ self.status_label.set_alignment(0.0, 0.5)
89+ rbox.pack_start(self.status_label, False, False)
90+ self.status_label.show()
91+
92 # Notebook
93 self.notebook = gtk.Notebook()
94 vbox.add(self.notebook)
95
96=== modified file 'ubuntuone/syncdaemon/dbus_interface.py'
97--- ubuntuone/syncdaemon/dbus_interface.py 2010-03-23 22:48:19 +0000
98+++ ubuntuone/syncdaemon/dbus_interface.py 2010-03-26 19:03:26 +0000
99@@ -143,17 +143,11 @@
100 DBusExposedObject.__init__(self, bus_name=bus_name,
101 path=self.path)
102
103- @dbus.service.method(DBUS_IFACE_STATUS_NAME,
104- in_signature='', out_signature='a{ss}')
105- def current_status(self):
106- """ return the current status of the system, one of: local_rescan,
107- offline, trying_to_connect, server_rescan or online.
108- """
109- logger.debug('called current_status')
110+ def _get_current_state(self):
111+ """Get the current status of the system."""
112 state = self.dbus_iface.main.state_manager.state
113 connection = self.dbus_iface.main.state_manager.connection.state
114 queues = self.dbus_iface.main.state_manager.queues.state.name
115- self.emit_status_changed(state)
116 state_dict = {
117 'name': state.name,
118 'description': state.description,
119@@ -165,6 +159,15 @@
120 }
121 return state_dict
122
123+ @dbus.service.method(DBUS_IFACE_STATUS_NAME,
124+ in_signature='', out_signature='a{ss}')
125+ def current_status(self):
126+ """ return the current status of the system, one of: local_rescan,
127+ offline, trying_to_connect, server_rescan or online.
128+ """
129+ logger.debug('called current_status')
130+ return self._get_current_state()
131+
132 @dbus.service.method(DBUS_IFACE_STATUS_NAME, out_signature='aa{ss}')
133 def current_downloads(self):
134 """ return list of files with a download in progress. """
135@@ -335,12 +338,7 @@
136
137 def emit_status_changed(self, state):
138 """Emits the signal."""
139- state_dict = {'name':state.name,
140- 'description':state.description,
141- 'is_error':self.bool_str(state.is_error),
142- 'is_connected':self.bool_str(state.is_connected),
143- 'is_online':self.bool_str(state.is_online)}
144- self.StatusChanged(state_dict)
145+ self.StatusChanged(self._get_current_state())
146
147 def emit_download_started(self, download):
148 """ Emits the signal """

Subscribers

People subscribed via source and target branches