diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 8fa2127ad..0139cd001 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -166,7 +166,7 @@ class ImageManager(QtCore.QObject): self.height = current_screen[u'size'].height() # Mark the images as dirty for a rebuild by setting the image and byte # stream to None. - for key, image in self._cache.iteritems(): + for image in self._cache.values(): self._reset_image(image) def update_images(self, image_type, background): @@ -176,7 +176,7 @@ class ImageManager(QtCore.QObject): log.debug(u'update_images') # Mark the images as dirty for a rebuild by setting the image and byte # stream to None. - for key, image in self._cache.iteritems(): + for image in self._cache.values(): if image.source == image_type: image.background = background self._reset_image(image) @@ -188,7 +188,7 @@ class ImageManager(QtCore.QObject): log.debug(u'update_images') # Mark the images as dirty for a rebuild by setting the image and byte # stream to None. - for key, image in self._cache.iteritems(): + for image in self._cache.values(): if image.source == image_type and image.name == name: image.background = background self._reset_image(image) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index 3e650765d..943f8daff 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -405,7 +405,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): # Only continue when we include the song's text. if not self.slideTextCheckBox.isChecked(): return - for index, item in enumerate(self.serviceManager.serviceItems): + for item in self.serviceManager.serviceItems: # Trigger Audit requests Receiver.send_message(u'print_service_started', [item[u'service_item']]) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 033558ca6..a8ab56f69 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -461,7 +461,7 @@ class ServiceManager(QtGui.QWidget): log.debug(temp_file_name) path_file_name = unicode(self.fileName()) path, file_name = os.path.split(path_file_name) - basename, extension = os.path.splitext(file_name) + basename = os.path.splitext(file_name)[0] service_file_name = '%s.osd' % basename log.debug(u'ServiceManager.saveFile - %s', path_file_name) SettingsManager.set_last_dir( @@ -1359,15 +1359,15 @@ class ServiceManager(QtGui.QWidget): Handle of the event pint passed """ link = event.mimeData() - if event.mimeData().hasUrls(): + if link.hasUrls(): event.setDropAction(QtCore.Qt.CopyAction) event.accept() - for url in event.mimeData().urls(): + for url in link.urls(): filename = unicode(url.toLocalFile()) if filename.endswith(u'.osz'): self.onLoadServiceClicked(filename) - elif event.mimeData().hasText(): - plugin = unicode(event.mimeData().text()) + elif link.hasText(): + plugin = unicode(link.text()) item = self.serviceManagerList.itemAt(event.pos()) # ServiceManager started the drag and drop if plugin == u'ServiceManager': diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 0aa5d44d0..b2e09e809 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -57,7 +57,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): def exec_(self): # load all the settings self.settingListWidget.clear() - for tabIndex in range(0, self.stackedLayout.count() + 1): + while self.stackedLayout.count(): # take at 0 and the rest shuffle up. self.stackedLayout.takeAt(0) self.insertTab(self.generalTab, 0, PluginStatus.Active) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 430a1b3a3..72a8b7e3b 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -153,7 +153,6 @@ class ThemeManager(QtGui.QWidget): Import new themes downloaded by the first time wizard """ Receiver.send_message(u'cursor_busy') - encoding = get_filesystem_encoding() files = SettingsManager.get_files(self.settingsSection, u'.otz') for file in files: file = os.path.join(self.path, file) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 80d6360a8..7015d5308 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -189,7 +189,7 @@ class ImageMediaItem(MediaManagerItem): # Continue with the existing images. for bitem in items: filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) - (path, name) = os.path.split(filename) + name = os.path.split(filename)[1] service_item.add_from_image(filename, name, background) return True @@ -220,7 +220,7 @@ class ImageMediaItem(MediaManagerItem): bitem = self.listView.item(item.row()) filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) if os.path.exists(filename): - (path, name) = os.path.split(filename) + name = os.path.split(filename)[1] if self.plugin.liveController.display.directImage(name, filename, background): self.resetAction.setVisible(True) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 02b464497..91fff151b 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -589,7 +589,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): verse_names.append(u'%s%s' % ( VerseType.translated_tag(verse[0]), verse[1:])) verses_not_used = [] - for count, verse in enumerate(verses): + for verse in verses: if not verse in order: verses_not_used.append(verse) self.warningLabel.setVisible(len(verses_not_used) > 0) @@ -680,7 +680,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.verseListWidget.rowCount()) if not result: return False - item = int(self.songBookComboBox.currentIndex()) text = unicode(self.songBookComboBox.currentText()) if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0: if QtGui.QMessageBox.question(self,