[Pkg-anonymity-tools] [onionshare] 34/57: No longer duplicates human_readable_filesize functions. Closes #170
Ulrike Uhlig
u-guest at moszumanska.debian.org
Tue May 19 18:18:56 UTC 2015
This is an automated email from the git hooks/post-receive script.
u-guest pushed a commit to annotated tag 0.7
in repository onionshare.
commit aab5ae31ab9bfd9493c9d6ea54d286f99456420d
Author: Micah Lee <micah at micahflee.com>
Date: Thu May 14 14:40:55 2015 -0700
No longer duplicates human_readable_filesize functions. Closes #170
---
onionshare_gui/file_selection.py | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/onionshare_gui/file_selection.py b/onionshare_gui/file_selection.py
index 89d2e56..c22a240 100644
--- a/onionshare_gui/file_selection.py
+++ b/onionshare_gui/file_selection.py
@@ -114,9 +114,9 @@ class FileList(QtGui.QListWidget):
icon = ip.icon(fileinfo)
if os.path.isfile(filename):
- size = self.human_readable_filesize(fileinfo.size())
+ size = helpers.human_readable_filesize(fileinfo.size())
else:
- size = self.human_readable_filesize(helpers.dir_size(filename))
+ size = helpers.human_readable_filesize(helpers.dir_size(filename))
item_name = unicode('{0} ({1})'.format(basename, size))
item = QtGui.QListWidgetItem(item_name)
item.setToolTip(QtCore.QString(size))
@@ -126,18 +126,6 @@ class FileList(QtGui.QListWidget):
self.files_updated.emit()
- def human_readable_filesize(self, b):
- thresh = 1024.0
- if b < thresh:
- return '{0} B'.format(b)
- units = ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
- u = 0
- b /= thresh
- while b >= thresh:
- b /= thresh
- u += 1
- return '{0} {1}'.format(round(b, 1), units[u])
-
class FileSelection(QtGui.QVBoxLayout):
def __init__(self):
@@ -220,4 +208,3 @@ class FileSelection(QtGui.QVBoxLayout):
def get_num_files(self):
return len(self.file_list.filenames)
-
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/onionshare.git
More information about the Pkg-anonymity-tools
mailing list