This commit is contained in:
Tim Bentley 2012-04-17 18:27:15 +01:00
commit d27c8f2f89
4 changed files with 22 additions and 3 deletions

View File

@ -386,7 +386,7 @@ def parse_reference(reference, bible, language_selection, book_ref_id=False):
if bible.get_book_by_book_ref_id(value[u'id']):
book_ref_id = value[u'id']
break
elif bible.get_book_by_book_ref_id(book_ref_id):
elif not bible.get_book_by_book_ref_id(book_ref_id):
book_ref_id = False
ranges = match.group(u'ranges')
range_list = get_reference_match(u'range_separator').split(ranges)

View File

@ -105,26 +105,30 @@ class ImageMediaItem(MediaManagerItem):
'You must select an image to delete.')):
row_list = [item.row() for item in self.listView.selectedIndexes()]
row_list.sort(reverse=True)
Receiver.send_message(u'cursor_busy')
self.plugin.formparent.displayProgressBar(len(row_list))
for row in row_list:
text = self.listView.item(row)
if text:
delete_file(os.path.join(self.servicePath,
unicode(text.text())))
self.listView.takeItem(row)
self.plugin.formparent.incrementProgressBar()
SettingsManager.set_list(self.settingsSection,
u'images', self.getFileList())
self.plugin.formparent.finishedProgressBar()
Receiver.send_message(u'cursor_normal')
self.listView.blockSignals(False)
def loadList(self, images, initialLoad=False):
if not initialLoad:
Receiver.send_message(u'cursor_busy')
self.plugin.formparent.displayProgressBar(len(images))
# Sort the themes by its filename considering language specific
# characters. lower() is needed for windows!
images.sort(cmp=locale.strcoll,
key=lambda filename: os.path.split(unicode(filename))[1].lower())
for imageFile in images:
if not initialLoad:
self.plugin.formparent.incrementProgressBar()
filename = os.path.split(unicode(imageFile))[1]
thumb = os.path.join(self.servicePath, filename)
if not os.path.exists(unicode(imageFile)):
@ -139,8 +143,11 @@ class ImageMediaItem(MediaManagerItem):
item_name.setToolTip(imageFile)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile))
self.listView.addItem(item_name)
if not initialLoad:
self.plugin.formparent.incrementProgressBar()
if not initialLoad:
self.plugin.formparent.finishedProgressBar()
Receiver.send_message(u'cursor_normal')
def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False):

View File

@ -165,6 +165,7 @@ class PresentationMediaItem(MediaManagerItem):
titles = [os.path.split(file)[1] for file in currlist]
Receiver.send_message(u'cursor_busy')
if not initialLoad:
Receiver.send_message(u'cursor_busy')
self.plugin.formparent.displayProgressBar(len(files))
# Sort the themes by its filename considering language specific
# characters. lower() is needed for windows!
@ -217,6 +218,7 @@ class PresentationMediaItem(MediaManagerItem):
Receiver.send_message(u'cursor_normal')
if not initialLoad:
self.plugin.formparent.finishedProgressBar()
Receiver.send_message(u'cursor_normal')
def onDeleteClick(self):
"""
@ -226,6 +228,8 @@ class PresentationMediaItem(MediaManagerItem):
items = self.listView.selectedIndexes()
row_list = [item.row() for item in items]
row_list.sort(reverse=True)
Receiver.send_message(u'cursor_busy')
self.plugin.formparent.displayProgressBar(len(row_list))
for item in items:
filepath = unicode(item.data(
QtCore.Qt.UserRole).toString())
@ -233,6 +237,9 @@ class PresentationMediaItem(MediaManagerItem):
doc = self.controllers[cidx].add_document(filepath)
doc.presentation_deleted()
doc.close_presentation()
self.plugin.formparent.incrementProgressBar()
self.plugin.formparent.finishedProgressBar()
Receiver.send_message(u'cursor_normal')
for row in row_list:
self.listView.takeItem(row)
SettingsManager.set_list(self.settingsSection,

View File

@ -408,6 +408,8 @@ class SongMediaItem(MediaManagerItem):
QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return
Receiver.send_message(u'cursor_busy')
self.plugin.formparent.displayProgressBar(len(items))
for item in items:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
media_files = self.plugin.manager.get_all_objects(MediaFile,
@ -426,6 +428,9 @@ class SongMediaItem(MediaManagerItem):
except OSError:
log.exception(u'Could not remove directory: %s', save_path)
self.plugin.manager.delete_object(Song, item_id)
self.plugin.formparent.incrementProgressBar()
self.plugin.formparent.finishedProgressBar()
Receiver.send_message(u'cursor_normal')
self.onSearchTextButtonClicked()
def onCloneClick(self):