fix appending of filenames when checking that a file hasn't already been added to the list

This commit is contained in:
Miguel Jacq 2018-02-21 15:29:56 +11:00
parent 21b08252d3
commit fd4bc51ec2
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6

View File

@ -82,8 +82,6 @@ class FileList(QtWidgets.QListWidget):
self.setMinimumHeight(205)
self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.filenames = []
self.drop_here_image = DropHereLabel(self, True)
self.drop_here_text = DropHereLabel(self, False)
self.drop_count = DropCountLabel(self)
@ -194,9 +192,9 @@ class FileList(QtWidgets.QListWidget):
Add a file or directory to this widget.
"""
for index in range(self.count()):
self.filenames.append(self.item(index))
filenames.append(self.item(index).filename)
if filename not in self.filenames:
if filename not in filenames:
if not os.access(filename, os.R_OK):
Alert(strings._("not_a_readable_file", True).format(filename))
return