This commit is contained in:
Tim Bentley 2010-06-30 05:53:09 +01:00
commit 56e4e38b99
30 changed files with 163 additions and 78 deletions

View File

@ -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:`renderer` module enables OpenLP to take the input from plugins and
format it for the output display.
"""
import logging
from PyQt4 import QtGui, QtCore

View File

@ -168,7 +168,7 @@ class Theme(object):
theme_strings.append(u'_%s_' % (getattr(self, key)))
return u''.join(theme_strings)
def _set_from_XML(self, xml):
def _set_from_xml(self, xml):
"""
Set theme class attributes with data from XML

View File

@ -662,7 +662,7 @@ class ServiceManager(QtGui.QWidget):
name = filename.split(os.path.sep)
if filename:
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
os.path.split(filename)[0])
name[0])
zip = None
file_to = None
try:

View File

@ -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:`languagemanager` module provides all the translation settings and
language file loading for OpenLP.
"""
import logging
import os
@ -42,50 +45,74 @@ class LanguageManager(object):
@staticmethod
def get_translator(language):
"""
Set up a translator to use in this instance of OpenLP
``language``
The language to load into the translator
"""
if LanguageManager.AutoLanguage:
language = QtCore.QLocale.system().name()
lang_Path = AppLocation.get_directory(AppLocation.AppDir)
lang_Path = os.path.join(lang_Path, u'resources', u'i18n')
appTranslator = QtCore.QTranslator()
if appTranslator.load("openlp_" + language, lang_Path):
return appTranslator
app_translator = QtCore.QTranslator()
if app_translator.load("openlp_" + language, lang_Path):
return app_translator
@staticmethod
def find_qm_files():
"""
Find all available language files in this OpenLP install
"""
trans_dir = AppLocation.get_directory(AppLocation.AppDir)
trans_dir = QtCore.QDir(os.path.join(trans_dir, u'resources', u'i18n'))
fileNames = trans_dir.entryList(QtCore.QStringList("*.qm"),
file_names = trans_dir.entryList(QtCore.QStringList("*.qm"),
QtCore.QDir.Files, QtCore.QDir.Name)
for name in fileNames:
fileNames.replaceInStrings(name, trans_dir.filePath(name))
return fileNames
for name in file_names:
file_names.replaceInStrings(name, trans_dir.filePath(name))
return file_names
@staticmethod
def language_name(qmFile):
def language_name(qm_file):
"""
Load the language name from a language file
``qm_file``
The file to obtain the name from
"""
translator = QtCore.QTranslator()
translator.load(qmFile)
translator.load(qm_file)
return translator.translate('MainWindow', 'English')
@staticmethod
def get_language():
"""
Retrieve a saved language to use from settings
"""
settings = QtCore.QSettings(u'OpenLP', u'OpenLP')
language = unicode(settings.value(
u'general/language', QtCore.QVariant(u'[en]')).toString())
log.info(u'Language file: \'%s\' Loaded from conf file' % language)
regEx = QtCore.QRegExp("^\[(.*)\]")
if regEx.exactMatch(language):
reg_ex = QtCore.QRegExp("^\[(.*)\]")
if reg_ex.exactMatch(language):
LanguageManager.AutoLanguage = True
language = regEx.cap(1)
language = reg_ex.cap(1)
return language
@staticmethod
def set_language(action):
actionName = u'%s' % action.objectName()
qmList = LanguageManager.get_qm_list()
"""
Set the language to translate OpenLP into
``action``
The language menu option
"""
action_name = u'%s' % action.objectName()
qm_list = LanguageManager.get_qm_list()
if LanguageManager.AutoLanguage:
language = u'[%s]' % qmList[actionName]
language = u'[%s]' % qm_list[action_name]
else:
language = u'%s' % qmList[actionName]
language = u'%s' % qm_list[action_name]
QtCore.QSettings().setValue(
u'general/language', QtCore.QVariant(language))
log.info(u'Language file: \'%s\' written to conf file' % language)
@ -96,17 +123,23 @@ class LanguageManager(object):
@staticmethod
def init_qm_list():
"""
Initialise the list of available translations
"""
LanguageManager.__qmList__ = {}
qmFiles = LanguageManager.find_qm_files()
for i, qmf in enumerate(qmFiles):
regEx = QtCore.QRegExp("^.*openlp_(.*).qm")
if regEx.exactMatch(qmf):
langName = regEx.cap(1)
qm_files = LanguageManager.find_qm_files()
for i, qmf in enumerate(qm_files):
reg_ex = QtCore.QRegExp("^.*openlp_(.*).qm")
if reg_ex.exactMatch(qmf):
lang_name = reg_ex.cap(1)
LanguageManager.__qmList__[u'%#2i %s' % (i+1,
LanguageManager.language_name(qmf))] = langName
LanguageManager.language_name(qmf))] = lang_name
@staticmethod
def get_qm_list():
"""
Return the list of available translations
"""
if LanguageManager.__qmList__ is None:
LanguageManager.init_qm_list()
return LanguageManager.__qmList__

View File

@ -24,5 +24,5 @@
###############################################################################
"""
The :mod:`alerts` module provides the Alerts plugin for producing impromptu
on-screen announcements during a service
on-screen announcements during a service.
"""

View File

@ -41,7 +41,7 @@ class alertsPlugin(Plugin):
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Alerts', u'1.9.2', plugin_helpers)
self.weight = -3
self.icon = build_icon(u':/media/media_image.png')
self.icon = build_icon(u':/plugins/plugin_alerts.png')
self.alertsmanager = AlertsManager(self)
self.manager = Manager(u'alerts', init_schema)
self.alertForm = AlertForm(self.manager, self)
@ -65,7 +65,7 @@ class alertsPlugin(Plugin):
"""
log.info(u'add tools menu')
self.toolsAlertItem = QtGui.QAction(tools_menu)
AlertIcon = build_icon(u':/tools/tools_alert.png')
AlertIcon = build_icon(u':/plugins/plugin_alerts.png')
self.toolsAlertItem.setIcon(AlertIcon)
self.toolsAlertItem.setObjectName(u'toolsAlertItem')
self.toolsAlertItem.setText(
@ -102,4 +102,4 @@ class alertsPlugin(Plugin):
about_text = translate('AlertsPlugin',
'<b>Alerts Plugin</b><br>This plugin '
'controls the displaying of alerts on the presentations screen')
return about_text
return about_text

View File

@ -23,6 +23,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`bibles' modules provides the Bible plugin to enable OpenLP to display
scripture
The :mod:`bibles' module provides the Bible plugin to enable OpenLP to display
scripture.
"""

View File

@ -22,3 +22,8 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`custom` module provides the Custom plugin which allows custom,
themed, text based items to be displayed without having to misuse another item
type.
"""

View File

@ -78,7 +78,7 @@ class CustomPlugin(Plugin):
return about_text
def can_delete_theme(self, theme):
filter_string = u'theme_name=%s' % theme
filter_string = u'theme_name=\'%s\'' % theme
if not self.custommanager.get_all_objects_filtered(CustomSlide,
filter_string):
return True

View File

@ -136,11 +136,14 @@ class CustomMediaItem(MediaManagerItem):
if check_item_selected(self.ListView,
translate('CustomPlugin.MediaItem',
'You must select an item to delete.')):
item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.custommanager.delete_object(CustomSlide, item_id)
row = self.ListView.row(item)
self.ListView.takeItem(row)
row_list = [item.row() for item in self.ListView.selectedIndexes()]
row_list.sort(reverse=True)
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
for item in self.ListView.selectedIndexes()]
for id in id_list:
self.parent.custommanager.delete_custom(id)
for row in row_list:
self.ListView.takeItem(row)
def generateSlideData(self, service_item, item=None):
raw_slides = []

View File

@ -22,3 +22,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`images` module provides the Images plugin. The Images plugin
provides the facility to display images from OpenLP.
"""

View File

@ -119,9 +119,10 @@ class ImageMediaItem(MediaManagerItem):
"""
if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem',
'You must select an item to delete.')):
items = self.ListView.selectedIndexes()
for item in items:
text = self.ListView.item(item.row())
row_list = [item.row() for item in self.ListView.selectedIndexes()]
row_list.sort(reverse=True)
for row in row_list:
text = self.ListView.item(row)
if text:
try:
os.remove(os.path.join(self.servicePath,
@ -129,9 +130,9 @@ class ImageMediaItem(MediaManagerItem):
except OSError:
#if not present do not worry
pass
self.ListView.takeItem(item.row())
SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList())
self.ListView.takeItem(row)
SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList())
def loadList(self, list):
for file in list:

View File

@ -22,3 +22,9 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`media` module provides the Media plugin which allows OpenLP to
display videos. The media supported depends not only on the Python support
but also extensively on the codecs installed on the underlying operating system
being picked up and usable by Python.
"""

View File

@ -143,9 +143,10 @@ class MediaMediaItem(MediaManagerItem):
"""
if check_item_selected(self.ListView, translate('MediaPlugin.MediaItem',
'You must select an item to delete.')):
item = self.ListView.currentItem()
row = self.ListView.row(item)
self.ListView.takeItem(row)
row_list = [item.row() for item in self.ListView.selectedIndexes()]
row_list.sort(reverse=True)
for row in row_list:
self.ListView.takeItem(row)
SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList())

View File

@ -22,3 +22,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`presentations` module provides the Presentations plugin which allows
OpenLP to show presentations from most popular presentation packages.
"""

View File

@ -180,18 +180,22 @@ class PresentationMediaItem(MediaManagerItem):
if check_item_selected(self.ListView,
translate('PresentationPlugin.MediaItem',
'You must select an item to delete.')):
item = self.ListView.currentItem()
row = self.ListView.row(item)
self.ListView.takeItem(row)
items = self.ListView.selectedIndexes()
row_list = [item.row() for item in items]
row_list.sort(reverse=True)
for item in items:
filepath = unicode(item.data(
QtCore.Qt.UserRole).toString())
#not sure of this has errors
#John please can you look at .
for cidx in self.controllers:
doc = self.controllers[cidx].add_doc(filepath)
doc.presentation_deleted()
doc.close_presentation()
for row in row_list:
self.ListView.takeItem(row)
SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList())
filepath = unicode(item.data(QtCore.Qt.UserRole).toString())
#not sure of this has errors
#John please can you look at .
for cidx in self.controllers:
doc = self.controllers[cidx].add_doc(filepath)
doc.presentation_deleted()
doc.close_presentation()
def generateSlideData(self, service_item, item=None):
items = self.ListView.selectedIndexes()

View File

@ -22,3 +22,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`remotes` plugin allows OpenLP to be controlled from another machine
over a network connection.
"""

View File

@ -25,7 +25,7 @@
import logging
from openlp.core.lib import Plugin, translate
from openlp.core.lib import Plugin, translate, build_icon
from openlp.plugins.remotes.lib import RemoteTab, HttpServer
log = logging.getLogger(__name__)
@ -38,6 +38,7 @@ class RemotesPlugin(Plugin):
remotes constructor
"""
Plugin.__init__(self, u'Remotes', u'1.9.2', plugin_helpers)
self.icon = build_icon(u':/plugins/plugin_remote.png')
self.weight = -1
self.server = None
@ -74,4 +75,4 @@ class RemotesPlugin(Plugin):
'provides the ability to send messages to a running version of '
'openlp on a different computer via a web browser or other app<br>'
'The Primary use for this would be to send alerts from a creche')
return about_text
return about_text

View File

@ -22,3 +22,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`songs` module provides the Songs plugin. The Songs plugin provides
the main lyric projection function of OpenLP.
"""

View File

@ -199,7 +199,7 @@ class SongsPlugin(Plugin):
return about_text
def can_delete_theme(self, theme):
filter_string = u'theme_name=%s' % theme
filter_string = u'theme_name=\'%s\'' % theme
if not self.manager.get_all_objects_filtered(Song, filter_string):
return True
return False

View File

@ -22,3 +22,8 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`songusage` module contains the Song Usage plugin. The Song Usage
plugin provides auditing capabilities for reporting the songs you are using to
copyright license organisations.
"""

View File

@ -42,7 +42,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
def __init__(self, parent=None):
"""
Constructor
Initialise the form
"""
QtGui.QDialog.__init__(self, None)
self.parent = parent

View File

@ -22,7 +22,9 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`manager` module provides song usage specific database query code
"""
import logging
from sqlalchemy.exceptions import InvalidRequestError

View File

@ -42,7 +42,7 @@ class SongUsagePlugin(Plugin):
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'SongUsage', u'1.9.2', plugin_helpers)
self.weight = -4
self.icon = build_icon(u':/media/media_image.png')
self.icon = build_icon(u':/plugins/plugin_songusage.png')
self.songusagemanager = None
self.songusageActive = False
@ -76,7 +76,7 @@ class SongUsagePlugin(Plugin):
translate('SongUsagePlugin', 'Generate report on Song Usage'))
self.SongUsageReport.setObjectName(u'SongUsageReport')
#SongUsage activation
SongUsageIcon = build_icon(u':/tools/tools_alert.png')
SongUsageIcon = build_icon(u':/plugins/plugin_songusage.png')
self.SongUsageStatus = QtGui.QAction(tools_menu)
self.SongUsageStatus.setIcon(SongUsageIcon)
self.SongUsageStatus.setCheckable(True)

View File

@ -1,5 +1,5 @@
<RCC>
<qresource prefix="songs" >
<qresource prefix="songs">
<file>topic_edit.png</file>
<file>author_add.png</file>
<file>author_delete.png</file>
@ -17,7 +17,12 @@
<file>song_topic_edit.png</file>
<file>song_book_edit.png</file>
</qresource>
<qresource prefix="general" >
<qresource prefix="plugins">
<file>plugin_alerts.png</file>
<file>plugin_remote.png</file>
<file>plugin_songusage.png</file>
</qresource>
<qresource prefix="general">
<file>general_preview.png</file>
<file>general_live.png</file>
<file>general_add.png</file>
@ -29,7 +34,7 @@
<file>general_open.png</file>
<file>general_save.png</file>
</qresource>
<qresource prefix="slides" >
<qresource prefix="slides">
<file>slide_close.png</file>
<file>slide_first.png</file>
<file>slide_last.png</file>
@ -42,7 +47,7 @@
<file>media_playback_stop.png</file>
<file>media_playback_pause.png</file>
</qresource>
<qresource prefix="icon" >
<qresource prefix="icon">
<file>openlp-logo-16x16.png</file>
<file>openlp-logo-32x32.png</file>
<file>openlp-logo-48x48.png</file>
@ -50,27 +55,27 @@
<file>openlp-logo-128x128.png</file>
<file>openlp-logo-256x256.png</file>
</qresource>
<qresource prefix="graphics" >
<qresource prefix="graphics">
<file>openlp-about-logo.png</file>
<file>openlp-splash-screen.png</file>
</qresource>
<qresource prefix="imports" >
<qresource prefix="imports">
<file>import_selectall.png</file>
<file>import_move_to_list.png</file>
<file>import_remove.png</file>
<file>import_load.png</file>
</qresource>
<qresource prefix="exports" >
<qresource prefix="exports">
<file>export_selectall.png</file>
<file>export_remove.png</file>
<file>export_load.png</file>
<file>export_move_to_list.png</file>
</qresource>
<qresource prefix="wizards" >
<qresource prefix="wizards">
<file>wizard_importsong.bmp</file>
<file>wizard_importbible.bmp</file>
</qresource>
<qresource prefix="services" >
<qresource prefix="services">
<file>service_notes.png</file>
<file>service_item_notes.png</file>
<file>service_bottom.png</file>
@ -78,7 +83,7 @@
<file>service_top.png</file>
<file>service_up.png</file>
</qresource>
<qresource prefix="system" >
<qresource prefix="system">
<file>system_close.png</file>
<file>system_about.png</file>
<file>system_help_contents.png</file>
@ -89,7 +94,7 @@
<file>system_exit.png</file>
<file>system_settings.png</file>
</qresource>
<qresource prefix="media" >
<qresource prefix="media">
<file>media_custom.png</file>
<file>media_presentation.png</file>
<file>media_image.png</file>
@ -100,16 +105,16 @@
<file>media_stop.png</file>
<file>image_clapperboard.png</file>
</qresource>
<qresource prefix="messagebox" >
<qresource prefix="messagebox">
<file>messagebox_critical.png</file>
<file>messagebox_info.png</file>
<file>messagebox_warning.png</file>
</qresource>
<qresource prefix="tools" >
<qresource prefix="tools">
<file>tools_add.png</file>
<file>tools_alert.png</file>
</qresource>
<qresource prefix="themes" >
<qresource prefix="themes">
<file>theme_delete.png</file>
<file>theme_new.png</file>
<file>theme_edit.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 719 B

After

Width:  |  Height:  |  Size: 516 B

0
scripts/generate_resources.sh Normal file → Executable file
View File