Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def init_repo_stats(self):
repo = self.profile().repo
if repo is not None:
self.sizeCompressed.setText(pretty_bytes(repo.unique_csize))
self.sizeDeduplicated.setText(pretty_bytes(repo.unique_size))
self.sizeOriginal.setText(pretty_bytes(repo.total_size))
self.repoEncryption.setText(str(repo.encryption))
else:
self.sizeCompressed.setText('')
self.sizeDeduplicated.setText('')
self.sizeOriginal.setText('')
self.repoEncryption.setText('')
self.repo_changed.emit()
def init_repo_stats(self):
repo = self.profile().repo
if repo is not None:
self.sizeCompressed.setText(pretty_bytes(repo.unique_csize))
self.sizeDeduplicated.setText(pretty_bytes(repo.unique_size))
self.sizeOriginal.setText(pretty_bytes(repo.total_size))
self.repoEncryption.setText(str(repo.encryption))
else:
self.sizeCompressed.setText('')
self.sizeDeduplicated.setText('')
self.sizeOriginal.setText('')
self.repoEncryption.setText('')
self.repo_changed.emit()
def init_repo_stats(self):
repo = self.profile().repo
if repo is not None:
self.sizeCompressed.setText(pretty_bytes(repo.unique_csize))
self.sizeDeduplicated.setText(pretty_bytes(repo.unique_size))
self.sizeOriginal.setText(pretty_bytes(repo.total_size))
self.repoEncryption.setText(str(repo.encryption))
else:
self.sizeCompressed.setText('')
self.sizeDeduplicated.setText('')
self.sizeOriginal.setText('')
self.repoEncryption.setText('')
self.repo_changed.emit()
def populate_from_profile(self):
"""Populate archive list and prune settings from profile."""
profile = self.profile()
if profile.repo is not None:
self.mount_points = get_mount_points(profile.repo.url)
self.toolBox.setItemText(0, self.tr('Archives for %s') % profile.repo.url)
archives = [s for s in profile.repo.archives.select().order_by(ArchiveModel.time.desc())]
for row, archive in enumerate(archives):
self.archiveTable.insertRow(row)
formatted_time = archive.time.strftime('%Y-%m-%d %H:%M')
self.archiveTable.setItem(row, 0, QTableWidgetItem(formatted_time))
self.archiveTable.setItem(row, 1, QTableWidgetItem(pretty_bytes(archive.size)))
if archive.duration is not None:
formatted_duration = str(timedelta(seconds=round(archive.duration)))
else:
formatted_duration = ''
self.archiveTable.setItem(row, 2, QTableWidgetItem(formatted_duration))
mount_point = self.mount_points.get(archive.name)
if mount_point is not None:
item = QTableWidgetItem(mount_point)
self.archiveTable.setItem(row, 3, item)
self.archiveTable.setItem(row, 4, QTableWidgetItem(archive.name))
self.archiveTable.setRowCount(len(archives))
item = self.archiveTable.item(0, 0)
def data(self, column):
if column == 1:
return self.itemData[column]
elif column == 2:
return pretty_bytes(self.itemData[column])
elif column == 0:
return self.itemData[column]