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
=== modified file 'bin/ubuntuone-preferences'
--- bin/ubuntuone-preferences 2010-03-25 18:30:27 +0000
+++ bin/ubuntuone-preferences 2010-03-26 19:03:26 +0000
@@ -1,4 +1,5 @@
1#!/usr/bin/python1#!/usr/bin/python
2# -*- coding: utf-8 -*-
23
3# ubuntuone-client-applet - Tray icon applet for managing Ubuntu One4# ubuntuone-client-applet - Tray icon applet for managing Ubuntu One
4#5#
@@ -483,12 +484,13 @@
483 # Timeout ID to avoid spamming DBus from spinbutton changes484 # Timeout ID to avoid spamming DBus from spinbutton changes
484 self.__update_id = 0485 self.__update_id = 0
485486
487 # Build the dialog
488 self.__construct()
489
486 # SD Tool object490 # SD Tool object
487 self.sdtool = SyncDaemonTool(self.__bus)491 self.sdtool = SyncDaemonTool(self.__bus)
488 self.sdtool.get_status().addCallbacks(lambda _: self.__got_state,492 self.sdtool.get_status().addCallbacks(self.__got_state,
489 self.__sd_error)493 self.__sd_error)
490 # Build the dialog
491 self.__construct()
492 logger.debug("starting")494 logger.debug("starting")
493495
494 def quit(self):496 def quit(self):
@@ -505,6 +507,21 @@
505507
506 def __got_state(self, state):508 def __got_state(self, state):
507 """Got the state of syncdaemon."""509 """Got the state of syncdaemon."""
510 if not state['is_connected']:
511 self.status_label.set_text(_("Disconnected"))
512 else:
513 try:
514 status = state['name']
515 queues = state['queues']
516 except KeyError:
517 status = None
518 queues = None
519 if status == u'QUEUE_MANAGER' and queues == u'IDLE':
520 self.status_label.set_text(_("Synchronization complete"))
521 else:
522 self.status_label.set_text(_(u"Synchronization in progress…"))
523
524 # Update the stuff in the devices tab
508 self.devices.handle_state_change(state)525 self.devices.handle_state_change(state)
509526
510 def __got_limits(self, limits):527 def __got_limits(self, limits):
@@ -684,29 +701,30 @@
684 vbox.show()701 vbox.show()
685702
686 # Usage text/progress bar703 # Usage text/progress bar
687 hbox = gtk.HBox(homogeneous=True)704 rbox = gtk.VBox(spacing=12)
688 vbox.pack_start(hbox, False, False)705 vbox.pack_start(rbox, False, False)
706 rbox.show()
707
708 hbox = gtk.HBox(spacing=6)
709 rbox.pack_start(hbox, False, False)
689 hbox.show()710 hbox.show()
690711
691 label = gtk.Label("")712 self.usage_graph = gtk.ProgressBar()
692 hbox.add(label)713 hbox.pack_start(self.usage_graph, False, False)
693 label.show()714 self.usage_graph.show()
694
695 rbox = gtk.VBox(spacing=2)
696 hbox.pack_end(rbox)
697 rbox.show()
698715
699 self.usage_label = gtk.Label("")716 self.usage_label = gtk.Label("")
700 self.usage_label.set_alignment(0.5, 0.5)717 self.usage_label.set_alignment(0.0, 0.5)
701 rbox.add(self.usage_label)718 hbox.pack_start(self.usage_label, True, True)
702 self.usage_label.show()719 self.usage_label.show()
703720
704 self.usage_graph = gtk.ProgressBar()
705 rbox.add(self.usage_graph)
706 self.usage_graph.show()
707
708 self.update_quota_display(0, 2)721 self.update_quota_display(0, 2)
709722
723 self.status_label = gtk.Label("")
724 self.status_label.set_alignment(0.0, 0.5)
725 rbox.pack_start(self.status_label, False, False)
726 self.status_label.show()
727
710 # Notebook728 # Notebook
711 self.notebook = gtk.Notebook()729 self.notebook = gtk.Notebook()
712 vbox.add(self.notebook)730 vbox.add(self.notebook)
713731
=== modified file 'ubuntuone/syncdaemon/dbus_interface.py'
--- ubuntuone/syncdaemon/dbus_interface.py 2010-03-23 22:48:19 +0000
+++ ubuntuone/syncdaemon/dbus_interface.py 2010-03-26 19:03:26 +0000
@@ -143,17 +143,11 @@
143 DBusExposedObject.__init__(self, bus_name=bus_name,143 DBusExposedObject.__init__(self, bus_name=bus_name,
144 path=self.path)144 path=self.path)
145145
146 @dbus.service.method(DBUS_IFACE_STATUS_NAME,146 def _get_current_state(self):
147 in_signature='', out_signature='a{ss}')147 """Get the current status of the system."""
148 def current_status(self):
149 """ return the current status of the system, one of: local_rescan,
150 offline, trying_to_connect, server_rescan or online.
151 """
152 logger.debug('called current_status')
153 state = self.dbus_iface.main.state_manager.state148 state = self.dbus_iface.main.state_manager.state
154 connection = self.dbus_iface.main.state_manager.connection.state149 connection = self.dbus_iface.main.state_manager.connection.state
155 queues = self.dbus_iface.main.state_manager.queues.state.name150 queues = self.dbus_iface.main.state_manager.queues.state.name
156 self.emit_status_changed(state)
157 state_dict = {151 state_dict = {
158 'name': state.name,152 'name': state.name,
159 'description': state.description,153 'description': state.description,
@@ -165,6 +159,15 @@
165 }159 }
166 return state_dict160 return state_dict
167161
162 @dbus.service.method(DBUS_IFACE_STATUS_NAME,
163 in_signature='', out_signature='a{ss}')
164 def current_status(self):
165 """ return the current status of the system, one of: local_rescan,
166 offline, trying_to_connect, server_rescan or online.
167 """
168 logger.debug('called current_status')
169 return self._get_current_state()
170
168 @dbus.service.method(DBUS_IFACE_STATUS_NAME, out_signature='aa{ss}')171 @dbus.service.method(DBUS_IFACE_STATUS_NAME, out_signature='aa{ss}')
169 def current_downloads(self):172 def current_downloads(self):
170 """ return list of files with a download in progress. """173 """ return list of files with a download in progress. """
@@ -335,12 +338,7 @@
335338
336 def emit_status_changed(self, state):339 def emit_status_changed(self, state):
337 """Emits the signal."""340 """Emits the signal."""
338 state_dict = {'name':state.name,341 self.StatusChanged(self._get_current_state())
339 'description':state.description,
340 'is_error':self.bool_str(state.is_error),
341 'is_connected':self.bool_str(state.is_connected),
342 'is_online':self.bool_str(state.is_online)}
343 self.StatusChanged(state_dict)
344342
345 def emit_download_started(self, download):343 def emit_download_started(self, download):
346 """ Emits the signal """344 """ Emits the signal """

Subscribers

People subscribed via source and target branches