From 96f5a62fbe30102c27265aad6588b9d17768ade2 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Wed, 9 Mar 2011 17:54:59 +0000 Subject: [PATCH 01/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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/29] 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()) From eb121abb12590f992707325902cda92459ddb940 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 3 Dec 2011 15:38:30 +0100 Subject: [PATCH 19/29] attempt to fix bug 768495 Fixes: https://launchpad.net/bugs/768495 --- openlp/core/utils/actions.py | 57 +++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/openlp/core/utils/actions.py b/openlp/core/utils/actions.py index 86ee69a48..36c1c2e78 100644 --- a/openlp/core/utils/actions.py +++ b/openlp/core/utils/actions.py @@ -188,6 +188,7 @@ class ActionList(object): actions or categories. """ instance = None + action_map = {} def __init__(self): self.categories = CategoryList() @@ -226,17 +227,41 @@ class ActionList(object): self.categories[category].actions.append(action) else: self.categories[category].actions.add(action, weight) - if category is None: - # Stop here, as this action is not configurable. - return # Load the shortcut from the config. settings = QtCore.QSettings() settings.beginGroup(u'shortcuts') shortcuts = settings.value(action.objectName(), QtCore.QVariant(action.shortcuts())).toStringList() + settings.endGroup() + if not shortcuts: + action.setShortcuts([]) + return + shortcuts = map(unicode, shortcuts) + # Check the alternate shortcut first, to avoid problems when the + # alternate shortcut becomes the primary shortcut after removing the + # (initial) primary shortcut due to confllicts. + if len(shortcuts) == 2: + existing_actions = ActionList.action_map.get(shortcuts[1], []) + # Check for conflicts with other actions considering the shortcut + # context. + if self._shortcut_available(existing_actions, action): + actions = ActionList.action_map.get(shortcuts[1], []) + actions.append(action) + ActionList.action_map[shortcuts[1]] = actions + else: + shortcuts.remove(shortcuts[1]) + # Check the primary shortcut. + existing_actions = ActionList.action_map.get(shortcuts[0], []) + # Check for conflicts with other actions considering the shortcut + # context. + if self._shortcut_available(existing_actions, action): + actions = ActionList.action_map.get(shortcuts[0], []) + actions.append(action) + ActionList.action_map[shortcuts[0]] = actions + else: + shortcuts.remove(shortcuts[0]) action.setShortcuts( [QtGui.QKeySequence(shortcut) for shortcut in shortcuts]) - settings.endGroup() def remove_action(self, action, category=None): """ @@ -279,6 +304,30 @@ class ActionList(object): return self.categories.add(name, weight) + def _shortcut_available(self, existing_actions, action): + """ + Checks if the given ``action`` may use its assigned shortcut(s) or not. + Returns ``True`` or ``False. + + ``existing_actions`` + A list of actions which already use a particular shortcut. + + ``action`` + The action which wants to use a particular shortcut. + """ + for existing_action in existing_actions: + if action is existing_action: + continue + if existing_action.parent() is action.parent(): + return False + if existing_action.shortcutContext() in [QtCore.Qt.WindowShortcut, + QtCore.Qt.ApplicationShortcut]: + return False + if action.shortcutContext() in [QtCore.Qt.WindowShortcut, + QtCore.Qt.ApplicationShortcut]: + return False + return True + class CategoryOrder(object): """ From 5bfc101f0978acb6b5a0ae4410e4ae5ced9f8de2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 3 Dec 2011 16:09:03 +0100 Subject: [PATCH 20/29] changed name --- openlp/core/utils/actions.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/core/utils/actions.py b/openlp/core/utils/actions.py index 36c1c2e78..525a18f37 100644 --- a/openlp/core/utils/actions.py +++ b/openlp/core/utils/actions.py @@ -188,7 +188,7 @@ class ActionList(object): actions or categories. """ instance = None - action_map = {} + shortcut_map = {} def __init__(self): self.categories = CategoryList() @@ -241,23 +241,23 @@ class ActionList(object): # alternate shortcut becomes the primary shortcut after removing the # (initial) primary shortcut due to confllicts. if len(shortcuts) == 2: - existing_actions = ActionList.action_map.get(shortcuts[1], []) + existing_actions = ActionList.shortcut_map.get(shortcuts[1], []) # Check for conflicts with other actions considering the shortcut # context. if self._shortcut_available(existing_actions, action): - actions = ActionList.action_map.get(shortcuts[1], []) + actions = ActionList.shortcut_map.get(shortcuts[1], []) actions.append(action) - ActionList.action_map[shortcuts[1]] = actions + ActionList.shortcut_map[shortcuts[1]] = actions else: shortcuts.remove(shortcuts[1]) # Check the primary shortcut. - existing_actions = ActionList.action_map.get(shortcuts[0], []) + existing_actions = ActionList.shortcut_map.get(shortcuts[0], []) # Check for conflicts with other actions considering the shortcut # context. if self._shortcut_available(existing_actions, action): - actions = ActionList.action_map.get(shortcuts[0], []) + actions = ActionList.shortcut_map.get(shortcuts[0], []) actions.append(action) - ActionList.action_map[shortcuts[0]] = actions + ActionList.shortcut_map[shortcuts[0]] = actions else: shortcuts.remove(shortcuts[0]) action.setShortcuts( @@ -269,7 +269,7 @@ class ActionList(object): automatically removed. ``action`` - The QAction object to be removed. + The ``QAction`` object to be removed. ``category`` The name (unicode string) of the category, which contains the From f34ae80eec59edff957c5a78401d397019d01697 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 3 Dec 2011 19:01:36 +0100 Subject: [PATCH 21/29] fixed bug 887313 Fixes: https://launchpad.net/bugs/887313 --- openlp/core/ui/printserviceform.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index c08b6293e..4d1dc71c8 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -402,6 +402,9 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): settings.endGroup() def update_song_usage(self): + # Only continue when we include the song's text. + if not self.slideTextCheckBox.isChecked(): + return for index, item in enumerate(self.serviceManager.serviceItems): # Trigger Audit requests Receiver.send_message(u'print_service_started', From 5b67d36b3cc91c94ffde82adfba1ab4c9d37350d Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 3 Dec 2011 20:23:46 +0200 Subject: [PATCH 22/29] Fix problem where importing new song databases now does not work. Fixes: https://launchpad.net/bugs/863845 --- openlp/plugins/songs/lib/olpimport.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index 75e149fad..29d03a136 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, Song, Topic, MediaFile from songimport import SongImport log = logging.getLogger(__name__) @@ -143,7 +143,8 @@ class OpenLPSongImport(SongImport): secondary=source_media_files_songs_table) else: song_props['media_files'] = relation(OldMediaFile, - backref='songs') + backref='songs', primaryjoin=source_songs_table.c.id==OldMediaFile.song_id, + foreign_keys=[source_media_files_table.c.song_id]) try: class_mapper(OldAuthor) except UnmappedClassError: From b78bb1c7e60547814beb6da01b92cbd79a0743bc Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 3 Dec 2011 21:35:53 +0100 Subject: [PATCH 23/29] fixed tooltip strings --- openlp/core/ui/media/mediacontroller.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index b05a7fe59..c4e3e7fa9 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -206,15 +206,15 @@ class MediaController(object): controller.mediabar = OpenLPToolbar(controller) controller.mediabar.addToolbarButton( u'media_playback_play', u':/slides/media_playback_start.png', - translate('OpenLP.SlideController', 'Start playing media'), + translate('OpenLP.SlideController', 'Start playing media.'), controller.sendToPlugins) controller.mediabar.addToolbarButton( u'media_playback_pause', u':/slides/media_playback_pause.png', - translate('OpenLP.SlideController', 'Pause playing media'), + translate('OpenLP.SlideController', 'Pause playing media.'), controller.sendToPlugins) controller.mediabar.addToolbarButton( u'media_playback_stop', u':/slides/media_playback_stop.png', - translate('OpenLP.SlideController', 'Stop playing media'), + translate('OpenLP.SlideController', 'Stop playing media.'), controller.sendToPlugins) # Build the seekSlider. controller.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal) @@ -223,7 +223,7 @@ class MediaController(object): 'OpenLP.SlideController', 'Video position.')) controller.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24)) controller.seekSlider.setObjectName(u'seek_slider') - controller.mediabar.addToolbarWidget(u'Seek Slider', + controller.mediabar.addToolbarWidget(u'Seek Slider', controller.seekSlider) # Build the volumeSlider. controller.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal) @@ -236,7 +236,7 @@ class MediaController(object): controller.volumeSlider.setValue(controller.media_info.volume) controller.volumeSlider.setGeometry(QtCore.QRect(90, 160, 221, 24)) controller.volumeSlider.setObjectName(u'volume_slider') - controller.mediabar.addToolbarWidget(u'Audio Volume', + controller.mediabar.addToolbarWidget(u'Audio Volume', controller.volumeSlider) control_panel.addWidget(controller.mediabar) controller.mediabar.setVisible(False) @@ -255,7 +255,7 @@ class MediaController(object): def setup_display(self, display): """ - After a new display is configured, all media related widget will be + After a new display is configured, all media related widget will be created too """ # clean up possible running old media files @@ -276,13 +276,13 @@ class MediaController(object): def set_controls_visible(self, controller, value): # Generic controls controller.mediabar.setVisible(value) - # Special controls: Here media type specific Controls will be enabled + # Special controls: Here media type specific Controls will be enabled # (e.g. for DVD control, ...) # TODO def resize(self, controller, display, player): """ - After Mainwindow changes or Splitter moved all related media widgets + After Mainwindow changes or Splitter moved all related media widgets have to be resized """ player.resize(display) @@ -389,7 +389,7 @@ class MediaController(object): def video_play(self, msg, status=True): """ Responds to the request to play a loaded video - + ``msg`` First element is the controller which should be used """ From def18307ccc9d1bb7b0c95d1eee4aaae65994900 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 3 Dec 2011 23:49:40 +0200 Subject: [PATCH 24/29] Avoid an error about something not being a Boolean. Fixes: https://launchpad.net/bugs/899532 --- openlp/plugins/songs/lib/olpimport.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index 29d03a136..99ca9e748 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -121,6 +121,7 @@ class OpenLPSongImport(SongImport): source_topics_table = source_meta.tables[u'topics'] source_authors_songs_table = source_meta.tables[u'authors_songs'] source_songs_topics_table = source_meta.tables[u'songs_topics'] + source_media_files_songs_table = None if has_media_files: source_media_files_table = source_meta.tables[u'media_files'] source_media_files_songs_table = \ @@ -137,7 +138,7 @@ class OpenLPSongImport(SongImport): secondary=source_songs_topics_table) } if has_media_files: - if source_media_files_songs_table: + if source_media_files_songs_table is not None: song_props['media_files'] = relation(OldMediaFile, backref='songs', secondary=source_media_files_songs_table) From 2016ce61ca220fdc7dcfe5445bb7d35966698657 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 4 Dec 2011 00:30:22 +0200 Subject: [PATCH 25/29] Sometimes the song_id column doesn't exist on the model, so we use the table instead. --- openlp/plugins/songs/lib/olpimport.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index 99ca9e748..d7a735033 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -144,8 +144,9 @@ class OpenLPSongImport(SongImport): secondary=source_media_files_songs_table) else: song_props['media_files'] = relation(OldMediaFile, - backref='songs', primaryjoin=source_songs_table.c.id==OldMediaFile.song_id, - foreign_keys=[source_media_files_table.c.song_id]) + backref='songs', + primaryjoin=source_songs_table.c.id == \ + source_media_files_table.c.song_id) try: class_mapper(OldAuthor) except UnmappedClassError: From c825df38fad9bd0a745c09f3f1d9dc5a9bb38a9a Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 4 Dec 2011 15:26:27 +0200 Subject: [PATCH 26/29] Hopefully the final piece of the fix. --- openlp/plugins/songs/lib/olpimport.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index d7a735033..598815c8f 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -145,6 +145,7 @@ class OpenLPSongImport(SongImport): else: song_props['media_files'] = relation(OldMediaFile, backref='songs', + foreign_keys=[source_media_files_table.c.song_id], primaryjoin=source_songs_table.c.id == \ source_media_files_table.c.song_id) try: From 5804dade748154574e775035ca6a5483983f84e5 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sun, 4 Dec 2011 14:42:39 +0000 Subject: [PATCH 27/29] Reduce recent file list duplication (Bug #892668) --- openlp/core/ui/mainwindow.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 9d546629b..b0640513a 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -1312,7 +1312,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): settings.value(u'preview splitter geometry').toByteArray()) self.controlSplitter.restoreState( settings.value(u'mainwindow splitter geometry').toByteArray()) - settings.endGroup() def saveSettings(self): @@ -1388,6 +1387,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): maxRecentFiles = QtCore.QSettings().value(u'advanced/max recent files', QtCore.QVariant(20)).toInt()[0] if filename: + # Add some cleanup to reduce duplication in the recent file list + filename = os.path.abspath(filename) + # abspath() only capitalises the drive letter if it wasn't provided + # in the given filename which then causes duplication. + if filename[1:3] == ':\\': + filename = filename[0].upper() + filename[1:] position = self.recentFiles.indexOf(filename) if position != -1: self.recentFiles.removeAt(position) From 06570a9941f89279f9252516cccccdd11d545814 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 4 Dec 2011 22:50:13 +0200 Subject: [PATCH 28/29] Fixed a minor bug where if you imported 2 OpenLP 2.0 databases in the same OpenLP session whose schemas were different, you'd get an error. --- openlp/plugins/songs/lib/olpimport.py | 74 +++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index 598815c8f..7187950b7 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -30,7 +30,7 @@ song databases into the current installation database. """ import logging -from sqlalchemy import create_engine, MetaData +from sqlalchemy import create_engine, MetaData, Table from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, \ sessionmaker from sqlalchemy.orm.exc import UnmappedClassError @@ -44,41 +44,6 @@ from songimport import SongImport log = logging.getLogger(__name__) -class OldAuthor(BaseModel): - """ - Author model - """ - pass - - -class OldBook(BaseModel): - """ - Book model - """ - pass - - -class OldMediaFile(BaseModel): - """ - MediaFile model - """ - pass - - -class OldSong(BaseModel): - """ - Song model - """ - pass - - -class OldTopic(BaseModel): - """ - Topic model - """ - pass - - class OpenLPSongImport(SongImport): """ The :class:`OpenLPSongImport` class provides OpenLP with the ability to @@ -101,6 +66,41 @@ class OpenLPSongImport(SongImport): """ Run the import for an OpenLP version 2 song database. """ + class OldAuthor(BaseModel): + """ + Author model + """ + pass + + + class OldBook(BaseModel): + """ + Book model + """ + pass + + + class OldMediaFile(BaseModel): + """ + MediaFile model + """ + pass + + + class OldSong(BaseModel): + """ + Song model + """ + pass + + + class OldTopic(BaseModel): + """ + Topic model + """ + pass + + if not self.importSource.endswith(u'.sqlite'): self.logError(self.importSource, translate('SongsPlugin.OpenLPSongImport', @@ -138,7 +138,7 @@ class OpenLPSongImport(SongImport): secondary=source_songs_topics_table) } if has_media_files: - if source_media_files_songs_table is not None: + if isinstance(source_media_files_songs_table, Table): song_props['media_files'] = relation(OldMediaFile, backref='songs', secondary=source_media_files_songs_table) From a54e7ff709c6863a3de684760ee267510f114e98 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sun, 4 Dec 2011 20:57:58 +0000 Subject: [PATCH 29/29] Fix non-ascii service filename loading --- openlp/core/ui/mainwindow.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index b0640513a..663f6c75a 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -720,7 +720,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): args = [] for a in self.arguments: args.extend([a]) - self.serviceManagerContents.loadFile(unicode(args[0])) + self.serviceManagerContents.loadFile(unicode(args[0], + sys.getfilesystemencoding())) elif QtCore.QSettings().value( self.generalSettingsSection + u'/auto open', QtCore.QVariant(False)).toBool():