From 36914114f9481903b4f42fe2ac53cf9087e04da9 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 28 Aug 2014 16:26:56 -0700 Subject: [PATCH] sort the list of filenames being shared --- onionshare/web.py | 2 ++ onionshare_gui/file_selection.py | 1 + 2 files changed, 3 insertions(+) diff --git a/onionshare/web.py b/onionshare/web.py index db5e7f53..f8449fdd 100644 --- a/onionshare/web.py +++ b/onionshare/web.py @@ -27,6 +27,8 @@ def set_file_info(filenames): info['size'] = helpers.dir_size(filename) info['size_human'] = helpers.human_readable_filesize(info['size']) file_info['dirs'].append(info) + file_info['files'] = sorted(file_info['files'], key=lambda k: k['basename']) + file_info['dirs'] = sorted(file_info['dirs'], key=lambda k: k['basename']) # zip up the files and folders z = helpers.ZipWriter() diff --git a/onionshare_gui/file_selection.py b/onionshare_gui/file_selection.py index 7898b3d2..5b7c8b8b 100644 --- a/onionshare_gui/file_selection.py +++ b/onionshare_gui/file_selection.py @@ -12,6 +12,7 @@ class FileList(QtGui.QListWidget): super(FileList, self).__init__(parent) self.setAcceptDrops(True) self.setIconSize(QtCore.QSize(32, 32)) + self.setSortingEnabled(True) # drag and drop label self.drop_label = QtGui.QLabel(QtCore.QString(strings._('gui_drag_and_drop')), parent=self)