Fix lists to sort if new items are added for Images, Media and Presentations

bzr-revno: 1748
Fixes: https://launchpad.net/bugs/827027
This commit is contained in:
Tim Bentley 2011-09-18 14:07:27 +01:00
commit f19db2e5dc
2 changed files with 9 additions and 5 deletions

View File

@ -236,7 +236,6 @@ def main(args=None):
logfile.setFormatter(logging.Formatter( logfile.setFormatter(logging.Formatter(
u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s')) u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
log.addHandler(logfile) log.addHandler(logfile)
logging.addLevelName(15, u'Timer')
# Parse command line options and deal with them. # Parse command line options and deal with them.
# Use args supplied programatically if possible. # Use args supplied programatically if possible.
(options, args) = parser.parse_args(args) if args else parser.parse_args() (options, args) = parser.parse_args(args) if args else parser.parse_args()

View File

@ -376,18 +376,23 @@ 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
filesAdded = 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) filesAdded = True
if newFiles: fullList.append(file)
self.loadList(newFiles) if fullList and filesAdded:
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,