openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #27323
[Merge] lp:~springermac/openlp/api-documentation-fixes into lp:openlp
Jonathan Springer has proposed merging lp:~springermac/openlp/api-documentation-fixes into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
For more details, see:
https://code.launchpad.net/~springermac/openlp/api-documentation-fixes/+merge/270592
Move icons that use build_icon into the function they are needed in so build_icon isn't called when the file is imported avoiding an assert when importing without a QApplication initialized
Change relative import in bible db to absolute import
Docstring cleanups
--
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/common/applocation.py'
--- openlp/core/common/applocation.py 2015-01-18 13:39:21 +0000
+++ openlp/core/common/applocation.py 2015-09-09 20:04:06 +0000
@@ -99,7 +99,7 @@
Get a list of files from the data files path.
:param section: Defaults to *None*. The section of code getting the files - used to load from a section's
- data subdirectory.
+ data subdirectory.
:param extension:
Defaults to *None*. The extension to search for. For example::
=== modified file 'openlp/core/common/settings.py'
--- openlp/core/common/settings.py 2015-02-21 13:08:56 +0000
+++ openlp/core/common/settings.py 2015-09-09 20:04:06 +0000
@@ -65,9 +65,9 @@
* Exposes all the methods of QSettings.
* Adds functionality for OpenLP Portable. If the ``defaultFormat`` is set to
- ``IniFormat``, and the path to the Ini file is set using ``set_filename``,
- then the Settings constructor (without any arguments) will create a Settings
- object for accessing settings stored in that Ini file.
+ ``IniFormat``, and the path to the Ini file is set using ``set_filename``,
+ then the Settings constructor (without any arguments) will create a Settings
+ object for accessing settings stored in that Ini file.
``__default_settings__``
This dict contains all core settings with their default values.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2015-04-02 09:04:56 +0000
+++ openlp/core/lib/__init__.py 2015-09-09 20:04:06 +0000
@@ -83,7 +83,7 @@
None.
:param text_file: The name of the file.
- :return The file as a single string
+ :return: The file as a single string
"""
if not os.path.isfile(text_file):
return False
@@ -108,7 +108,7 @@
Convert a string version of a boolean into a real boolean.
:param string_value: The string value to examine and convert to a boolean type.
- :return The correct boolean value
+ :return: The correct boolean value
"""
if isinstance(string_value, bool):
return string_value
@@ -123,7 +123,7 @@
:param icon:
The icon to build. This can be a QIcon, a resource string in the form ``:/resource/file.png``, or a file
location like ``/path/to/file.png``. However, the **recommended** way is to specify a resource string.
- :return The build icon.
+ :return: The build icon.
"""
button_icon = QtGui.QIcon()
if isinstance(icon, QtGui.QIcon):
@@ -168,7 +168,7 @@
:param return_icon: States if an icon should be build and returned from the thumb. Defaults to ``True``.
:param size: Allows to state a own size (QtCore.QSize) to use. Defaults to ``None``, which means that a default
height of 88 is used.
- :return The final icon.
+ :return: The final icon.
"""
ext = os.path.splitext(thumb_path)[1].lower()
reader = QtGui.QImageReader(image_path)
@@ -194,7 +194,7 @@
:param file_path: The path to the file. The file **must** exist!
:param thumb_path: The path to the thumb.
- :return True, False if the image has changed since the thumb was created.
+ :return: True, False if the image has changed since the thumb was created.
"""
if not os.path.exists(thumb_path):
return False
=== modified file 'openlp/core/lib/formattingtags.py'
--- openlp/core/lib/formattingtags.py 2015-01-18 13:39:21 +0000
+++ openlp/core/lib/formattingtags.py 2015-09-09 20:04:06 +0000
@@ -164,29 +164,29 @@
Add a list of tags to the list.
:param tags: The list with tags to add.
- Each **tag** has to be a ``dict`` and should have the following keys:
-
- * desc
- The formatting tag's description, e. g. **Red**
-
- * start tag
- The start tag, e. g. ``{r}``
-
- * end tag
- The end tag, e. g. ``{/r}``
-
- * start html
- The start html tag. For instance ``<span style="-webkit-text-fill-color:red">``
-
- * end html
- The end html tag. For example ``</span>``
-
- * protected
- A boolean stating whether this is a build-in tag or not. Should be ``True`` in most cases.
-
- * temporary
- A temporary tag will not be saved, but is also considered when displaying text containing the tag. It has
- to be a ``boolean``.
+ Each **tag** has to be a ``dict`` and should have the following keys:
+
+ * desc
+ The formatting tag's description, e. g. **Red**
+
+ * start tag
+ The start tag, e. g. ``{r}``
+
+ * end tag
+ The end tag, e. g. ``{/r}``
+
+ * start html
+ The start html tag. For instance ``<span style="-webkit-text-fill-color:red">``
+
+ * end html
+ The end html tag. For example ``</span>``
+
+ * protected
+ A boolean stating whether this is a build-in tag or not. Should be ``True`` in most cases.
+
+ * temporary
+ A temporary tag will not be saved, but is also considered when displaying text containing the tag. It has
+ to be a ``boolean``.
"""
FormattingTags.html_expands.extend(tags)
=== modified file 'openlp/core/lib/projector/pjlink1.py'
--- openlp/core/lib/projector/pjlink1.py 2015-02-04 16:43:04 +0000
+++ openlp/core/lib/projector/pjlink1.py 2015-09-09 20:04:06 +0000
@@ -25,7 +25,9 @@
See PJLink Class 1 Specifications for details.
http://pjlink.jbmia.or.jp/english/dl.html
+
Section 5-1 PJLink Specifications
+
Section 5-5 Guidelines for Input Terminals
NOTE:
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2015-01-18 13:39:21 +0000
+++ openlp/core/lib/renderer.py 2015-09-09 20:04:06 +0000
@@ -89,9 +89,9 @@
:param theme_name: The current theme name.
:param old_theme_name: The old theme name. Has only to be passed, when the theme has been renamed.
- Defaults to *None*.
+ Defaults to *None*.
:param only_delete: Only remove the given ``theme_name`` from the ``_theme_dimensions`` list. This can be
- used when a theme is permanently deleted.
+ used when a theme is permanently deleted.
"""
if old_theme_name is not None and old_theme_name in self._theme_dimensions:
del self._theme_dimensions[old_theme_name]
=== modified file 'openlp/core/lib/screen.py'
--- openlp/core/lib/screen.py 2015-01-18 13:39:21 +0000
+++ openlp/core/lib/screen.py 2015-09-09 20:04:06 +0000
@@ -142,7 +142,9 @@
"""
Add a screen to the list of known screens.
- :param screen: A dict with the screen properties::
+ :param screen: A dict with the screen properties:
+
+ ::
{
'primary': True,
=== modified file 'openlp/core/lib/searchedit.py'
--- openlp/core/lib/searchedit.py 2015-01-18 13:39:21 +0000
+++ openlp/core/lib/searchedit.py 2015-09-09 20:04:06 +0000
@@ -114,17 +114,17 @@
default.
:param items: The list of tuples to use. The tuples should contain an integer identifier, an icon (QIcon
- instance or string) and a title for the item in the menu. In short, they should look like this::
-
- (<identifier>, <icon>, <title>, <place holder text>)
-
- For instance::
-
- (1, <QIcon instance>, "Titles", "Search Song Titles...")
-
- Or::
-
- (2, ":/songs/authors.png", "Authors", "Search Authors...")
+ instance or string) and a title for the item in the menu. In short, they should look like this::
+
+ (<identifier>, <icon>, <title>, <place holder text>)
+
+ For instance::
+
+ (1, <QIcon instance>, "Titles", "Search Song Titles...")
+
+ Or::
+
+ (2, ":/songs/authors.png", "Authors", "Search Authors...")
"""
menu = QtGui.QMenu(self)
first = None
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2015-06-10 15:14:23 +0000
+++ openlp/core/lib/serviceitem.py 2015-09-09 20:04:06 +0000
@@ -388,7 +388,7 @@
:param service_item: The item to extract data from.
:param path: Defaults to *None*. This is the service manager path for things which have their files saved
- with them or None when the saved service is lite and the original file paths need to be preserved.
+ with them or None when the saved service is lite and the original file paths need to be preserved.
"""
log.debug('set_from_service called with path %s' % path)
header = service_item['serviceitem']['header']
=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py 2015-01-18 13:39:21 +0000
+++ openlp/core/lib/ui.py 2015-09-09 20:04:06 +0000
@@ -66,9 +66,9 @@
:param dialog: The parent object. This has to be a ``QDialog`` descendant.
:param name: A string which is set as object name.
:param standard_buttons: A list of strings for the used buttons. It might contain: ``ok``, ``save``, ``cancel``,
- ``close``, and ``defaults``.
+ ``close``, and ``defaults``.
:param custom_buttons: A list of additional buttons. If an item is an instance of QtGui.QAbstractButton it is added
- with QDialogButtonBox.ActionRole. Otherwise the item has to be a tuple of a Button and a ButtonRole.
+ with QDialogButtonBox.ActionRole. Otherwise the item has to be a tuple of a Button and a ButtonRole.
"""
if custom_buttons is None:
custom_buttons = []
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2015-05-22 03:15:15 +0000
+++ openlp/core/ui/maindisplay.py 2015-09-09 20:04:06 +0000
@@ -320,7 +320,7 @@
cache.
:param path: The path to the image to be displayed. **Note**, the path is only passed to identify the image.
- If the image has changed it has to be re-added to the image manager.
+ If the image has changed it has to be re-added to the image manager.
"""
image = self.image_manager.get_image_bytes(path, ImageSource.ImagePlugin)
self.controller.media_controller.media_reset(self.controller)
=== modified file 'openlp/core/ui/projector/sourceselectform.py'
--- openlp/core/ui/projector/sourceselectform.py 2015-01-31 14:18:19 +0000
+++ openlp/core/ui/projector/sourceselectform.py 2015-09-09 20:04:06 +0000
@@ -44,17 +44,19 @@
Return a dictionary where key is source[0] and values are inputs
grouped by source[0].
- source_text = dict{"key1": "key1-text",
- "key2": "key2-text",
- ...}
- return:
- dict{ key1[0]: { "key11": "key11-text",
- "key12": "key12-text",
- "key13": "key13-text",
- ... }
- key2[0]: {"key21": "key21-text",
- "key22": "key22-text",
- ... }
+ ::
+
+ source_text = dict{"key1": "key1-text",
+ "key2": "key2-text",
+ ...}
+ return:
+ dict{key1[0]: {"key11": "key11-text",
+ "key12": "key12-text",
+ "key13": "key13-text",
+ ...}
+ key2[0]: {"key21": "key21-text",
+ "key22": "key22-text",
+ ...}
:param inputs: List of inputs
:param source_text: Dictionary of {code: text} values to display
@@ -81,16 +83,18 @@
Create the radio button page for a tab.
Dictionary will be a 1-key entry where key=tab to setup, val=list of inputs.
- source_key: {"groupkey1": {"key11": "key11-text",
- "key12": "key12-text",
- ...
- },
- "groupkey2": {"key21": "key21-text",
- "key22": "key22-text",
- ....
- },
- ...
- }
+ ::
+
+ source_key: {"groupkey1": {"key11": "key11-text",
+ "key12": "key12-text",
+ ...
+ },
+ "groupkey2": {"key21": "key21-text",
+ "key22": "key22-text",
+ ...
+ },
+ ...
+ }
:param group: Button group widget to add buttons to
:param source_key: Dictionary of sources for radio buttons
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2015-03-09 22:10:21 +0000
+++ openlp/core/ui/servicemanager.py 2015-09-09 20:04:06 +0000
@@ -480,7 +480,7 @@
"""
Create the initial service array with the base items to be saved.
- :return service array
+ :return: service array
"""
service = []
core = {'lite-service': self._save_lite,
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2015-04-02 09:04:56 +0000
+++ openlp/core/ui/thememanager.py 2015-09-09 20:04:06 +0000
@@ -503,7 +503,7 @@
Returns a theme object from an XML file
:param theme_name: Name of the theme to load from file
- :return The theme object.
+ :return: The theme object.
"""
self.log_debug('get theme data for theme %s' % theme_name)
xml_file = os.path.join(self.path, str(theme_name), str(theme_name) + '.xml')
@@ -519,7 +519,7 @@
Display a warning box to the user that a theme already exists
:param theme_name: Name of the theme.
- :return Confirm if the theme is to be overwritten.
+ :return: Confirm if the theme is to be overwritten.
"""
ret = QtGui.QMessageBox.question(self, translate('OpenLP.ThemeManager', 'Theme Already Exists'),
translate('OpenLP.ThemeManager',
@@ -607,7 +607,7 @@
Check if theme already exists and displays error message
:param theme_name: Name of the Theme to test
- :return True or False if theme exists
+ :return: True or False if theme exists
"""
theme_dir = os.path.join(self.path, theme_name)
if os.path.exists(theme_dir):
@@ -718,7 +718,7 @@
:param theme_xml: The Theme data object.
:param image_path: Where the theme image is stored
- :return Theme data.
+ :return: Theme data.
"""
theme = ThemeXML()
theme.parse(theme_xml)
@@ -734,7 +734,7 @@
:param confirm_text: Confirm message text to be displayed.
:param test_plugin: Do we check the plugins for theme usage.
:param confirm: Do we display a confirm box before run checks.
- :return True or False depending on the validity.
+ :return: True or False depending on the validity.
"""
self.global_theme = Settings().value(self.settings_section + '/global theme')
if check_item_selected(self.theme_list_widget, select_text):
=== modified file 'openlp/core/utils/actions.py'
--- openlp/core/utils/actions.py 2015-01-18 13:39:21 +0000
+++ openlp/core/utils/actions.py 2015-09-09 20:04:06 +0000
@@ -238,10 +238,10 @@
:param action: The action to add (QAction). **Note**, the action must not have an empty ``objectName``.
:param category: The category this action belongs to. The category has to be a python string. . **Note**,
- if the category is ``None``, the category and its actions are being hidden in the shortcut dialog. However,
- if they are added, it is possible to avoid assigning shortcuts twice, which is important.
+ if the category is ``None``, the category and its actions are being hidden in the shortcut dialog. However,
+ if they are added, it is possible to avoid assigning shortcuts twice, which is important.
:param weight: The weight specifies how important a category is. However, this only has an impact on the order
- the categories are displayed.
+ the categories are displayed.
"""
if category not in self.categories:
self.categories.append(category)
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py 2015-02-26 21:10:35 +0000
+++ openlp/plugins/bibles/lib/db.py 2015-09-09 20:04:06 +0000
@@ -37,7 +37,7 @@
from openlp.core.lib.db import BaseModel, init_db, Manager
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.utils import clean_filename
-from . import upgrade
+from openlp.plugins.bibles.lib import upgrade
log = logging.getLogger(__name__)
@@ -219,7 +219,7 @@
:param book_id: The id of the book being appended.
:param chapter: The chapter number.
:param text_list: A dict of the verses to be inserted. The key is the verse number, and the value is the
- verse text.
+ verse text.
"""
log.debug('BibleDBcreate_chapter("%s", "%s")' % (book_id, chapter))
# Text list has book and chapter as first two elements of the array.
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py 2015-06-07 20:56:06 +0000
+++ openlp/plugins/bibles/lib/http.py 2015-09-09 20:04:06 +0000
@@ -743,7 +743,7 @@
:param reference_url: The URL to obtain the soup from.
:param header: An optional HTTP header to pass to the bible web server.
:param pre_parse_regex: A regular expression to run on the webpage. Allows manipulation of the webpage before
- passing to BeautifulSoup for parsing.
+ passing to BeautifulSoup for parsing.
:param pre_parse_substitute: The text to replace any matches to the regular expression with.
"""
if not reference_url:
=== modified file 'openlp/plugins/custom/lib/customxmlhandler.py'
--- openlp/plugins/custom/lib/customxmlhandler.py 2015-01-18 13:39:21 +0000
+++ openlp/plugins/custom/lib/customxmlhandler.py 2015-09-09 20:04:06 +0000
@@ -84,7 +84,7 @@
Add a verse to the ``<lyrics>`` tag.
:param verse_type: A string denoting the type of verse. Possible values are "Chorus", "Verse", "Bridge",
- and "Custom".
+ and "Custom".
:param number: An integer denoting the number of the item, for example: verse 1.
:param content: The actual text of the verse to be stored.
=== modified file 'openlp/plugins/images/forms/addgroupform.py'
--- openlp/plugins/images/forms/addgroupform.py 2015-01-18 13:39:21 +0000
+++ openlp/plugins/images/forms/addgroupform.py 2015-09-09 20:04:06 +0000
@@ -44,7 +44,7 @@
:param clear: Set to False if the text input box should not be cleared when showing the dialog (default: True).
:param show_top_level_group: Set to True when "-- Top level group --" should be showed as first item
- (default: False).
+ (default: False).
:param selected_group: The ID of the group that should be selected by default when showing the dialog.
"""
if clear:
=== modified file 'openlp/plugins/images/lib/db.py'
--- openlp/plugins/images/lib/db.py 2015-01-18 13:39:21 +0000
+++ openlp/plugins/images/lib/db.py 2015-09-09 20:04:06 +0000
@@ -48,24 +48,24 @@
Setup the images database connection and initialise the database schema.
:param url: The database to setup
- The images database contains the following tables:
-
- * image_groups
- * image_filenames
-
- **image_groups Table**
- This table holds the names of the images groups. It has the following columns:
-
- * id
- * parent_id
- * group_name
-
- **image_filenames Table**
- This table holds the filenames of the images and the group they belong to. It has the following columns:
-
- * id
- * group_id
- * filename
+ The images database contains the following tables:
+
+ * image_groups
+ * image_filenames
+
+ **image_groups Table**
+ This table holds the names of the images groups. It has the following columns:
+
+ * id
+ * parent_id
+ * group_name
+
+ **image_filenames Table**
+ This table holds the filenames of the images and the group they belong to. It has the following columns:
+
+ * id
+ * group_id
+ * filename
"""
session, metadata = init_db(url)
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2015-05-16 21:24:57 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2015-09-09 20:04:06 +0000
@@ -285,7 +285,7 @@
:param combobox: The QComboBox to add the options to.
:param parent_group_id: The ID of the group that will be added.
:param prefix: A string containing the prefix that will be added in front of the groupname for each level of
- the tree.
+ the tree.
"""
if parent_group_id == 0:
combobox.clear()
@@ -333,7 +333,7 @@
:param images: A List of Image Filenames objects that will be used to reload the mediamanager list.
:param initial_load: When set to False, the busy cursor and progressbar will be shown while loading images.
:param open_group: ImageGroups object of the group that must be expanded after reloading the list in the
- interface.
+ interface.
"""
if not initial_load:
self.application.set_busy_cursor()
@@ -469,7 +469,7 @@
:param images_list: A List of strings containing image filenames
:param group_id: The ID of the group to save the images in
:param reload_list: This boolean is set to True when the list in the interface should be reloaded after saving
- the new images
+ the new images
"""
for filename in images_list:
if not isinstance(filename, str):
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2015-05-28 20:38:43 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2015-09-09 20:04:06 +0000
@@ -43,11 +43,6 @@
CLAPPERBOARD = ':/media/slidecontroller_multimedia.png'
-OPTICAL = ':/media/media_optical.png'
-VIDEO_ICON = build_icon(':/media/media_video.png')
-AUDIO_ICON = build_icon(':/media/media_audio.png')
-OPTICAL_ICON = build_icon(OPTICAL)
-ERROR_ICON = build_icon(':/general/general_delete.png')
class MediaMediaItem(MediaManagerItem, RegistryProperties):
@@ -69,6 +64,10 @@
self.single_service_item = False
self.has_search = True
self.media_object = None
+ self.optical_icon = build_icon(':/media/media_optical.png')
+ self.video_icon = build_icon(':/media/media_video.png')
+ self.audio_icon = build_icon(':/media/media_audio.png')
+ self.error_icon = build_icon(':/general/general_delete.png')
self.display_controller = DisplayController(self.parent())
self.display_controller.controller_layout = QtGui.QVBoxLayout()
self.media_controller.register_controller(self.display_controller)
@@ -130,7 +129,8 @@
optical_button_text = translate('MediaPlugin.MediaItem', 'Load CD/DVD')
optical_button_tooltip = translate('MediaPlugin.MediaItem',
'Load CD/DVD - only supported when VLC is installed and enabled')
- self.load_optical = self.toolbar.add_toolbar_action('load_optical', icon=OPTICAL_ICON, text=optical_button_text,
+ self.load_optical = self.toolbar.add_toolbar_action('load_optical', icon=self.optical_icon,
+ text=optical_button_text,
tooltip=optical_button_tooltip,
triggers=self.on_load_optical)
if disable_optical_button_text:
@@ -351,14 +351,14 @@
# Handle optical based item
(file_name, title, audio_track, subtitle_track, start, end, clip_name) = parse_optical_path(track)
item_name = QtGui.QListWidgetItem(clip_name)
- item_name.setIcon(OPTICAL_ICON)
+ item_name.setIcon(self.optical_icon)
item_name.setData(QtCore.Qt.UserRole, track)
item_name.setToolTip('%s@%s-%s' % (file_name, format_milliseconds(start), format_milliseconds(end)))
elif not os.path.exists(track):
# File doesn't exist, mark as error.
file_name = os.path.split(str(track))[1]
item_name = QtGui.QListWidgetItem(file_name)
- item_name.setIcon(ERROR_ICON)
+ item_name.setIcon(self.error_icon)
item_name.setData(QtCore.Qt.UserRole, track)
item_name.setToolTip(track)
elif track_info.isFile():
@@ -366,9 +366,9 @@
file_name = os.path.split(str(track))[1]
item_name = QtGui.QListWidgetItem(file_name)
if '*.%s' % (file_name.split('.')[-1].lower()) in self.media_controller.audio_extensions_list:
- item_name.setIcon(AUDIO_ICON)
+ item_name.setIcon(self.audio_icon)
else:
- item_name.setIcon(VIDEO_ICON)
+ item_name.setIcon(self.video_icon)
item_name.setData(QtCore.Qt.UserRole, track)
item_name.setToolTip(track)
if item_name:
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py 2015-01-18 13:39:21 +0000
+++ openlp/plugins/songs/forms/songimportform.py 2015-09-09 20:04:06 +0000
@@ -228,6 +228,7 @@
:param listbox: A listbox (QListWidget).
:param filters: The file extension filters. It should contain the file descriptions as well as the file
extensions. For example::
+
'SongBeamer Files (*.sng)'
"""
if filters:
=== modified file 'openlp/plugins/songs/lib/db.py'
--- openlp/plugins/songs/lib/db.py 2015-02-11 20:56:13 +0000
+++ openlp/plugins/songs/lib/db.py 2015-09-09 20:04:06 +0000
@@ -173,6 +173,7 @@
Setup the songs database connection and initialise the database schema.
:param url: The database to setup
+
The song database contains the following tables:
* authors
=== modified file 'openlp/plugins/songs/lib/importers/easyslides.py'
--- openlp/plugins/songs/lib/importers/easyslides.py 2015-01-18 13:39:21 +0000
+++ openlp/plugins/songs/lib/importers/easyslides.py 2015-09-09 20:04:06 +0000
@@ -36,7 +36,7 @@
Import songs exported from EasySlides
The format example is here:
- http://wiki.openlp.org/Development:EasySlides_-_Song_Data_Format
+ http://wiki.openlp.org/Development:EasySlides\_-_Song_Data_Format
"""
def __init__(self, manager, **kwargs):
"""
=== modified file 'openlp/plugins/songs/lib/importers/powersong.py'
--- openlp/plugins/songs/lib/importers/powersong.py 2015-01-18 13:39:21 +0000
+++ openlp/plugins/songs/lib/importers/powersong.py 2015-09-09 20:04:06 +0000
@@ -71,7 +71,7 @@
"""
Checks if source is a PowerSong 1.0 folder:
* is a directory
- * contains at least one *.song file
+ * contains at least one \*.song file
"""
if os.path.isdir(import_source):
for file in os.listdir(import_source):
=== modified file 'openlp/plugins/songs/lib/importers/songimport.py'
--- openlp/plugins/songs/lib/importers/songimport.py 2015-01-18 13:39:21 +0000
+++ openlp/plugins/songs/lib/importers/songimport.py 2015-09-09 20:04:06 +0000
@@ -105,7 +105,7 @@
This should be called, when a song could not be imported.
:param file_path: This should be the file path if ``self.import_source`` is a list with different files. If it
- is not a list, but a single file (for instance a database), then this should be the song's title.
+ is not a list, but a single file (for instance a database), then this should be the song's title.
:param reason: The reason why the import failed. The string should be as informative as possible.
"""
self.set_defaults()
=== modified file 'openlp/plugins/songs/lib/importers/songpro.py'
--- openlp/plugins/songs/lib/importers/songpro.py 2015-08-28 13:20:17 +0000
+++ openlp/plugins/songs/lib/importers/songpro.py 2015-09-09 20:04:06 +0000
@@ -36,30 +36,30 @@
**SongPro Song File Format:**
- SongPro has the option to export under its File menu
- This produces files containing single or multiple songs
- The file is text with lines tagged with # followed by an identifier.
- This is documented here: http://creationsoftware.com/ImportIdentifiers.php
- An example here: http://creationsoftware.com/ExampleImportingManySongs.txt
-
- #A - next line is the Song Author
- #B - the lines following until next tagged line are the "Bridge" words
- (can be in rtf or plain text) which we map as B1
- #C - the lines following until next tagged line are the chorus words
- (can be in rtf or plain text)
- which we map as C1
- #D - the lines following until next tagged line are the "Ending" words
- (can be in rtf or plain text) which we map as E1
- #E - this song ends here, so we process the song -
- and start again at the next line
- #G - next line is the Group
- #M - next line is the Song Number
- #N - next line are Notes
- #R - next line is the SongCopyright
- #O - next line is the Verse Sequence
- #T - next line is the Song Title
- #1 - #7 the lines following until next tagged line are the verse x words
- (can be in rtf or plain text)
+ | SongPro has the option to export under its File menu
+ | This produces files containing single or multiple songs
+ | The file is text with lines tagged with # followed by an identifier.
+ | This is documented here: http://creationsoftware.com/ImportIdentifiers.php
+ | An example here: http://creationsoftware.com/ExampleImportingManySongs.txt
+ |
+ | #A - next line is the Song Author
+ | #B - the lines following until next tagged line are the "Bridge" words
+ | (can be in rtf or plain text) which we map as B1
+ | #C - the lines following until next tagged line are the chorus words
+ | (can be in rtf or plain text)
+ | which we map as C1
+ | #D - the lines following until next tagged line are the "Ending" words
+ | (can be in rtf or plain text) which we map as E1
+ | #E - this song ends here, so we process the song -
+ | and start again at the next line
+ | #G - next line is the Group
+ | #M - next line is the Song Number
+ | #N - next line are Notes
+ | #R - next line is the SongCopyright
+ | #O - next line is the Verse Sequence
+ | #T - next line is the Song Title
+ | #1 - #7 the lines following until next tagged line are the verse x words
+ | (can be in rtf or plain text)
"""
def __init__(self, manager, **kwargs):
"""
=== modified file 'openlp/plugins/songs/lib/importers/songshowplus.py'
--- openlp/plugins/songs/lib/importers/songshowplus.py 2015-01-18 13:39:21 +0000
+++ openlp/plugins/songs/lib/importers/songshowplus.py 2015-09-09 20:04:06 +0000
@@ -60,22 +60,22 @@
* Each piece of data in the song file has some information that precedes it.
* The general format of this data is as follows:
- 4 Bytes, forming a 32 bit number, a key if you will, this describes what the data is (see blockKey below)
- 4 Bytes, forming a 32 bit number, which is the number of bytes until the next block starts
- 1 Byte, which tells how many bytes follows
- 1 or 4 Bytes, describes how long the string is, if its 1 byte, the string is less than 255
- The next bytes are the actual data.
- The next block of data follows on.
-
- This description does differ for verses. Which includes extra bytes stating the verse type or number. In some cases
- a "custom" verse is used, in that case, this block will in include 2 strings, with the associated string length
- descriptors. The first string is the name of the verse, the second is the verse content.
-
- The file is ended with four null bytes.
-
- Valid extensions for a SongShow Plus song file are:
-
- * .sbsong
+ | 4 Bytes, forming a 32 bit number, a key if you will, this describes what the data is (see blockKey below)
+ | 4 Bytes, forming a 32 bit number, which is the number of bytes until the next block starts
+ | 1 Byte, which tells how many bytes follows
+ | 1 or 4 Bytes, describes how long the string is, if its 1 byte, the string is less than 255
+ | The next bytes are the actual data.
+ | The next block of data follows on.
+
+ This description does differ for verses. Which includes extra bytes stating the verse type or number. In some
+ cases a "custom" verse is used, in that case, this block will in include 2 strings, with the associated string
+ length descriptors. The first string is the name of the verse, the second is the verse content.
+
+ The file is ended with four null bytes.
+
+ Valid extensions for a SongShow Plus song file are:
+
+ * .sbsong
"""
other_count = 0
=== modified file 'openlp/plugins/songs/lib/openlyricsxml.py'
--- openlp/plugins/songs/lib/openlyricsxml.py 2015-04-02 20:32:20 +0000
+++ openlp/plugins/songs/lib/openlyricsxml.py 2015-09-09 20:04:06 +0000
@@ -91,7 +91,7 @@
Add a verse to the ``<lyrics>`` tag.
:param type: A string denoting the type of verse. Possible values are *v*, *c*, *b*, *p*, *i*, *e* and *o*.
- Any other type is **not** allowed, this also includes translated types.
+ Any other type is **not** allowed, this also includes translated types.
:param number: An integer denoting the number of the item, for example: verse 1.
:param content: The actual text of the verse to be stored.
:param lang: The verse's language code (ISO-639). This is not required, but should be added if available.
@@ -113,6 +113,7 @@
Iterates through the verses in the XML and returns a list of verses and their attributes.
:param xml: The XML of the song to be parsed.
+
The returned list has the following format::
[[{'type': 'v', 'label': '1'}, u"optional slide split 1[---]optional slide split 2"],
@@ -371,7 +372,7 @@
:param xml: The XML to parse (unicode).
:param parse_and_temporary_save: Switch to skip processing the whole song and storing the songs in the database
- with a temporary flag. Defaults to ``False``.
+ with a temporary flag. Defaults to ``False``.
"""
# No xml get out of here.
if not xml:
=== modified file 'openlp/plugins/songs/lib/songcompare.py'
--- openlp/plugins/songs/lib/songcompare.py 2015-01-18 13:39:21 +0000
+++ openlp/plugins/songs/lib/songcompare.py 2015-09-09 20:04:06 +0000
@@ -21,20 +21,21 @@
###############################################################################
"""
The :mod:`songcompare` module provides functionality to search for
-duplicate songs. It has one single :function:`songs_probably_equal`.
-
-The algorithm is based on the diff algorithm.
-First a diffset is calculated for two songs.
-To compensate for typos all differences that are smaller than a
-limit (<max_typo_size) and are surrounded by larger equal blocks
-(>min_fragment_size) are removed and the surrounding equal parts are merged.
-Finally two conditions can qualify a song tuple to be a duplicate:
-1. There is a block of equal content that is at least min_block_size large.
- This condition should hit for all larger songs that have a long enough
- equal part. Even if only one verse is equal this condition should still hit.
-2. Two thirds of the smaller song is contained in the larger song.
- This condition should hit if one of the two songs (or both) is small (smaller
- than the min_block_size), but most of the song is contained in the other song.
+duplicate songs. It has one single :func:`songs_probably_equal`.
+
+| The algorithm is based on the diff algorithm.
+| First a diffset is calculated for two songs.
+| To compensate for typos all differences that are smaller than a
+ limit (<max_typo_size) and are surrounded by larger equal blocks
+ (>min_fragment_size) are removed and the surrounding equal parts are merged.
+| Finally two conditions can qualify a song tuple to be a duplicate:
+
+ 1. There is a block of equal content that is at least min_block_size large.
+ This condition should hit for all larger songs that have a long enough
+ equal part. Even if only one verse is equal this condition should still hit.
+ 2. Two thirds of the smaller song is contained in the larger song.
+ This condition should hit if one of the two songs (or both) is small (smaller
+ than the min_block_size), but most of the song is contained in the other song.
"""
import difflib
Follow ups