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)
This commit is contained in:
Miguel Jacq 2017-05-31 11:17:15 +10:00
parent a9ee14551b
commit 64b5cc59bb
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6

View File

@ -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('/'))