forked from openlp/openlp
- fixed crash attempting to add a non existent image to the service
- fixed display of full presentation path in remote search - fixed names - fixed use of 'settingsSection' (the second argument is not a sections, rather a value name <-> using settingsSection is misleading) bzr-revno: 1635
This commit is contained in:
commit
81c89e97f1
@ -984,7 +984,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
bible = unicode(self.quickVersionComboBox.currentText())
|
bible = unicode(self.quickVersionComboBox.currentText())
|
||||||
search_results = self.plugin.manager.get_verses(bible, string, False, False)
|
search_results = self.plugin.manager.get_verses(bible, string, False, False)
|
||||||
results = []
|
|
||||||
if search_results:
|
if search_results:
|
||||||
versetext = u' '.join([verse.text for verse in search_results])
|
versetext = u' '.join([verse.text for verse in search_results])
|
||||||
return [[string, versetext]]
|
return [[string, versetext]]
|
||||||
|
@ -80,7 +80,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
u'thumbnails')
|
u'thumbnails')
|
||||||
check_directory_exists(self.servicePath)
|
check_directory_exists(self.servicePath)
|
||||||
self.loadList(SettingsManager.load_list(
|
self.loadList(SettingsManager.load_list(
|
||||||
self.settingsSection, self.settingsSection), True)
|
self.settingsSection, u'images'), True)
|
||||||
|
|
||||||
def addListViewToToolBar(self):
|
def addListViewToToolBar(self):
|
||||||
MediaManagerItem.addListViewToToolBar(self)
|
MediaManagerItem.addListViewToToolBar(self)
|
||||||
@ -108,16 +108,16 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
unicode(text.text())))
|
unicode(text.text())))
|
||||||
self.listView.takeItem(row)
|
self.listView.takeItem(row)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
self.settingsSection, self.getFileList())
|
u'images', 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,10 @@ 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, u'images')
|
||||||
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])
|
||||||
|
@ -139,8 +139,6 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.mediaObject.clearQueue()
|
self.mediaObject.clearQueue()
|
||||||
self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))
|
self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))
|
||||||
if not self.mediaStateWait(Phonon.StoppedState):
|
if not self.mediaStateWait(Phonon.StoppedState):
|
||||||
# Due to string freeze, borrow a message from presentations
|
|
||||||
# This will be corrected in 1.9.6
|
|
||||||
critical_error_message_box(UiStrings().UnsupportedFile,
|
critical_error_message_box(UiStrings().UnsupportedFile,
|
||||||
UiStrings().UnsupportedFile)
|
UiStrings().UnsupportedFile)
|
||||||
return False
|
return False
|
||||||
@ -150,8 +148,6 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
if not self.mediaStateWait(Phonon.PlayingState) \
|
if not self.mediaStateWait(Phonon.PlayingState) \
|
||||||
or self.mediaObject.currentSource().type() \
|
or self.mediaObject.currentSource().type() \
|
||||||
== Phonon.MediaSource.Invalid:
|
== Phonon.MediaSource.Invalid:
|
||||||
# Due to string freeze, borrow a message from presentations
|
|
||||||
# This will be corrected in 1.9.6
|
|
||||||
self.mediaObject.stop()
|
self.mediaObject.stop()
|
||||||
critical_error_message_box(UiStrings().UnsupportedFile,
|
critical_error_message_box(UiStrings().UnsupportedFile,
|
||||||
UiStrings().UnsupportedFile)
|
UiStrings().UnsupportedFile)
|
||||||
@ -186,8 +182,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
def initialise(self):
|
def initialise(self):
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
self.listView.setIconSize(QtCore.QSize(88, 50))
|
self.listView.setIconSize(QtCore.QSize(88, 50))
|
||||||
self.loadList(SettingsManager.load_list(self.settingsSection,
|
self.loadList(SettingsManager.load_list(self.settingsSection, u'media'))
|
||||||
self.settingsSection))
|
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
"""
|
"""
|
||||||
@ -200,14 +195,14 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
for row in row_list:
|
for row in row_list:
|
||||||
self.listView.takeItem(row)
|
self.listView.takeItem(row)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
self.settingsSection, self.getFileList())
|
u'media', 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 +216,10 @@ 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, u'media')
|
||||||
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])
|
||||||
|
@ -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):
|
||||||
@ -228,7 +228,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
for row in row_list:
|
for row in row_list:
|
||||||
self.listView.takeItem(row)
|
self.listView.takeItem(row)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
self.settingsSection, self.getFileList())
|
u'presentations', self.getFileList())
|
||||||
|
|
||||||
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
||||||
"""
|
"""
|
||||||
@ -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, u'presentations')
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user