- fixed crash attempting to add a non existent image to the service

- fixed display of full presentation path in remote search
- fixed names
- fixed hard coded 'setting section'
This commit is contained in:
Andreas Preikschat 2011-06-12 13:51:23 +02:00
parent 55cfa19737
commit 869ab41cad
3 changed files with 20 additions and 18 deletions

View File

@ -110,14 +110,14 @@ class ImageMediaItem(MediaManagerItem):
SettingsManager.set_list(self.settingsSection, SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList()) self.settingsSection, self.getFileList())
def loadList(self, list, initialLoad=False): def loadList(self, images, initialLoad=False):
if not initialLoad: if not initialLoad:
self.plugin.formparent.displayProgressBar(len(list)) self.plugin.formparent.displayProgressBar(len(images))
# Sort the themes by its filename considering language specific # Sort the themes by its filename considering language specific
# characters. lower() is needed for windows! # characters. lower() is needed for windows!
list.sort(cmp=locale.strcoll, images.sort(cmp=locale.strcoll,
key=lambda filename: os.path.split(unicode(filename))[1].lower()) key=lambda filename: os.path.split(unicode(filename))[1].lower())
for imageFile in list: for imageFile in images:
if not initialLoad: if not initialLoad:
self.plugin.formparent.incrementProgressBar() self.plugin.formparent.incrementProgressBar()
filename = os.path.split(unicode(imageFile))[1] filename = os.path.split(unicode(imageFile))[1]
@ -155,7 +155,7 @@ class ImageMediaItem(MediaManagerItem):
for bitem in items: for bitem in items:
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
if not os.path.exists(filename): if not os.path.exists(filename):
missing_items.append(item) missing_items.append(bitem)
missing_items_filenames.append(filename) missing_items_filenames.append(filename)
for item in missing_items: for item in missing_items:
items.remove(item) items.remove(item)
@ -217,11 +217,11 @@ class ImageMediaItem(MediaManagerItem):
'the image file "%s" no longer exists.')) % filename) 'the image file "%s" no longer exists.')) % filename)
def search(self, string): def search(self, string):
list = SettingsManager.load_list(self.settingsSection, files = SettingsManager.load_list(self.settingsSection,
self.settingsSection) self.settingsSection)
results = [] results = []
string = string.lower() string = string.lower()
for file in list: for file in files:
filename = os.path.split(unicode(file))[1] filename = os.path.split(unicode(file))[1]
if filename.lower().find(string) > -1: if filename.lower().find(string) > -1:
results.append([file, filename]) results.append([file, filename])

View File

@ -202,12 +202,12 @@ class MediaMediaItem(MediaManagerItem):
SettingsManager.set_list(self.settingsSection, SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList()) self.settingsSection, self.getFileList())
def loadList(self, list): def loadList(self, files):
# Sort the themes by its filename considering language specific # Sort the themes by its filename considering language specific
# characters. lower() is needed for windows! # characters. lower() is needed for windows!
list.sort(cmp=locale.strcoll, files.sort(cmp=locale.strcoll,
key=lambda filename: os.path.split(unicode(filename))[1].lower()) key=lambda filename: os.path.split(unicode(filename))[1].lower())
for file in list: for file in files:
filename = os.path.split(unicode(file))[1] filename = os.path.split(unicode(file))[1]
item_name = QtGui.QListWidgetItem(filename) item_name = QtGui.QListWidgetItem(filename)
img = QtGui.QPixmap(u':/media/media_video.png').toImage() img = QtGui.QPixmap(u':/media/media_video.png').toImage()
@ -221,11 +221,11 @@ class MediaMediaItem(MediaManagerItem):
self.mediaObject = Phonon.MediaObject(self) self.mediaObject = Phonon.MediaObject(self)
def search(self, string): def search(self, string):
list = SettingsManager.load_list(self.settingsSection, files = SettingsManager.load_list(self.settingsSection,
self.settingsSection) self.settingsSection)
results = [] results = []
string = string.lower() string = string.lower()
for file in list: for file in files:
filename = os.path.split(unicode(file))[1] filename = os.path.split(unicode(file))[1]
if filename.lower().find(string) > -1: if filename.lower().find(string) > -1:
results.append([file, filename]) results.append([file, filename])

View File

@ -119,9 +119,9 @@ class PresentationMediaItem(MediaManagerItem):
Populate the media manager tab Populate the media manager tab
""" """
self.listView.setIconSize(QtCore.QSize(88, 50)) self.listView.setIconSize(QtCore.QSize(88, 50))
list = SettingsManager.load_list( files = SettingsManager.load_list(
self.settingsSection, u'presentations') self.settingsSection, u'presentations')
self.loadList(list, True) self.loadList(files, True)
self.populateDisplayTypes() self.populateDisplayTypes()
def rebuild(self): def rebuild(self):
@ -312,10 +312,12 @@ class PresentationMediaItem(MediaManagerItem):
return None return None
def search(self, string): def search(self, string):
list = SettingsManager.load_list(self.settingsSection, u'presentations') files = SettingsManager.load_list(
self.settingsSection, self.settingsSection)
results = [] results = []
string = string.lower() string = string.lower()
for file in list: for file in files:
if file.lower().find(string) > -1: filename = os.path.split(unicode(file))[1]
results.append([file, file]) if filename.lower().find(string) > -1:
results.append([file, filename])
return results return results