This commit is contained in:
Tim Bentley 2010-06-22 17:45:45 +01:00
commit ebddea9a7b
15 changed files with 156 additions and 31 deletions

View File

@ -17,3 +17,4 @@ resources/innosetup/Output
_eric4project
.pylint.d
*.qm
openlp/core/resources.py.old

View File

@ -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 *

View File

@ -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')

View File

@ -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):

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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():

View File

@ -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):

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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')

View File

@ -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

59
scripts/resources.patch Normal file
View File

@ -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()