diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index aa8c0a95a..c7f96528c 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -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 diff --git a/openlp/core/theme/theme.py b/openlp/core/theme/theme.py index 2ea13d01b..6cddbcb45 100644 --- a/openlp/core/theme/theme.py +++ b/openlp/core/theme/theme.py @@ -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 diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 284d9c7e4..1ee0d13a5 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -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: diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index e556e7e7c..c0315559f 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -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__ diff --git a/openlp/plugins/alerts/__init__.py b/openlp/plugins/alerts/__init__.py index cb376ec38..76ca202dd 100644 --- a/openlp/plugins/alerts/__init__.py +++ b/openlp/plugins/alerts/__init__.py @@ -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. """ diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index b442edc5b..46d4e8cb7 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -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', 'Alerts Plugin
This plugin ' 'controls the displaying of alerts on the presentations screen') - return about_text \ No newline at end of file + return about_text diff --git a/openlp/plugins/bibles/__init__.py b/openlp/plugins/bibles/__init__.py index ca5ff7508..2491c4142 100644 --- a/openlp/plugins/bibles/__init__.py +++ b/openlp/plugins/bibles/__init__.py @@ -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. """ diff --git a/openlp/plugins/custom/__init__.py b/openlp/plugins/custom/__init__.py index 1a348a0df..2b9a101f1 100644 --- a/openlp/plugins/custom/__init__.py +++ b/openlp/plugins/custom/__init__.py @@ -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. +""" diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index 7f64aab52..362f8d64c 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -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 diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index b5fb4c224..f2ac04c1b 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -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 = [] diff --git a/openlp/plugins/images/__init__.py b/openlp/plugins/images/__init__.py index 1a348a0df..58cfb69b5 100644 --- a/openlp/plugins/images/__init__.py +++ b/openlp/plugins/images/__init__.py @@ -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. +""" diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 29985a9ed..bcc3a84c4 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -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: diff --git a/openlp/plugins/media/__init__.py b/openlp/plugins/media/__init__.py index 1a348a0df..28ea0e960 100644 --- a/openlp/plugins/media/__init__.py +++ b/openlp/plugins/media/__init__.py @@ -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. +""" diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index b6de22712..6cd7b175b 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -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()) diff --git a/openlp/plugins/presentations/__init__.py b/openlp/plugins/presentations/__init__.py index 1a348a0df..b7f26b39b 100644 --- a/openlp/plugins/presentations/__init__.py +++ b/openlp/plugins/presentations/__init__.py @@ -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. +""" diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 384d28c4a..ee50dd556 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -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() diff --git a/openlp/plugins/remotes/__init__.py b/openlp/plugins/remotes/__init__.py index 1a348a0df..59b771c0d 100644 --- a/openlp/plugins/remotes/__init__.py +++ b/openlp/plugins/remotes/__init__.py @@ -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. +""" diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 7004207e4..fad7ecbe8 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -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
' 'The Primary use for this would be to send alerts from a creche') - return about_text \ No newline at end of file + return about_text diff --git a/openlp/plugins/songs/__init__.py b/openlp/plugins/songs/__init__.py index 1a348a0df..4cd5537eb 100644 --- a/openlp/plugins/songs/__init__.py +++ b/openlp/plugins/songs/__init__.py @@ -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. +""" diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index d128bc6a2..c24352a91 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -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 diff --git a/openlp/plugins/songusage/__init__.py b/openlp/plugins/songusage/__init__.py index 1a348a0df..adebb7c74 100644 --- a/openlp/plugins/songusage/__init__.py +++ b/openlp/plugins/songusage/__init__.py @@ -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. +""" diff --git a/openlp/plugins/songusage/forms/songusagedetailform.py b/openlp/plugins/songusage/forms/songusagedetailform.py index 3cbe46735..be1b8221c 100644 --- a/openlp/plugins/songusage/forms/songusagedetailform.py +++ b/openlp/plugins/songusage/forms/songusagedetailform.py @@ -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 diff --git a/openlp/plugins/songusage/lib/manager.py b/openlp/plugins/songusage/lib/manager.py index 363f06fb8..2c34f3a54 100644 --- a/openlp/plugins/songusage/lib/manager.py +++ b/openlp/plugins/songusage/lib/manager.py @@ -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 diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 06687acfe..a9994902a 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -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) diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc index 49309b8d5..ba382e0fd 100644 --- a/resources/images/openlp-2.qrc +++ b/resources/images/openlp-2.qrc @@ -1,5 +1,5 @@ - + topic_edit.png author_add.png author_delete.png @@ -17,7 +17,12 @@ song_topic_edit.png song_book_edit.png - + + plugin_alerts.png + plugin_remote.png + plugin_songusage.png + + general_preview.png general_live.png general_add.png @@ -29,7 +34,7 @@ general_open.png general_save.png - + slide_close.png slide_first.png slide_last.png @@ -42,7 +47,7 @@ media_playback_stop.png media_playback_pause.png - + openlp-logo-16x16.png openlp-logo-32x32.png openlp-logo-48x48.png @@ -50,27 +55,27 @@ openlp-logo-128x128.png openlp-logo-256x256.png - + openlp-about-logo.png openlp-splash-screen.png - + import_selectall.png import_move_to_list.png import_remove.png import_load.png - + export_selectall.png export_remove.png export_load.png export_move_to_list.png - + wizard_importsong.bmp wizard_importbible.bmp - + service_notes.png service_item_notes.png service_bottom.png @@ -78,7 +83,7 @@ service_top.png service_up.png - + system_close.png system_about.png system_help_contents.png @@ -89,7 +94,7 @@ system_exit.png system_settings.png - + media_custom.png media_presentation.png media_image.png @@ -100,16 +105,16 @@ media_stop.png image_clapperboard.png - + messagebox_critical.png messagebox_info.png messagebox_warning.png - + tools_add.png tools_alert.png - + theme_delete.png theme_new.png theme_edit.png diff --git a/resources/images/plugin_alerts.png b/resources/images/plugin_alerts.png new file mode 100644 index 000000000..331aa2687 Binary files /dev/null and b/resources/images/plugin_alerts.png differ diff --git a/resources/images/plugin_remote.png b/resources/images/plugin_remote.png new file mode 100644 index 000000000..d70f0f6de Binary files /dev/null and b/resources/images/plugin_remote.png differ diff --git a/resources/images/plugin_songusage.png b/resources/images/plugin_songusage.png new file mode 100644 index 000000000..bf110aa6d Binary files /dev/null and b/resources/images/plugin_songusage.png differ diff --git a/resources/images/song_maintenance.png b/resources/images/song_maintenance.png index 860e1717e..992e1b638 100644 Binary files a/resources/images/song_maintenance.png and b/resources/images/song_maintenance.png differ diff --git a/scripts/generate_resources.sh b/scripts/generate_resources.sh old mode 100644 new mode 100755