openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #01995
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
* Fix log file location (Bug #596822)
* Script resources generation
* Cleanup some new long lines
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/28172
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file '.bzrignore'
--- .bzrignore 2010-06-21 16:43:59 +0000
+++ .bzrignore 2010-06-22 12:36:34 +0000
@@ -17,3 +17,4 @@
_eric4project
.pylint.d
*.qm
+openlp/core/resources.py.old
=== modified file 'openlp.pyw'
--- openlp.pyw 2010-05-30 23:07:15 +0000
+++ openlp.pyw 2010-06-22 12:36:34 +0000
@@ -163,7 +163,7 @@
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')
=== modified file 'openlp/core/resources.py'
--- openlp/core/resources.py 2010-04-02 12:26:50 +0000
+++ openlp/core/resources.py 2010-06-22 12:36:34 +0000
@@ -22,7 +22,10 @@
# 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 = "\
@@ -48661,8 +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)
=== modified file 'openlp/core/ui/mediadockmanager.py'
--- openlp/core/ui/mediadockmanager.py 2010-06-21 16:20:41 +0000
+++ openlp/core/ui/mediadockmanager.py 2010-06-22 12:36:34 +0000
@@ -76,6 +76,7 @@
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)
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py 2010-06-19 18:42:49 +0000
+++ openlp/core/utils/__init__.py 2010-06-22 12:36:34 +0000
@@ -50,6 +50,7 @@
DataDir = 3
PluginsDir = 4
VersionDir = 5
+ CacheDir = 6
@staticmethod
def get_directory(dir_type=1):
@@ -103,6 +104,20 @@
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():
=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py 2010-06-19 03:43:10 +0000
+++ openlp/plugins/custom/forms/editcustomform.py 2010-06-22 12:36:34 +0000
@@ -85,9 +85,8 @@
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):
=== added file 'scripts/generate_resources.sh'
--- scripts/generate_resources.sh 1970-01-01 00:00:00 +0000
+++ scripts/generate_resources.sh 2010-06-22 12:36:34 +0000
@@ -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
+
=== added file 'scripts/resources.patch'
--- scripts/resources.patch 1970-01-01 00:00:00 +0000
+++ scripts/resources.patch 2010-06-22 12:36:34 +0000
@@ -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()
Follow ups