forked from openlp/openlp
* Fix log file location (Bug #596822)
* Script resources generation * Cleanup long lines bzr-revno: 872
This commit is contained in:
commit
ec87fddf53
@ -17,3 +17,4 @@ resources/innosetup/Output
|
||||
_eric4project
|
||||
.pylint.d
|
||||
*.qm
|
||||
openlp/core/resources.py.old
|
||||
|
@ -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')
|
||||
|
@ -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)
|
||||
|
@ -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():
|
||||
|
@ -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):
|
||||
|
54
scripts/generate_resources.sh
Normal file
54
scripts/generate_resources.sh
Normal 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
59
scripts/resources.patch
Normal 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()
|
Loading…
Reference in New Issue
Block a user