def UpdateInfoLabel(self):
        local = [item for item, tree_item, _ in self.updateItems
                 if item.state != AVAILABLE and not tree_item.isHidden()]
        size = sum(float(item.size) for item in local)

        onServer = [item for item, tree_item, _ in self.updateItems if not tree_item.isHidden()]
        sizeOnServer = sum(float(item.size) for item in onServer)

        text = ("%i items, %s (on server: %i items, %s)" %
                (len(local),
                 sizeof_fmt(size),
                 len(onServer),
                 sizeof_fmt(sizeOnServer)))

        self.infoLabel.setText(text)
Esempio n. 2
0
    def UpdateInfoLabel(self):
        local = [item for item, tree_item, _ in self.updateItems
                 if item.state != AVAILABLE and not tree_item.isHidden()]
        size = sum(float(item.size) for item in local)

        onServer = [item for item, tree_item, _ in self.updateItems if not tree_item.isHidden()]
        sizeOnServer = sum(float(item.size) for item in onServer)

        text = ("%i items, %s (on server: %i items, %s)" %
                (len(local),
                 sizeof_fmt(size),
                 len(onServer),
                 sizeof_fmt(sizeOnServer)))

        self.infoLabel.setText(text)
    def setUpdateItem(self, item):
        """
        Set the update item to display.

        :param UpdateItem item:
            The update item to display.

        """
        self.item = item

        self.setData(0, UpdateTreeWidgetItem.StateRole, item.state)

        self.setData(1, Qt.DisplayRole, item.title)
        self.setData(1, self.EditRole2, item.title)

        self.setData(4, Qt.DisplayRole, sizeof_fmt(item.size))
        self.setData(4, self.EditRole2, item.size)

        if item.local is not None:
            self.setData(3, Qt.DisplayRole, item.local.date().isoformat())
            self.setData(3, self.EditRole2, item.local)
        else:
            self.setData(3, Qt.DisplayRole, "")
            self.setData(3, self.EditRole2, datetime.now())

        self._updateToolTip()
Esempio n. 4
0
    def setUpdateItem(self, item):
        """
        Set the update item to display.

        :param UpdateItem item:
            The update item to display.

        """
        self.item = item

        self.setData(0, UpdateTreeWidgetItem.StateRole, item.state)

        self.setData(1, Qt.DisplayRole, item.title)
        self.setData(1, self.EditRole2, item.title)

        self.setData(4, Qt.DisplayRole, sizeof_fmt(item.size))
        self.setData(4, self.EditRole2, item.size)

        if item.local is not None:
            self.setData(3, Qt.DisplayRole, item.local.date().isoformat())
            self.setData(3, self.EditRole2, item.local)
        else:
            self.setData(3, Qt.DisplayRole, "")
            self.setData(3, self.EditRole2, datetime.now())

        self._updateToolTip()