~dobey/ubuntuone-client/fix-home-patch

« back to all changes in this revision

Viewing changes to ubuntuone/status/aggregator.py

- Collect and return the data for the menu from aggregator (LP:  #1032659).

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
import itertools
34
34
import operator
35
35
import os
36
 
 
 
36
from collections import deque
37
37
 
38
38
import gettext
39
39
 
624
624
        self.finished_delay = 10
625
625
        self.progress = {}
626
626
        self.to_do = {}
 
627
        self.recent_transfers = deque(maxlen=10)
627
628
 
628
629
    def get_notification(self):
629
630
        """Create a new toggleable notification object."""
775
776
        if command.deflated_size is not None:
776
777
            self.progress[
777
778
                (command.share_id, command.node_id)] = command.deflated_size
 
779
        self.recent_transfers.append(command.path)
778
780
        logger.debug("unqueueing command: %s", command.__class__.__name__)
779
781
        self.update_progressbar()
780
782
 
806
808
        self.messaging = Messaging()
807
809
        self.quota_timer = None
808
810
 
 
811
    def recent_transfers(self):
 
812
        """Return a tuple with the recent transfers paths."""
 
813
        return tuple(self.aggregator.recent_transfers)
 
814
 
 
815
    def files_uploading(self):
 
816
        """Return a list with the files being uploading."""
 
817
        uploading = []
 
818
        for upload in self.aggregator.files_uploading:
 
819
            uploading.append((upload.path, upload.size,
 
820
                upload.n_bytes_written))
 
821
        return uploading
 
822
 
809
823
    def file_published(self, public_url):
810
824
        """A file was published."""
811
825
        status_event = FilePublishingStatus(new_public_url=public_url)