Comment parameter cleanups

bzr-revno: 2337
This commit is contained in:
Tim Bentley 2014-03-18 21:12:48 +00:00
commit e3842b6809
68 changed files with 459 additions and 869 deletions

View File

@ -49,8 +49,7 @@ def trace_error_handler(logger):
""" """
Log the calling path of an exception Log the calling path of an exception
``logger`` :param logger: logger to use so traceback is logged to correct class
logger to use so traceback is logged to correct class
""" """
for tb in traceback.extract_stack(): for tb in traceback.extract_stack():
logger.error('Called by ' + tb[3] + ' at line ' + str(tb[1]) + ' in ' + tb[0]) logger.error('Called by ' + tb[3] + ' at line ' + str(tb[1]) + ' in ' + tb[0])
@ -60,11 +59,8 @@ def check_directory_exists(directory, do_not_log=False):
""" """
Check a theme directory exists and if not create it Check a theme directory exists and if not create it
``directory`` :param directory: The directory to make sure exists
The directory to make sure exists :param do_not_log: To not log anything. This is need for the start up, when the log isn't ready.
``do_not_log``
To not log anything. This is need for the start up, when the log isn't ready.
""" """
if not do_not_log: if not do_not_log:
log.debug('check_directory_exists %s' % directory) log.debug('check_directory_exists %s' % directory)
@ -99,14 +95,12 @@ def translate(context, text, comment=None, encoding=QtCore.QCoreApplication.Code
A special shortcut method to wrap around the Qt4 translation functions. This abstracts the translation procedure so A special shortcut method to wrap around the Qt4 translation functions. This abstracts the translation procedure so
that we can change it if at a later date if necessary, without having to redo the whole of OpenLP. that we can change it if at a later date if necessary, without having to redo the whole of OpenLP.
``context`` :param context: The translation context, used to give each string a context or a namespace.
The translation context, used to give each string a context or a namespace. :param text: The text to put into the translation tables for translation.
:param comment: An identifying string for when the same text is used in different roles within the same context.
``text`` :param encoding:
The text to put into the translation tables for translation. :param n:
:param qt_translate:
``comment``
An identifying string for when the same text is used in different roles within the same context.
""" """
return qt_translate(context, text, comment, encoding, n) return qt_translate(context, text, comment, encoding, n)

View File

@ -69,8 +69,7 @@ class AppLocation(object):
""" """
Return the appropriate directory according to the directory type. Return the appropriate directory according to the directory type.
``dir_type`` :param dir_type: The directory type you want, for instance the data directory. Default *AppLocation.AppDir*
The directory type you want, for instance the data directory. Default *AppLocation.AppDir*
""" """
if dir_type == AppLocation.AppDir: if dir_type == AppLocation.AppDir:
return get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0]) return get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0])
@ -106,10 +105,9 @@ class AppLocation(object):
""" """
Get a list of files from the data files path. Get a list of files from the data files path.
``section`` :param section: Defaults to *None*. The section of code getting the files - used to load from a section's
Defaults to *None*. The section of code getting the files - used to load from a section's data subdirectory. data subdirectory.
:param extension:
``extension``
Defaults to *None*. The extension to search for. For example:: Defaults to *None*. The extension to search for. For example::
u'.png' u'.png'

View File

@ -73,8 +73,7 @@ class Registry(object):
""" """
Extracts the registry value from the list based on the key passed in Extracts the registry value from the list based on the key passed in
``key`` :param key: The service to be retrieved.
The service to be retrieved.
""" """
if key in self.service_list: if key in self.service_list:
return self.service_list[key] return self.service_list[key]
@ -88,11 +87,8 @@ class Registry(object):
""" """
Registers a component against a key. Registers a component against a key.
``key`` :param key: The service to be created this is usually a major class like "renderer" or "main_window" .
The service to be created this is usually a major class like "renderer" or "main_window" . :param reference: The service address to be saved.
``reference``
The service address to be saved.
""" """
if key in self.service_list: if key in self.service_list:
trace_error_handler(log) trace_error_handler(log)
@ -106,8 +102,7 @@ class Registry(object):
Removes the registry value from the list based on the key passed in (Only valid and active for testing Removes the registry value from the list based on the key passed in (Only valid and active for testing
framework). framework).
``key`` :param key: The service to be deleted.
The service to be deleted.
""" """
if key in self.service_list: if key in self.service_list:
del self.service_list[key] del self.service_list[key]
@ -116,13 +111,10 @@ class Registry(object):
""" """
Register an event and associated function to be called Register an event and associated function to be called
``event`` :param event: The function description like "live_display_hide" where a number of places in the code
The function description like "live_display_hide" where a number of places in the code
will/may need to respond to a single action and the caller does not need to understand or know about the will/may need to respond to a single action and the caller does not need to understand or know about the
recipients. recipients.
:param function: The function to be called when the event happens.
``function``
The function to be called when the event happens.
""" """
if event in self.functions_list: if event in self.functions_list:
self.functions_list[event].append(function) self.functions_list[event].append(function)
@ -133,11 +125,8 @@ class Registry(object):
""" """
Remove an event and associated handler Remove an event and associated handler
``event`` :param event: The function description..
The function description.. :param function: The function to be called when the event happens.
``function``
The function to be called when the event happens.
""" """
if self.running_under_test is False: if self.running_under_test is False:
trace_error_handler(log) trace_error_handler(log)
@ -150,14 +139,9 @@ class Registry(object):
""" """
Execute all the handlers associated with the event and return an array of results. Execute all the handlers associated with the event and return an array of results.
``event`` :param event: The function to be processed
The function to be processed :param args: Parameters to be passed to the function.
:param kwargs: Parameters to be passed to the function.
``*args``
Parameters to be passed to the function.
``*kwargs``
Parameters to be passed to the function.
""" """
results = [] results = []
if event in self.functions_list: if event in self.functions_list:

View File

@ -348,8 +348,7 @@ class Settings(QtCore.QSettings):
""" """
Static method to merge the given ``default_values`` with the ``Settings.__default_settings__``. Static method to merge the given ``default_values`` with the ``Settings.__default_settings__``.
``default_values`` :param default_values: A dict with setting keys and their default values.
A dict with setting keys and their default values.
""" """
Settings.__default_settings__ = dict(list(default_values.items()) + list(Settings.__default_settings__.items())) Settings.__default_settings__ = dict(list(default_values.items()) + list(Settings.__default_settings__.items()))
@ -419,8 +418,7 @@ class Settings(QtCore.QSettings):
Returns the value for the given ``key``. The returned ``value`` is of the same type as the default value in the Returns the value for the given ``key``. The returned ``value`` is of the same type as the default value in the
*Settings.__default_settings__* dict. *Settings.__default_settings__* dict.
``key`` :param key: The key to return the value from.
The key to return the value from.
""" """
# if group() is not empty the group has not been specified together with the key. # if group() is not empty the group has not been specified together with the key.
if self.group(): if self.group():
@ -434,12 +432,9 @@ class Settings(QtCore.QSettings):
""" """
This converts the given ``setting`` to the type of the given ``default_value``. This converts the given ``setting`` to the type of the given ``default_value``.
``setting`` :param setting: The setting to convert. This could be ``true`` for example.Settings()
The setting to convert. This could be ``true`` for example.Settings() :param default_value: Indication the type the setting should be converted to. For example ``True``
(type is boolean), meaning that we convert the string ``true`` to a python boolean.
``default_value``
Indication the type the setting should be converted to. For example ``True`` (type is boolean), meaning that
we convert the string ``true`` to a python boolean.
**Note**, this method only converts a few types and might need to be extended if a certain type is missing! **Note**, this method only converts a few types and might need to be extended if a certain type is missing!
""" """
@ -471,10 +466,9 @@ class Settings(QtCore.QSettings):
This removes the settings needed for old way we saved files (e. g. the image paths for the image plugin). A list This removes the settings needed for old way we saved files (e. g. the image paths for the image plugin). A list
of file paths are returned. of file paths are returned.
**Note**: Only a list of paths is returned; this does not convert anything! **Note**: Only a list of paths is returned; this does not convert anything!
``plugin`` :param plugin: The Plugin object.The caller has to convert/save the list himself; o
The Plugin object.The caller has to convert/save the list himself; o
""" """
files_list = [] files_list = []
# We need QSettings instead of Settings here to bypass our central settings dict. # We need QSettings instead of Settings here to bypass our central settings dict.

View File

@ -52,14 +52,9 @@ def init_db(url, auto_flush=True, auto_commit=False):
""" """
Initialise and return the session and metadata for a database Initialise and return the session and metadata for a database
``url`` :param url: The database to initialise connection with
The database to initialise connection with :param auto_flush: Sets the flushing behaviour of the session
:param auto_commit: Sets the commit behaviour of the session
``auto_flush``
Sets the flushing behaviour of the session
``auto_commit``
Sets the commit behaviour of the session
""" """
engine = create_engine(url, poolclass=NullPool) engine = create_engine(url, poolclass=NullPool)
metadata = MetaData(bind=engine) metadata = MetaData(bind=engine)
@ -71,8 +66,7 @@ def get_upgrade_op(session):
""" """
Create a migration context and an operations object for performing upgrades. Create a migration context and an operations object for performing upgrades.
``session`` :param session: The SQLAlchemy session object.
The SQLAlchemy session object.
""" """
context = MigrationContext.configure(session.bind.connect()) context = MigrationContext.configure(session.bind.connect())
return Operations(context) return Operations(context)

View File

@ -170,9 +170,7 @@ class FormattingTags(object):
""" """
Add a list of tags to the list. Add a list of tags to the list.
``tags`` :param tags: The list with tags to add.
The list with tags to add.
Each **tag** has to be a ``dict`` and should have the following keys: Each **tag** has to be a ``dict`` and should have the following keys:
* desc * desc

View File

@ -556,23 +556,12 @@ def build_html(item, screen, is_live, background, image=None, plugins=None):
""" """
Build the full web paged structure for display Build the full web paged structure for display
``item`` :param item: Service Item to be displayed
Service Item to be displayed :param screen: Current display information
:param is_live: Item is going live, rather than preview/theme building
``screen`` :param background: Theme background image - bytes
Current display information :param image: Image media item - bytes
:param plugins: The List of available plugins
``is_live``
Item is going live, rather than preview/theme building
``background``
Theme background image - bytes
``image``
Image media item - bytes
``plugins``
The List of available plugins
""" """
width = screen['size'].width() width = screen['size'].width()
height = screen['size'].height() height = screen['size'].height()
@ -626,8 +615,8 @@ def build_background_css(item, width):
""" """
Build the background css Build the background css
``item`` :param item: Service Item containing theme and location information
Service Item containing theme and location information :param width:
""" """
width = int(width) // 2 width = int(width) // 2
theme = item.theme_data theme = item.theme_data
@ -660,9 +649,7 @@ def build_lyrics_css(item):
""" """
Build the lyrics display css Build the lyrics display css
``item`` :param item: Service Item containing theme and location information
Service Item containing theme and location information
""" """
style = """ style = """
.lyricstable { .lyricstable {
@ -700,8 +687,7 @@ def build_lyrics_outline_css(theme_data):
""" """
Build the css which controls the theme outline. Also used by renderer for splitting verses Build the css which controls the theme outline. Also used by renderer for splitting verses
``theme_data`` :param theme_data: Object containing theme information
Object containing theme information
""" """
if theme_data.font_main_outline: if theme_data.font_main_outline:
size = float(theme_data.font_main_outline_size) / 16 size = float(theme_data.font_main_outline_size) / 16
@ -715,14 +701,9 @@ def build_lyrics_format_css(theme_data, width, height):
""" """
Build the css which controls the theme format. Also used by renderer for splitting verses Build the css which controls the theme format. Also used by renderer for splitting verses
``theme_data`` :param theme_data: Object containing theme information
Object containing theme information :param width: Width of the lyrics block
:param height: Height of the lyrics block
``width``
Width of the lyrics block
``height``
Height of the lyrics block
""" """
align = HorizontalType.Names[theme_data.display_horizontal_align] align = HorizontalType.Names[theme_data.display_horizontal_align]
valign = VerticalType.Names[theme_data.display_vertical_align] valign = VerticalType.Names[theme_data.display_vertical_align]
@ -756,8 +737,8 @@ def build_footer_css(item, height):
""" """
Build the display of the item footer Build the display of the item footer
``item`` :param item: Service Item to be processed.
Service Item to be processed. :param height:
""" """
style = """ style = """
left: %spx; left: %spx;

View File

@ -110,16 +110,12 @@ class Image(object):
""" """
Create an image for the :class:`ImageManager`'s cache. Create an image for the :class:`ImageManager`'s cache.
``path`` :param path: The image's file path. This should be an existing file path.
The image's file path. This should be an existing file path. :param source: The source describes the image's origin. Possible values are described in the
``source``
The source describes the image's origin. Possible values are described in the
:class:`~openlp.core.lib.ImageSource` class. :class:`~openlp.core.lib.ImageSource` class.
:param background: A ``QtGui.QColor`` object specifying the colour to be used to fill the gabs if the image's ratio does not
``background``
A ``QtGui.QColor`` object specifying the colour to be used to fill the gabs if the image's ratio does not
match with the display ratio. match with the display ratio.
""" """
self.path = path self.path = path
self.image = None self.image = None
@ -153,11 +149,8 @@ class PriorityQueue(queue.PriorityQueue):
""" """
Modifies the priority of the given ``image``. Modifies the priority of the given ``image``.
``image`` :param image: The image to remove. This should be an :class:`Image` instance.
The image to remove. This should be an :class:`Image` instance. :param new_priority: The image's new priority. See the :class:`Priority` class for priorities.
``new_priority``
The image's new priority. See the :class:`Priority` class for priorities.
""" """
self.remove(image) self.remove(image)
image.priority = new_priority image.priority = new_priority
@ -167,8 +160,7 @@ class PriorityQueue(queue.PriorityQueue):
""" """
Removes the given ``image`` from the queue. Removes the given ``image`` from the queue.
``image`` :param image: The image to remove. This should be an ``Image`` instance.
The image to remove. This should be an ``Image`` instance.
""" """
if (image.priority, image.secondary_priority, image) in self.queue: if (image.priority, image.secondary_priority, image) in self.queue:
self.queue.remove((image.priority, image.secondary_priority, image)) self.queue.remove((image.priority, image.secondary_priority, image))

View File

@ -95,8 +95,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
""" """
Receive drop event check if it is a file and process it if it is. Receive drop event check if it is a file and process it if it is.
``event`` :param event: Handle of the event pint passed
Handle of the event pint passed
""" """
if event.mimeData().hasUrls(): if event.mimeData().hasUrls():
event.setDropAction(QtCore.Qt.CopyAction) event.setDropAction(QtCore.Qt.CopyAction)

View File

@ -122,28 +122,21 @@ class Plugin(QtCore.QObject, RegistryProperties):
def __init__(self, name, default_settings, media_item_class=None, settings_tab_class=None, version=None): def __init__(self, name, default_settings, media_item_class=None, settings_tab_class=None, version=None):
""" """
This is the constructor for the plugin object. This provides an easy This is the constructor for the plugin object. This provides an easy way for descendant plugins to populate
way for descendent plugins to populate common data. This method *must* common data. This method *must*
be overridden, like so:: be overridden, like so::
class MyPlugin(Plugin): class MyPlugin(Plugin):
def __init__(self): def __init__(self):
super(MyPlugin, self).__init__('MyPlugin', version=u'0.1') super(MyPlugin, self).__init__('MyPlugin', version=u'0.1')
``name`` :param name: Defaults to *None*. The name of the plugin.
Defaults to *None*. The name of the plugin. :param default_settings: A dict containing the plugin's settings. The value to each key is the default value
to be used.
``default_settings`` :param media_item_class: The class name of the plugin's media item.
A dict containing the plugin's settings. The value to each key is the default value to be used. :param settings_tab_class: The class name of the plugin's settings tab.
:param version: Defaults to *None*, which means that the same version number is used as OpenLP's version number.
``media_item_class``
The class name of the plugin's media item.
``settings_tab_class``
The class name of the plugin's settings tab.
``version``
Defaults to *None*, which means that the same version number is used as OpenLP's version number.
""" """
log.debug('Plugin %s initialised' % name) log.debug('Plugin %s initialised' % name)
super(Plugin, self).__init__() super(Plugin, self).__init__()
@ -221,8 +214,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
""" """
Upgrade the settings of this plugin. Upgrade the settings of this plugin.
``settings`` :param settings: The Settings object containing the old settings.
The Settings object containing the old settings.
""" """
pass pass
@ -230,8 +222,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
""" """
Create a menu item and add it to the "Import" menu. Create a menu item and add it to the "Import" menu.
``import_menu`` :param import_menu: The Import menu.
The Import menu.
""" """
pass pass
@ -239,8 +230,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
""" """
Create a menu item and add it to the "Export" menu. Create a menu item and add it to the "Export" menu.
``export_menu`` :param export_menu: The Export menu
The Export menu
""" """
pass pass
@ -248,8 +238,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
""" """
Create a menu item and add it to the "Tools" menu. Create a menu item and add it to the "Tools" menu.
``tools_menu`` :param tools_menu: The Tools menu
The Tools menu
""" """
pass pass
@ -267,8 +256,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
""" """
Add menu items to the menu, given the menubar. Add menu items to the menu, given the menubar.
``menubar`` :param menubar: The application's menu bar.
The application's menu bar.
""" """
pass pass
@ -284,8 +272,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
def about(self): def about(self):
""" """
Show a dialog when the user clicks on the 'About' button in the plugin Show a dialog when the user clicks on the 'About' button in the plugin manager.
manager.
""" """
raise NotImplementedError('Plugin.about needs to be defined by the plugin') raise NotImplementedError('Plugin.about needs to be defined by the plugin')
@ -328,11 +315,8 @@ class Plugin(QtCore.QObject, RegistryProperties):
""" """
Renames a theme a plugin is using making the plugin use the new name. Renames a theme a plugin is using making the plugin use the new name.
``old_theme`` :param old_theme: The name of the theme the plugin should stop using.
The name of the theme the plugin should stop using. :param new_theme: The new name the plugin should now use
``new_theme``
The new name the plugin should now use.
""" """
pass pass

View File

@ -176,8 +176,7 @@ class PluginManager(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Loop through all the plugins and give them an opportunity to upgrade their settings. Loop through all the plugins and give them an opportunity to upgrade their settings.
``settings`` :param settings: The Settings object containing the old settings.
The Settings object containing the old settings.
""" """
for plugin in self.plugins: for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled: if plugin.status is not PluginStatus.Disabled:
@ -185,8 +184,7 @@ class PluginManager(RegistryMixin, OpenLPMixin, RegistryProperties):
def initialise_plugins(self): def initialise_plugins(self):
""" """
Loop through all the plugins and give them an opportunity to Loop through all the plugins and give them an opportunity to initialise themselves.
initialise themselves.
""" """
for plugin in self.plugins: for plugin in self.plugins:
self.log_info('initialising plugins %s in a %s state' % (plugin.name, plugin.is_active())) self.log_info('initialising plugins %s in a %s state' % (plugin.name, plugin.is_active()))
@ -196,8 +194,7 @@ class PluginManager(RegistryMixin, OpenLPMixin, RegistryProperties):
def finalise_plugins(self): def finalise_plugins(self):
""" """
Loop through all the plugins and give them an opportunity to Loop through all the plugins and give them an opportunity to clean themselves up
clean themselves up
""" """
for plugin in self.plugins: for plugin in self.plugins:
if plugin.is_active(): if plugin.is_active():

View File

@ -150,8 +150,7 @@ class ScreenList(object):
""" """
Add a screen to the list of known screens. Add a screen to the list of known screens.
``screen`` :param screen: A dict with the screen properties::
A dict with the screen properties::
{ {
u'primary': True, u'primary': True,
@ -170,8 +169,7 @@ class ScreenList(object):
""" """
Remove a screen from the list of known screens. Remove a screen from the list of known screens.
``number`` :param number: The screen number (int).
The screen number (int).
""" """
log.info('remove_screen %d' % number) log.info('remove_screen %d' % number)
for screen in self.screen_list: for screen in self.screen_list:
@ -184,8 +182,7 @@ class ScreenList(object):
""" """
Confirms a screen is known. Confirms a screen is known.
``number`` :param number: The screen number (int).
The screen number (int).
""" """
for screen in self.screen_list: for screen in self.screen_list:
if screen['number'] == number: if screen['number'] == number:
@ -196,8 +193,7 @@ class ScreenList(object):
""" """
Set up the current screen dimensions. Set up the current screen dimensions.
``number`` :param number: The screen number (int).
The screen number (int).
""" """
log.debug('set_current_display %s' % number) log.debug('set_current_display %s' % number)
if number + 1 > self.display_count: if number + 1 > self.display_count:
@ -211,8 +207,7 @@ class ScreenList(object):
def set_override_display(self): def set_override_display(self):
""" """
Replace the current size with the override values, as the user wants to Replace the current size with the override values, as the user wants to have their own screen attributes.
have their own screen attributes.
""" """
log.debug('set_override_display') log.debug('set_override_display')
self.current = copy.deepcopy(self.override) self.current = copy.deepcopy(self.override)
@ -220,8 +215,7 @@ class ScreenList(object):
def reset_current_display(self): def reset_current_display(self):
""" """
Replace the current values with the correct values, as the user wants to Replace the current values with the correct values, as the user wants to use the correct screen attributes.
use the correct screen attributes.
""" """
log.debug('reset_current_display') log.debug('reset_current_display')
self.set_current_display(self.current['number']) self.set_current_display(self.current['number'])
@ -230,8 +224,7 @@ class ScreenList(object):
""" """
Return the screen number that the centre of the passed window is in. Return the screen number that the centre of the passed window is in.
``window`` :param window: A QWidget we are finding the location of.
A QWidget we are finding the location of.
""" """
x = window.x() + (window.width() // 2) x = window.x() + (window.width() // 2)
y = window.y() + (window.height() // 2) y = window.y() + (window.height() // 2)

View File

@ -79,8 +79,7 @@ class SearchEdit(QtGui.QLineEdit):
""" """
Reimplemented method to react to resizing of the widget. Reimplemented method to react to resizing of the widget.
``event`` :param event: The event that happened.
The event that happened.
""" """
size = self.clear_button.size() size = self.clear_button.size()
frame_width = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth) frame_width = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
@ -100,8 +99,7 @@ class SearchEdit(QtGui.QLineEdit):
""" """
Set a new current search type. Set a new current search type.
``identifier`` :param identifier: The search type identifier (int).
The search type identifier (int).
""" """
menu = self.menu_button.menu() menu = self.menu_button.menu()
for action in menu.actions(): for action in menu.actions():
@ -122,8 +120,8 @@ class SearchEdit(QtGui.QLineEdit):
A list of tuples to be used in the search type menu. The first item in the list will be preselected as the A list of tuples to be used in the search type menu. The first item in the list will be preselected as the
default. default.
``items`` :param items: The list of tuples to use. The tuples should contain an integer identifier, an icon (QIcon instance or
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:: string) and a title for the item in the menu. In short, they should look like this::
(<identifier>, <icon>, <title>, <place holder text>) (<identifier>, <icon>, <title>, <place holder text>)
@ -162,8 +160,7 @@ class SearchEdit(QtGui.QLineEdit):
Internally implemented slot to react to when the text in the line edit has changed so that we can show or hide Internally implemented slot to react to when the text in the line edit has changed so that we can show or hide
the clear button. the clear button.
``text`` :param text: A :class:`~PyQt4.QtCore.QString` instance which represents the text in the line edit.
A :class:`~PyQt4.QtCore.QString` instance which represents the text in the line edit.
""" """
self.clear_button.setVisible(bool(text)) self.clear_button.setVisible(bool(text))

View File

@ -139,8 +139,7 @@ class ServiceItem(RegistryProperties):
""" """
Set up the service item. Set up the service item.
``plugin`` :param plugin: The plugin that this service item belongs to.
The plugin that this service item belongs to.
""" """
if plugin: if plugin:
self.name = plugin.name self.name = plugin.name
@ -186,8 +185,7 @@ class ServiceItem(RegistryProperties):
def _new_item(self): def _new_item(self):
""" """
Method to set the internal id of the item. This is used to compare Method to set the internal id of the item. This is used to compare service items to see if they are the same.
service items to see if they are the same.
""" """
self.unique_identifier = str(uuid.uuid1()) self.unique_identifier = str(uuid.uuid1())
self.validate_item() self.validate_item()
@ -196,8 +194,7 @@ class ServiceItem(RegistryProperties):
""" """
Add an ItemCapability to a ServiceItem Add an ItemCapability to a ServiceItem
``capability`` :param capability: The capability to add
The capability to add
""" """
self.capabilities.append(capability) self.capabilities.append(capability)
@ -205,30 +202,25 @@ class ServiceItem(RegistryProperties):
""" """
Tell the caller if a ServiceItem has a capability Tell the caller if a ServiceItem has a capability
``capability`` :param capability: The capability to test for
The capability to test for
""" """
return capability in self.capabilities return capability in self.capabilities
def add_icon(self, icon): def add_icon(self, icon):
""" """
Add an icon to the service item. This is used when displaying the Add an icon to the service item. This is used when displaying the service item in the service manager.
service item in the service manager.
``icon`` :param icon: A string to an icon in the resources or on disk.
A string to an icon in the resources or on disk.
""" """
self.icon = icon self.icon = icon
self.iconic_representation = build_icon(icon) self.iconic_representation = build_icon(icon)
def render(self, provides_own_theme_data=False): def render(self, provides_own_theme_data=False):
""" """
The render method is what generates the frames for the screen and The render method is what generates the frames for the screen and obtains the display information from the
obtains the display information from the renderer. At this point all renderer. At this point all slides are built for the given display size.
slides are built for the given display size.
``provides_own_theme_data`` :param provides_own_theme_data: This switch disables the usage of the item's theme. However, this is
This switch disables the usage of the item's theme. However, this is
disabled by default. If this is used, it has to be taken care, that disabled by default. If this is used, it has to be taken care, that
the renderer knows the correct theme data. However, this is needed the renderer knows the correct theme data. However, this is needed
for the theme manager. for the theme manager.
@ -276,11 +268,9 @@ class ServiceItem(RegistryProperties):
""" """
Add an image slide to the service item. Add an image slide to the service item.
``path`` :param path: The directory in which the image file is located.
The directory in which the image file is located. :param title: A title for the slide in the service item.
:param background:
``title``
A title for the slide in the service item.
""" """
if background: if background:
self.image_border = background self.image_border = background
@ -293,8 +283,8 @@ class ServiceItem(RegistryProperties):
""" """
Add a text slide to the service item. Add a text slide to the service item.
``raw_slide`` :param raw_slide: The raw text of the slide.
The raw text of the slide. :param verse_tag:
""" """
if verse_tag: if verse_tag:
verse_tag = verse_tag.upper() verse_tag = verse_tag.upper()
@ -307,14 +297,9 @@ class ServiceItem(RegistryProperties):
""" """
Add a slide from a command. Add a slide from a command.
``path`` :param path: The title of the slide in the service item.
The title of the slide in the service item. :param file_name: The title of the slide in the service item.
:param image: The command of/for the slide.
``file_name``
The title of the slide in the service item.
``image``
The command of/for the slide.
""" """
self.service_item_type = ServiceItemType.Command self.service_item_type = ServiceItemType.Command
self._raw_frames.append({'title': file_name, 'image': image, 'path': path}) self._raw_frames.append({'title': file_name, 'image': image, 'path': path})
@ -322,8 +307,7 @@ class ServiceItem(RegistryProperties):
def get_service_repr(self, lite_save): def get_service_repr(self, lite_save):
""" """
This method returns some text which can be saved into the service This method returns some text which can be saved into the service file to represent this item.
file to represent this item.
""" """
service_header = { service_header = {
'name': self.name, 'name': self.name,
@ -365,21 +349,17 @@ class ServiceItem(RegistryProperties):
service_data.append({'title': slide['title'], 'image': slide['image'], 'path': slide['path']}) service_data.append({'title': slide['title'], 'image': slide['image'], 'path': slide['path']})
return {'header': service_header, 'data': service_data} return {'header': service_header, 'data': service_data}
def set_from_service(self, serviceitem, path=None): def set_from_service(self, service_item, path=None):
""" """
This method takes a service item from a saved service file (passed This method takes a service item from a saved service file (passed from the ServiceManager) and extracts the
from the ServiceManager) and extracts the data actually required. data actually required.
``serviceitem`` :param service_item: The item to extract data from.
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.
``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..
""" """
log.debug('set_from_service called with path %s' % path) log.debug('set_from_service called with path %s' % path)
header = serviceitem['serviceitem']['header'] header = service_item['serviceitem']['header']
self.title = header['title'] self.title = header['title']
self.name = header['name'] self.name = header['name']
self.service_item_type = header['type'] self.service_item_type = header['type']
@ -415,21 +395,21 @@ class ServiceItem(RegistryProperties):
self.background_audio.append(os.path.join(path, filename)) self.background_audio.append(os.path.join(path, filename))
self.theme_overwritten = header.get('theme_overwritten', False) self.theme_overwritten = header.get('theme_overwritten', False)
if self.service_item_type == ServiceItemType.Text: if self.service_item_type == ServiceItemType.Text:
for slide in serviceitem['serviceitem']['data']: for slide in service_item['serviceitem']['data']:
self._raw_frames.append(slide) self._raw_frames.append(slide)
elif self.service_item_type == ServiceItemType.Image: elif self.service_item_type == ServiceItemType.Image:
settings_section = serviceitem['serviceitem']['header']['name'] settings_section = service_item['serviceitem']['header']['name']
background = QtGui.QColor(Settings().value(settings_section + '/background color')) background = QtGui.QColor(Settings().value(settings_section + '/background color'))
if path: if path:
self.has_original_files = False self.has_original_files = False
for text_image in serviceitem['serviceitem']['data']: for text_image in service_item['serviceitem']['data']:
filename = os.path.join(path, text_image) filename = os.path.join(path, text_image)
self.add_from_image(filename, text_image, background) self.add_from_image(filename, text_image, background)
else: else:
for text_image in serviceitem['serviceitem']['data']: for text_image in service_item['serviceitem']['data']:
self.add_from_image(text_image['path'], text_image['title'], background) self.add_from_image(text_image['path'], text_image['title'], background)
elif self.service_item_type == ServiceItemType.Command: elif self.service_item_type == ServiceItemType.Command:
for text_image in serviceitem['serviceitem']['data']: for text_image in service_item['serviceitem']['data']:
if not self.title: if not self.title:
self.title = text_image['title'] self.title = text_image['title']
if path: if path:
@ -454,11 +434,9 @@ class ServiceItem(RegistryProperties):
def merge(self, other): def merge(self, other):
""" """
Updates the unique_identifier with the value from the original one Updates the unique_identifier with the value from the original one
The unique_identifier is unique for a given service item but this allows one to The unique_identifier is unique for a given service item but this allows one to replace an original version.
replace an original version.
``other`` :param other: The service item to be merged with
The service item to be merged with
""" """
self.unique_identifier = other.unique_identifier self.unique_identifier = other.unique_identifier
self.notes = other.notes self.notes = other.notes
@ -525,8 +503,7 @@ class ServiceItem(RegistryProperties):
""" """
Stores the media length of the item Stores the media length of the item
``length`` :param length: The length of the media item
The length of the media item
""" """
self.media_length = length self.media_length = length
if length > 0: if length > 0:
@ -544,8 +521,8 @@ class ServiceItem(RegistryProperties):
def get_rendered_frame(self, row): def get_rendered_frame(self, row):
""" """
Returns the correct frame for a given list and renders it if required. Returns the correct frame for a given list and renders it if required.
``row``
The service item slide to be returned :param row: The service item slide to be returned
""" """
if self.service_item_type == ServiceItemType.Text: if self.service_item_type == ServiceItemType.Text:
return self._display_frames[row]['html'].split('\n')[0] return self._display_frames[row]['html'].split('\n')[0]
@ -610,8 +587,7 @@ class ServiceItem(RegistryProperties):
""" """
updates the theme in the service item updates the theme in the service item
``theme`` :param theme: The new theme to be replaced in the service item
The new theme to be replaced in the service item
""" """
self.theme_overwritten = (theme is None) self.theme_overwritten = (theme is None)
self.theme = theme self.theme = theme

View File

@ -46,11 +46,10 @@ class SettingsTab(QtGui.QWidget, RegistryProperties):
""" """
Constructor to create the Settings tab item. Constructor to create the Settings tab item.
``title`` :param parent:
The title of the tab, which is used internally for the tab handling. :param title: The title of the tab, which is used internally for the tab handling.
:param visible_title: The title of the tab, which is usually displayed on the tab.
``visible_title`` :param icon_path:
The title of the tab, which is usually displayed on the tab.
""" """
super(SettingsTab, self).__init__(parent) super(SettingsTab, self).__init__(parent)
self.tab_title = title self.tab_title = title
@ -129,9 +128,7 @@ class SettingsTab(QtGui.QWidget, RegistryProperties):
""" """
Changes which need to be made after setup of application Changes which need to be made after setup of application
``postUpdate`` :param post_update: Indicates if called before or after updates.
Indicates if called before or after updates.
""" """
pass pass

View File

@ -128,8 +128,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
""" """
Changes the language for this spelltextedit. Changes the language for this spelltextedit.
``action`` :param action: The action.
The action.
""" """
self.dictionary = enchant.Dict(action.text()) self.dictionary = enchant.Dict(action.text())
self.highlighter.spelling_dictionary = self.dictionary self.highlighter.spelling_dictionary = self.dictionary
@ -182,7 +181,7 @@ class Highlighter(QtGui.QSyntaxHighlighter):
def highlightBlock(self, text): def highlightBlock(self, text):
""" """
Highlight misspelt words in a block of text. Highlight mis spelt words in a block of text.
Note, this is a Qt hook. Note, this is a Qt hook.
""" """

View File

@ -172,11 +172,8 @@ class ThemeXML(object):
""" """
Expand the json objects and make into variables. Expand the json objects and make into variables.
``var`` :param var: The array list to be processed.
The array list to be processed. :param prev: The preceding string to add to the key to make the variable.
``prev``
The preceding string to add to the key to make the variable.
""" """
for key, value in var.items(): for key, value in var.items():
if prev: if prev:
@ -192,8 +189,7 @@ class ThemeXML(object):
""" """
Add the path name to the image name so the background can be rendered. Add the path name to the image name so the background can be rendered.
``path`` :param path: The path name to be added.
The path name to be added.
""" """
if self.background_type == 'image': if self.background_type == 'image':
if self.background_filename and path: if self.background_filename and path:
@ -226,8 +222,7 @@ class ThemeXML(object):
""" """
Add a Solid background. Add a Solid background.
``bkcolor`` :param bkcolor: The color of the background.
The color of the background.
""" """
background = self.theme_xml.createElement('background') background = self.theme_xml.createElement('background')
background.setAttribute('type', 'solid') background.setAttribute('type', 'solid')
@ -238,14 +233,9 @@ class ThemeXML(object):
""" """
Add a gradient background. Add a gradient background.
``startcolor`` :param startcolor: The gradient's starting colour.
The gradient's starting colour. :param endcolor: The gradient's ending colour.
:param direction: The direction of the gradient.
``endcolor``
The gradient's ending colour.
``direction``
The direction of the gradient.
""" """
background = self.theme_xml.createElement('background') background = self.theme_xml.createElement('background')
background.setAttribute('type', 'gradient') background.setAttribute('type', 'gradient')
@ -261,8 +251,8 @@ class ThemeXML(object):
""" """
Add a image background. Add a image background.
``filename`` :param filename: The file name of the image.
The file name of the image. :param border_color:
""" """
background = self.theme_xml.createElement('background') background = self.theme_xml.createElement('background')
background.setAttribute('type', 'image') background.setAttribute('type', 'image')
@ -278,57 +268,24 @@ class ThemeXML(object):
""" """
Add a Font. Add a Font.
``name`` :param name: The name of the font.
The name of the font. :param color: The colour of the font.
:param size: The size of the font.
``color`` :param override: Whether or not to override the default positioning of the theme.
The colour of the font. :param fonttype: The type of font, ``main`` or ``footer``. Defaults to ``main``.
:param bold:
``size`` :param italics: The weight of then font Defaults to 50 Normal
The size of the font. :param line_adjustment: Does the font render to italics Defaults to 0 Normal
:param xpos: The X position of the text block.
``override`` :param ypos: The Y position of the text block.
Whether or not to override the default positioning of the theme. :param width: The width of the text block.
:param height: The height of the text block.
``fonttype`` :param outline: Whether or not to show an outline.
The type of font, ``main`` or ``footer``. Defaults to ``main``. :param outline_color: The colour of the outline.
:param outline_pixel: How big the Shadow is
``weight`` :param shadow: Whether or not to show a shadow.
The weight of then font Defaults to 50 Normal :param shadow_color: The colour of the shadow.
:param shadow_pixel: How big the Shadow is
``italics``
Does the font render to italics Defaults to 0 Normal
``xpos``
The X position of the text block.
``ypos``
The Y position of the text block.
``width``
The width of the text block.
``height``
The height of the text block.
``outline``
Whether or not to show an outline.
``outline_color``
The colour of the outline.
``outline_size``
How big the Shadow is
``shadow``
Whether or not to show a shadow.
``shadow_color``
The colour of the shadow.
``shadow_size``
How big the Shadow is
""" """
background = self.theme_xml.createElement('font') background = self.theme_xml.createElement('font')
background.setAttribute('type', fonttype) background.setAttribute('type', fonttype)
@ -372,15 +329,9 @@ class ThemeXML(object):
""" """
Add a Display options. Add a Display options.
``horizontal`` :param horizontal: The horizontal alignment of the text.
The horizontal alignment of the text. :param vertical: The vertical alignment of the text.
:param transition: Whether the slide transition is active.
``vertical``
The vertical alignment of the text.
``transition``
Whether the slide transition is active.
""" """
background = self.theme_xml.createElement('display') background = self.theme_xml.createElement('display')
self.theme.appendChild(background) self.theme.appendChild(background)
@ -446,8 +397,7 @@ class ThemeXML(object):
""" """
Read in an XML string and parse it. Read in an XML string and parse it.
``xml`` :param xml: The XML string to parse.
The XML string to parse.
""" """
self.parse_xml(str(xml)) self.parse_xml(str(xml))
@ -455,8 +405,7 @@ class ThemeXML(object):
""" """
Parse an XML string. Parse an XML string.
``xml`` :param xml: The XML string to parse.
The XML string to parse.
""" """
# remove encoding string # remove encoding string
line = xml.find('?>') line = xml.find('?>')

View File

@ -74,11 +74,8 @@ class OpenLPToolbar(QtGui.QToolBar):
""" """
Set the visibility for a widget or a list of widgets. Set the visibility for a widget or a list of widgets.
``widget`` :param widgets: A list of string with widget object names.
A list of string with widget object names. :param visible: The new state as bool.
``visible``
The new state as bool.
""" """
for handle in widgets: for handle in widgets:
if handle in self.actions: if handle in self.actions:

View File

@ -66,8 +66,7 @@ class TreeWidgetWithDnD(QtGui.QTreeWidget):
Drag and drop event does not care what data is selected as the recipient will use events to request the data Drag and drop event does not care what data is selected as the recipient will use events to request the data
move just tell it what plugin to call move just tell it what plugin to call
``event`` :param event: The event that occurred
The event that occurred
""" """
if event.buttons() != QtCore.Qt.LeftButton: if event.buttons() != QtCore.Qt.LeftButton:
event.ignore() event.ignore()
@ -85,8 +84,7 @@ class TreeWidgetWithDnD(QtGui.QTreeWidget):
""" """
Receive drag enter event, check if it is a file or internal object and allow it if it is. Receive drag enter event, check if it is a file or internal object and allow it if it is.
``event`` :param event: The event that occurred
The event that occurred
""" """
if event.mimeData().hasUrls(): if event.mimeData().hasUrls():
event.accept() event.accept()
@ -99,8 +97,7 @@ class TreeWidgetWithDnD(QtGui.QTreeWidget):
""" """
Receive drag move event, check if it is a file or internal object and allow it if it is. Receive drag move event, check if it is a file or internal object and allow it if it is.
``event`` :param event: The event that occurred
The event that occurred
""" """
QtGui.QTreeWidget.dragMoveEvent(self, event) QtGui.QTreeWidget.dragMoveEvent(self, event)
if event.mimeData().hasUrls(): if event.mimeData().hasUrls():
@ -116,8 +113,7 @@ class TreeWidgetWithDnD(QtGui.QTreeWidget):
""" """
Receive drop event, check if it is a file or internal object and process it if it is. Receive drop event, check if it is a file or internal object and process it if it is.
``event`` :param event: Handle of the event pint passed
Handle of the event pint passed
""" """
if event.mimeData().hasUrls(): if event.mimeData().hasUrls():
event.setDropAction(QtCore.Qt.CopyAction) event.setDropAction(QtCore.Qt.CopyAction)

View File

@ -45,11 +45,8 @@ def add_welcome_page(parent, image):
""" """
Generate an opening welcome page for a wizard using a provided image. Generate an opening welcome page for a wizard using a provided image.
``parent`` :param parent: A ``QWizard`` object to add the welcome page to.
A ``QWizard`` object to add the welcome page to. :param image: A splash image for the wizard.
``image``
A splash image for the wizard.
""" """
parent.welcome_page = QtGui.QWizardPage() parent.welcome_page = QtGui.QWizardPage()
parent.welcome_page.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(image)) parent.welcome_page.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(image))
@ -73,19 +70,12 @@ def create_button_box(dialog, name, standard_buttons, custom_buttons=None):
Creates a QDialogButtonBox with the given buttons. The ``accepted()`` and ``rejected()`` signals of the button box Creates a QDialogButtonBox with the given buttons. The ``accepted()`` and ``rejected()`` signals of the button box
are connected with the dialogs ``accept()`` and ``reject()`` slots. are connected with the dialogs ``accept()`` and ``reject()`` slots.
``dialog`` :param dialog: The parent object. This has to be a ``QDialog`` descendant.
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``,
``name`` ``close``, and ``defaults``.
A string which is set as object name. :param custom_buttons: A list of additional buttons. If a item is a instance of QtGui.QAbstractButton it is added
with QDialogButtonBox.ActionRole. Other wise the item has to be a tuple of a button and a ButtonRole.
``standard_buttons``
A list of strings for the used buttons. It might contain: ``ok``, ``save``, ``cancel``, ``close``, and
``defaults``.
``custom_buttons``
A list of additional buttons. If a item is a instance of QtGui.QAbstractButton it is added with
QDialogButtonBox.ActionRole. Otherwhise the item has to be a tuple of a button and a ButtonRole.
""" """
if custom_buttons is None: if custom_buttons is None:
custom_buttons = [] custom_buttons = []
@ -117,17 +107,10 @@ def critical_error_message_box(title=None, message=None, parent=None, question=F
""" """
Provides a standard critical message box for errors that OpenLP displays to users. Provides a standard critical message box for errors that OpenLP displays to users.
``title`` :param title: The title for the message box.
The title for the message box. :param message: The message to display to the user.
:param parent: The parent UI element to attach the dialog to.
``message`` :param question: Should this message box question the user.
The message to display to the user.
``parent``
The parent UI element to attach the dialog to.
``question``
Should this message box question the user.
""" """
if question: if question:
return QtGui.QMessageBox.critical(parent, UiStrings().Error, message, return QtGui.QMessageBox.critical(parent, UiStrings().Error, message,
@ -140,11 +123,8 @@ def create_horizontal_adjusting_combo_box(parent, name):
""" """
Creates a QComboBox with adapting width for media items. Creates a QComboBox with adapting width for media items.
``parent`` :param parent: The parent widget.
The parent widget. :param name: A string set as object name for the combo box.
``name``
A string set as object name for the combo box.
""" """
combo = QtGui.QComboBox(parent) combo = QtGui.QComboBox(parent)
combo.setObjectName(name) combo.setObjectName(name)
@ -157,11 +137,9 @@ def create_button(parent, name, **kwargs):
""" """
Return an button with the object name set and the given parameters. Return an button with the object name set and the given parameters.
``parent`` :param parent: A QtCore.QWidget for the buttons parent (required).
A QtCore.QWidget for the buttons parent (required). :param name: A string which is set as object name (required).
:param kwargs:
``name``
A string which is set as object name (required).
``role`` ``role``
A string which can have one value out of ``delete``, ``up``, and ``down``. This decides about default values A string which can have one value out of ``delete``, ``up``, and ``down``. This decides about default values
@ -178,6 +156,7 @@ def create_button(parent, name, **kwargs):
``enabled`` ``enabled``
False in case the button should be disabled. False in case the button should be disabled.
""" """
if 'role' in kwargs: if 'role' in kwargs:
role = kwargs.pop('role') role = kwargs.pop('role')
@ -217,11 +196,9 @@ def create_action(parent, name, **kwargs):
""" """
Return an action with the object name set and the given parameters. Return an action with the object name set and the given parameters.
``parent`` :param parent: A QtCore.QObject for the actions parent (required).
A QtCore.QObject for the actions parent (required). :param name: A string which is set as object name (required).
:param kwargs:
``name``
A string which is set as object name (required).
``text`` ``text``
A string for the action text. A string for the action text.
@ -253,6 +230,7 @@ def create_action(parent, name, **kwargs):
``can_shortcuts`` ``can_shortcuts``
Capability stating if this action can have shortcuts. If ``True`` the action is added to shortcut dialog Capability stating if this action can have shortcuts. If ``True`` the action is added to shortcut dialog
otherwise it it not. Define your shortcut in the :class:`~openlp.core.lib.Settings` class. *Note*: When *not* otherwise it it not. Define your shortcut in the :class:`~openlp.core.lib.Settings` class. *Note*: When *not*
``True`` you *must not* set a shortcuts at all. ``True`` you *must not* set a shortcuts at all.
@ -314,11 +292,8 @@ def set_case_insensitive_completer(cache, widget):
""" """
Sets a case insensitive text completer for a widget. Sets a case insensitive text completer for a widget.
``cache`` :param cache: The list of items to use as suggestions.
The list of items to use as suggestions. :param widget: A widget to set the completer (QComboBox or QTextEdit instance)
``widget``
A widget to set the completer (QComboBox or QTextEdit instance)
""" """
completer = QtGui.QCompleter(cache) completer = QtGui.QCompleter(cache)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
@ -329,10 +304,7 @@ def create_valign_selection_widgets(parent):
""" """
Creates a standard label and combo box for asking users to select a vertical alignment. Creates a standard label and combo box for asking users to select a vertical alignment.
``parent`` :param parent: The parent object. This should be a ``QWidget`` descendant.
The parent object. This should be a ``QWidget`` descendant.
Returns a tuple of QLabel and QComboBox.
""" """
label = QtGui.QLabel(parent) label = QtGui.QLabel(parent)
label.setText(translate('OpenLP.Ui', '&Vertical Align:')) label.setText(translate('OpenLP.Ui', '&Vertical Align:'))

View File

@ -641,8 +641,7 @@ class AdvancedTab(SettingsTab):
""" """
Notify user about required restart. Notify user about required restart.
``checked`` :param checked: The state of the check box (boolean).
The state of the check box (boolean).
""" """
QtGui.QMessageBox.information(self, translate('OpenLP.AdvancedTab', 'Restart Required'), QtGui.QMessageBox.information(self, translate('OpenLP.AdvancedTab', 'Restart Required'),
translate('OpenLP.AdvancedTab', 'This change will only take effect once OpenLP ' translate('OpenLP.AdvancedTab', 'This change will only take effect once OpenLP '

View File

@ -284,8 +284,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
def _build_theme_screenshots(self): def _build_theme_screenshots(self):
""" """
This method builds the theme screenshots' icons for all items in the This method builds the theme screenshots' icons for all items in the ``self.themes_list_widget``.
``self.themes_list_widget``.
""" """
themes = self.config.get('themes', 'files') themes = self.config.get('themes', 'files')
themes = themes.split(',') themes = themes.split(',')
@ -298,12 +297,11 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
break break
item.setIcon(build_icon(os.path.join(gettempdir(), 'openlp', screenshot))) item.setIcon(build_icon(os.path.join(gettempdir(), 'openlp', screenshot)))
def _getFileSize(self, url): def _get_file_size(self, url):
""" """
Get the size of a file. Get the size of a file.
``url`` :param url: The URL of the file we want to download.
The URL of the file we want to download.
""" """
site = urllib.request.urlopen(url) site = urllib.request.urlopen(url)
meta = site.info() meta = site.info()
@ -321,11 +319,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
""" """
Update the wizard progress page. Update the wizard progress page.
``status_text`` :param status_text: Current status information to display.
Current status information to display. :param increment: The value to increment the progress bar by.
``increment``
The value to increment the progress bar by.
""" """
if status_text: if status_text:
self.progress_label.setText(status_text) self.progress_label.setText(status_text)
@ -346,7 +341,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
item = self.songs_list_widget.item(i) item = self.songs_list_widget.item(i)
if item.checkState() == QtCore.Qt.Checked: if item.checkState() == QtCore.Qt.Checked:
filename = item.data(QtCore.Qt.UserRole) filename = item.data(QtCore.Qt.UserRole)
size = self._getFileSize('%s%s' % (self.web, filename)) size = self._get_file_size('%s%s' % (self.web, filename))
self.max_progress += size self.max_progress += size
# Loop through the Bibles list and increase for each selected item # Loop through the Bibles list and increase for each selected item
iterator = QtGui.QTreeWidgetItemIterator(self.bibles_tree_widget) iterator = QtGui.QTreeWidgetItemIterator(self.bibles_tree_widget)
@ -355,7 +350,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
item = iterator.value() item = iterator.value()
if item.parent() and item.checkState(0) == QtCore.Qt.Checked: if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
filename = item.data(0, QtCore.Qt.UserRole) filename = item.data(0, QtCore.Qt.UserRole)
size = self._getFileSize('%s%s' % (self.web, filename)) size = self._get_file_size('%s%s' % (self.web, filename))
self.max_progress += size self.max_progress += size
iterator += 1 iterator += 1
# Loop through the themes list and increase for each selected item # Loop through the themes list and increase for each selected item
@ -364,7 +359,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
item = self.themes_list_widget.item(i) item = self.themes_list_widget.item(i)
if item.checkState() == QtCore.Qt.Checked: if item.checkState() == QtCore.Qt.Checked:
filename = item.data(QtCore.Qt.UserRole) filename = item.data(QtCore.Qt.UserRole)
size = self._getFileSize('%s%s' % (self.web, filename)) size = self._get_file_size('%s%s' % (self.web, filename))
self.max_progress += size self.max_progress += size
if self.max_progress: if self.max_progress:
# Add on 2 for plugins status setting plus a "finished" point. # Add on 2 for plugins status setting plus a "finished" point.

View File

@ -335,8 +335,7 @@ class GeneralTab(SettingsTab):
""" """
Toggle screen state depending on check box state. Toggle screen state depending on check box state.
``checked`` :param checked: The state of the check box (boolean).
The state of the check box (boolean).
""" """
self.monitor_combo_box.setDisabled(checked) self.monitor_combo_box.setDisabled(checked)
self.custom_X_value_edit.setEnabled(checked) self.custom_X_value_edit.setEnabled(checked)

View File

@ -477,8 +477,7 @@ class AudioPlayer(OpenLPMixin, QtCore.QObject):
""" """
The constructor for the display form. The constructor for the display form.
``parent`` :param parent: The parent widget.
The parent widget.
""" """
super(AudioPlayer, self).__init__(parent) super(AudioPlayer, self).__init__(parent)
self.current_index = -1 self.current_index = -1

View File

@ -697,11 +697,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
""" """
Display an error message Display an error message
``title`` :param title: The title of the warning box.
The title of the warning box. :param message: The message to be displayed.
``message``
The message to be displayed.
""" """
if hasattr(self.application, 'splash'): if hasattr(self.application, 'splash'):
self.application.splash.close() self.application.splash.close()
@ -711,11 +708,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
""" """
Display a warning message Display a warning message
``title`` :param title: The title of the warning box.
The title of the warning box. :param message: The message to be displayed.
``message``
The message to be displayed.
""" """
if hasattr(self.application, 'splash'): if hasattr(self.application, 'splash'):
self.application.splash.close() self.application.splash.close()
@ -725,11 +719,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
""" """
Display an informational message Display an informational message
``title`` :param title: The title of the warning box.
The title of the warning box. :param message: The message to be displayed.
``message``
The message to be displayed.
""" """
if hasattr(self.application, 'splash'): if hasattr(self.application, 'splash'):
self.application.splash.close() self.application.splash.close()
@ -1067,8 +1058,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
""" """
Runs all the cleanup code before OpenLP shuts down. Runs all the cleanup code before OpenLP shuts down.
``save_settings`` :param save_settings: Switch to prevent saving settings. Defaults to **True**.
Switch to prevent saving settings. Defaults to **True**.
""" """
self.image_manager.stop_manager = True self.image_manager.stop_manager = True
while self.image_manager.image_thread.isRunning(): while self.image_manager.image_thread.isRunning():
@ -1099,11 +1089,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
""" """
This method is called from the ServiceManager to set the title of the main window. This method is called from the ServiceManager to set the title of the main window.
``modified`` :param modified: Whether or not this service has been modified.
Whether or not this service has been modified. :param file_name: The file name of the service file.
``file_name``
The file name of the service file.
""" """
if modified: if modified:
title = '%s - %s*' % (UiStrings().OLPV2x, file_name) title = '%s - %s*' % (UiStrings().OLPV2x, file_name)
@ -1146,10 +1133,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
""" """
Sets the visibility of the preview panel including saving the setting and updating the menu. Sets the visibility of the preview panel including saving the setting and updating the menu.
``visible`` :param visible: A bool giving the state to set the panel to
A bool giving the state to set the panel to
True - Visible True - Visible
False - Hidden False - Hidden
""" """
self.preview_controller.panel.setVisible(visible) self.preview_controller.panel.setVisible(visible)
Settings().setValue('user interface/preview panel', visible) Settings().setValue('user interface/preview panel', visible)
@ -1183,8 +1170,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
""" """
Sets the visibility of the live panel including saving the setting and updating the menu. Sets the visibility of the live panel including saving the setting and updating the menu.
``visible``
A bool giving the state to set the panel to :param visible: A bool giving the state to set the panel to
True - Visible True - Visible
False - Hidden False - Hidden
""" """
@ -1266,8 +1253,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
""" """
Adds a service to the list of recently used files. Adds a service to the list of recently used files.
``filename`` :param filename: The service filename to add
The service filename to add
""" """
# The max_recent_files value does not have an interface and so never gets # The max_recent_files value does not have an interface and so never gets
# actually stored in the settings therefore the default value of 20 will # actually stored in the settings therefore the default value of 20 will

View File

@ -96,14 +96,10 @@ def get_media_players():
def set_media_players(players_list, overridden_player='auto'): def set_media_players(players_list, overridden_player='auto'):
""" """
This method saves the configured media players and overridden player to the This method saves the configured media players and overridden player to the settings
settings
``players_list`` :param players_list: A list with all active media players.
A list with all active media players. :param overridden_player: Here an special media player is chosen for all media actions.
``overridden_player``
Here an special media player is chosen for all media actions.
""" """
log.debug('set_media_players') log.debug('set_media_players')
players = ','.join(players_list) players = ','.join(players_list)

View File

@ -82,12 +82,11 @@ class MediaSlider(QtGui.QSlider):
class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties): class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
The implementation of the Media Controller. The Media Controller adds an own The implementation of the Media Controller. The Media Controller adds an own class for every Player.
class for every Player. Currently these are QtWebkit, Phonon and Vlc. Currently these are QtWebkit, Phonon and Vlc. display_controllers are an array of controllers keyed on the
slidecontroller or plugin which built them.
display_controllers are an array of controllers keyed on the ControllerType is the class containing the key values.
slidecontroller or plugin which built them. ControllerType is the class
containing the key values.
media_players are an array of media players keyed on player name. media_players are an array of media players keyed on player name.
@ -155,8 +154,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
Register each media Player (Webkit, Phonon, etc) and store Register each media Player (Webkit, Phonon, etc) and store
for later use for later use
``player`` :param player: Individual player class which has been enabled
Individual player class which has been enabled
""" """
self.media_players[player.name] = player self.media_players[player.name] = player
@ -198,8 +196,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
def media_state(self): def media_state(self):
""" """
Check if there is a running media Player and do updating stuff (e.g. Check if there is a running media Player and do updating stuff (e.g. update the UI)
update the UI)
""" """
if not list(self.current_media_players.keys()): if not list(self.current_media_players.keys()):
self.timer.stop() self.timer.stop()
@ -255,8 +252,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Registers media controls where the players will be placed to run. Registers media controls where the players will be placed to run.
``controller`` :param controller: The controller where a player will be placed
The controller where a player will be placed
""" """
self.display_controllers[controller.controller_type] = controller self.display_controllers[controller.controller_type] = controller
self.setup_generic_controls(controller) self.setup_generic_controls(controller)
@ -265,8 +261,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Set up controls on the control_panel for a given controller Set up controls on the control_panel for a given controller
``controller`` :param controller: First element is the controller which should be used
First element is the controller which should be used
""" """
controller.media_info = MediaInfo() controller.media_info = MediaInfo()
# Build a Media ToolBar # Build a Media ToolBar
@ -312,14 +307,10 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
def setup_display(self, display, preview): def setup_display(self, display, preview):
""" """
After a new display is configured, all media related widgets will be After a new display is configured, all media related widgets will be created too
created too
``display`` :param display: Display on which the output is to be played
Display on which the output is to be played :param preview: Whether the display is a main or preview display
``preview``
Whether the display is a main or preview display
""" """
# clean up possible running old media files # clean up possible running old media files
self.finalise() self.finalise()
@ -336,14 +327,10 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
def set_controls_visible(self, controller, value): def set_controls_visible(self, controller, value):
""" """
After a new display is configured, all media related widget will be After a new display is configured, all media related widget will be created too
created too
``controller`` :param controller: The controller on which controls act.
The controller on which controls act. :param value: control name to be changed.
``value``
control name to be changed.
""" """
# Generic controls # Generic controls
controller.mediabar.setVisible(value) controller.mediabar.setVisible(value)
@ -354,14 +341,10 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
def resize(self, display, player): def resize(self, display, player):
""" """
After Mainwindow changes or Splitter moved all related media widgets After Mainwindow changes or Splitter moved all related media widgets have to be resized
have to be resized
``display`` :param display: The display on which output is playing.
The display on which output is playing. :param player: The player which is doing the playing.
``player``
The player which is doing the playing.
""" """
player.resize(display) player.resize(display)
@ -369,17 +352,10 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Loads and starts a video to run with the option of sound Loads and starts a video to run with the option of sound
``source`` :param source: Where the call originated form
Where the call originated form :param service_item: The player which is doing the playing
:param hidden: The player which is doing the playing
``service_item`` :param video_behind_text: Is the video to be played behind text.
The player which is doing the playing
``hidden``
The player which is doing the playing
``video_behind_text``
Is the video to be played behind text.
""" """
log.debug('video') log.debug('video')
is_valid = False is_valid = False
@ -436,8 +412,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Loads and starts a media item to obtain the media length Loads and starts a media item to obtain the media length
``service_item`` :param service_item: The ServiceItem containing the details to be played.
The ServiceItem containing the details to be played.
""" """
controller = self.display_controllers[DisplayControllerType.Plugin] controller = self.display_controllers[DisplayControllerType.Plugin]
log.debug('media_length') log.debug('media_length')
@ -465,11 +440,9 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Select the correct media Player type from the prioritized Player list Select the correct media Player type from the prioritized Player list
``controller`` :param controller: First element is the controller which should be used
First element is the controller which should be used :param display: Which display to use
:param service_item: The ServiceItem containing the details to be played.
``service_item``
The ServiceItem containing the details to be played.
""" """
used_players = get_media_players()[0] used_players = get_media_players()[0]
if service_item.processor != UiStrings().Automatic: if service_item.processor != UiStrings().Automatic:
@ -507,8 +480,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Responds to the request to play a loaded video Responds to the request to play a loaded video
``msg`` :param msg: First element is the controller which should be used
First element is the controller which should be used :param status:
""" """
log.debug('media_play_msg') log.debug('media_play_msg')
self.media_play(msg[0], status) self.media_play(msg[0], status)
@ -517,8 +490,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Responds to the request to play a loaded video Responds to the request to play a loaded video
``controller`` :param controller: The controller to be played
The controller to be played :param status:
""" """
log.debug('media_play') log.debug('media_play')
controller.seek_slider.blockSignals(True) controller.seek_slider.blockSignals(True)
@ -557,8 +530,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Responds to the request to pause a loaded video Responds to the request to pause a loaded video
``msg`` :param msg: First element is the controller which should be used
First element is the controller which should be used
""" """
log.debug('media_pause_msg') log.debug('media_pause_msg')
self.media_pause(msg[0]) self.media_pause(msg[0])
@ -567,8 +539,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Responds to the request to pause a loaded video Responds to the request to pause a loaded video
``controller`` :param controller: The Controller to be paused
The Controller to be paused
""" """
log.debug('media_pause') log.debug('media_pause')
display = self._define_display(controller) display = self._define_display(controller)
@ -581,8 +552,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Responds to the request to stop a loaded video Responds to the request to stop a loaded video
``msg`` :param msg: First element is the controller which should be used
First element is the controller which should be used
""" """
log.debug('media_stop_msg') log.debug('media_stop_msg')
self.media_stop(msg[0]) self.media_stop(msg[0])
@ -591,8 +561,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Responds to the request to stop a loaded video Responds to the request to stop a loaded video
``controller`` :param controller: The controller that needs to be stopped
The controller that needs to be stopped
""" """
log.debug('media_stop') log.debug('media_stop')
display = self._define_display(controller) display = self._define_display(controller)
@ -609,8 +578,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Changes the volume of a running video Changes the volume of a running video
``msg`` :param msg: First element is the controller which should be used
First element is the controller which should be used
""" """
controller = msg[0] controller = msg[0]
vol = msg[1][0] vol = msg[1][0]
@ -620,8 +588,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Changes the volume of a running video Changes the volume of a running video
``msg`` :param controller: The Controller to use
First element is the controller which should be used :param volume: The volume to be set
""" """
log.debug('media_volume %d' % volume) log.debug('media_volume %d' % volume)
display = self._define_display(controller) display = self._define_display(controller)
@ -632,8 +600,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Responds to the request to change the seek Slider of a loaded video via a message Responds to the request to change the seek Slider of a loaded video via a message
``msg`` :param msg: First element is the controller which should be used
First element is the controller which should be used
Second element is a list with the seek value as first element Second element is a list with the seek value as first element
""" """
log.debug('media_seek') log.debug('media_seek')
@ -645,12 +612,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Responds to the request to change the seek Slider of a loaded video Responds to the request to change the seek Slider of a loaded video
``controller`` :param controller: The controller to use.
The controller to use. :param seek_value: The value to set.
``seek_value``
The value to set.
""" """
log.debug('media_seek') log.debug('media_seek')
display = self._define_display(controller) display = self._define_display(controller)
@ -674,8 +637,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Hide the related video Widget Hide the related video Widget
``msg`` :param msg: First element is the boolean for Live indication
First element is the boolean for Live indication
""" """
is_live = msg[1] is_live = msg[1]
if not is_live: if not is_live:
@ -690,8 +652,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Blank the related video Widget Blank the related video Widget
``msg`` :param msg: First element is the boolean for Live indication
First element is the boolean for Live indication
Second element is the hide mode Second element is the hide mode
""" """
is_live = msg[1] is_live = msg[1]
@ -708,8 +669,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Unblank the related video Widget Unblank the related video Widget
``msg`` :param msg: First element is not relevant in this context
First element is not relevant in this context
Second element is the boolean for Live indication Second element is the boolean for Live indication
""" """
Registry().execute('live_display_show') Registry().execute('live_display_show')
@ -737,8 +697,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
Extract the correct display for a given controller Extract the correct display for a given controller
``controller`` :param controller: Controller to be used
Controller to be used
""" """
if controller.is_live: if controller.is_live:
return controller.display return controller.display

View File

@ -66,10 +66,8 @@ ADDITIONAL_EXT = {
class PhononPlayer(MediaPlayer): class PhononPlayer(MediaPlayer):
""" """
A specialised version of the MediaPlayer class, which provides a Phonon A specialised version of the MediaPlayer class, which provides a Phonon display.
display.
""" """
def __init__(self, parent): def __init__(self, parent):
""" """
Constructor Constructor
@ -83,11 +81,11 @@ class PhononPlayer(MediaPlayer):
for mime_type in Phonon.BackendCapabilities.availableMimeTypes(): for mime_type in Phonon.BackendCapabilities.availableMimeTypes():
mime_type = str(mime_type) mime_type = str(mime_type)
if mime_type.startswith('audio/'): if mime_type.startswith('audio/'):
self._addToList(self.audio_extensions_list, mime_type) self._add_to_list(self.audio_extensions_list, mime_type)
elif mime_type.startswith('video/'): elif mime_type.startswith('video/'):
self._addToList(self.video_extensions_list, mime_type) self._add_to_list(self.video_extensions_list, mime_type)
def _addToList(self, mimetype_list, mimetype): def _add_to_list(self, mime_type_list, mimetype):
""" """
Add mimetypes to the provided list Add mimetypes to the provided list
""" """
@ -95,8 +93,8 @@ class PhononPlayer(MediaPlayer):
extensions = mimetypes.guess_all_extensions(str(mimetype)) extensions = mimetypes.guess_all_extensions(str(mimetype))
for extension in extensions: for extension in extensions:
ext = '*%s' % extension ext = '*%s' % extension
if ext not in mimetype_list: if ext not in mime_type_list:
mimetype_list.append(ext) mime_type_list.append(ext)
log.info('MediaPlugin: %s extensions: %s' % (mimetype, ' '.join(extensions))) log.info('MediaPlugin: %s extensions: %s' % (mimetype, ' '.join(extensions)))
# Add extensions for this mimetype from self.additional_extensions. # Add extensions for this mimetype from self.additional_extensions.
# This hack clears mimetypes' and operating system's shortcomings # This hack clears mimetypes' and operating system's shortcomings
@ -104,8 +102,8 @@ class PhononPlayer(MediaPlayer):
if mimetype in list(self.additional_extensions.keys()): if mimetype in list(self.additional_extensions.keys()):
for extension in self.additional_extensions[mimetype]: for extension in self.additional_extensions[mimetype]:
ext = '*%s' % extension ext = '*%s' % extension
if ext not in mimetype_list: if ext not in mime_type_list:
mimetype_list.append(ext) mime_type_list.append(ext)
log.info('MediaPlugin: %s additional extensions: %s' % log.info('MediaPlugin: %s additional extensions: %s' %
(mimetype, ' '.join(self.additional_extensions[mimetype]))) (mimetype, ' '.join(self.additional_extensions[mimetype])))

View File

@ -99,11 +99,11 @@ class PlayerTab(SettingsTab):
self.player_order_layout = QtGui.QHBoxLayout(self.player_order_group_box) self.player_order_layout = QtGui.QHBoxLayout(self.player_order_group_box)
self.player_order_layout.setObjectName('player_order_layout') self.player_order_layout.setObjectName('player_order_layout')
self.player_order_list_widget = QtGui.QListWidget(self.player_order_group_box) self.player_order_list_widget = QtGui.QListWidget(self.player_order_group_box)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) size_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0) size_policy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) size_policy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.player_order_list_widget.sizePolicy().hasHeightForWidth()) size_policy.setHeightForWidth(self.player_order_list_widget.sizePolicy().hasHeightForWidth())
self.player_order_list_widget.setSizePolicy(sizePolicy) self.player_order_list_widget.setSizePolicy(size_policy)
self.player_order_list_widget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.player_order_list_widget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.player_order_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.player_order_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.player_order_list_widget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.player_order_list_widget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)

View File

@ -50,11 +50,9 @@ class MediaDockManager(object):
""" """
Add a MediaManagerItem to the dock Add a MediaManagerItem to the dock
``media_item`` :param media_item: The item to add to the dock
The item to add to the dock :param icon: An icon for this dock item
:param weight:
``icon``
An icon for this dock item
""" """
visible_title = media_item.plugin.get_string(StringContent.VisibleName) visible_title = media_item.plugin.get_string(StringContent.VisibleName)
log.info('Adding %s dock' % visible_title) log.info('Adding %s dock' % visible_title)
@ -80,8 +78,7 @@ class MediaDockManager(object):
""" """
Removes a MediaManagerItem from the dock Removes a MediaManagerItem from the dock
``media_item`` :param media_item: The item to add to the dock
The item to add to the dock
""" """
visible_title = media_item.plugin.get_string(StringContent.VisibleName) visible_title = media_item.plugin.get_string(StringContent.VisibleName)
log.debug('remove %s dock' % visible_title['title']) log.debug('remove %s dock' % visible_title['title'])

View File

@ -239,23 +239,14 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog, RegistryProperties)
def _add_element(self, tag, text=None, parent=None, classId=None, attribute=None): def _add_element(self, tag, text=None, parent=None, classId=None, attribute=None):
""" """
Creates a html element. If ``text`` is given, the element's text will Creates a html element. If ``text`` is given, the element's text will set and if a ``parent`` is given,
set and if a ``parent`` is given, the element is appended. the element is appended.
``tag`` :param tag: The html tag, e. g. ``u'span'``. Defaults to ``None``.
The html tag, e. g. ``u'span'``. Defaults to ``None``. :param text: The text for the tag. Defaults to ``None``.
:param parent: The parent element. Defaults to ``None``.
``text`` :param classId: Value for the class attribute
The text for the tag. Defaults to ``None``. :param attribute: Tuple name/value pair to add as an optional attribute
``parent``
The parent element. Defaults to ``None``.
``classId``
Value for the class attribute
``attribute``
Tuple name/value pair to add as an optional attribute
""" """
if text is not None: if text is not None:
element = lxml.html.fragment_fromstring(str(text), create_parent=tag) element = lxml.html.fragment_fromstring(str(text), create_parent=tag)

View File

@ -131,8 +131,7 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog, RegistryPrope
""" """
Called when the currentRow has changed. Called when the currentRow has changed.
``row`` :param row: The row number (int).
The row number (int).
""" """
# Disable all buttons, as no row is selected or only one image is left. # Disable all buttons, as no row is selected or only one image is left.
if row == -1 or self.list_widget.count() == 1: if row == -1 or self.list_widget.count() == 1:

View File

@ -148,8 +148,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
""" """
Register for updates to be done on save removing duplicate functions Register for updates to be done on save removing duplicate functions
``function`` :param function: The function to be called
The function to be called
""" """
if not function in self.processes: if not function in self.processes:
self.processes.append(function) self.processes.append(function)

View File

@ -397,11 +397,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog, RegistryProperties)
Checks if the given ``changing_action `` can use the given ``key_sequence``. Returns ``True`` if the Checks if the given ``changing_action `` can use the given ``key_sequence``. Returns ``True`` if the
``key_sequence`` can be used by the action, otherwise displays a dialog and returns ``False``. ``key_sequence`` can be used by the action, otherwise displays a dialog and returns ``False``.
``changing_action`` :param changing_action: The action which wants to use the ``key_sequence``.
The action which wants to use the ``key_sequence``. :param key_sequence: The key sequence which the action want so use.
``key_sequence``
The key sequence which the action want so use.
""" """
is_valid = True is_valid = True
for category in self.action_list.categories: for category in self.action_list.categories:

View File

@ -55,8 +55,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
""" """
Instantiate the wizard, and run any extra setup we need to. Instantiate the wizard, and run any extra setup we need to.
``parent`` :param parent: The QWidget-derived parent of the wizard.
The QWidget-derived parent of the wizard.
""" """
super(ThemeForm, self).__init__(parent) super(ThemeForm, self).__init__(parent)
self.setupUi(self) self.setupUi(self)

View File

@ -186,8 +186,7 @@ class ThemesTab(SettingsTab):
""" """
Called from ThemeManager when the Themes have changed. Called from ThemeManager when the Themes have changed.
``theme_list`` :param theme_list: The list of available themes::
The list of available themes::
[u'Bible Theme', u'Song Theme'] [u'Bible Theme', u'Song Theme']
""" """

View File

@ -64,12 +64,12 @@ class WizardStrings(object):
PercentSymbolFormat = translate('OpenLP.Ui', '%p%') PercentSymbolFormat = translate('OpenLP.Ui', '%p%')
Ready = translate('OpenLP.Ui', 'Ready.') Ready = translate('OpenLP.Ui', 'Ready.')
StartingImport = translate('OpenLP.Ui', 'Starting import...') StartingImport = translate('OpenLP.Ui', 'Starting import...')
YouSpecifyFile = translate('OpenLP.Ui', 'You need to specify one ' YouSpecifyFile = translate('OpenLP.Ui', 'You need to specify one %s file to import from.',
'%s file to import from.', 'A file type e.g. OpenSong') 'A file type e.g. OpenSong')
YouSpecifyFiles = translate('OpenLP.Ui', 'You need to specify at ' YouSpecifyFiles = translate('OpenLP.Ui', 'You need to specify at least one %s file to import from.',
'least one %s file to import from.', 'A file type e.g. OpenSong') 'A file type e.g. OpenSong')
YouSpecifyFolder = translate('OpenLP.Ui', 'You need to specify one ' YouSpecifyFolder = translate('OpenLP.Ui', 'You need to specify one %s folder to import from.',
'%s folder to import from.', 'A song format e.g. PowerSong') 'A song format e.g. PowerSong')
class OpenLPWizard(QtGui.QWizard, RegistryProperties): class OpenLPWizard(QtGui.QWizard, RegistryProperties):
@ -121,7 +121,7 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
self.setModal(True) self.setModal(True)
self.setWizardStyle(QtGui.QWizard.ModernStyle) self.setWizardStyle(QtGui.QWizard.ModernStyle)
self.setOptions(QtGui.QWizard.IndependentPages | self.setOptions(QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage) QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage)
add_welcome_page(self, image) add_welcome_page(self, image)
self.add_custom_pages() self.add_custom_pages()
if self.with_progress_page: if self.with_progress_page:
@ -209,18 +209,18 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
Registry().execute('openlp_stop_wizard') Registry().execute('openlp_stop_wizard')
self.done(QtGui.QDialog.Rejected) self.done(QtGui.QDialog.Rejected)
def on_current_id_changed(self, pageId): def on_current_id_changed(self, page_id):
""" """
Perform necessary functions depending on which wizard page is active. Perform necessary functions depending on which wizard page is active.
""" """
if self.with_progress_page and self.page(pageId) == self.progress_page: if self.with_progress_page and self.page(page_id) == self.progress_page:
self.pre_wizard() self.pre_wizard()
self.perform_wizard() self.perform_wizard()
self.post_wizard() self.post_wizard()
else: else:
self.custom_page_changed(pageId) self.custom_page_changed(page_id)
def custom_page_changed(self, pageId): def custom_page_changed(self, page_id):
""" """
Called when changing to a page other than the progress page Called when changing to a page other than the progress page
""" """
@ -242,11 +242,8 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
""" """
Update the wizard progress page. Update the wizard progress page.
``status_text`` :param status_text: Current status information to display.
Current status information to display. :param increment: The value to increment the progress bar by.
``increment``
The value to increment the progress bar by.
""" """
log.debug('IncrementBar %s', status_text) log.debug('IncrementBar %s', status_text)
self.progress_label.setText(status_text) self.progress_label.setText(status_text)
@ -276,17 +273,10 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
""" """
Opens a QFileDialog and saves the filename to the given editbox. Opens a QFileDialog and saves the filename to the given editbox.
``title`` :param title: The title of the dialog (unicode).
The title of the dialog (unicode). :param editbox: An editbox (QLineEdit).
:param setting_name: The place where to save the last opened directory.
``editbox`` :param filters: The file extension filters. It should contain the file description
An editbox (QLineEdit).
``setting_name``
The place where to save the last opened directory.
``filters``
The file extension filters. It should contain the file description
as well as the file extension. For example:: as well as the file extension. For example::
u'OpenLP 2.0 Databases (*.sqlite)' u'OpenLP 2.0 Databases (*.sqlite)'
@ -304,14 +294,9 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
""" """
Opens a QFileDialog and saves the selected folder to the given editbox. Opens a QFileDialog and saves the selected folder to the given editbox.
``title`` :param title: The title of the dialog (unicode).
The title of the dialog (unicode). :param editbox: An editbox (QLineEdit).
:param setting_name: The place where to save the last opened directory.
``editbox``
An editbox (QLineEdit).
``setting_name``
The place where to save the last opened directory.
""" """
folder = QtGui.QFileDialog.getExistingDirectory( folder = QtGui.QFileDialog.getExistingDirectory(
self, title, Settings().value(self.plugin.settings_section + '/' + setting_name), self, title, Settings().value(self.plugin.settings_section + '/' + setting_name),

View File

@ -179,8 +179,7 @@ def check_latest_version(current_version):
Check the latest version of OpenLP against the version file on the OpenLP Check the latest version of OpenLP against the version file on the OpenLP
site. site.
``current_version`` :param current_version: The current version of OpenLP.
The current version of OpenLP.
**Rules around versions and version files:** **Rules around versions and version files:**
@ -222,11 +221,8 @@ def add_actions(target, actions):
""" """
Adds multiple actions to a menu or toolbar in one command. Adds multiple actions to a menu or toolbar in one command.
``target`` :param target: The menu or toolbar to add actions to
The menu or toolbar to add actions to. :param actions: The actions to be added. An action consisting of the keyword ``None``
``actions``
The actions to be added. An action consisting of the keyword ``None``
will result in a separator being inserted into the target. will result in a separator being inserted into the target.
""" """
for action in actions: for action in actions:
@ -264,8 +260,7 @@ def is_not_image_file(file_name):
""" """
Validate that the file is not an image file. Validate that the file is not an image file.
``file_name`` :param file_name: File name to be checked.
File name to be checked.
""" """
if not file_name: if not file_name:
return True return True
@ -292,8 +287,7 @@ def clean_filename(filename):
""" """
Removes invalid characters from the given ``filename``. Removes invalid characters from the given ``filename``.
``filename`` :param filename: The "dirty" file name to clean.
The "dirty" file name to clean.
""" """
if not isinstance(filename, str): if not isinstance(filename, str):
filename = str(filename, 'utf-8') filename = str(filename, 'utf-8')
@ -304,8 +298,7 @@ def delete_file(file_path_name):
""" """
Deletes a file from the system. Deletes a file from the system.
``file_path_name`` :param file_path_name: The file, including path, to delete.
The file, including path, to delete.
""" """
if not file_path_name: if not file_path_name:
return False return False
@ -333,14 +326,9 @@ def get_web_page(url, header=None, update_openlp=False):
""" """
Attempts to download the webpage at url and returns that page or None. Attempts to download the webpage at url and returns that page or None.
``url`` :param url: The URL to be downloaded.
The URL to be downloaded. :param header: An optional HTTP header to pass in the request to the web server.
:param update_openlp: Tells OpenLP to update itself if the page is successfully downloaded.
``header``
An optional HTTP header to pass in the request to the web server.
``update_openlp``
Tells OpenLP to update itself if the page is successfully downloaded.
Defaults to False. Defaults to False.
""" """
# TODO: Add proxy usage. Get proxy info from OpenLP settings, add to a # TODO: Add proxy usage. Get proxy info from OpenLP settings, add to a
@ -386,8 +374,7 @@ def get_uno_instance(resolver):
""" """
Returns a running openoffice.org instance. Returns a running openoffice.org instance.
``resolver`` :param resolver: The UNO resolver to use to find a running instance.
The UNO resolver to use to find a running instance.
""" """
log.debug('get UNO Desktop Openoffice - resolve') log.debug('get UNO Desktop Openoffice - resolve')
if UNO_CONNECTION_TYPE == 'pipe': if UNO_CONNECTION_TYPE == 'pipe':
@ -404,11 +391,8 @@ def format_time(text, local_time):
unicode string and passes individual % placeholders to time.strftime(). unicode string and passes individual % placeholders to time.strftime().
This ensures only ascii characters are passed to time.strftime(). This ensures only ascii characters are passed to time.strftime().
``text`` :param text: The text to be processed.
The text to be processed. :param local_time: The time to be used to add to the string. This is a time object
``local_time``
The time to be used to add to the string. This is a time object
""" """
def match_formatting(match): def match_formatting(match):
""" """
@ -422,8 +406,7 @@ def get_locale_key(string):
""" """
Creates a key for case insensitive, locale aware string sorting. Creates a key for case insensitive, locale aware string sorting.
``string`` :param string: The corresponding string.
The corresponding string.
""" """
string = string.lower() string = string.lower()
# ICU is the prefered way to handle locale sort key, we fallback to locale.strxfrm which will work in most cases. # ICU is the prefered way to handle locale sort key, we fallback to locale.strxfrm which will work in most cases.
@ -439,6 +422,7 @@ def get_locale_key(string):
except: except:
return locale.strxfrm(string).encode() return locale.strxfrm(string).encode()
def get_natural_key(string): def get_natural_key(string):
""" """
Generate a key for locale aware natural string sorting. Generate a key for locale aware natural string sorting.
@ -458,5 +442,5 @@ from .actions import ActionList
__all__ = ['ActionList', 'LanguageManager', 'get_application_version', 'check_latest_version', __all__ = ['ActionList', 'LanguageManager', 'get_application_version', 'check_latest_version',
'add_actions', 'get_filesystem_encoding', 'get_web_page', 'get_uno_command', 'get_uno_instance', 'add_actions', 'get_filesystem_encoding', 'get_web_page', 'get_uno_command', 'get_uno_instance',
'delete_file', 'clean_filename', 'format_time', 'get_locale_key', 'get_natural_key'] 'delete_file', 'clean_filename', 'format_time', 'get_locale_key', 'get_natural_key']

View File

@ -258,17 +258,12 @@ class ActionList(object):
**Note**: The action's objectName must be set when you want to add it! **Note**: The action's objectName must be set when you want to add it!
``action`` :param action: The action to add (QAction). **Note**, the action must not have an empty ``objectName``.
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,
``category`` if they are added, it is possible to avoid assigning shortcuts twice, which is important.
The category this action belongs to. The category has to be a python string. . **Note**, if the category :param weight: The weight specifies how important a category is. However, this only has an impact on the order
is ``None``, the category and its actions are being hidden in the shortcut dialog. However, if they are the categories are displayed.
added, it is possible to avoid assigning shortcuts twice, which is important.
``weight``
The weight specifies how important a category is. However, this only has an impact on the order the
categories are displayed.
""" """
if category not in self.categories: if category not in self.categories:
self.categories.append(category) self.categories.append(category)
@ -319,11 +314,8 @@ class ActionList(object):
""" """
This removes an action from its category. Empty categories are automatically removed. This removes an action from its category. Empty categories are automatically removed.
``action`` :param action: The ``QAction`` object to be removed.
The ``QAction`` object to be removed. :param category: The name (unicode string) of the category, which contains the action. Defaults to None.
``category``
The name (unicode string) of the category, which contains the action. Defaults to None.
""" """
if category not in self.categories: if category not in self.categories:
return return
@ -343,11 +335,8 @@ class ActionList(object):
""" """
Add an empty category to the list of categories. This is only convenient for categories with a given weight. Add an empty category to the list of categories. This is only convenient for categories with a given weight.
``name`` :param name: The category's name.
The category's name. :param weight: The category's weight (int).
``weight``
The category's weight (int).
""" """
if name in self.categories: if name in self.categories:
# Only change the weight and resort the categories again. # Only change the weight and resort the categories again.
@ -361,15 +350,11 @@ class ActionList(object):
def update_shortcut_map(self, action, old_shortcuts): def update_shortcut_map(self, action, old_shortcuts):
""" """
Remove the action for the given ``old_shortcuts`` from the ``shortcut_map`` to ensure its up-to-dateness. Remove the action for the given ``old_shortcuts`` from the ``shortcut_map`` to ensure its up-to-dateness.
**Note**: The new action's shortcuts **must** be assigned to the given ``action`` **before** calling this **Note**: The new action's shortcuts **must** be assigned to the given ``action`` **before** calling this
method. method.
``action`` :param action: The action whose shortcuts are supposed to be updated in the ``shortcut_map``.
The action whose shortcuts are supposed to be updated in the ``shortcut_map``. :param old_shortcuts: A list of unicode key sequences.
``old_shortcuts``
A list of unicode keysequences.
""" """
for old_shortcut in old_shortcuts: for old_shortcut in old_shortcuts:
# Remove action from the list of actions which are using this shortcut. # Remove action from the list of actions which are using this shortcut.
@ -388,11 +373,8 @@ class ActionList(object):
""" """
Checks if the given ``action`` may use its assigned shortcut(s) or not. Returns ``True`` or ``False. Checks if the given ``action`` may use its assigned shortcut(s) or not. Returns ``True`` or ``False.
``existing_actions`` :param existing_actions: A list of actions which already use a particular shortcut.
A list of actions which already use a particular shortcut. :param action: The action which wants to use a particular shortcut.
``action``
The action which wants to use a particular shortcut.
""" """
global_context = action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut] global_context = action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]
affected_actions = [] affected_actions = []

View File

@ -52,8 +52,7 @@ class LanguageManager(object):
""" """
Set up a translator to use in this instance of OpenLP Set up a translator to use in this instance of OpenLP
``language`` :param language: The language to load into the translator
The language to load into the translator
""" """
if LanguageManager.auto_language: if LanguageManager.auto_language:
language = QtCore.QLocale.system().name() language = QtCore.QLocale.system().name()
@ -85,8 +84,7 @@ class LanguageManager(object):
""" """
Load the language name from a language file Load the language name from a language file
``qm_file`` :param qm_file: The file to obtain the name from
The file to obtain the name from
""" """
translator = QtCore.QTranslator() translator = QtCore.QTranslator()
translator.load(qm_file) translator.load(qm_file)
@ -110,11 +108,8 @@ class LanguageManager(object):
""" """
Set the language to translate OpenLP into Set the language to translate OpenLP into
``action`` :param action: The language menu option
The language menu option :param message: Display the message option
``message``
Display the message option
""" """
language = 'en' language = 'en'
if action: if action:

View File

@ -136,8 +136,7 @@ class BiblePlugin(Plugin):
""" """
Give the bible plugin the opportunity to add items to the **Tools** menu. Give the bible plugin the opportunity to add items to the **Tools** menu.
``tools_menu`` :param tools_menu: The actual **Tools** menu item, so that your actions can use it as their parent.
The actual **Tools** menu item, so that your actions can use it as their parent.
""" """
log.debug('add tools menu') log.debug('add tools menu')
self.tools_upgrade_item = create_action( self.tools_upgrade_item = create_action(

View File

@ -67,14 +67,9 @@ class BibleImportForm(OpenLPWizard):
""" """
Instantiate the wizard, and run any extra setup we need to. Instantiate the wizard, and run any extra setup we need to.
``parent`` :param parent: The QWidget-derived parent of the wizard.
The QWidget-derived parent of the wizard. :param manager: The Bible manager.
:param bible_plugin: The Bible plugin.
``manager``
The Bible manager.
``bible_plugin``
The Bible plugin.
""" """
self.manager = manager self.manager = manager
self.web_bible_list = {} self.web_bible_list = {}

View File

@ -57,14 +57,9 @@ class BibleUpgradeForm(OpenLPWizard):
""" """
Instantiate the wizard, and run any extra setup we need to. Instantiate the wizard, and run any extra setup we need to.
``parent`` :param parent: The QWidget-derived parent of the wizard.
The QWidget-derived parent of the wizard. :param manager: The Bible manager.
:param bible_plugin: The Bible plugin.
``manager``
The Bible manager.
``bible_plugin``
The Bible plugin.
""" """
self.manager = manager self.manager = manager
self.media_item = bible_plugin.media_item self.media_item = bible_plugin.media_item

View File

@ -41,6 +41,7 @@ from openlp.plugins.bibles.lib.db import BiblesResourcesDB
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties): class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
""" """
Class to manage the editing of a bible Class to manage the editing of a bible
@ -57,12 +58,13 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
self.setupUi(self) self.setupUi(self)
self.manager = manager self.manager = manager
def loadBible(self, bible): def load_bible(self, bible):
""" """
Loads a bible. Loads a bible.
``bible`` ``bible``
The name of the bible.
:param bible: The name of the bible.
""" """
log.debug('Load Bible') log.debug('Load Bible')
self.bible = bible self.bible = bible
@ -73,18 +75,20 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
if book_name_language and book_name_language.value != 'None': if book_name_language and book_name_language.value != 'None':
self.language_selection_combo_box.setCurrentIndex(int(book_name_language.value) + 1) self.language_selection_combo_box.setCurrentIndex(int(book_name_language.value) + 1)
self.books = {} self.books = {}
self.webbible = self.manager.get_meta_data(self.bible, 'download_source') self.web_bible = self.manager.get_meta_data(self.bible, 'download_source')
if self.webbible: if self.web_bible:
self.book_name_notice.setText(translate('BiblesPlugin.EditBibleForm', self.book_name_notice.setText(
'This is a Web Download Bible.\nIt is not possible to customize the Book Names.')) translate('BiblesPlugin.EditBibleForm',
'This is a Web Download Bible.\nIt is not possible to customize the Book Names.'))
self.scroll_area.hide() self.scroll_area.hide()
else: else:
self.book_name_notice.setText(translate('BiblesPlugin.EditBibleForm', self.book_name_notice.setText(
'To use the customized book names, "Bible language" must be selected on the Meta Data tab or, ' translate('BiblesPlugin.EditBibleForm',
'if "Global settings" is selected, on the Bible page in Configure OpenLP.')) 'To use the customized book names, "Bible language" must be selected on the Meta Data tab '
'or, if "Global settings" is selected, on the Bible page in Configure OpenLP.'))
for book in BiblesResourcesDB.get_books(): for book in BiblesResourcesDB.get_books():
self.books[book['abbreviation']] = self.manager.get_book_by_id(self.bible, book['id']) self.books[book['abbreviation']] = self.manager.get_book_by_id(self.bible, book['id'])
if self.books[book['abbreviation']] and not self.webbible: if self.books[book['abbreviation']] and not self.web_bible:
self.book_name_edit[book['abbreviation']].setText(self.books[book['abbreviation']].name) self.book_name_edit[book['abbreviation']].setText(self.books[book['abbreviation']].name)
else: else:
# It is necessary to remove the Widget otherwise there still # It is necessary to remove the Widget otherwise there still
@ -113,19 +117,19 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
book_name_language = self.language_selection_combo_box.currentIndex() - 1 book_name_language = self.language_selection_combo_box.currentIndex() - 1
if book_name_language == -1: if book_name_language == -1:
book_name_language = None book_name_language = None
if not self.validateMeta(version, copyright): if not self.validate_meta(version, copyright):
return return
if not self.webbible: if not self.web_bible:
custom_names = {} custom_names = {}
for abbr, book in self.books.items(): for abbr, book in self.books.items():
if book: if book:
custom_names[abbr] = self.book_name_edit[abbr].text() custom_names[abbr] = self.book_name_edit[abbr].text()
if book.name != custom_names[abbr]: if book.name != custom_names[abbr]:
if not self.validateBook(custom_names[abbr], abbr): if not self.validate_book(custom_names[abbr], abbr):
return return
self.application.set_busy_cursor() self.application.set_busy_cursor()
self.manager.save_meta_data(self.bible, version, copyright, permissions, book_name_language) self.manager.save_meta_data(self.bible, version, copyright, permissions, book_name_language)
if not self.webbible: if not self.web_bible:
for abbr, book in self.books.items(): for abbr, book in self.books.items():
if book: if book:
if book.name != custom_names[abbr]: if book.name != custom_names[abbr]:
@ -135,47 +139,52 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
self.application.set_normal_cursor() self.application.set_normal_cursor()
QtGui.QDialog.accept(self) QtGui.QDialog.accept(self)
def validateMeta(self, name, copyright): def validate_meta(self, name, copyright):
""" """
Validate the Meta before saving. Validate the Meta before saving.
""" """
if not name: if not name:
self.version_name_edit.setFocus() self.version_name_edit.setFocus()
critical_error_message_box(UiStrings().EmptyField, critical_error_message_box(
UiStrings().EmptyField,
translate('BiblesPlugin.BibleEditForm', 'You need to specify a version name for your Bible.')) translate('BiblesPlugin.BibleEditForm', 'You need to specify a version name for your Bible.'))
return False return False
elif not copyright: elif not copyright:
self.copyright_edit.setFocus() self.copyright_edit.setFocus()
critical_error_message_box(UiStrings().EmptyField, critical_error_message_box(
UiStrings().EmptyField,
translate('BiblesPlugin.BibleEditForm', translate('BiblesPlugin.BibleEditForm',
'You need to set a copyright for your Bible. Bibles in the Public Domain need to be marked as such.')) 'You need to set a copyright for your Bible. Bibles in the Public Domain need to be marked '
'as such.'))
return False return False
elif self.manager.exists(name) and self.manager.get_meta_data(self.bible, 'name').value != \ elif self.manager.exists(name) and self.manager.get_meta_data(self.bible, 'name').value != name:
name:
self.version_name_edit.setFocus() self.version_name_edit.setFocus()
critical_error_message_box(translate('BiblesPlugin.BibleEditForm', 'Bible Exists'), critical_error_message_box(
translate('BiblesPlugin.BibleEditForm', 'Bible Exists'),
translate('BiblesPlugin.BibleEditForm', 'This Bible already exists. Please import ' translate('BiblesPlugin.BibleEditForm', 'This Bible already exists. Please import '
'a different Bible or first delete the existing one.')) 'a different Bible or first delete the existing one.'))
return False return False
return True return True
def validateBook(self, new_book_name, abbreviation): def validate_book(self, new_book_name, abbreviation):
""" """
Validate a book. Validate a book.
""" """
book_regex = re.compile('[\d]*[^\d]+$') book_regex = re.compile('[\d]*[^\d]+$')
if not new_book_name: if not new_book_name:
self.book_name_edit[abbreviation].setFocus() self.book_name_edit[abbreviation].setFocus()
critical_error_message_box(UiStrings().EmptyField, critical_error_message_box(
UiStrings().EmptyField,
translate('BiblesPlugin.BibleEditForm', 'You need to specify a book name for "%s".') % translate('BiblesPlugin.BibleEditForm', 'You need to specify a book name for "%s".') %
self.book_names[abbreviation]) self.book_names[abbreviation])
return False return False
elif not book_regex.match(new_book_name): elif not book_regex.match(new_book_name):
self.book_name_edit[abbreviation].setFocus() self.book_name_edit[abbreviation].setFocus()
critical_error_message_box(UiStrings().EmptyField, critical_error_message_box(
UiStrings().EmptyField,
translate('BiblesPlugin.BibleEditForm', translate('BiblesPlugin.BibleEditForm',
'The book name "%s" is not correct.\nNumbers can only be used at the beginning and must\nbe ' 'The book name "%s" is not correct.\nNumbers can only be used at the beginning and must\nbe '
'followed by one or more non-numeric characters.') % new_book_name) 'followed by one or more non-numeric characters.') % new_book_name)
return False return False
for abbr, book in self.books.items(): for abbr, book in self.books.items():
if book: if book:
@ -186,6 +195,6 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
critical_error_message_box( critical_error_message_box(
translate('BiblesPlugin.BibleEditForm', 'Duplicate Book Name'), translate('BiblesPlugin.BibleEditForm', 'Duplicate Book Name'),
translate('BiblesPlugin.BibleEditForm', 'The Book Name "%s" has been entered more than once.') translate('BiblesPlugin.BibleEditForm', 'The Book Name "%s" has been entered more than once.')
% new_book_name) % new_book_name)
return False return False
return True return True

View File

@ -74,8 +74,7 @@ def init_schema(url):
""" """
Setup a bible database connection and initialise the database schema. Setup a bible database connection and initialise the database schema.
``url`` :param url: The database to setup.
The database to setup.
""" """
session, metadata = init_db(url) session, metadata = init_db(url)
@ -711,9 +710,9 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
@staticmethod @staticmethod
def get_webbibles(source): def get_webbibles(source):
""" """
Return the bibles a webbible provide for download. Return the bibles a web_bible provide for download.
:param source: The source of the webbible. :param source: The source of the web_bible.
""" """
log.debug('BiblesResourcesDB.get_webbibles("%s")', source) log.debug('BiblesResourcesDB.get_webbibles("%s")', source)
if not isinstance(source, str): if not isinstance(source, str):
@ -735,10 +734,10 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
@staticmethod @staticmethod
def get_webbible(abbreviation, source): def get_webbible(abbreviation, source):
""" """
Return the bibles a webbible provide for download. Return the bibles a web_bible provide for download.
:param abbreviation: The abbreviation of the webbible. :param abbreviation: The abbreviation of the web_bible.
:param source: The source of the webbible. :param source: The source of the web_bible.
""" """
log.debug('BiblesResourcesDB.get_webbibles("%s", "%s")', abbreviation, source) log.debug('BiblesResourcesDB.get_webbibles("%s", "%s")', abbreviation, source)
if not isinstance(abbreviation, str): if not isinstance(abbreviation, str):

View File

@ -641,8 +641,7 @@ def send_error_message(error_type):
""" """
Send a standard error message informing the user of an issue. Send a standard error message informing the user of an issue.
``error_type`` :param error_type: The type of error that occurred for the issue.
The type of error that occured for the issue.
""" """
if error_type == 'download': if error_type == 'download':
critical_error_message_box( critical_error_message_box(

View File

@ -475,7 +475,7 @@ class BibleMediaItem(MediaManagerItem):
bible = self.advancedVersionComboBox.currentText() bible = self.advancedVersionComboBox.currentText()
if bible: if bible:
self.edit_bible_form = EditBibleForm(self, self.main_window, self.plugin.manager) self.edit_bible_form = EditBibleForm(self, self.main_window, self.plugin.manager)
self.edit_bible_form.loadBible(bible) self.edit_bible_form.load_bible(bible)
if self.edit_bible_form.exec_(): if self.edit_bible_form.exec_():
self.reload_bibles() self.reload_bibles()

View File

@ -83,14 +83,10 @@ class CustomPlugin(Plugin):
def rename_theme(self, old_theme, new_theme): def rename_theme(self, old_theme, new_theme):
""" """
Renames a theme the custom plugin is using making the plugin use the Renames a theme the custom plugin is using making the plugin use the new name.
new name.
``oldTheme`` :param old_theme: The name of the theme the plugin should stop using.
The name of the theme the plugin should stop using. :param new_theme: The new name the plugin should now use.
``newTheme``
The new name the plugin should now use.
""" """
customs_using_theme = self.db_manager.get_all_objects(CustomSlide, CustomSlide.theme_name == old_theme) customs_using_theme = self.db_manager.get_all_objects(CustomSlide, CustomSlide.theme_name == old_theme)
for custom in customs_using_theme: for custom in customs_using_theme:

View File

@ -127,8 +127,7 @@ class CustomXMLParser(object):
""" """
Set up our custom XML parser. Set up our custom XML parser.
``xml`` :param xml: The XML of the custom to be parsed.
The XML of the custom to be parsed.
""" """
self.custom_xml = None self.custom_xml = None
if xml[:5] == '<?xml': if xml[:5] == '<?xml':
@ -140,8 +139,7 @@ class CustomXMLParser(object):
def get_verses(self): def get_verses(self):
""" """
Iterates through the verses in the XML and returns a list of verses Iterates through the verses in the XML and returns a list of verses and their attributes.
and their attributes.
""" """
xml_iter = self.custom_xml.getiterator() xml_iter = self.custom_xml.getiterator()
verse_list = [] verse_list = []

View File

@ -60,8 +60,7 @@ def init_schema(url):
""" """
Setup the custom database connection and initialise the database schema Setup the custom database connection and initialise the database schema
``url`` :param url: The database to setup
The database to setup
""" """
session, metadata = init_db(url) session, metadata = init_db(url)

View File

@ -41,8 +41,7 @@ class Ui_ChooseGroupDialog(object):
""" """
Set up the UI. Set up the UI.
``choose_group_dialog`` :param choose_group_dialog: The form object (not the class).
The form object (not the class).
""" """
choose_group_dialog.setObjectName('choose_group_dialog') choose_group_dialog.setObjectName('choose_group_dialog')
choose_group_dialog.resize(399, 119) choose_group_dialog.resize(399, 119)
@ -84,8 +83,7 @@ class Ui_ChooseGroupDialog(object):
""" """
Translate the UI on the fly. Translate the UI on the fly.
``choose_group_dialog`` :param choose_group_dialog: The form object (not the class).
The form object (not the class).
""" """
choose_group_dialog.setWindowTitle(translate('ImagePlugin.ChooseGroupForm', 'Select Image Group')) choose_group_dialog.setWindowTitle(translate('ImagePlugin.ChooseGroupForm', 'Select Image Group'))
self.group_question_label.setText(translate('ImagePlugin.ChooseGroupForm', 'Add images to group:')) self.group_question_label.setText(translate('ImagePlugin.ChooseGroupForm', 'Add images to group:'))

View File

@ -47,8 +47,7 @@ class ChooseGroupForm(QtGui.QDialog, Ui_ChooseGroupDialog):
""" """
Show the form Show the form
``selected_group`` :param selected_group: The ID of the group that should be selected by default when showing the dialog.
The ID of the group that should be selected by default when showing the dialog.
""" """
self.new_group_edit.clear() self.new_group_edit.clear()
if selected_group is not None: if selected_group is not None:

View File

@ -84,8 +84,7 @@ class ImagePlugin(Plugin):
""" """
Upgrade the settings of this plugin. Upgrade the settings of this plugin.
``settings`` :param settings: The Settings object containing the old settings.
The Settings object containing the old settings.
""" """
files_from_config = settings.get_files_from_config(self) files_from_config = settings.get_files_from_config(self)
if files_from_config: if files_from_config:

View File

@ -54,9 +54,7 @@ def init_schema(url):
""" """
Setup the images database connection and initialise the database schema. Setup the images database connection and initialise the database schema.
``url`` :param url: The database to setup
The database to setup
The images database contains the following tables: The images database contains the following tables:
* image_groups * image_groups

View File

@ -218,8 +218,7 @@ class PresentationDocument(object):
""" """
Jumps directly to the requested slide. Jumps directly to the requested slide.
``slide_no`` :param slide_no: The slide to jump to, starting at 1
The slide to jump to, starting at 1
""" """
pass pass
@ -250,8 +249,8 @@ class PresentationDocument(object):
""" """
Returns an image path containing a preview for the requested slide Returns an image path containing a preview for the requested slide
``slide_no`` :param slide_no: The slide an image is required for, starting at 1
The slide an image is required for, starting at 1 :param check_exists:
""" """
path = os.path.join(self.get_thumbnail_folder(), self.controller.thumbnail_prefix + str(slide_no) + '.png') path = os.path.join(self.get_thumbnail_folder(), self.controller.thumbnail_prefix + str(slide_no) + '.png')
if os.path.isfile(path) or not check_exists: if os.path.isfile(path) or not check_exists:

View File

@ -208,11 +208,8 @@ class HttpRouter(RegistryProperties):
""" """
Invoke the route function passing the relevant values Invoke the route function passing the relevant values
``function`` :param function: The function to be called.
The function to be calledL. :param args: Any passed data.
``*args``
Any passed data.
""" """
response = function['function'](*args) response = function['function'](*args)
if response: if response:
@ -223,11 +220,8 @@ class HttpRouter(RegistryProperties):
""" """
Common function to process HTTP requests Common function to process HTTP requests
``url_path`` :param url_path: The requested URL.
The requested URL. :param args: Any passed data.
``*args``
Any passed data.
""" """
self.request_data = None self.request_data = None
url_path_split = urlparse(url_path) url_path_split = urlparse(url_path)
@ -379,8 +373,7 @@ class HttpRouter(RegistryProperties):
def get_content_type(self, file_name): def get_content_type(self, file_name):
""" """
Examines the extension of the file and determines Examines the extension of the file and determines what the content_type should be, defaults to text/plain
what the content_type should be, defaults to text/plain
Returns the extension and the content_type Returns the extension and the content_type
""" """
content_type = 'text/plain' content_type = 'text/plain'
@ -432,8 +425,7 @@ class HttpRouter(RegistryProperties):
Hide or show the display screen. Hide or show the display screen.
This is a cross Thread call and UI is updated so Events need to be used. This is a cross Thread call and UI is updated so Events need to be used.
``action`` :param action: This is the action, either ``hide`` or ``show``.
This is the action, either ``hide`` or ``show``.
""" """
self.live_controller.emit(QtCore.SIGNAL('slidecontroller_toggle_display'), action) self.live_controller.emit(QtCore.SIGNAL('slidecontroller_toggle_display'), action)
self.do_json_header() self.do_json_header()
@ -489,11 +481,8 @@ class HttpRouter(RegistryProperties):
""" """
Perform an action on the slide controller. Perform an action on the slide controller.
``display_type`` :param display_type: This is the type of slide controller, either ``preview`` or ``live``.
This is the type of slide controller, either ``preview`` or ``live``. :param action: The action to perform.
``action``
The action to perform.
""" """
event = 'slidecontroller_%s_%s' % (display_type, action) event = 'slidecontroller_%s_%s' % (display_type, action)
if self.request_data: if self.request_data:
@ -514,8 +503,6 @@ class HttpRouter(RegistryProperties):
""" """
Handles requests for service items in the service manager Handles requests for service items in the service manager
``action``
The action to perform.
""" """
self.do_json_header() self.do_json_header()
return json.dumps({'results': {'items': self._get_service_items()}}).encode() return json.dumps({'results': {'items': self._get_service_items()}}).encode()
@ -524,8 +511,7 @@ class HttpRouter(RegistryProperties):
""" """
Handles requests for service items in the service manager Handles requests for service items in the service manager
``action`` :param action: The action to perform.
The action to perform.
""" """
event = 'servicemanager_%s_item' % action event = 'servicemanager_%s_item' % action
if self.request_data: if self.request_data:
@ -543,9 +529,7 @@ class HttpRouter(RegistryProperties):
""" """
Return plugin related information, based on the action. Return plugin related information, based on the action.
``action`` :param action: The action to perform. If *search* return a list of plugin names which support search.
The action to perform. If *search* return a list of plugin names
which support search.
""" """
if action == 'search': if action == 'search':
searches = [] searches = []
@ -559,8 +543,7 @@ class HttpRouter(RegistryProperties):
""" """
Return a list of items that match the search text. Return a list of items that match the search text.
``plugin`` :param plugin_name: The plugin name to search in.
The plugin name to search in.
""" """
try: try:
text = json.loads(self.request_data)['request']['text'] text = json.loads(self.request_data)['request']['text']

View File

@ -83,8 +83,7 @@ class HttpThread(QtCore.QThread):
""" """
Constructor for the thread class. Constructor for the thread class.
``server`` :param server: The http server class.
The http server class.
""" """
super(HttpThread, self).__init__(None) super(HttpThread, self).__init__(None)
self.http_server = server self.http_server = server

View File

@ -56,7 +56,7 @@ class RemoteTab(SettingsTab):
self.address_edit = QtGui.QLineEdit(self.server_settings_group_box) self.address_edit = QtGui.QLineEdit(self.server_settings_group_box)
self.address_edit.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) self.address_edit.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
self.address_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'), self.address_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'),
self)) self))
self.address_edit.setObjectName('address_edit') self.address_edit.setObjectName('address_edit')
self.server_settings_layout.addRow(self.address_label, self.address_edit) self.server_settings_layout.addRow(self.address_label, self.address_edit)
self.twelve_hour_check_box = QtGui.QCheckBox(self.server_settings_group_box) self.twelve_hour_check_box = QtGui.QCheckBox(self.server_settings_group_box)
@ -177,14 +177,13 @@ class RemoteTab(SettingsTab):
self.live_url_label.setText(translate('RemotePlugin.RemoteTab', 'Live view URL:')) self.live_url_label.setText(translate('RemotePlugin.RemoteTab', 'Live view URL:'))
self.twelve_hour_check_box.setText(translate('RemotePlugin.RemoteTab', 'Display stage time in 12h format')) self.twelve_hour_check_box.setText(translate('RemotePlugin.RemoteTab', 'Display stage time in 12h format'))
self.android_app_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'Android App')) self.android_app_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'Android App'))
self.qr_description_label.setText(translate('RemotePlugin.RemoteTab', self.qr_description_label.setText(
'Scan the QR code or click <a href="https://play.google.com/store/' translate('RemotePlugin.RemoteTab', 'Scan the QR code or click <a href="https://play.google.com/store/'
'apps/details?id=org.openlp.android">download</a> to install the ' 'apps/details?id=org.openlp.android">download</a> to install the Android app from Google Play.'))
'Android app from Google Play.'))
self.https_settings_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'HTTPS Server')) self.https_settings_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'HTTPS Server'))
self.https_error_label.setText(translate('RemotePlugin.RemoteTab', self.https_error_label.setText(
'Could not find an SSL certificate. The HTTPS server will not be available unless an SSL certificate ' translate('RemotePlugin.RemoteTab', 'Could not find an SSL certificate. The HTTPS server will not be '
'is found. Please see the manual for more information.')) 'available unless an SSL certificate is found. Please see the manual for more information.'))
self.https_port_label.setText(self.port_label.text()) self.https_port_label.setText(self.port_label.text())
self.remote_https_url_label.setText(self.remote_url_label.text()) self.remote_https_url_label.setText(self.remote_url_label.text())
self.stage_https_url_label.setText(self.stage_url_label.text()) self.stage_https_url_label.setText(self.stage_url_label.text())
@ -290,4 +289,3 @@ class RemoteTab(SettingsTab):
Invert the HTTP group box based on Https group settings Invert the HTTP group box based on Https group settings
""" """
self.http_settings_group_box.setEnabled(not self.https_settings_group_box.isChecked()) self.http_settings_group_box.setEnabled(not self.https_settings_group_box.isChecked())

View File

@ -83,9 +83,9 @@ class RemotesPlugin(Plugin):
Information about this plugin Information about this plugin
""" """
about_text = translate('RemotePlugin', '<strong>Remote Plugin</strong>' about_text = translate('RemotePlugin', '<strong>Remote Plugin</strong>'
'<br />The remote plugin provides the ability to send messages to ' '<br />The remote plugin provides the ability to send messages to '
'a running version of OpenLP on a different computer via a web ' 'a running version of OpenLP on a different computer via a web '
'browser or through the remote API.') 'browser or through the remote API.')
return about_text return about_text
def set_plugin_text_strings(self): def set_plugin_text_strings(self):

View File

@ -52,8 +52,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
""" """
Execute the dialog. Execute the dialog.
``clear`` :param clear: Clear the form fields before displaying the dialog.
Clear the form fields before displaying the dialog.
""" """
if clear: if clear:
self.first_name_edit.clear() self.first_name_edit.clear()
@ -69,8 +68,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
When the first name is edited and the setting to automatically create a display name is True, then try to create When the first name is edited and the setting to automatically create a display name is True, then try to create
a display name from the first and last names. a display name from the first and last names.
``display_name`` :param display_name: The text from the first_name_edit widget.
The text from the first_name_edit widget.
""" """
if not self.auto_display_name: if not self.auto_display_name:
return return
@ -85,8 +83,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
When the last name is edited and the setting to automatically create a display name is True, then try to create When the last name is edited and the setting to automatically create a display name is True, then try to create
a display name from the first and last names. a display name from the first and last names.
``display_name`` :param display_name: The text from the last_name_edit widget.
The text from the last_name_edit widget.
""" """
if not self.auto_display_name: if not self.auto_display_name:
return return

View File

@ -334,11 +334,8 @@ def create_combo_box(parent, name):
""" """
Utility method to generate a standard combo box for this dialog. Utility method to generate a standard combo box for this dialog.
``parent`` :param parent: The parent widget for this combo box.
The parent widget for this combo box. :param name: The object name
``name``
The object name.
""" """
combo_box = QtGui.QComboBox(parent) combo_box = QtGui.QComboBox(parent)
combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength) combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)

View File

@ -82,8 +82,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog, RegistryPrope
""" """
Show the dialog. Show the dialog.
``from_song_edit``
Indicates if the maintenance dialog has been opened from song edit :param from_song_edit: Indicates if the maintenance dialog has been opened from song edit
or from the media manager. Defaults to **False**. or from the media manager. Defaults to **False**.
""" """
self.from_song_edit = from_song_edit self.from_song_edit = from_song_edit

View File

@ -58,11 +58,8 @@ class SongReviewWidget(QtGui.QWidget):
def __init__(self, parent, song): def __init__(self, parent, song):
""" """
``parent`` :param parent: The QWidget-derived parent of the wizard.
The QWidget-derived parent of the wizard. :param song: The Song which this SongReviewWidget should represent.
``song``
The Song which this SongReviewWidget should represent.
""" """
super(SongReviewWidget, self).__init__(parent) super(SongReviewWidget, self).__init__(parent)
self.song = song self.song = song

View File

@ -92,9 +92,7 @@ def init_schema(url):
""" """
Setup the songs database connection and initialise the database schema. Setup the songs database connection and initialise the database schema.
``url`` :param url: The database to setup
The database to setup
The song database contains the following tables: The song database contains the following tables:
* authors * authors

View File

@ -211,8 +211,7 @@ class FoilPresenter(object):
""" """
Create and save a song from Foilpresenter format xml to the database. Create and save a song from Foilpresenter format xml to the database.
``xml`` :param xml: The XML to parse (unicode).
The XML to parse (unicode).
""" """
# No xml get out of here. # No xml get out of here.
if not xml: if not xml:

View File

@ -361,11 +361,8 @@ class SongFormat(object):
""" """
Return requested song format attribute(s). Return requested song format attribute(s).
``format`` :param format: A song format from SongFormat.
A song format from SongFormat. :param attributes: Zero or more song format attributes from SongFormat.
``*attributes``
Zero or more song format attributes from SongFormat.
Return type depends on number of supplied attributes: Return type depends on number of supplied attributes:

View File

@ -65,8 +65,7 @@ class OpenLPSongImport(SongImport):
""" """
Run the import for an OpenLP version 2 song database. Run the import for an OpenLP version 2 song database.
``progress_dialog`` :param progress_dialog: The QProgressDialog used when importing songs from the FRW.
The QProgressDialog used when importing songs from the FRW.
""" """
class OldAuthor(BaseModel): class OldAuthor(BaseModel):

View File

@ -41,8 +41,7 @@ def try_int(s):
Convert string s to an integer if possible. Fail silently and return Convert string s to an integer if possible. Fail silently and return
the string as-is if it isn't an integer. the string as-is if it isn't an integer.
``s`` :param s: The string to try to convert.
The string to try to convert.
""" """
try: try:
return int(s) return int(s)
@ -54,8 +53,7 @@ def natural_sort_key(s):
""" """
Return a tuple by which s is sorted. Return a tuple by which s is sorted.
``s`` :param s: A string value from the list we want to sort.
A string value from the list we want to sort.
""" """
return list(map(try_int, SPLIT_ALPHA_DIGITS.findall(s))) return list(map(try_int, SPLIT_ALPHA_DIGITS.findall(s)))
@ -64,11 +62,8 @@ def natural_compare(a, b):
""" """
Compare two strings naturally and return the result. Compare two strings naturally and return the result.
``a`` :param a: A string to compare.
A string to compare. :param b: A string to compare.
``b``
A string to compare.
""" """
return cmp(natural_sort_key(a), natural_sort_key(b)) return cmp(natural_sort_key(a), natural_sort_key(b))