From 64b5cc59bba4b5ebf257938a7191eae77cfbf70b Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Wed, 31 May 2017 11:17:15 +1000 Subject: [PATCH] Ensure the self.filenames list is sorted internally. This is important because even though the QListWidget UI is sorted automatically, the list is not necessarily. Drag-drop events, depending on the order in which items were highlighted before being dragged, can result in a different or reversed order. This has implications for popping the list later (e.g on delete events) --- onionshare_gui/file_selection.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/onionshare_gui/file_selection.py b/onionshare_gui/file_selection.py index 300525be..391e6a30 100644 --- a/onionshare_gui/file_selection.py +++ b/onionshare_gui/file_selection.py @@ -136,6 +136,8 @@ class FileList(QtWidgets.QListWidget): return self.filenames.append(filename) + # Re-sort the list internally + self.filenames.sort() fileinfo = QtCore.QFileInfo(filename) basename = os.path.basename(filename.rstrip('/'))