From d7bd2c507404ed5cc990129e3157b61b76acf86e Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 21 Jun 2010 22:06:36 +0200 Subject: [PATCH 1/8] Fix up Theme form parentage. Some new lines? --- openlp/core/ui/amendthemeform.py | 4 ++-- openlp/core/ui/thememanager.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 1439e711e..c85eff4b8 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -37,9 +37,9 @@ log = logging.getLogger(u'AmendThemeForm') class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): - def __init__(self, thememanager, parent=None): + def __init__(self, parent): QtGui.QDialog.__init__(self, parent) - self.thememanager = thememanager + self.thememanager = parent self.path = None self.theme = ThemeXML() self.setupUi(self) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 7849175a3..6da526af0 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -66,7 +66,7 @@ class ThemeManager(QtGui.QWidget): translate('ThemeManager', 'Delete a theme.'), self.onDeleteTheme) self.Toolbar.addSeparator() self.Toolbar.addToolbarButton( - translate('ThemeManager', 'Import Theme'), + translate('ThemeManager', 'Import Theme'), u':/general/general_import.png', translate('ThemeManager', 'Import a theme.'), self.onImportTheme) self.Toolbar.addToolbarButton( @@ -211,7 +211,7 @@ class ThemeManager(QtGui.QWidget): else: for plugin in self.parent.plugin_manager.plugins: if not plugin.can_delete_theme(theme): - QtGui.QMessageBox.critical(self, + QtGui.QMessageBox.critical(self, translate('ThemeManager', 'Error'), unicode(translate('ThemeManager', 'Theme %s is use in %s plugin.')) % \ @@ -248,7 +248,7 @@ class ThemeManager(QtGui.QWidget): """ item = self.ThemeListWidget.currentItem() if item is None: - QtGui.QMessageBox.critical(self, + QtGui.QMessageBox.critical(self, translate('ThemeManager', 'Error'), translate('ThemeManager', 'You have not selected a theme.')) return From 75376730239ae4bd6f713a74755d3da01b2956af Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Mon, 21 Jun 2010 21:19:57 +0100 Subject: [PATCH 2/8] Fix [Bug 596995] Remotes Plugin does not work with PPA version --- MANIFEST.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index 73ff3c545..e8a5822e6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,8 @@ recursive-include openlp *.py recursive-include openlp *.sqlite recursive-include openlp *.csv +recursive-include openlp *.html +recursive-include openlp *.js recursive-include documentation * recursive-include resources/forms * recursive-include resources/i18n * From 2a7167014934d601630e26d3628d4fb4de474b96 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 21 Jun 2010 21:52:25 +0100 Subject: [PATCH 3/8] Stray trailing backslashes --- openlp/plugins/songs/lib/songimport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index dbc9fa08d..454d7e3aa 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -63,9 +63,9 @@ class SongImport(object): self.verses = [] self.versecount = 0 self.choruscount = 0 - self.copyright_string = unicode(QtGui.QApplication.translate( \ + self.copyright_string = unicode(QtGui.QApplication.translate( u'SongsPlugin.SongImport', u'copyright')) - self.copyright_symbol = unicode(QtGui.QApplication.translate( \ + self.copyright_symbol = unicode(QtGui.QApplication.translate( u'SongsPlugin.SongImport', u'\xa9')) @staticmethod From 1cf85205cec2b63c92802fc0b42f40481044c193 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 21 Jun 2010 22:04:56 +0100 Subject: [PATCH 4/8] More translate() --- openlp/plugins/bibles/bibleplugin.py | 2 +- openlp/plugins/songs/songsplugin.py | 7 +++---- openlp/plugins/songusage/songusageplugin.py | 21 ++++++++------------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 2c10e9c0d..8ebf551ab 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -82,7 +82,7 @@ class BiblePlugin(Plugin): self.ExportBibleItem.setObjectName(u'ExportBibleItem') export_menu.addAction(self.ExportBibleItem) self.ExportBibleItem.setText(translate( - u'BiblePlugin', u'&Bible')) + 'BiblePlugin', '&Bible')) self.ExportBibleItem.setVisible(False) def onBibleImportClick(self): diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 0e0c5b36d..a36c9b048 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -91,10 +91,9 @@ class SongsPlugin(Plugin): self.SongImportItem = QtGui.QAction(import_menu) self.SongImportItem.setObjectName(u'SongImportItem') self.SongImportItem.setText(translate( - u'SongsPlugin', u'&Song')) - self.SongImportItem.setToolTip( - translate('SongsPlugin', - 'Import songs using the import wizard.')) + 'SongsPlugin', '&Song')) + self.SongImportItem.setToolTip(translate('SongsPlugin', + 'Import songs using the import wizard.')) import_menu.addAction(self.SongImportItem) # Songs of Fellowship import menu item - will be removed and the # functionality will be contained within the import wizard diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index dc341791e..83aa43785 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -60,24 +60,20 @@ class SongUsagePlugin(Plugin): self.SongUsageMenu = QtGui.QMenu(tools_menu) self.SongUsageMenu.setObjectName(u'SongUsageMenu') self.SongUsageMenu.setTitle(translate( - u'SongUsagePlugin', u'&Song Usage')) + 'SongUsagePlugin', '&Song Usage')) #SongUsage Delete self.SongUsageDelete = QtGui.QAction(tools_menu) - self.SongUsageDelete.setText( - translate('SongUsagePlugin', - '&Delete recorded data')) - self.SongUsageDelete.setStatusTip( - translate('SongUsagePlugin', - 'Delete song usage to specified date')) + self.SongUsageDelete.setText(translate('SongUsagePlugin', + '&Delete recorded data')) + self.SongUsageDelete.setStatusTip(translate('SongUsagePlugin', + 'Delete song usage to specified date')) self.SongUsageDelete.setObjectName(u'SongUsageDelete') #SongUsage Report self.SongUsageReport = QtGui.QAction(tools_menu) self.SongUsageReport.setText( - translate('SongUsagePlugin', - '&Extract recorded data')) + translate('SongUsagePlugin', '&Extract recorded data')) self.SongUsageReport.setStatusTip( - translate('SongUsagePlugin', - 'Generate report on Song Usage')) + translate('SongUsagePlugin', 'Generate report on Song Usage')) self.SongUsageReport.setObjectName(u'SongUsageReport') #SongUsage activation SongUsageIcon = build_icon(u':/tools/tools_alert.png') @@ -87,8 +83,7 @@ class SongUsagePlugin(Plugin): self.SongUsageStatus.setChecked(False) self.SongUsageStatus.setText(translate( 'SongUsagePlugin', 'Song Usage Status')) - self.SongUsageStatus.setStatusTip( - translate('SongUsagePlugin', + self.SongUsageStatus.setStatusTip(translate('SongUsagePlugin', 'Start/Stop live song usage recording')) self.SongUsageStatus.setShortcut(u'F4') self.SongUsageStatus.setObjectName(u'SongUsageStatus') From e18a8067c714990838031cab32f947fbcfe7b367 Mon Sep 17 00:00:00 2001 From: Frode Woldsund Date: Mon, 21 Jun 2010 23:57:01 +0200 Subject: [PATCH 5/8] switched place on function that did not make sense: translate(unicode -> unicode(translate --- openlp/core/lib/mediamanageritem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index a011a1c94..5e2566704 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -491,7 +491,7 @@ class MediaManagerItem(QtGui.QWidget): #Turn off the remote edit update message indicator QtGui.QMessageBox.information(self, translate('MediaManagerItem', 'Invalid Service Item'), - translate(unicode('MediaManagerItem', + unicode(translate('MediaManagerItem', 'You must select a %s service item.')) % self.title) def buildServiceItem(self, item=None): From 979129ebe75f7a241d2297023389476354217813 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Tue, 22 Jun 2010 00:26:35 +0100 Subject: [PATCH 6/8] Script resource generation --- .bzrignore | 1 + scripts/generate_resources.sh | 54 ++++++++++++++++++++++++++++++++ scripts/resources.patch | 59 +++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 scripts/generate_resources.sh create mode 100644 scripts/resources.patch diff --git a/.bzrignore b/.bzrignore index e63989097..191ba49fd 100644 --- a/.bzrignore +++ b/.bzrignore @@ -17,3 +17,4 @@ resources/innosetup/Output _eric4project .pylint.d *.qm +openlp/core/resources.py.old diff --git a/scripts/generate_resources.sh b/scripts/generate_resources.sh new file mode 100644 index 000000000..c2039a5b6 --- /dev/null +++ b/scripts/generate_resources.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # +# Thompson, Jon Tibble, Carsten Tinggaard # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### +# +# This script automates the generation of resources.py for OpenLP saving a +# backup of the old resources, inserting the coding and copyright header and +# conforming it to the project coding standards. +# +# To make use of the script: +# 1 - Add the new image files in resources/images/ +# 2 - Modify resources/images/openlp-2.qrc as appropriate +# 3 - run sh scripts/generate_resources.sh +# +# Once you have confirmed the resources are correctly modified to an updated, +# working state you may optionally remove openlp/core/resources.py.old +# +############################################################################### +# Backup the existing resources +mv openlp/core/resources.py openlp/core/resources.py.old + +# Create the new data from the updated qrc +pyrcc4 -o openlp/core/resources.py.new resources/images/openlp-2.qrc + +# Remove patch breaking lines +cat openlp/core/resources.py.new | sed '/# Created: /d;/# by: /d' \ + > openlp/core/resources.py + +# Patch resources.py to OpenLP coding style +patch --posix -s openlp/core/resources.py scripts/resources.patch + +# Remove temporary file +rm openlp/core/resources.py.new + diff --git a/scripts/resources.patch b/scripts/resources.patch new file mode 100644 index 000000000..ba85a157c --- /dev/null +++ b/scripts/resources.patch @@ -0,0 +1,59 @@ +--- openlp/core/resources.py.old Mon Jun 21 23:16:19 2010 ++++ openlp/core/resources.py Mon Jun 21 23:27:48 2010 +@@ -1,10 +1,31 @@ + # -*- coding: utf-8 -*- ++# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +-# Resource object code +-# +-# +-# WARNING! All changes made in this file will be lost! +- ++############################################################################### ++# OpenLP - Open Source Lyrics Projection # ++# --------------------------------------------------------------------------- # ++# Copyright (c) 2008-2010 Raoul Snyman # ++# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # ++# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # ++# Thompson, Jon Tibble, Carsten Tinggaard # ++# --------------------------------------------------------------------------- # ++# This program is free software; you can redistribute it and/or modify it # ++# under the terms of the GNU General Public License as published by the Free # ++# Software Foundation; version 2 of the License. # ++# # ++# This program is distributed in the hope that it will be useful, but WITHOUT # ++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # ++# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # ++# more details. # ++# # ++# You should have received a copy of the GNU General Public License along # ++# with this program; if not, write to the Free Software Foundation, Inc., 59 # ++# Temple Place, Suite 330, Boston, MA 02111-1307 USA # ++############################################################################### ++""" ++The :mod:`resources` module provides application images and icons in a central ++store for use by OpenLP. ++""" + from PyQt4 import QtCore + + qt_resource_data = "\ +@@ -48643,9 +48664,16 @@ + " + + def qInitResources(): +- QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) ++ """ ++ Initialise OpenLP resources at application startup. ++ """ ++ QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, ++ qt_resource_data) + + def qCleanupResources(): +- QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) ++ """ ++ Cleanup OpenLP resources when the application shuts down. ++ """ ++ QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, ++ qt_resource_data) + +-qInitResources() From 70df49476d4dd7c6f6b1d165d53cee8f50dee5b1 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Tue, 22 Jun 2010 00:38:54 +0100 Subject: [PATCH 7/8] Long lines --- openlp/core/ui/mediadockmanager.py | 3 ++- openlp/plugins/custom/forms/editcustomform.py | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/mediadockmanager.py b/openlp/core/ui/mediadockmanager.py index f55dfa70c..932c1b024 100644 --- a/openlp/core/ui/mediadockmanager.py +++ b/openlp/core/ui/mediadockmanager.py @@ -76,6 +76,7 @@ class MediaDockManager(object): log.debug(u'remove %s dock' % name) for dock_index in range(0, self.media_dock.count()): if self.media_dock.widget(dock_index): - if self.media_dock.widget(dock_index).settingsSection == name.lower(): + if self.media_dock.widget(dock_index).settingsSection == \ + name.lower(): self.media_dock.widget(dock_index).hide() self.media_dock.removeItem(dock_index) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index d3e460beb..d387e7543 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -85,9 +85,8 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): def onPreview(self, button): log.debug(u'onPreview') - if button.text() == \ - unicode(translate('CustomPlugin.EditCustomForm', 'Save && Preview')) \ - and self.saveCustom(): + if button.text() == unicode(translate('CustomPlugin.EditCustomForm', + 'Save && Preview')) and self.saveCustom(): Receiver.send_message(u'custom_preview') def initialise(self): From a9e9f334e26bdfc14eeabc01199c0a340fa1aad2 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Tue, 22 Jun 2010 13:32:15 +0100 Subject: [PATCH 8/8] Fix log file location --- openlp.pyw | 2 +- openlp/core/utils/__init__.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/openlp.pyw b/openlp.pyw index 5ec730e22..fd8bfb41e 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -163,7 +163,7 @@ def main(): parser.add_option("-s", "--style", dest="style", help="Set the Qt4 style (passed directly to Qt4).") # Set up logging - log_path = AppLocation.get_directory(AppLocation.ConfigDir) + log_path = AppLocation.get_directory(AppLocation.CacheDir) if not os.path.exists(log_path): os.makedirs(log_path) filename = os.path.join(log_path, u'openlp.log') diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 78c16e26a..4fb1e613e 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -50,6 +50,7 @@ class AppLocation(object): DataDir = 3 PluginsDir = 4 VersionDir = 5 + CacheDir = 6 @staticmethod def get_directory(dir_type=1): @@ -103,6 +104,20 @@ class AppLocation(object): else: plugin_path = os.path.split(openlp.__file__)[0] return plugin_path + elif dir_type == AppLocation.CacheDir: + if sys.platform == u'win32': + path = os.path.join(os.getenv(u'APPDATA'), u'openlp') + elif sys.platform == u'darwin': + path = os.path.join(os.getenv(u'HOME'), u'Library', + u'Application Support', u'openlp') + else: + try: + from xdg import BaseDirectory + path = os.path.join( + BaseDirectory.xdg_cache_home, u'openlp') + except ImportError: + path = os.path.join(os.getenv(u'HOME'), u'.openlp') + return path @staticmethod def get_data_path():