From 96f5a62fbe30102c27265aad6588b9d17768ade2 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Wed, 9 Mar 2011 17:54:59 +0000 Subject: [PATCH 01/18] Cleanups --- openlp/core/ui/firsttimelanguageform.py | 1 - openlp/core/ui/maindisplay.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/ui/firsttimelanguageform.py b/openlp/core/ui/firsttimelanguageform.py index 98489fde7..3916e428e 100644 --- a/openlp/core/ui/firsttimelanguageform.py +++ b/openlp/core/ui/firsttimelanguageform.py @@ -28,7 +28,6 @@ from PyQt4 import QtGui from firsttimelanguagedialog import Ui_FirstTimeLanguageDialog -from openlp.core.lib import translate from openlp.core.utils import LanguageManager class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog): diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 357eb655a..a3195fc39 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -396,7 +396,7 @@ class MainDisplay(DisplayWidget): if self.hideMode: self.hideDisplay(self.hideMode) else: - self.setVisible(True) + self.setVisible(True) preview = QtGui.QImage(self.screen[u'size'].width(), self.screen[u'size'].height(), QtGui.QImage.Format_ARGB32_Premultiplied) From 292aba71daeb6f2830079602f7b86440909504d0 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Wed, 9 Mar 2011 20:50:12 +0000 Subject: [PATCH 02/18] UiStrings.OpenFile --- openlp/core/lib/ui.py | 1 + openlp/core/ui/advancedtab.py | 3 +-- openlp/core/ui/servicemanager.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index eae4f60ca..1306a903f 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -73,6 +73,7 @@ class UiStrings(object): NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural') OLPV1 = translate('OpenLP.Ui', 'openlp.org 1.x') OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0') + OpenFile = translate('OpenLP.Ui', 'Open File') OpenService = translate('OpenLP.Ui', 'Open Service') Preview = translate('OpenLP.Ui', 'Preview') PreviewPanel = translate('OpenLP.Ui', 'Preview Panel') diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index a8e8b294e..bb3a252a9 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -215,8 +215,7 @@ class AdvancedTab(SettingsTab): file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(), UiStrings.AllFiles) filename = QtGui.QFileDialog.getOpenFileName(self, - translate('OpenLP.AdvancedTab', 'Open File'), '', - file_filters) + UiStrings.OpenFile, '', file_filters) if filename: self.defaultFileEdit.setText(filename) self.defaultFileEdit.setFocus() diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 3cdf25c7a..47e1f2de0 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -376,7 +376,7 @@ class ServiceManager(QtGui.QWidget): elif result == QtGui.QMessageBox.Save: self.saveFile() fileName = unicode(QtGui.QFileDialog.getOpenFileName(self.mainwindow, - translate('OpenLP.ServiceManager', 'Open File'), + UiStrings.OpenFile, SettingsManager.get_last_dir( self.mainwindow.serviceSettingsSection), translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))) From 85b5a31813695b37c95cc406af906ec698350f26 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 11 Mar 2011 16:35:32 +0000 Subject: [PATCH 03/18] Unused import --- openlp/plugins/songs/lib/sofimport.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/plugins/songs/lib/sofimport.py b/openlp/plugins/songs/lib/sofimport.py index 49adcd302..37f3136e9 100644 --- a/openlp/plugins/songs/lib/sofimport.py +++ b/openlp/plugins/songs/lib/sofimport.py @@ -33,7 +33,6 @@ import os import re -from songimport import SongImport from oooimport import OooImport if os.name == u'nt': From c663c09932c73d5c133794a8e256815ea88e994a Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 11 Mar 2011 16:51:07 +0000 Subject: [PATCH 04/18] Unused variables --- openlp/core/ui/servicemanager.py | 4 ++-- openlp/plugins/images/lib/mediaitem.py | 17 +++++++++-------- openlp/plugins/media/lib/mediaitem.py | 1 - 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index bb313fa3b..05a5b3d5c 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -417,7 +417,7 @@ class ServiceManager(QtGui.QWidget): return self.saveFileAs() 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 = basename + '.osd' log.debug(u'ServiceManager.saveFile - %s' % path_file_name) SettingsManager.set_last_dir(self.mainwindow.serviceSettingsSection, @@ -439,7 +439,7 @@ class ServiceManager(QtGui.QWidget): if path_from in write_list: continue file_size = os.path.getsize(path_from) - size_limit = 52428800 # 50MiB + #size_limit = 52428800 # 50MiB #if file_size > size_limit: # # File exeeds size_limit bytes, ask user # message = unicode(translate('OpenLP.ServiceManager', diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index e6fdfe7db..ac4074835 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -162,9 +162,9 @@ class ImageMediaItem(MediaManagerItem): # Continue with the existing images. for item in items: bitem = self.listView.item(item.row()) - filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) - (path, name) = os.path.split(filename) - service_item.add_from_image(filename, name) + filepath = unicode(bitem.data(QtCore.Qt.UserRole).toString()) + filename = os.path.split(filepath)[1] + service_item.add_from_image(filepath, filename) return True else: return False @@ -191,13 +191,14 @@ class ImageMediaItem(MediaManagerItem): 'You must select an image to replace the background with.')): item = self.listView.selectedIndexes()[0] 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) - self.parent.liveController.display.directImage(name, filename) + filepath = unicode(bitem.data(QtCore.Qt.UserRole).toString()) + if os.path.exists(filepath): + filename = os.path.split(filename)[1] + self.parent.liveController.display.directImage(filename, + filepath) self.resetAction.setVisible(True) else: critical_error_message_box(UiStrings.LiveBGError, unicode(translate('ImagePlugin.MediaItem', 'There was a problem replacing your background, ' - 'the image file "%s" no longer exists.')) % filename) + 'the image file "%s" no longer exists.')) % filepath) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 40ea7abb1..d5d6ad926 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -109,7 +109,6 @@ class MediaMediaItem(MediaManagerItem): item = self.listView.currentItem() filename = unicode(item.data(QtCore.Qt.UserRole).toString()) if os.path.exists(filename): - (path, name) = os.path.split(filename) self.parent.liveController.display.video(filename, 0, True) self.resetAction.setVisible(True) else: From 89cf1f8c8cdfaa44cba570bd62bc66f6bb8a0771 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Tue, 15 Mar 2011 12:56:47 +0000 Subject: [PATCH 05/18] Fix typo --- openlp/plugins/images/lib/mediaitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index ac4074835..fd7d39c57 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -193,7 +193,7 @@ class ImageMediaItem(MediaManagerItem): bitem = self.listView.item(item.row()) filepath = unicode(bitem.data(QtCore.Qt.UserRole).toString()) if os.path.exists(filepath): - filename = os.path.split(filename)[1] + filename = os.path.split(filepath)[1] self.parent.liveController.display.directImage(filename, filepath) self.resetAction.setVisible(True) From f931bb29f09e330359ea4592f28eeb85fd224886 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 19 Mar 2011 01:46:45 +0000 Subject: [PATCH 06/18] Unused import --- openlp/plugins/remotes/lib/httpserver.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 0d1e163eb..53603101a 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -111,7 +111,6 @@ import logging import os import urlparse import re -from pprint import pformat try: import json From 4222b0be9fe93a312003ad91561bd5964cd193ed Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 19 Mar 2011 12:57:48 +0000 Subject: [PATCH 07/18] Long line --- openlp/plugins/songs/lib/songbeamerimport.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songbeamerimport.py index 6d6b4e932..b28150ad7 100644 --- a/openlp/plugins/songs/lib/songbeamerimport.py +++ b/openlp/plugins/songs/lib/songbeamerimport.py @@ -112,7 +112,8 @@ class SongBeamerImport(SongImport): self.add_verse(self.current_verse, self.current_verse_type) self.current_verse = u'' - self.current_verse_type = VerseType.Tags[VerseType.Verse] + self.current_verse_type = \ + VerseType.Tags[VerseType.Verse] read_verses = True verse_start = True elif read_verses: From 95fad4b2d7509dde0ac824b4f037d2c9ab201c38 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 26 Mar 2011 22:46:56 +0000 Subject: [PATCH 08/18] Alignment --- openlp/core/ui/firsttimewizard.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index 4c7ae6880..71b3f5dfc 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -80,9 +80,9 @@ class Ui_FirstTimeWizard(object): self.pluginLayout.addWidget(self.imageCheckBox) self.presentationCheckBox = QtGui.QCheckBox(self.pluginPage) if sys.platform == "darwin": - self.presentationCheckBox.setChecked(False) + self.presentationCheckBox.setChecked(False) else: - self.presentationCheckBox.setChecked(True) + self.presentationCheckBox.setChecked(True) self.presentationCheckBox.setObjectName(u'presentationCheckBox') self.pluginLayout.addWidget(self.presentationCheckBox) self.mediaCheckBox = QtGui.QCheckBox(self.pluginPage) From ac365e5b6a735ce41620cd7e22e35e5f0f4d9580 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 26 Nov 2011 21:26:50 +0000 Subject: [PATCH 09/18] Cleanups --- openlp/core/lib/listwidgetwithdnd.py | 4 ++-- openlp/core/ui/maindisplay.py | 1 - openlp/core/ui/mainwindow.py | 8 ++++---- openlp/core/ui/themelayoutdialog.py | 1 - openlp/core/ui/themelayoutform.py | 3 --- openlp/plugins/alerts/lib/alertstab.py | 2 +- openlp/plugins/bibles/lib/versereferencelist.py | 3 ++- openlp/plugins/custom/forms/editcustomform.py | 3 ++- openlp/plugins/presentations/lib/mediaitem.py | 3 ++- openlp/plugins/songs/forms/editsongform.py | 10 ++++++---- openlp/plugins/songs/lib/upgrade.py | 1 - openlp/plugins/songusage/lib/upgrade.py | 1 - 12 files changed, 19 insertions(+), 21 deletions(-) diff --git a/openlp/core/lib/listwidgetwithdnd.py b/openlp/core/lib/listwidgetwithdnd.py index 69fb23092..31be1f5be 100644 --- a/openlp/core/lib/listwidgetwithdnd.py +++ b/openlp/core/lib/listwidgetwithdnd.py @@ -104,7 +104,7 @@ class ListWidgetWithDnD(QtGui.QListWidget): elif os.path.isdir(localFile): listing = os.listdir(localFile) for file in listing: - files.append(os.path.join(localFile,file)) - Receiver.send_message(u'%s_dnd' % self.mimeDataText,files) + files.append(os.path.join(localFile, file)) + Receiver.send_message(u'%s_dnd' % self.mimeDataText, files) else: event.ignore() diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 2a16867e5..c4f0903c7 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -29,7 +29,6 @@ The :mod:`maindisplay` module provides the functionality to display screens and play multimedia within OpenLP. """ import logging -import os from PyQt4 import QtCore, QtGui, QtWebKit from PyQt4.phonon import Phonon diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 47570cd8a..ed1a9318c 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -35,15 +35,14 @@ from datetime import datetime from PyQt4 import QtCore, QtGui from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \ - PluginManager, Receiver, translate, ImageManager, PluginStatus, \ - SettingsManager + PluginManager, Receiver, translate, ImageManager, PluginStatus from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \ icon_action, shortcut_action from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ ThemeManager, SlideController, PluginForm, MediaDockManager, \ ShortcutListForm, FormattingTagForm from openlp.core.utils import AppLocation, add_actions, LanguageManager, \ - get_application_version, delete_file + get_application_version from openlp.core.utils.actions import ActionList, CategoryOrder from openlp.core.ui.firsttimeform import FirstTimeForm from openlp.core.ui import ScreenList @@ -503,7 +502,8 @@ class Ui_MainWindow(object): self.toolsFirstTimeWizard.setText( translate('OpenLP.MainWindow', 'Re-run First Time Wizard')) self.toolsFirstTimeWizard.setStatusTip(translate('OpenLP.MainWindow', - 'Re-run the First Time Wizard, importing songs, Bibles and themes.')) + 'Re-run the First Time Wizard, importing songs, Bibles and ' + 'themes.')) self.updateThemeImages.setText( translate('OpenLP.MainWindow', 'Update Theme Images')) self.updateThemeImages.setStatusTip( diff --git a/openlp/core/ui/themelayoutdialog.py b/openlp/core/ui/themelayoutdialog.py index 5be08ad65..56bfe79bb 100644 --- a/openlp/core/ui/themelayoutdialog.py +++ b/openlp/core/ui/themelayoutdialog.py @@ -28,7 +28,6 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate -from openlp.core.lib.ui import create_accept_reject_button_box class Ui_ThemeLayoutDialog(object): diff --git a/openlp/core/ui/themelayoutform.py b/openlp/core/ui/themelayoutform.py index 6f77d31da..57d8bd952 100644 --- a/openlp/core/ui/themelayoutform.py +++ b/openlp/core/ui/themelayoutform.py @@ -29,9 +29,6 @@ from PyQt4 import QtGui, QtCore from themelayoutdialog import Ui_ThemeLayoutDialog -from openlp.core.lib import translate -from openlp.core.lib.ui import UiStrings, critical_error_message_box - class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog): """ The exception dialog diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index bd879fef3..90e06caab 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -192,7 +192,7 @@ class AlertsTab(SettingsTab): settings.setValue(u'location', QtCore.QVariant(self.location)) settings.endGroup() if self.changed: - Receiver.send_message(u'update_display_css') + Receiver.send_message(u'update_display_css') self.changed = False def updateDisplay(self): diff --git a/openlp/plugins/bibles/lib/versereferencelist.py b/openlp/plugins/bibles/lib/versereferencelist.py index 471fc6a66..a1727655e 100644 --- a/openlp/plugins/bibles/lib/versereferencelist.py +++ b/openlp/plugins/bibles/lib/versereferencelist.py @@ -72,7 +72,8 @@ class VerseReferenceList(object): continue prev = index - 1 if self.verse_list[prev][u'version'] != verse[u'version']: - result = u'%s (%s)' % (result, self.verse_list[prev][u'version']) + result = u'%s (%s)' % (result, + self.verse_list[prev][u'version']) result = result + u', ' if self.verse_list[prev][u'book'] != verse[u'book']: result = u'%s%s %s:' % (result, verse[u'book'], diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 0eadf6021..a85daa38b 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -30,7 +30,8 @@ import logging from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, translate -from openlp.core.lib.ui import critical_error_message_box, find_and_set_in_combo_box +from openlp.core.lib.ui import critical_error_message_box, \ + find_and_set_in_combo_box from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser from openlp.plugins.custom.lib.db import CustomSlide from editcustomdialog import Ui_CustomEditDialog diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index e1dd57271..6dc57373a 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -285,7 +285,8 @@ class PresentationMediaItem(MediaManagerItem): critical_error_message_box( translate('PresentationPlugin.MediaItem', 'Missing Presentation'), - unicode(translate('PresentationPlugin.MediaItem', + unicode(translate( + 'PresentationPlugin.MediaItem', 'The Presentation %s is incomplete,' ' please reload.')) % filename) return False diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 1c254406c..9164ef2a9 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -331,8 +331,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.topicsListView.addItem(topic_name) self.audioListWidget.clear() for media in self.song.media_files: - media_file = QtGui.QListWidgetItem(os.path.split(media.file_name)[1]) - media_file.setData(QtCore.Qt.UserRole, QtCore.QVariant(media.file_name)) + media_file = QtGui.QListWidgetItem( + os.path.split(media.file_name)[1]) + media_file.setData(QtCore.Qt.UserRole, + QtCore.QVariant(media.file_name)) self.audioListWidget.addItem(media_file) self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason) # Hide or show the preview button. @@ -721,7 +723,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): """ if self.mediaForm.exec_(): for filename in self.mediaForm.getSelectedFiles(): - item = QtGui.QListWidgetItem(os.path.split(unicode(filename))[1]) + item = QtGui.QListWidgetItem( + os.path.split(unicode(filename))[1]) item.setData(QtCore.Qt.UserRole, filename) self.audioListWidget.addItem(item) @@ -876,7 +879,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): os.remove(audio) except: log.exception('Could not remove file: %s', audio) - pass if not files: try: os.rmdir(save_path) diff --git a/openlp/plugins/songs/lib/upgrade.py b/openlp/plugins/songs/lib/upgrade.py index 21988c267..c1ce65702 100644 --- a/openlp/plugins/songs/lib/upgrade.py +++ b/openlp/plugins/songs/lib/upgrade.py @@ -31,7 +31,6 @@ backend for the Songs plugin from sqlalchemy import Column, Table, types from sqlalchemy.sql.expression import func -from migrate import changeset from migrate.changeset.constraint import ForeignKeyConstraint __version__ = 2 diff --git a/openlp/plugins/songusage/lib/upgrade.py b/openlp/plugins/songusage/lib/upgrade.py index 50ca32fcd..e9a508b76 100644 --- a/openlp/plugins/songusage/lib/upgrade.py +++ b/openlp/plugins/songusage/lib/upgrade.py @@ -30,7 +30,6 @@ backend for the SongsUsage plugin """ from sqlalchemy import Column, Table, types -from migrate import changeset __version__ = 1 From 5b4e8826ec06cf3ee4c3e6a50c100d4ccb1201f6 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 26 Nov 2011 21:59:21 +0000 Subject: [PATCH 10/18] Fix undefined variables --- openlp/plugins/songs/lib/olpimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index 7d2558ce8..b3acee5aa 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -39,7 +39,7 @@ from openlp.core.lib import translate from openlp.core.lib.db import BaseModel from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib import clean_song -from openlp.plugins.songs.lib.db import Author, Book, Song, Topic #, MediaFile +from openlp.plugins.songs.lib.db import Author, Book, MediaFile, Song, Topic from songimport import SongImport log = logging.getLogger(__name__) From f970d9462d109bd34deb75f4d45f1c4d5d71e998 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 2 Dec 2011 21:13:05 +0000 Subject: [PATCH 11/18] Cleanups --- openlp/core/ui/firsttimeform.py | 2 +- openlp/core/ui/media/mediacontroller.py | 35 ++++++++++++++----------- openlp/core/ui/media/phononplayer.py | 1 - openlp/core/ui/media/webkitplayer.py | 3 --- openlp/core/ui/slidecontroller.py | 23 ++++++++-------- openlp/plugins/media/lib/mediaitem.py | 4 +-- openlp/plugins/media/lib/mediatab.py | 2 +- openlp/plugins/media/mediaplugin.py | 1 - 8 files changed, 34 insertions(+), 37 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index bfa4bf6b1..9a5a2ea9d 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -65,7 +65,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.downloadCanceled = False self.downloading = unicode(translate('OpenLP.FirstTimeWizard', 'Downloading %s...')) - QtCore.QObject.connect(self.cancelButton,QtCore.SIGNAL('clicked()'), + QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.onCancelButtonClicked) QtCore.QObject.connect(self.noInternetFinishButton, QtCore.SIGNAL('clicked()'), self.onNoInternetFinishButtonClicked) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 453567d28..aca141271 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -26,13 +26,12 @@ ############################################################################### import logging - -import sys, os,time -from PyQt4 import QtCore, QtGui, QtWebKit +import os +from PyQt4 import QtCore, QtGui from openlp.core.lib import OpenLPToolbar, Receiver, translate from openlp.core.lib.mediaplayer import MediaPlayer -from openlp.core.lib.ui import UiStrings, critical_error_message_box +from openlp.core.lib.ui import critical_error_message_box from openlp.core.ui.media import MediaState, MediaInfo, MediaType from openlp.core.utils import AppLocation @@ -136,8 +135,9 @@ class MediaController(object): savedPlayers = playerSettings.split(u',') invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers \ if not mediaPlayer in self.mediaPlayers] - if len(invalidMediaPlayers)>0: - [savedPlayers.remove(invalidPlayer) for invalidPlayer in invalidMediaPlayers] + if len(invalidMediaPlayers) > 0: + for invalidPlayer in invalidMediaPlayers: + savedPlayers.remove(invalidPlayer) newPlayerSetting = u','.join(savedPlayers) QtCore.QSettings().setValue(u'media/players', QtCore.QVariant(newPlayerSetting)) @@ -346,7 +346,7 @@ class MediaController(object): def check_file_type(self, controller, display): """ - Used to choose the right media Player type from the prioritized Player list + Select the correct media Player type from the prioritized Player list """ playerSettings = str(QtCore.QSettings().value(u'media/players', QtCore.QVariant(u'webkit')).toString()) @@ -354,19 +354,21 @@ class MediaController(object): if QtCore.QSettings().value(u'media/override player', QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked: if self.overridenPlayer != '': - usedPlayers = [self.overridenPlayer] + usedPlayers = [self.overridenPlayer] if controller.media_info.file_info.isFile(): - suffix = u'*.%s' % controller.media_info.file_info.suffix().toLower() + suffix = u'*.%s' % \ + controller.media_info.file_info.suffix().toLower() for title in usedPlayers: player = self.mediaPlayers[title] if suffix in player.video_extensions_list: if not controller.media_info.is_background or \ - controller.media_info.is_background and player.canBackground: - self.resize(controller, display, player) - if player.load(display): - self.curDisplayMediaPlayer[display] = player - controller.media_info.media_type = MediaType.Video - return True + controller.media_info.is_background and \ + player.canBackground: + self.resize(controller, display, player) + if player.load(display): + self.curDisplayMediaPlayer[display] = player + controller.media_info.media_type = MediaType.Video + return True if suffix in player.audio_extensions_list: if player.load(display): self.curDisplayMediaPlayer[display] = player @@ -399,7 +401,8 @@ class MediaController(object): return False if status: display.frame.evaluateJavaScript(u'show_blank("desktop");') - self.curDisplayMediaPlayer[display].set_visible(display, True) + self.curDisplayMediaPlayer[display].set_visible(display, + True) if controller.isLive: if controller.hideMenu.defaultAction().isChecked(): controller.hideMenu.defaultAction().trigger() diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index abafb1d5c..5203c5960 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -29,7 +29,6 @@ import logging import mimetypes from datetime import datetime -from PyQt4 import QtCore, QtGui from PyQt4.phonon import Phonon from openlp.core.lib import Receiver diff --git a/openlp/core/ui/media/webkitplayer.py b/openlp/core/ui/media/webkitplayer.py index 058f30f58..3f7bc37be 100644 --- a/openlp/core/ui/media/webkitplayer.py +++ b/openlp/core/ui/media/webkitplayer.py @@ -27,9 +27,6 @@ import logging -from PyQt4 import QtCore, QtGui, QtWebKit - -from openlp.core.lib import OpenLPToolbar, translate from openlp.core.lib.mediaplayer import MediaPlayer from openlp.core.ui.media import MediaState diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 316243b91..3cb98ff97 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -27,12 +27,10 @@ import os import logging -import time import copy from collections import deque from PyQt4 import QtCore, QtGui -from PyQt4.phonon import Phonon from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \ translate, build_icon, ServiceItem, build_html, PluginManager, ServiceItem @@ -68,7 +66,8 @@ class Controller(QtGui.QWidget): created from within other plugins This function is needed to catch the current controller """ - sender = self.sender().objectName() if self.sender().objectName() else self.sender().text() + sender = self.sender().objectName() if self.sender().objectName() \ + else self.sender().text() controller = self Receiver.send_message('%s' % sender, [controller, args]) @@ -573,7 +572,6 @@ class SlideController(Controller): """ self.keypress_queue.append(u'previous') self._process_queue() - def serviceNext(self): """ @@ -581,7 +579,7 @@ class SlideController(Controller): """ self.keypress_queue.append(u'next') self._process_queue() - + def _process_queue(self): """ Process the service item request queue. The key presses can arrive @@ -595,7 +593,6 @@ class SlideController(Controller): else: Receiver.send_message('servicemanager_next_item') self.keypress_loop = False - def screenSizeChanged(self): """ @@ -640,11 +637,12 @@ class SlideController(Controller): self.previewFrame.height()): # We have to take the height as limit. max_height = self.previewFrame.height() - self.grid.margin() * 2 - self.slidePreview.setFixedSize(QtCore.QSize(max_height * self.ratio, - max_height)) - self.previewDisplay.setFixedSize(QtCore.QSize(max_height * self.ratio, - max_height)) - self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()} + self.slidePreview.setFixedSize(QtCore.QSize( + max_height * self.ratio, max_height)) + self.previewDisplay.setFixedSize(QtCore.QSize( + max_height * self.ratio, max_height)) + self.previewDisplay.screen = { + u'size':self.previewDisplay.geometry()} else: # We have to take the width as limit. max_width = self.previewFrame.width() - self.grid.margin() * 2 @@ -652,7 +650,8 @@ class SlideController(Controller): max_width / self.ratio)) self.previewDisplay.setFixedSize(QtCore.QSize(max_width, max_width / self.ratio)) - self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()} + self.previewDisplay.screen = { + u'size':self.previewDisplay.geometry()} # Make sure that the frames have the correct size. self.previewListWidget.setColumnWidth(0, self.previewListWidget.viewport().size().width()) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index d33aeb47b..0d5d8eeff 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -30,7 +30,6 @@ import os import locale from PyQt4 import QtCore, QtGui -from PyQt4.phonon import Phonon from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \ SettingsManager, translate, check_item_selected, Receiver, MediaType, \ @@ -139,7 +138,8 @@ class MediaMediaItem(MediaManagerItem): # Add the Media widget to the page layout self.pageLayout.addWidget(self.mediaWidget) QtCore.QObject.connect(self.displayTypeComboBox, - QtCore.SIGNAL(u'currentIndexChanged (int)'), self.overridePlayerChanged) + QtCore.SIGNAL(u'currentIndexChanged (int)'), + self.overridePlayerChanged) def overridePlayerChanged(self, index): Receiver.send_message(u'media_override_player', \ diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index 2b2485dea..4e39bc419 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, translate, Receiver -from openlp.core.lib.ui import UiStrings, critical_error_message_box +from openlp.core.lib.ui import UiStrings class MediaTab(SettingsTab): """ diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 13a84b289..97f749689 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -26,7 +26,6 @@ ############################################################################### import logging -import os from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.plugins.media.lib import MediaMediaItem, MediaTab From e526687c71df6b15a29aa71249bc8cb76f801b60 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 2 Dec 2011 21:33:11 +0000 Subject: [PATCH 12/18] Cleanup fix --- openlp/core/ui/media/mediacontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index aca141271..b05a7fe59 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -354,7 +354,7 @@ class MediaController(object): if QtCore.QSettings().value(u'media/override player', QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked: if self.overridenPlayer != '': - usedPlayers = [self.overridenPlayer] + usedPlayers = [self.overridenPlayer] if controller.media_info.file_info.isFile(): suffix = u'*.%s' % \ controller.media_info.file_info.suffix().toLower() From bd02fb5f30f7d23a85bbda0ed530297d63841846 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 2 Dec 2011 21:49:20 +0000 Subject: [PATCH 13/18] Whitespace --- openlp/core/ui/slidecontroller.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 3cb98ff97..f6d5e3d90 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -582,14 +582,14 @@ class SlideController(Controller): def _process_queue(self): """ - Process the service item request queue. The key presses can arrive - faster than the processing so implement a FIFO queue. + Process the service item request queue. The key presses can arrive + faster than the processing so implement a FIFO queue. """ if len(self.keypress_queue): while len(self.keypress_queue) and not self.keypress_loop: - self.keypress_loop = True + self.keypress_loop = True if self.keypress_queue.popleft() == u'previous': - Receiver.send_message('servicemanager_previous_item') + Receiver.send_message('servicemanager_previous_item') else: Receiver.send_message('servicemanager_next_item') self.keypress_loop = False From 02f5e819fb25ca26d80532ad58076495fe8ea18d Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 2 Dec 2011 22:23:37 +0000 Subject: [PATCH 14/18] Revert broken old incomplete thought --- openlp/core/ui/advancedtab.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index d6d28f053..43e2a9915 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -243,7 +243,8 @@ class AdvancedTab(SettingsTab): file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(), UiStrings().AllFiles) filename = QtGui.QFileDialog.getOpenFileName(self, - UiStrings.OpenFile, '', file_filters) + translate('OpenLP.AdvancedTab', 'Open File'), '', + file_filters) if filename: self.defaultFileEdit.setText(filename) self.defaultFileEdit.setFocus() From 69c33adba7d74db8ce6252d3d93913ff75763468 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 3 Dec 2011 13:42:49 +0200 Subject: [PATCH 15/18] Added a missing dependency (python-qt4-gl). --- resources/debian/debian/control | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/debian/debian/control b/resources/debian/debian/control index a1c2298e9..a00f5c86f 100644 --- a/resources/debian/debian/control +++ b/resources/debian/debian/control @@ -10,8 +10,9 @@ Homepage: http://openlp.org/ Package: openlp Architecture: all Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-qt4, - python-qt4-phonon, python-sqlalchemy, python-chardet, python-beautifulsoup, - python-lxml, python-sqlite, python-enchant, python-mako, python-migrate + python-qt4-phonon, python-qt4-gl, python-sqlalchemy, python-chardet, + python-beautifulsoup, python-lxml, python-sqlite, python-enchant, + python-mako, python-migrate Conflicts: python-openlp Description: Church lyrics projection application OpenLP is free church presentation software, or lyrics projection software, From 1239cd707c71200fe0f5f3d07c325ee23e0dfe33 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 3 Dec 2011 12:51:40 +0000 Subject: [PATCH 16/18] Fix database versions --- openlp/core/lib/db.py | 1 + openlp/core/lib/pluginmanager.py | 2 ++ openlp/core/ui/pluginform.py | 9 +++++---- openlp/plugins/songs/songsplugin.py | 3 +++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index cafc867b3..86e0a0a30 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -182,6 +182,7 @@ class Manager(object): settings.beginGroup(plugin_name) self.db_url = u'' self.is_dirty = False + self.session = None db_type = unicode( settings.value(u'db type', QtCore.QVariant(u'sqlite')).toString()) if db_type == u'sqlite': diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index 277842167..db5d9b60e 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -158,6 +158,8 @@ class PluginManager(object): for plugin in self.plugins: if plugin.status is not PluginStatus.Disabled: plugin.settings_tab = plugin.getSettingsTab(settings_form) + else: + plugin.settings_tab = None settings_form.plugins = self.plugins def hook_import_menu(self, import_menu): diff --git a/openlp/core/ui/pluginform.py b/openlp/core/ui/pluginform.py index c529248a9..6933bd8fc 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -117,16 +117,17 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): self.pluginListWidget.currentItem().text().split(u'(')[0][:-1] self.activePlugin = None for plugin in self.parent().pluginManager.plugins: - if plugin.nameStrings[u'singular'] == plugin_name_singular: - self.activePlugin = plugin - break + if plugin.status != PluginStatus.Disabled: + if plugin.nameStrings[u'singular'] == plugin_name_singular: + self.activePlugin = plugin + break if self.activePlugin: self._setDetails() else: self._clearDetails() def onStatusComboBoxChanged(self, status): - if self.programaticChange: + if self.programaticChange or status == PluginStatus.Disabled: return if status == 0: Receiver.send_message(u'cursor_busy') diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 54b1d3f1f..90fd1b7bc 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -64,6 +64,9 @@ class SongsPlugin(Plugin): self.icon_path = u':/plugins/plugin_songs.png' self.icon = build_icon(self.icon_path) + def checkPreConditions(self): + return not self.manager.session == None + def initialise(self): log.info(u'Songs Initialising') Plugin.initialise(self) From b37c41d7a85382108cb58394f73cff352a700b8c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 3 Dec 2011 13:32:19 +0000 Subject: [PATCH 17/18] minor fixes --- openlp/plugins/songs/songsplugin.py | 2 +- openlp/plugins/songusage/songusageplugin.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 90fd1b7bc..a5f194f7b 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -65,7 +65,7 @@ class SongsPlugin(Plugin): self.icon = build_icon(self.icon_path) def checkPreConditions(self): - return not self.manager.session == None + return self.manager.session is not None def initialise(self): log.info(u'Songs Initialising') diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 495d3103d..d09831052 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -54,6 +54,9 @@ class SongUsagePlugin(Plugin): self.inactiveIcon = build_icon(u':/songusage/song_usage_inactive.png') self.songUsageActive = False + def checkPreConditions(self): + return self.manager.session is not None + def addToolsMenuItem(self, tools_menu): """ Give the SongUsage plugin the opportunity to add items to the From 9c0bde098f604dc53aa03d6af25712e4faf0b97f Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 3 Dec 2011 13:40:48 +0000 Subject: [PATCH 18/18] Fix spacing --- openlp/core/ui/slidecontroller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index f6d5e3d90..92eb7971e 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -642,7 +642,7 @@ class SlideController(Controller): self.previewDisplay.setFixedSize(QtCore.QSize( max_height * self.ratio, max_height)) self.previewDisplay.screen = { - u'size':self.previewDisplay.geometry()} + u'size': self.previewDisplay.geometry()} else: # We have to take the width as limit. max_width = self.previewFrame.width() - self.grid.margin() * 2 @@ -651,7 +651,7 @@ class SlideController(Controller): self.previewDisplay.setFixedSize(QtCore.QSize(max_width, max_width / self.ratio)) self.previewDisplay.screen = { - u'size':self.previewDisplay.geometry()} + u'size': self.previewDisplay.geometry()} # Make sure that the frames have the correct size. self.previewListWidget.setColumnWidth(0, self.previewListWidget.viewport().size().width())