Sort for added items in Images, Media and Presentations

Fixes: https://launchpad.net/bugs/827027
This commit is contained in:
Tim Bentley 2011-09-17 09:20:03 +01:00
parent 52c63d9665
commit 62979a0062

View File

@ -376,18 +376,21 @@ class MediaManagerItem(QtGui.QWidget):
The files to be loaded The files to be loaded
""" """
names = [] names = []
fullList = []
for count in range(0, self.listView.count()): for count in range(0, self.listView.count()):
names.append(unicode(self.listView.item(count).text())) names.append(unicode(self.listView.item(count).text()))
newFiles = [] fullList.append(unicode(self.listView.item(count).
data(QtCore.Qt.UserRole).toString()))
duplicatesFound = False duplicatesFound = False
for file in files: for file in files:
filename = os.path.split(unicode(file))[1] filename = os.path.split(unicode(file))[1]
if filename in names: if filename in names:
duplicatesFound = True duplicatesFound = True
else: else:
newFiles.append(file) fullList.append(file)
if newFiles: if fullList:
self.loadList(newFiles) self.listView.clear()
self.loadList(fullList)
lastDir = os.path.split(unicode(files[0]))[0] lastDir = os.path.split(unicode(files[0]))[0]
SettingsManager.set_last_dir(self.settingsSection, lastDir) SettingsManager.set_last_dir(self.settingsSection, lastDir)
SettingsManager.set_list(self.settingsSection, SettingsManager.set_list(self.settingsSection,