forked from openlp/openlp
Comment parameter cleanups
bzr-revno: 2337
This commit is contained in:
commit
e3842b6809
@ -49,8 +49,7 @@ def trace_error_handler(logger):
|
||||
"""
|
||||
Log the calling path of an exception
|
||||
|
||||
``logger``
|
||||
logger to use so traceback is logged to correct class
|
||||
:param logger: logger to use so traceback is logged to correct class
|
||||
"""
|
||||
for tb in traceback.extract_stack():
|
||||
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
|
||||
|
||||
``directory``
|
||||
The directory to make sure exists
|
||||
|
||||
``do_not_log``
|
||||
To not log anything. This is need for the start up, when the log isn't ready.
|
||||
:param directory: 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.
|
||||
"""
|
||||
if not do_not_log:
|
||||
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
|
||||
that we can change it if at a later date if necessary, without having to redo the whole of OpenLP.
|
||||
|
||||
``context``
|
||||
The translation context, used to give each string a context or a namespace.
|
||||
|
||||
``text``
|
||||
The text to put into the translation tables for translation.
|
||||
|
||||
``comment``
|
||||
An identifying string for when the same text is used in different roles within the same context.
|
||||
:param context: 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.
|
||||
:param encoding:
|
||||
:param n:
|
||||
:param qt_translate:
|
||||
"""
|
||||
return qt_translate(context, text, comment, encoding, n)
|
||||
|
||||
|
@ -69,8 +69,7 @@ class AppLocation(object):
|
||||
"""
|
||||
Return the appropriate directory according to the directory type.
|
||||
|
||||
``dir_type``
|
||||
The directory type you want, for instance the data directory. Default *AppLocation.AppDir*
|
||||
:param dir_type: The directory type you want, for instance the data directory. Default *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])
|
||||
@ -106,10 +105,9 @@ class AppLocation(object):
|
||||
"""
|
||||
Get a list of files from the data files path.
|
||||
|
||||
``section``
|
||||
Defaults to *None*. The section of code getting the files - used to load from a section's data subdirectory.
|
||||
|
||||
``extension``
|
||||
:param section: Defaults to *None*. The section of code getting the files - used to load from a section's
|
||||
data subdirectory.
|
||||
:param extension:
|
||||
Defaults to *None*. The extension to search for. For example::
|
||||
|
||||
u'.png'
|
||||
|
@ -73,8 +73,7 @@ class Registry(object):
|
||||
"""
|
||||
Extracts the registry value from the list based on the key passed in
|
||||
|
||||
``key``
|
||||
The service to be retrieved.
|
||||
:param key: The service to be retrieved.
|
||||
"""
|
||||
if key in self.service_list:
|
||||
return self.service_list[key]
|
||||
@ -88,11 +87,8 @@ class Registry(object):
|
||||
"""
|
||||
Registers a component against a key.
|
||||
|
||||
``key``
|
||||
The service to be created this is usually a major class like "renderer" or "main_window" .
|
||||
|
||||
``reference``
|
||||
The service address to be saved.
|
||||
:param key: The service to be created this is usually a major class like "renderer" or "main_window" .
|
||||
:param reference: The service address to be saved.
|
||||
"""
|
||||
if key in self.service_list:
|
||||
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
|
||||
framework).
|
||||
|
||||
``key``
|
||||
The service to be deleted.
|
||||
:param key: The service to be deleted.
|
||||
"""
|
||||
if key in self.service_list:
|
||||
del self.service_list[key]
|
||||
@ -116,13 +111,10 @@ class Registry(object):
|
||||
"""
|
||||
Register an event and associated function to be called
|
||||
|
||||
``event``
|
||||
The function description like "live_display_hide" where a number of places in the code
|
||||
:param event: 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
|
||||
recipients.
|
||||
|
||||
``function``
|
||||
The function to be called when the event happens.
|
||||
:param function: The function to be called when the event happens.
|
||||
"""
|
||||
if event in self.functions_list:
|
||||
self.functions_list[event].append(function)
|
||||
@ -133,11 +125,8 @@ class Registry(object):
|
||||
"""
|
||||
Remove an event and associated handler
|
||||
|
||||
``event``
|
||||
The function description..
|
||||
|
||||
``function``
|
||||
The function to be called when the event happens.
|
||||
:param event: The function description..
|
||||
:param function: The function to be called when the event happens.
|
||||
"""
|
||||
if self.running_under_test is False:
|
||||
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.
|
||||
|
||||
``event``
|
||||
The function to be processed
|
||||
|
||||
``*args``
|
||||
Parameters to be passed to the function.
|
||||
|
||||
``*kwargs``
|
||||
Parameters to be passed to the function.
|
||||
:param event: The function to be processed
|
||||
:param args: Parameters to be passed to the function.
|
||||
:param kwargs: Parameters to be passed to the function.
|
||||
"""
|
||||
results = []
|
||||
if event in self.functions_list:
|
||||
|
@ -348,8 +348,7 @@ class Settings(QtCore.QSettings):
|
||||
"""
|
||||
Static method to merge the given ``default_values`` with the ``Settings.__default_settings__``.
|
||||
|
||||
``default_values``
|
||||
A dict with setting keys and their default values.
|
||||
:param default_values: A dict with setting keys and their default values.
|
||||
"""
|
||||
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
|
||||
*Settings.__default_settings__* dict.
|
||||
|
||||
``key``
|
||||
The key to return the value from.
|
||||
:param key: The key to return the value from.
|
||||
"""
|
||||
# if group() is not empty the group has not been specified together with the key.
|
||||
if self.group():
|
||||
@ -434,12 +432,9 @@ class Settings(QtCore.QSettings):
|
||||
"""
|
||||
This converts the given ``setting`` to the type of the given ``default_value``.
|
||||
|
||||
``setting``
|
||||
The setting to convert. This could be ``true`` for example.Settings()
|
||||
|
||||
``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.
|
||||
:param setting: 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.
|
||||
|
||||
**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
|
||||
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``
|
||||
The Plugin object.The caller has to convert/save the list himself; o
|
||||
:param plugin: The Plugin object.The caller has to convert/save the list himself; o
|
||||
"""
|
||||
files_list = []
|
||||
# We need QSettings instead of Settings here to bypass our central settings dict.
|
||||
|
@ -52,14 +52,9 @@ def init_db(url, auto_flush=True, auto_commit=False):
|
||||
"""
|
||||
Initialise and return the session and metadata for a database
|
||||
|
||||
``url``
|
||||
The database to initialise connection with
|
||||
|
||||
``auto_flush``
|
||||
Sets the flushing behaviour of the session
|
||||
|
||||
``auto_commit``
|
||||
Sets the commit behaviour of the session
|
||||
:param url: 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
|
||||
"""
|
||||
engine = create_engine(url, poolclass=NullPool)
|
||||
metadata = MetaData(bind=engine)
|
||||
@ -71,8 +66,7 @@ def get_upgrade_op(session):
|
||||
"""
|
||||
Create a migration context and an operations object for performing upgrades.
|
||||
|
||||
``session``
|
||||
The SQLAlchemy session object.
|
||||
:param session: The SQLAlchemy session object.
|
||||
"""
|
||||
context = MigrationContext.configure(session.bind.connect())
|
||||
return Operations(context)
|
||||
|
@ -170,9 +170,7 @@ class FormattingTags(object):
|
||||
"""
|
||||
Add a list of tags to the list.
|
||||
|
||||
``tags``
|
||||
The list with tags to add.
|
||||
|
||||
:param tags: The list with tags to add.
|
||||
Each **tag** has to be a ``dict`` and should have the following keys:
|
||||
|
||||
* desc
|
||||
|
@ -556,23 +556,12 @@ def build_html(item, screen, is_live, background, image=None, plugins=None):
|
||||
"""
|
||||
Build the full web paged structure for display
|
||||
|
||||
``item``
|
||||
Service Item to be displayed
|
||||
|
||||
``screen``
|
||||
Current display information
|
||||
|
||||
``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
|
||||
:param item: Service Item to be displayed
|
||||
:param screen: Current display information
|
||||
:param is_live: Item is going live, rather than preview/theme building
|
||||
:param background: Theme background image - bytes
|
||||
:param image: Image media item - bytes
|
||||
:param plugins: The List of available plugins
|
||||
"""
|
||||
width = screen['size'].width()
|
||||
height = screen['size'].height()
|
||||
@ -626,8 +615,8 @@ def build_background_css(item, width):
|
||||
"""
|
||||
Build the background css
|
||||
|
||||
``item``
|
||||
Service Item containing theme and location information
|
||||
:param item: Service Item containing theme and location information
|
||||
:param width:
|
||||
"""
|
||||
width = int(width) // 2
|
||||
theme = item.theme_data
|
||||
@ -660,9 +649,7 @@ def build_lyrics_css(item):
|
||||
"""
|
||||
Build the lyrics display css
|
||||
|
||||
``item``
|
||||
Service Item containing theme and location information
|
||||
|
||||
:param item: Service Item containing theme and location information
|
||||
"""
|
||||
style = """
|
||||
.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
|
||||
|
||||
``theme_data``
|
||||
Object containing theme information
|
||||
:param theme_data: Object containing theme information
|
||||
"""
|
||||
if theme_data.font_main_outline:
|
||||
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
|
||||
|
||||
``theme_data``
|
||||
Object containing theme information
|
||||
|
||||
``width``
|
||||
Width of the lyrics block
|
||||
|
||||
``height``
|
||||
Height of the lyrics block
|
||||
:param theme_data: Object containing theme information
|
||||
:param width: Width of the lyrics block
|
||||
:param height: Height of the lyrics block
|
||||
"""
|
||||
align = HorizontalType.Names[theme_data.display_horizontal_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
|
||||
|
||||
``item``
|
||||
Service Item to be processed.
|
||||
:param item: Service Item to be processed.
|
||||
:param height:
|
||||
"""
|
||||
style = """
|
||||
left: %spx;
|
||||
|
@ -110,16 +110,12 @@ class Image(object):
|
||||
"""
|
||||
Create an image for the :class:`ImageManager`'s cache.
|
||||
|
||||
``path``
|
||||
The image's file path. This should be an existing file path.
|
||||
|
||||
``source``
|
||||
The source describes the image's origin. Possible values are described in the
|
||||
:param 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
|
||||
:class:`~openlp.core.lib.ImageSource` class.
|
||||
|
||||
``background``
|
||||
A ``QtGui.QColor`` object specifying the colour to be used to fill the gabs if the image's ratio does not
|
||||
:param 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.
|
||||
|
||||
"""
|
||||
self.path = path
|
||||
self.image = None
|
||||
@ -153,11 +149,8 @@ class PriorityQueue(queue.PriorityQueue):
|
||||
"""
|
||||
Modifies the priority of the given ``image``.
|
||||
|
||||
``image``
|
||||
The image to remove. This should be an :class:`Image` instance.
|
||||
|
||||
``new_priority``
|
||||
The image's new priority. See the :class:`Priority` class for priorities.
|
||||
:param image: 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.
|
||||
"""
|
||||
self.remove(image)
|
||||
image.priority = new_priority
|
||||
@ -167,8 +160,7 @@ class PriorityQueue(queue.PriorityQueue):
|
||||
"""
|
||||
Removes the given ``image`` from the queue.
|
||||
|
||||
``image``
|
||||
The image to remove. This should be an ``Image`` instance.
|
||||
:param image: The image to remove. This should be an ``Image`` instance.
|
||||
"""
|
||||
if (image.priority, image.secondary_priority, image) in self.queue:
|
||||
self.queue.remove((image.priority, image.secondary_priority, image))
|
||||
|
@ -95,8 +95,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
|
||||
"""
|
||||
Receive drop event check if it is a file and process it if it is.
|
||||
|
||||
``event``
|
||||
Handle of the event pint passed
|
||||
:param event: Handle of the event pint passed
|
||||
"""
|
||||
if event.mimeData().hasUrls():
|
||||
event.setDropAction(QtCore.Qt.CopyAction)
|
||||
|
@ -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):
|
||||
"""
|
||||
This is the constructor for the plugin object. This provides an easy
|
||||
way for descendent plugins to populate common data. This method *must*
|
||||
This is the constructor for the plugin object. This provides an easy way for descendant plugins to populate
|
||||
common data. This method *must*
|
||||
|
||||
be overridden, like so::
|
||||
|
||||
class MyPlugin(Plugin):
|
||||
def __init__(self):
|
||||
super(MyPlugin, self).__init__('MyPlugin', version=u'0.1')
|
||||
|
||||
``name``
|
||||
Defaults to *None*. The name of the plugin.
|
||||
|
||||
``default_settings``
|
||||
A dict containing the plugin's settings. The value to each key is the default value to be used.
|
||||
|
||||
``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.
|
||||
:param name: 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.
|
||||
:param media_item_class: The class name of the plugin's media item.
|
||||
: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.
|
||||
"""
|
||||
log.debug('Plugin %s initialised' % name)
|
||||
super(Plugin, self).__init__()
|
||||
@ -221,8 +214,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
|
||||
"""
|
||||
Upgrade the settings of this plugin.
|
||||
|
||||
``settings``
|
||||
The Settings object containing the old settings.
|
||||
:param settings: The Settings object containing the old settings.
|
||||
"""
|
||||
pass
|
||||
|
||||
@ -230,8 +222,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
|
||||
"""
|
||||
Create a menu item and add it to the "Import" menu.
|
||||
|
||||
``import_menu``
|
||||
The Import menu.
|
||||
:param import_menu: The Import menu.
|
||||
"""
|
||||
pass
|
||||
|
||||
@ -239,8 +230,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
|
||||
"""
|
||||
Create a menu item and add it to the "Export" menu.
|
||||
|
||||
``export_menu``
|
||||
The Export menu
|
||||
:param export_menu: The Export menu
|
||||
"""
|
||||
pass
|
||||
|
||||
@ -248,8 +238,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
|
||||
"""
|
||||
Create a menu item and add it to the "Tools" menu.
|
||||
|
||||
``tools_menu``
|
||||
The Tools menu
|
||||
:param tools_menu: The Tools menu
|
||||
"""
|
||||
pass
|
||||
|
||||
@ -267,8 +256,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
|
||||
"""
|
||||
Add menu items to the menu, given the menubar.
|
||||
|
||||
``menubar``
|
||||
The application's menu bar.
|
||||
:param menubar: The application's menu bar.
|
||||
"""
|
||||
pass
|
||||
|
||||
@ -284,8 +272,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
|
||||
|
||||
def about(self):
|
||||
"""
|
||||
Show a dialog when the user clicks on the 'About' button in the plugin
|
||||
manager.
|
||||
Show a dialog when the user clicks on the 'About' button in the plugin manager.
|
||||
"""
|
||||
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.
|
||||
|
||||
``old_theme``
|
||||
The name of the theme the plugin should stop using.
|
||||
|
||||
``new_theme``
|
||||
The new name the plugin should now use.
|
||||
:param old_theme: The name of the theme the plugin should stop using.
|
||||
:param new_theme: The new name the plugin should now use
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -176,8 +176,7 @@ class PluginManager(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Loop through all the plugins and give them an opportunity to upgrade their settings.
|
||||
|
||||
``settings``
|
||||
The Settings object containing the old settings.
|
||||
:param settings: The Settings object containing the old settings.
|
||||
"""
|
||||
for plugin in self.plugins:
|
||||
if plugin.status is not PluginStatus.Disabled:
|
||||
@ -185,8 +184,7 @@ class PluginManager(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
|
||||
def initialise_plugins(self):
|
||||
"""
|
||||
Loop through all the plugins and give them an opportunity to
|
||||
initialise themselves.
|
||||
Loop through all the plugins and give them an opportunity to initialise themselves.
|
||||
"""
|
||||
for plugin in self.plugins:
|
||||
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):
|
||||
"""
|
||||
Loop through all the plugins and give them an opportunity to
|
||||
clean themselves up
|
||||
Loop through all the plugins and give them an opportunity to clean themselves up
|
||||
"""
|
||||
for plugin in self.plugins:
|
||||
if plugin.is_active():
|
||||
|
@ -150,8 +150,7 @@ class ScreenList(object):
|
||||
"""
|
||||
Add a screen to the list of known screens.
|
||||
|
||||
``screen``
|
||||
A dict with the screen properties::
|
||||
:param screen: A dict with the screen properties::
|
||||
|
||||
{
|
||||
u'primary': True,
|
||||
@ -170,8 +169,7 @@ class ScreenList(object):
|
||||
"""
|
||||
Remove a screen from the list of known screens.
|
||||
|
||||
``number``
|
||||
The screen number (int).
|
||||
:param number: The screen number (int).
|
||||
"""
|
||||
log.info('remove_screen %d' % number)
|
||||
for screen in self.screen_list:
|
||||
@ -184,8 +182,7 @@ class ScreenList(object):
|
||||
"""
|
||||
Confirms a screen is known.
|
||||
|
||||
``number``
|
||||
The screen number (int).
|
||||
:param number: The screen number (int).
|
||||
"""
|
||||
for screen in self.screen_list:
|
||||
if screen['number'] == number:
|
||||
@ -196,8 +193,7 @@ class ScreenList(object):
|
||||
"""
|
||||
Set up the current screen dimensions.
|
||||
|
||||
``number``
|
||||
The screen number (int).
|
||||
:param number: The screen number (int).
|
||||
"""
|
||||
log.debug('set_current_display %s' % number)
|
||||
if number + 1 > self.display_count:
|
||||
@ -211,8 +207,7 @@ class ScreenList(object):
|
||||
|
||||
def set_override_display(self):
|
||||
"""
|
||||
Replace the current size with the override values, as the user wants to
|
||||
have their own screen attributes.
|
||||
Replace the current size with the override values, as the user wants to have their own screen attributes.
|
||||
"""
|
||||
log.debug('set_override_display')
|
||||
self.current = copy.deepcopy(self.override)
|
||||
@ -220,8 +215,7 @@ class ScreenList(object):
|
||||
|
||||
def reset_current_display(self):
|
||||
"""
|
||||
Replace the current values with the correct values, as the user wants to
|
||||
use the correct screen attributes.
|
||||
Replace the current values with the correct values, as the user wants to use the correct screen attributes.
|
||||
"""
|
||||
log.debug('reset_current_display')
|
||||
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.
|
||||
|
||||
``window``
|
||||
A QWidget we are finding the location of.
|
||||
:param window: A QWidget we are finding the location of.
|
||||
"""
|
||||
x = window.x() + (window.width() // 2)
|
||||
y = window.y() + (window.height() // 2)
|
||||
|
@ -79,8 +79,7 @@ class SearchEdit(QtGui.QLineEdit):
|
||||
"""
|
||||
Reimplemented method to react to resizing of the widget.
|
||||
|
||||
``event``
|
||||
The event that happened.
|
||||
:param event: The event that happened.
|
||||
"""
|
||||
size = self.clear_button.size()
|
||||
frame_width = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
|
||||
@ -100,8 +99,7 @@ class SearchEdit(QtGui.QLineEdit):
|
||||
"""
|
||||
Set a new current search type.
|
||||
|
||||
``identifier``
|
||||
The search type identifier (int).
|
||||
:param identifier: The search type identifier (int).
|
||||
"""
|
||||
menu = self.menu_button.menu()
|
||||
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
|
||||
default.
|
||||
|
||||
``items``
|
||||
The list of tuples to use. The tuples should contain an integer identifier, an icon (QIcon instance or
|
||||
:param items: The list of tuples to use. The tuples should contain an integer identifier, an icon (QIcon instance or
|
||||
|
||||
string) and a title for the item in the menu. In short, they should look like this::
|
||||
|
||||
(<identifier>, <icon>, <title>, <place holder text>)
|
||||
@ -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
|
||||
the clear button.
|
||||
|
||||
``text``
|
||||
A :class:`~PyQt4.QtCore.QString` instance which represents the text in the line edit.
|
||||
:param text: A :class:`~PyQt4.QtCore.QString` instance which represents the text in the line edit.
|
||||
"""
|
||||
self.clear_button.setVisible(bool(text))
|
||||
|
||||
|
@ -139,8 +139,7 @@ class ServiceItem(RegistryProperties):
|
||||
"""
|
||||
Set up the service item.
|
||||
|
||||
``plugin``
|
||||
The plugin that this service item belongs to.
|
||||
:param plugin: The plugin that this service item belongs to.
|
||||
"""
|
||||
if plugin:
|
||||
self.name = plugin.name
|
||||
@ -186,8 +185,7 @@ class ServiceItem(RegistryProperties):
|
||||
|
||||
def _new_item(self):
|
||||
"""
|
||||
Method to set the internal id of the item. This is used to compare
|
||||
service items to see if they are the same.
|
||||
Method to set the internal id of the item. This is used to compare service items to see if they are the same.
|
||||
"""
|
||||
self.unique_identifier = str(uuid.uuid1())
|
||||
self.validate_item()
|
||||
@ -196,8 +194,7 @@ class ServiceItem(RegistryProperties):
|
||||
"""
|
||||
Add an ItemCapability to a ServiceItem
|
||||
|
||||
``capability``
|
||||
The capability to add
|
||||
:param capability: The capability to add
|
||||
"""
|
||||
self.capabilities.append(capability)
|
||||
|
||||
@ -205,30 +202,25 @@ class ServiceItem(RegistryProperties):
|
||||
"""
|
||||
Tell the caller if a ServiceItem has a capability
|
||||
|
||||
``capability``
|
||||
The capability to test for
|
||||
:param capability: The capability to test for
|
||||
"""
|
||||
return capability in self.capabilities
|
||||
|
||||
def add_icon(self, icon):
|
||||
"""
|
||||
Add an icon to the service item. This is used when displaying the
|
||||
service item in the service manager.
|
||||
Add an icon to the service item. This is used when displaying the service item in the service manager.
|
||||
|
||||
``icon``
|
||||
A string to an icon in the resources or on disk.
|
||||
:param icon: A string to an icon in the resources or on disk.
|
||||
"""
|
||||
self.icon = icon
|
||||
self.iconic_representation = build_icon(icon)
|
||||
|
||||
def render(self, provides_own_theme_data=False):
|
||||
"""
|
||||
The render method is what generates the frames for the screen and
|
||||
obtains the display information from the renderer. At this point all
|
||||
slides are built for the given display size.
|
||||
The render method is what generates the frames for the screen and obtains the display information from the
|
||||
renderer. At this point all slides are built for the given display size.
|
||||
|
||||
``provides_own_theme_data``
|
||||
This switch disables the usage of the item's theme. However, this is
|
||||
:param provides_own_theme_data: 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
|
||||
the renderer knows the correct theme data. However, this is needed
|
||||
for the theme manager.
|
||||
@ -276,11 +268,9 @@ class ServiceItem(RegistryProperties):
|
||||
"""
|
||||
Add an image slide to the service item.
|
||||
|
||||
``path``
|
||||
The directory in which the image file is located.
|
||||
|
||||
``title``
|
||||
A title for the slide in the service item.
|
||||
:param path: The directory in which the image file is located.
|
||||
:param title: A title for the slide in the service item.
|
||||
:param background:
|
||||
"""
|
||||
if background:
|
||||
self.image_border = background
|
||||
@ -293,8 +283,8 @@ class ServiceItem(RegistryProperties):
|
||||
"""
|
||||
Add a text slide to the service item.
|
||||
|
||||
``raw_slide``
|
||||
The raw text of the slide.
|
||||
:param raw_slide: The raw text of the slide.
|
||||
:param verse_tag:
|
||||
"""
|
||||
if verse_tag:
|
||||
verse_tag = verse_tag.upper()
|
||||
@ -307,14 +297,9 @@ class ServiceItem(RegistryProperties):
|
||||
"""
|
||||
Add a slide from a command.
|
||||
|
||||
``path``
|
||||
The title of the slide in the service item.
|
||||
|
||||
``file_name``
|
||||
The title of the slide in the service item.
|
||||
|
||||
``image``
|
||||
The command of/for the slide.
|
||||
:param path: 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.
|
||||
"""
|
||||
self.service_item_type = ServiceItemType.Command
|
||||
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):
|
||||
"""
|
||||
This method returns some text which can be saved into the service
|
||||
file to represent this item.
|
||||
This method returns some text which can be saved into the service file to represent this item.
|
||||
"""
|
||||
service_header = {
|
||||
'name': self.name,
|
||||
@ -365,21 +349,17 @@ class ServiceItem(RegistryProperties):
|
||||
service_data.append({'title': slide['title'], 'image': slide['image'], 'path': slide['path']})
|
||||
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
|
||||
from the ServiceManager) and extracts the data actually required.
|
||||
This method takes a service item from a saved service file (passed from the ServiceManager) and extracts the
|
||||
data actually required.
|
||||
|
||||
``serviceitem``
|
||||
The item to extract data from.
|
||||
|
||||
``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..
|
||||
:param service_item: The item to extract data from.
|
||||
:param path: Defaults to *None*. This is the service manager path for things which have their files saved
|
||||
with them or None when the saved service is lite and the original file paths need to be preserved.
|
||||
"""
|
||||
log.debug('set_from_service called with path %s' % path)
|
||||
header = serviceitem['serviceitem']['header']
|
||||
header = service_item['serviceitem']['header']
|
||||
self.title = header['title']
|
||||
self.name = header['name']
|
||||
self.service_item_type = header['type']
|
||||
@ -415,21 +395,21 @@ class ServiceItem(RegistryProperties):
|
||||
self.background_audio.append(os.path.join(path, filename))
|
||||
self.theme_overwritten = header.get('theme_overwritten', False)
|
||||
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)
|
||||
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'))
|
||||
if path:
|
||||
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)
|
||||
self.add_from_image(filename, text_image, background)
|
||||
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)
|
||||
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:
|
||||
self.title = text_image['title']
|
||||
if path:
|
||||
@ -454,11 +434,9 @@ class ServiceItem(RegistryProperties):
|
||||
def merge(self, other):
|
||||
"""
|
||||
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
|
||||
replace an original version.
|
||||
The unique_identifier is unique for a given service item but this allows one to replace an original version.
|
||||
|
||||
``other``
|
||||
The service item to be merged with
|
||||
:param other: The service item to be merged with
|
||||
"""
|
||||
self.unique_identifier = other.unique_identifier
|
||||
self.notes = other.notes
|
||||
@ -525,8 +503,7 @@ class ServiceItem(RegistryProperties):
|
||||
"""
|
||||
Stores the media length of the item
|
||||
|
||||
``length``
|
||||
The length of the media item
|
||||
:param length: The length of the media item
|
||||
"""
|
||||
self.media_length = length
|
||||
if length > 0:
|
||||
@ -544,8 +521,8 @@ class ServiceItem(RegistryProperties):
|
||||
def get_rendered_frame(self, row):
|
||||
"""
|
||||
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:
|
||||
return self._display_frames[row]['html'].split('\n')[0]
|
||||
@ -610,8 +587,7 @@ class ServiceItem(RegistryProperties):
|
||||
"""
|
||||
updates the theme in the service item
|
||||
|
||||
``theme``
|
||||
The new theme to be replaced in the service item
|
||||
:param theme: The new theme to be replaced in the service item
|
||||
"""
|
||||
self.theme_overwritten = (theme is None)
|
||||
self.theme = theme
|
||||
|
@ -46,11 +46,10 @@ class SettingsTab(QtGui.QWidget, RegistryProperties):
|
||||
"""
|
||||
Constructor to create the Settings tab item.
|
||||
|
||||
``title``
|
||||
The title of the tab, which is used internally for the tab handling.
|
||||
|
||||
``visible_title``
|
||||
The title of the tab, which is usually displayed on the tab.
|
||||
:param parent:
|
||||
: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.
|
||||
:param icon_path:
|
||||
"""
|
||||
super(SettingsTab, self).__init__(parent)
|
||||
self.tab_title = title
|
||||
@ -129,9 +128,7 @@ class SettingsTab(QtGui.QWidget, RegistryProperties):
|
||||
"""
|
||||
Changes which need to be made after setup of application
|
||||
|
||||
``postUpdate``
|
||||
Indicates if called before or after updates.
|
||||
|
||||
:param post_update: Indicates if called before or after updates.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -128,8 +128,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
|
||||
"""
|
||||
Changes the language for this spelltextedit.
|
||||
|
||||
``action``
|
||||
The action.
|
||||
:param action: The action.
|
||||
"""
|
||||
self.dictionary = enchant.Dict(action.text())
|
||||
self.highlighter.spelling_dictionary = self.dictionary
|
||||
@ -182,7 +181,7 @@ class Highlighter(QtGui.QSyntaxHighlighter):
|
||||
|
||||
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.
|
||||
"""
|
||||
|
@ -172,11 +172,8 @@ class ThemeXML(object):
|
||||
"""
|
||||
Expand the json objects and make into variables.
|
||||
|
||||
``var``
|
||||
The array list to be processed.
|
||||
|
||||
``prev``
|
||||
The preceding string to add to the key to make the variable.
|
||||
:param var: The array list to be processed.
|
||||
:param prev: The preceding string to add to the key to make the variable.
|
||||
"""
|
||||
for key, value in var.items():
|
||||
if prev:
|
||||
@ -192,8 +189,7 @@ class ThemeXML(object):
|
||||
"""
|
||||
Add the path name to the image name so the background can be rendered.
|
||||
|
||||
``path``
|
||||
The path name to be added.
|
||||
:param path: The path name to be added.
|
||||
"""
|
||||
if self.background_type == 'image':
|
||||
if self.background_filename and path:
|
||||
@ -226,8 +222,7 @@ class ThemeXML(object):
|
||||
"""
|
||||
Add a Solid background.
|
||||
|
||||
``bkcolor``
|
||||
The color of the background.
|
||||
:param bkcolor: The color of the background.
|
||||
"""
|
||||
background = self.theme_xml.createElement('background')
|
||||
background.setAttribute('type', 'solid')
|
||||
@ -238,14 +233,9 @@ class ThemeXML(object):
|
||||
"""
|
||||
Add a gradient background.
|
||||
|
||||
``startcolor``
|
||||
The gradient's starting colour.
|
||||
|
||||
``endcolor``
|
||||
The gradient's ending colour.
|
||||
|
||||
``direction``
|
||||
The direction of the gradient.
|
||||
:param startcolor: The gradient's starting colour.
|
||||
:param endcolor: The gradient's ending colour.
|
||||
:param direction: The direction of the gradient.
|
||||
"""
|
||||
background = self.theme_xml.createElement('background')
|
||||
background.setAttribute('type', 'gradient')
|
||||
@ -261,8 +251,8 @@ class ThemeXML(object):
|
||||
"""
|
||||
Add a image background.
|
||||
|
||||
``filename``
|
||||
The file name of the image.
|
||||
:param filename: The file name of the image.
|
||||
:param border_color:
|
||||
"""
|
||||
background = self.theme_xml.createElement('background')
|
||||
background.setAttribute('type', 'image')
|
||||
@ -278,57 +268,24 @@ class ThemeXML(object):
|
||||
"""
|
||||
Add a Font.
|
||||
|
||||
``name``
|
||||
The name of the font.
|
||||
|
||||
``color``
|
||||
The colour of the font.
|
||||
|
||||
``size``
|
||||
The size of the font.
|
||||
|
||||
``override``
|
||||
Whether or not to override the default positioning of the theme.
|
||||
|
||||
``fonttype``
|
||||
The type of font, ``main`` or ``footer``. Defaults to ``main``.
|
||||
|
||||
``weight``
|
||||
The weight of then font Defaults to 50 Normal
|
||||
|
||||
``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
|
||||
|
||||
:param name: The name of the font.
|
||||
:param color: The colour of the font.
|
||||
:param size: The size of the font.
|
||||
:param override: Whether or not to override the default positioning of the theme.
|
||||
:param fonttype: The type of font, ``main`` or ``footer``. Defaults to ``main``.
|
||||
:param bold:
|
||||
:param italics: The weight of then font Defaults to 50 Normal
|
||||
:param line_adjustment: Does the font render to italics Defaults to 0 Normal
|
||||
:param xpos: The X position of the text block.
|
||||
:param ypos: The Y position of the text block.
|
||||
:param width: The width of the text block.
|
||||
:param height: The height of the text block.
|
||||
:param outline: Whether or not to show an outline.
|
||||
:param outline_color: The colour of the outline.
|
||||
:param outline_pixel: How big the Shadow is
|
||||
:param shadow: Whether or not to show a shadow.
|
||||
:param shadow_color: The colour of the shadow.
|
||||
:param shadow_pixel: How big the Shadow is
|
||||
"""
|
||||
background = self.theme_xml.createElement('font')
|
||||
background.setAttribute('type', fonttype)
|
||||
@ -372,15 +329,9 @@ class ThemeXML(object):
|
||||
"""
|
||||
Add a Display options.
|
||||
|
||||
``horizontal``
|
||||
The horizontal alignment of the text.
|
||||
|
||||
``vertical``
|
||||
The vertical alignment of the text.
|
||||
|
||||
``transition``
|
||||
Whether the slide transition is active.
|
||||
|
||||
:param horizontal: The horizontal alignment of the text.
|
||||
:param vertical: The vertical alignment of the text.
|
||||
:param transition: Whether the slide transition is active.
|
||||
"""
|
||||
background = self.theme_xml.createElement('display')
|
||||
self.theme.appendChild(background)
|
||||
@ -446,8 +397,7 @@ class ThemeXML(object):
|
||||
"""
|
||||
Read in an XML string and parse it.
|
||||
|
||||
``xml``
|
||||
The XML string to parse.
|
||||
:param xml: The XML string to parse.
|
||||
"""
|
||||
self.parse_xml(str(xml))
|
||||
|
||||
@ -455,8 +405,7 @@ class ThemeXML(object):
|
||||
"""
|
||||
Parse an XML string.
|
||||
|
||||
``xml``
|
||||
The XML string to parse.
|
||||
:param xml: The XML string to parse.
|
||||
"""
|
||||
# remove encoding string
|
||||
line = xml.find('?>')
|
||||
|
@ -74,11 +74,8 @@ class OpenLPToolbar(QtGui.QToolBar):
|
||||
"""
|
||||
Set the visibility for a widget or a list of widgets.
|
||||
|
||||
``widget``
|
||||
A list of string with widget object names.
|
||||
|
||||
``visible``
|
||||
The new state as bool.
|
||||
:param widgets: A list of string with widget object names.
|
||||
:param visible: The new state as bool.
|
||||
"""
|
||||
for handle in widgets:
|
||||
if handle in self.actions:
|
||||
|
@ -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
|
||||
move just tell it what plugin to call
|
||||
|
||||
``event``
|
||||
The event that occurred
|
||||
:param event: The event that occurred
|
||||
"""
|
||||
if event.buttons() != QtCore.Qt.LeftButton:
|
||||
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.
|
||||
|
||||
``event``
|
||||
The event that occurred
|
||||
:param event: The event that occurred
|
||||
"""
|
||||
if event.mimeData().hasUrls():
|
||||
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.
|
||||
|
||||
``event``
|
||||
The event that occurred
|
||||
:param event: The event that occurred
|
||||
"""
|
||||
QtGui.QTreeWidget.dragMoveEvent(self, event)
|
||||
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.
|
||||
|
||||
``event``
|
||||
Handle of the event pint passed
|
||||
:param event: Handle of the event pint passed
|
||||
"""
|
||||
if event.mimeData().hasUrls():
|
||||
event.setDropAction(QtCore.Qt.CopyAction)
|
||||
|
@ -45,11 +45,8 @@ def add_welcome_page(parent, image):
|
||||
"""
|
||||
Generate an opening welcome page for a wizard using a provided image.
|
||||
|
||||
``parent``
|
||||
A ``QWizard`` object to add the welcome page to.
|
||||
|
||||
``image``
|
||||
A splash image for the wizard.
|
||||
:param parent: A ``QWizard`` object to add the welcome page to.
|
||||
:param image: A splash image for the wizard.
|
||||
"""
|
||||
parent.welcome_page = QtGui.QWizardPage()
|
||||
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
|
||||
are connected with the dialogs ``accept()`` and ``reject()`` slots.
|
||||
|
||||
``dialog``
|
||||
The parent object. This has to be a ``QDialog`` descendant.
|
||||
|
||||
``name``
|
||||
A string which is set as object name.
|
||||
|
||||
``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.
|
||||
:param dialog: The parent object. This has to be a ``QDialog`` descendant.
|
||||
:param name: A string which is set as object name.
|
||||
:param standard_buttons: A list of strings for the used buttons. It might contain: ``ok``, ``save``, ``cancel``,
|
||||
``close``, and ``defaults``.
|
||||
: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.
|
||||
"""
|
||||
if custom_buttons is None:
|
||||
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.
|
||||
|
||||
``title``
|
||||
The title for the message box.
|
||||
|
||||
``message``
|
||||
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.
|
||||
:param title: 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.
|
||||
:param question: Should this message box question the user.
|
||||
"""
|
||||
if question:
|
||||
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.
|
||||
|
||||
``parent``
|
||||
The parent widget.
|
||||
|
||||
``name``
|
||||
A string set as object name for the combo box.
|
||||
:param parent: The parent widget.
|
||||
:param name: A string set as object name for the combo box.
|
||||
"""
|
||||
combo = QtGui.QComboBox(parent)
|
||||
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.
|
||||
|
||||
``parent``
|
||||
A QtCore.QWidget for the buttons parent (required).
|
||||
|
||||
``name``
|
||||
A string which is set as object name (required).
|
||||
:param parent: A QtCore.QWidget for the buttons parent (required).
|
||||
:param name: A string which is set as object name (required).
|
||||
:param kwargs:
|
||||
|
||||
``role``
|
||||
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``
|
||||
False in case the button should be disabled.
|
||||
|
||||
"""
|
||||
if 'role' in kwargs:
|
||||
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.
|
||||
|
||||
``parent``
|
||||
A QtCore.QObject for the actions parent (required).
|
||||
|
||||
``name``
|
||||
A string which is set as object name (required).
|
||||
:param parent: A QtCore.QObject for the actions parent (required).
|
||||
:param name: A string which is set as object name (required).
|
||||
:param kwargs:
|
||||
|
||||
``text``
|
||||
A string for the action text.
|
||||
@ -253,6 +230,7 @@ def create_action(parent, name, **kwargs):
|
||||
|
||||
``can_shortcuts``
|
||||
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*
|
||||
``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.
|
||||
|
||||
``cache``
|
||||
The list of items to use as suggestions.
|
||||
|
||||
``widget``
|
||||
A widget to set the completer (QComboBox or QTextEdit instance)
|
||||
:param cache: The list of items to use as suggestions.
|
||||
:param widget: A widget to set the completer (QComboBox or QTextEdit instance)
|
||||
"""
|
||||
completer = QtGui.QCompleter(cache)
|
||||
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.
|
||||
|
||||
``parent``
|
||||
The parent object. This should be a ``QWidget`` descendant.
|
||||
|
||||
Returns a tuple of QLabel and QComboBox.
|
||||
:param parent: The parent object. This should be a ``QWidget`` descendant.
|
||||
"""
|
||||
label = QtGui.QLabel(parent)
|
||||
label.setText(translate('OpenLP.Ui', '&Vertical Align:'))
|
||||
|
@ -641,8 +641,7 @@ class AdvancedTab(SettingsTab):
|
||||
"""
|
||||
Notify user about required restart.
|
||||
|
||||
``checked``
|
||||
The state of the check box (boolean).
|
||||
:param checked: The state of the check box (boolean).
|
||||
"""
|
||||
QtGui.QMessageBox.information(self, translate('OpenLP.AdvancedTab', 'Restart Required'),
|
||||
translate('OpenLP.AdvancedTab', 'This change will only take effect once OpenLP '
|
||||
|
@ -284,8 +284,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
|
||||
|
||||
def _build_theme_screenshots(self):
|
||||
"""
|
||||
This method builds the theme screenshots' icons for all items in the
|
||||
``self.themes_list_widget``.
|
||||
This method builds the theme screenshots' icons for all items in the ``self.themes_list_widget``.
|
||||
"""
|
||||
themes = self.config.get('themes', 'files')
|
||||
themes = themes.split(',')
|
||||
@ -298,12 +297,11 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
|
||||
break
|
||||
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.
|
||||
|
||||
``url``
|
||||
The URL of the file we want to download.
|
||||
:param url: The URL of the file we want to download.
|
||||
"""
|
||||
site = urllib.request.urlopen(url)
|
||||
meta = site.info()
|
||||
@ -321,11 +319,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
|
||||
"""
|
||||
Update the wizard progress page.
|
||||
|
||||
``status_text``
|
||||
Current status information to display.
|
||||
|
||||
``increment``
|
||||
The value to increment the progress bar by.
|
||||
:param status_text: Current status information to display.
|
||||
:param increment: The value to increment the progress bar by.
|
||||
"""
|
||||
if 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)
|
||||
if item.checkState() == QtCore.Qt.Checked:
|
||||
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
|
||||
# Loop through the Bibles list and increase for each selected item
|
||||
iterator = QtGui.QTreeWidgetItemIterator(self.bibles_tree_widget)
|
||||
@ -355,7 +350,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
|
||||
item = iterator.value()
|
||||
if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
|
||||
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
|
||||
iterator += 1
|
||||
# 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)
|
||||
if item.checkState() == QtCore.Qt.Checked:
|
||||
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
|
||||
if self.max_progress:
|
||||
# Add on 2 for plugins status setting plus a "finished" point.
|
||||
|
@ -335,8 +335,7 @@ class GeneralTab(SettingsTab):
|
||||
"""
|
||||
Toggle screen state depending on check box state.
|
||||
|
||||
``checked``
|
||||
The state of the check box (boolean).
|
||||
:param checked: The state of the check box (boolean).
|
||||
"""
|
||||
self.monitor_combo_box.setDisabled(checked)
|
||||
self.custom_X_value_edit.setEnabled(checked)
|
||||
|
@ -477,8 +477,7 @@ class AudioPlayer(OpenLPMixin, QtCore.QObject):
|
||||
"""
|
||||
The constructor for the display form.
|
||||
|
||||
``parent``
|
||||
The parent widget.
|
||||
:param parent: The parent widget.
|
||||
"""
|
||||
super(AudioPlayer, self).__init__(parent)
|
||||
self.current_index = -1
|
||||
|
@ -697,11 +697,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
||||
"""
|
||||
Display an error message
|
||||
|
||||
``title``
|
||||
The title of the warning box.
|
||||
|
||||
``message``
|
||||
The message to be displayed.
|
||||
:param title: The title of the warning box.
|
||||
:param message: The message to be displayed.
|
||||
"""
|
||||
if hasattr(self.application, 'splash'):
|
||||
self.application.splash.close()
|
||||
@ -711,11 +708,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
||||
"""
|
||||
Display a warning message
|
||||
|
||||
``title``
|
||||
The title of the warning box.
|
||||
|
||||
``message``
|
||||
The message to be displayed.
|
||||
:param title: The title of the warning box.
|
||||
:param message: The message to be displayed.
|
||||
"""
|
||||
if hasattr(self.application, 'splash'):
|
||||
self.application.splash.close()
|
||||
@ -725,11 +719,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
||||
"""
|
||||
Display an informational message
|
||||
|
||||
``title``
|
||||
The title of the warning box.
|
||||
|
||||
``message``
|
||||
The message to be displayed.
|
||||
:param title: The title of the warning box.
|
||||
:param message: The message to be displayed.
|
||||
"""
|
||||
if hasattr(self.application, 'splash'):
|
||||
self.application.splash.close()
|
||||
@ -1067,8 +1058,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
||||
"""
|
||||
Runs all the cleanup code before OpenLP shuts down.
|
||||
|
||||
``save_settings``
|
||||
Switch to prevent saving settings. Defaults to **True**.
|
||||
:param save_settings: Switch to prevent saving settings. Defaults to **True**.
|
||||
"""
|
||||
self.image_manager.stop_manager = True
|
||||
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.
|
||||
|
||||
``modified``
|
||||
Whether or not this service has been modified.
|
||||
|
||||
``file_name``
|
||||
The file name of the service file.
|
||||
:param modified: Whether or not this service has been modified.
|
||||
:param file_name: The file name of the service file.
|
||||
"""
|
||||
if modified:
|
||||
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.
|
||||
|
||||
``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
|
||||
False - Hidden
|
||||
|
||||
"""
|
||||
self.preview_controller.panel.setVisible(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.
|
||||
|
||||
``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
|
||||
False - Hidden
|
||||
"""
|
||||
@ -1266,8 +1253,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
||||
"""
|
||||
Adds a service to the list of recently used files.
|
||||
|
||||
``filename``
|
||||
The service filename to add
|
||||
:param filename: The service filename to add
|
||||
"""
|
||||
# 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
|
||||
|
@ -96,14 +96,10 @@ def get_media_players():
|
||||
|
||||
def set_media_players(players_list, overridden_player='auto'):
|
||||
"""
|
||||
This method saves the configured media players and overridden player to the
|
||||
settings
|
||||
This method saves the configured media players and overridden player to the settings
|
||||
|
||||
``players_list``
|
||||
A list with all active media players.
|
||||
|
||||
``overridden_player``
|
||||
Here an special media player is chosen for all media actions.
|
||||
:param players_list: A list with all active media players.
|
||||
:param overridden_player: Here an special media player is chosen for all media actions.
|
||||
"""
|
||||
log.debug('set_media_players')
|
||||
players = ','.join(players_list)
|
||||
|
@ -82,12 +82,11 @@ class MediaSlider(QtGui.QSlider):
|
||||
|
||||
class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
The implementation of the Media Controller. The Media Controller adds an own
|
||||
class for every Player. Currently these are QtWebkit, Phonon and Vlc.
|
||||
The implementation of the Media Controller. The Media Controller adds an own class for every Player.
|
||||
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
|
||||
slidecontroller or plugin which built them. ControllerType is the class
|
||||
containing the key values.
|
||||
ControllerType is the class containing the key values.
|
||||
|
||||
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
|
||||
for later use
|
||||
|
||||
``player``
|
||||
Individual player class which has been enabled
|
||||
:param player: Individual player class which has been enabled
|
||||
"""
|
||||
self.media_players[player.name] = player
|
||||
|
||||
@ -198,8 +196,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
|
||||
def media_state(self):
|
||||
"""
|
||||
Check if there is a running media Player and do updating stuff (e.g.
|
||||
update the UI)
|
||||
Check if there is a running media Player and do updating stuff (e.g. update the UI)
|
||||
"""
|
||||
if not list(self.current_media_players.keys()):
|
||||
self.timer.stop()
|
||||
@ -255,8 +252,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Registers media controls where the players will be placed to run.
|
||||
|
||||
``controller``
|
||||
The controller where a player will be placed
|
||||
:param controller: The controller where a player will be placed
|
||||
"""
|
||||
self.display_controllers[controller.controller_type] = 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
|
||||
|
||||
``controller``
|
||||
First element is the controller which should be used
|
||||
:param controller: First element is the controller which should be used
|
||||
"""
|
||||
controller.media_info = MediaInfo()
|
||||
# Build a Media ToolBar
|
||||
@ -312,14 +307,10 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
|
||||
def setup_display(self, display, preview):
|
||||
"""
|
||||
After a new display is configured, all media related widgets will be
|
||||
created too
|
||||
After a new display is configured, all media related widgets will be created too
|
||||
|
||||
``display``
|
||||
Display on which the output is to be played
|
||||
|
||||
``preview``
|
||||
Whether the display is a main or preview display
|
||||
:param display: Display on which the output is to be played
|
||||
:param preview: Whether the display is a main or preview display
|
||||
"""
|
||||
# clean up possible running old media files
|
||||
self.finalise()
|
||||
@ -336,14 +327,10 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
|
||||
def set_controls_visible(self, controller, value):
|
||||
"""
|
||||
After a new display is configured, all media related widget will be
|
||||
created too
|
||||
After a new display is configured, all media related widget will be created too
|
||||
|
||||
``controller``
|
||||
The controller on which controls act.
|
||||
|
||||
``value``
|
||||
control name to be changed.
|
||||
:param controller: The controller on which controls act.
|
||||
:param value: control name to be changed.
|
||||
"""
|
||||
# Generic controls
|
||||
controller.mediabar.setVisible(value)
|
||||
@ -354,14 +341,10 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
|
||||
def resize(self, display, player):
|
||||
"""
|
||||
After Mainwindow changes or Splitter moved all related media widgets
|
||||
have to be resized
|
||||
After Mainwindow changes or Splitter moved all related media widgets have to be resized
|
||||
|
||||
``display``
|
||||
The display on which output is playing.
|
||||
|
||||
``player``
|
||||
The player which is doing the playing.
|
||||
:param display: The display on which output is playing.
|
||||
:param player: The player which is doing the playing.
|
||||
"""
|
||||
player.resize(display)
|
||||
|
||||
@ -369,17 +352,10 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Loads and starts a video to run with the option of sound
|
||||
|
||||
``source``
|
||||
Where the call originated form
|
||||
|
||||
``service_item``
|
||||
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.
|
||||
:param source: Where the call originated form
|
||||
:param service_item: The player which is doing the playing
|
||||
:param hidden: The player which is doing the playing
|
||||
:param video_behind_text: Is the video to be played behind text.
|
||||
"""
|
||||
log.debug('video')
|
||||
is_valid = False
|
||||
@ -436,8 +412,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Loads and starts a media item to obtain the media length
|
||||
|
||||
``service_item``
|
||||
The ServiceItem containing the details to be played.
|
||||
:param service_item: The ServiceItem containing the details to be played.
|
||||
"""
|
||||
controller = self.display_controllers[DisplayControllerType.Plugin]
|
||||
log.debug('media_length')
|
||||
@ -465,11 +440,9 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Select the correct media Player type from the prioritized Player list
|
||||
|
||||
``controller``
|
||||
First element is the controller which should be used
|
||||
|
||||
``service_item``
|
||||
The ServiceItem containing the details to be played.
|
||||
:param controller: 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.
|
||||
"""
|
||||
used_players = get_media_players()[0]
|
||||
if service_item.processor != UiStrings().Automatic:
|
||||
@ -507,8 +480,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Responds to the request to play a loaded video
|
||||
|
||||
``msg``
|
||||
First element is the controller which should be used
|
||||
:param msg: First element is the controller which should be used
|
||||
:param status:
|
||||
"""
|
||||
log.debug('media_play_msg')
|
||||
self.media_play(msg[0], status)
|
||||
@ -517,8 +490,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Responds to the request to play a loaded video
|
||||
|
||||
``controller``
|
||||
The controller to be played
|
||||
:param controller: The controller to be played
|
||||
:param status:
|
||||
"""
|
||||
log.debug('media_play')
|
||||
controller.seek_slider.blockSignals(True)
|
||||
@ -557,8 +530,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Responds to the request to pause a loaded video
|
||||
|
||||
``msg``
|
||||
First element is the controller which should be used
|
||||
:param msg: First element is the controller which should be used
|
||||
"""
|
||||
log.debug('media_pause_msg')
|
||||
self.media_pause(msg[0])
|
||||
@ -567,8 +539,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Responds to the request to pause a loaded video
|
||||
|
||||
``controller``
|
||||
The Controller to be paused
|
||||
:param controller: The Controller to be paused
|
||||
"""
|
||||
log.debug('media_pause')
|
||||
display = self._define_display(controller)
|
||||
@ -581,8 +552,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Responds to the request to stop a loaded video
|
||||
|
||||
``msg``
|
||||
First element is the controller which should be used
|
||||
:param msg: First element is the controller which should be used
|
||||
"""
|
||||
log.debug('media_stop_msg')
|
||||
self.media_stop(msg[0])
|
||||
@ -591,8 +561,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Responds to the request to stop a loaded video
|
||||
|
||||
``controller``
|
||||
The controller that needs to be stopped
|
||||
:param controller: The controller that needs to be stopped
|
||||
"""
|
||||
log.debug('media_stop')
|
||||
display = self._define_display(controller)
|
||||
@ -609,8 +578,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Changes the volume of a running video
|
||||
|
||||
``msg``
|
||||
First element is the controller which should be used
|
||||
:param msg: First element is the controller which should be used
|
||||
"""
|
||||
controller = msg[0]
|
||||
vol = msg[1][0]
|
||||
@ -620,8 +588,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Changes the volume of a running video
|
||||
|
||||
``msg``
|
||||
First element is the controller which should be used
|
||||
:param controller: The Controller to use
|
||||
:param volume: The volume to be set
|
||||
"""
|
||||
log.debug('media_volume %d' % volume)
|
||||
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
|
||||
|
||||
``msg``
|
||||
First element is the controller which should be used
|
||||
:param msg: First element is the controller which should be used
|
||||
Second element is a list with the seek value as first element
|
||||
"""
|
||||
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
|
||||
|
||||
``controller``
|
||||
The controller to use.
|
||||
|
||||
``seek_value``
|
||||
The value to set.
|
||||
|
||||
:param controller: The controller to use.
|
||||
:param seek_value: The value to set.
|
||||
"""
|
||||
log.debug('media_seek')
|
||||
display = self._define_display(controller)
|
||||
@ -674,8 +637,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Hide the related video Widget
|
||||
|
||||
``msg``
|
||||
First element is the boolean for Live indication
|
||||
:param msg: First element is the boolean for Live indication
|
||||
"""
|
||||
is_live = msg[1]
|
||||
if not is_live:
|
||||
@ -690,8 +652,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Blank the related video Widget
|
||||
|
||||
``msg``
|
||||
First element is the boolean for Live indication
|
||||
:param msg: First element is the boolean for Live indication
|
||||
Second element is the hide mode
|
||||
"""
|
||||
is_live = msg[1]
|
||||
@ -708,8 +669,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Unblank the related video Widget
|
||||
|
||||
``msg``
|
||||
First element is not relevant in this context
|
||||
:param msg: First element is not relevant in this context
|
||||
Second element is the boolean for Live indication
|
||||
"""
|
||||
Registry().execute('live_display_show')
|
||||
@ -737,8 +697,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
"""
|
||||
Extract the correct display for a given controller
|
||||
|
||||
``controller``
|
||||
Controller to be used
|
||||
:param controller: Controller to be used
|
||||
"""
|
||||
if controller.is_live:
|
||||
return controller.display
|
||||
|
@ -66,10 +66,8 @@ ADDITIONAL_EXT = {
|
||||
|
||||
class PhononPlayer(MediaPlayer):
|
||||
"""
|
||||
A specialised version of the MediaPlayer class, which provides a Phonon
|
||||
display.
|
||||
A specialised version of the MediaPlayer class, which provides a Phonon display.
|
||||
"""
|
||||
|
||||
def __init__(self, parent):
|
||||
"""
|
||||
Constructor
|
||||
@ -83,11 +81,11 @@ class PhononPlayer(MediaPlayer):
|
||||
for mime_type in Phonon.BackendCapabilities.availableMimeTypes():
|
||||
mime_type = str(mime_type)
|
||||
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/'):
|
||||
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
|
||||
"""
|
||||
@ -95,8 +93,8 @@ class PhononPlayer(MediaPlayer):
|
||||
extensions = mimetypes.guess_all_extensions(str(mimetype))
|
||||
for extension in extensions:
|
||||
ext = '*%s' % extension
|
||||
if ext not in mimetype_list:
|
||||
mimetype_list.append(ext)
|
||||
if ext not in mime_type_list:
|
||||
mime_type_list.append(ext)
|
||||
log.info('MediaPlugin: %s extensions: %s' % (mimetype, ' '.join(extensions)))
|
||||
# Add extensions for this mimetype from self.additional_extensions.
|
||||
# This hack clears mimetypes' and operating system's shortcomings
|
||||
@ -104,8 +102,8 @@ class PhononPlayer(MediaPlayer):
|
||||
if mimetype in list(self.additional_extensions.keys()):
|
||||
for extension in self.additional_extensions[mimetype]:
|
||||
ext = '*%s' % extension
|
||||
if ext not in mimetype_list:
|
||||
mimetype_list.append(ext)
|
||||
if ext not in mime_type_list:
|
||||
mime_type_list.append(ext)
|
||||
log.info('MediaPlugin: %s additional extensions: %s' %
|
||||
(mimetype, ' '.join(self.additional_extensions[mimetype])))
|
||||
|
||||
|
@ -99,11 +99,11 @@ class PlayerTab(SettingsTab):
|
||||
self.player_order_layout = QtGui.QHBoxLayout(self.player_order_group_box)
|
||||
self.player_order_layout.setObjectName('player_order_layout')
|
||||
self.player_order_list_widget = QtGui.QListWidget(self.player_order_group_box)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.player_order_list_widget.sizePolicy().hasHeightForWidth())
|
||||
self.player_order_list_widget.setSizePolicy(sizePolicy)
|
||||
size_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
size_policy.setHorizontalStretch(0)
|
||||
size_policy.setVerticalStretch(0)
|
||||
size_policy.setHeightForWidth(self.player_order_list_widget.sizePolicy().hasHeightForWidth())
|
||||
self.player_order_list_widget.setSizePolicy(size_policy)
|
||||
self.player_order_list_widget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
|
||||
self.player_order_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.player_order_list_widget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
|
||||
|
@ -50,11 +50,9 @@ class MediaDockManager(object):
|
||||
"""
|
||||
Add a MediaManagerItem to the dock
|
||||
|
||||
``media_item``
|
||||
The item to add to the dock
|
||||
|
||||
``icon``
|
||||
An icon for this dock item
|
||||
:param media_item: The item to add to the dock
|
||||
:param icon: An icon for this dock item
|
||||
:param weight:
|
||||
"""
|
||||
visible_title = media_item.plugin.get_string(StringContent.VisibleName)
|
||||
log.info('Adding %s dock' % visible_title)
|
||||
@ -80,8 +78,7 @@ class MediaDockManager(object):
|
||||
"""
|
||||
Removes a MediaManagerItem from the dock
|
||||
|
||||
``media_item``
|
||||
The item to add to the dock
|
||||
:param media_item: The item to add to the dock
|
||||
"""
|
||||
visible_title = media_item.plugin.get_string(StringContent.VisibleName)
|
||||
log.debug('remove %s dock' % visible_title['title'])
|
||||
|
@ -239,23 +239,14 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog, RegistryProperties)
|
||||
|
||||
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
|
||||
set and if a ``parent`` is given, the element is appended.
|
||||
Creates a html element. If ``text`` is given, the element's text will set and if a ``parent`` is given,
|
||||
the element is appended.
|
||||
|
||||
``tag``
|
||||
The html tag, e. g. ``u'span'``. Defaults to ``None``.
|
||||
|
||||
``text``
|
||||
The text for the tag. Defaults to ``None``.
|
||||
|
||||
``parent``
|
||||
The parent element. Defaults to ``None``.
|
||||
|
||||
``classId``
|
||||
Value for the class attribute
|
||||
|
||||
``attribute``
|
||||
Tuple name/value pair to add as an optional attribute
|
||||
:param tag: 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``.
|
||||
:param classId: Value for the class attribute
|
||||
:param attribute: Tuple name/value pair to add as an optional attribute
|
||||
"""
|
||||
if text is not None:
|
||||
element = lxml.html.fragment_fromstring(str(text), create_parent=tag)
|
||||
|
@ -131,8 +131,7 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog, RegistryPrope
|
||||
"""
|
||||
Called when the currentRow has changed.
|
||||
|
||||
``row``
|
||||
The row number (int).
|
||||
:param row: The row number (int).
|
||||
"""
|
||||
# Disable all buttons, as no row is selected or only one image is left.
|
||||
if row == -1 or self.list_widget.count() == 1:
|
||||
|
@ -148,8 +148,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
|
||||
"""
|
||||
Register for updates to be done on save removing duplicate functions
|
||||
|
||||
``function``
|
||||
The function to be called
|
||||
:param function: The function to be called
|
||||
"""
|
||||
if not function in self.processes:
|
||||
self.processes.append(function)
|
@ -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
|
||||
``key_sequence`` can be used by the action, otherwise displays a dialog and returns ``False``.
|
||||
|
||||
``changing_action``
|
||||
The action which wants to use the ``key_sequence``.
|
||||
|
||||
``key_sequence``
|
||||
The key sequence which the action want so use.
|
||||
:param changing_action: The action which wants to use the ``key_sequence``.
|
||||
:param key_sequence: The key sequence which the action want so use.
|
||||
"""
|
||||
is_valid = True
|
||||
for category in self.action_list.categories:
|
||||
|
@ -55,8 +55,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
|
||||
"""
|
||||
Instantiate the wizard, and run any extra setup we need to.
|
||||
|
||||
``parent``
|
||||
The QWidget-derived parent of the wizard.
|
||||
:param parent: The QWidget-derived parent of the wizard.
|
||||
"""
|
||||
super(ThemeForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
@ -186,8 +186,7 @@ class ThemesTab(SettingsTab):
|
||||
"""
|
||||
Called from ThemeManager when the Themes have changed.
|
||||
|
||||
``theme_list``
|
||||
The list of available themes::
|
||||
:param theme_list: The list of available themes::
|
||||
|
||||
[u'Bible Theme', u'Song Theme']
|
||||
"""
|
||||
|
@ -64,12 +64,12 @@ class WizardStrings(object):
|
||||
PercentSymbolFormat = translate('OpenLP.Ui', '%p%')
|
||||
Ready = translate('OpenLP.Ui', 'Ready.')
|
||||
StartingImport = translate('OpenLP.Ui', 'Starting import...')
|
||||
YouSpecifyFile = translate('OpenLP.Ui', 'You need to specify one '
|
||||
'%s file to import from.', 'A file type e.g. OpenSong')
|
||||
YouSpecifyFiles = translate('OpenLP.Ui', 'You need to specify at '
|
||||
'least one %s file to import from.', 'A file type e.g. OpenSong')
|
||||
YouSpecifyFolder = translate('OpenLP.Ui', 'You need to specify one '
|
||||
'%s folder to import from.', 'A song format e.g. PowerSong')
|
||||
YouSpecifyFile = translate('OpenLP.Ui', 'You need to specify one %s file to import from.',
|
||||
'A file type e.g. OpenSong')
|
||||
YouSpecifyFiles = translate('OpenLP.Ui', 'You need to specify at least one %s file to import from.',
|
||||
'A file type e.g. OpenSong')
|
||||
YouSpecifyFolder = translate('OpenLP.Ui', 'You need to specify one %s folder to import from.',
|
||||
'A song format e.g. PowerSong')
|
||||
|
||||
|
||||
class OpenLPWizard(QtGui.QWizard, RegistryProperties):
|
||||
@ -121,7 +121,7 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
|
||||
self.setModal(True)
|
||||
self.setWizardStyle(QtGui.QWizard.ModernStyle)
|
||||
self.setOptions(QtGui.QWizard.IndependentPages |
|
||||
QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage)
|
||||
QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage)
|
||||
add_welcome_page(self, image)
|
||||
self.add_custom_pages()
|
||||
if self.with_progress_page:
|
||||
@ -209,18 +209,18 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
|
||||
Registry().execute('openlp_stop_wizard')
|
||||
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.
|
||||
"""
|
||||
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.perform_wizard()
|
||||
self.post_wizard()
|
||||
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
|
||||
"""
|
||||
@ -242,11 +242,8 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
|
||||
"""
|
||||
Update the wizard progress page.
|
||||
|
||||
``status_text``
|
||||
Current status information to display.
|
||||
|
||||
``increment``
|
||||
The value to increment the progress bar by.
|
||||
:param status_text: Current status information to display.
|
||||
:param increment: The value to increment the progress bar by.
|
||||
"""
|
||||
log.debug('IncrementBar %s', 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.
|
||||
|
||||
``title``
|
||||
The title of the dialog (unicode).
|
||||
|
||||
``editbox``
|
||||
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
|
||||
:param title: The title of the dialog (unicode).
|
||||
:param editbox: An editbox (QLineEdit).
|
||||
:param setting_name: The place where to save the last opened directory.
|
||||
:param filters: The file extension filters. It should contain the file description
|
||||
as well as the file extension. For example::
|
||||
|
||||
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.
|
||||
|
||||
``title``
|
||||
The title of the dialog (unicode).
|
||||
|
||||
``editbox``
|
||||
An editbox (QLineEdit).
|
||||
|
||||
``setting_name``
|
||||
The place where to save the last opened directory.
|
||||
:param title: The title of the dialog (unicode).
|
||||
:param editbox: An editbox (QLineEdit).
|
||||
:param setting_name: The place where to save the last opened directory.
|
||||
"""
|
||||
folder = QtGui.QFileDialog.getExistingDirectory(
|
||||
self, title, Settings().value(self.plugin.settings_section + '/' + setting_name),
|
||||
|
@ -179,8 +179,7 @@ def check_latest_version(current_version):
|
||||
Check the latest version of OpenLP against the version file on the OpenLP
|
||||
site.
|
||||
|
||||
``current_version``
|
||||
The current version of OpenLP.
|
||||
:param current_version: The current version of OpenLP.
|
||||
|
||||
**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.
|
||||
|
||||
``target``
|
||||
The menu or toolbar to add actions to.
|
||||
|
||||
``actions``
|
||||
The actions to be added. An action consisting of the keyword ``None``
|
||||
:param target: The menu or toolbar to add actions to
|
||||
:param actions: The actions to be added. An action consisting of the keyword ``None``
|
||||
will result in a separator being inserted into the target.
|
||||
"""
|
||||
for action in actions:
|
||||
@ -264,8 +260,7 @@ def is_not_image_file(file_name):
|
||||
"""
|
||||
Validate that the file is not an image file.
|
||||
|
||||
``file_name``
|
||||
File name to be checked.
|
||||
:param file_name: File name to be checked.
|
||||
"""
|
||||
if not file_name:
|
||||
return True
|
||||
@ -292,8 +287,7 @@ def clean_filename(filename):
|
||||
"""
|
||||
Removes invalid characters from the given ``filename``.
|
||||
|
||||
``filename``
|
||||
The "dirty" file name to clean.
|
||||
:param filename: The "dirty" file name to clean.
|
||||
"""
|
||||
if not isinstance(filename, str):
|
||||
filename = str(filename, 'utf-8')
|
||||
@ -304,8 +298,7 @@ def delete_file(file_path_name):
|
||||
"""
|
||||
Deletes a file from the system.
|
||||
|
||||
``file_path_name``
|
||||
The file, including path, to delete.
|
||||
:param file_path_name: The file, including path, to delete.
|
||||
"""
|
||||
if not file_path_name:
|
||||
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.
|
||||
|
||||
``url``
|
||||
The URL to be 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.
|
||||
:param url: 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.
|
||||
Defaults to False.
|
||||
"""
|
||||
# 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.
|
||||
|
||||
``resolver``
|
||||
The UNO resolver to use to find a running instance.
|
||||
:param resolver: The UNO resolver to use to find a running instance.
|
||||
"""
|
||||
log.debug('get UNO Desktop Openoffice - resolve')
|
||||
if UNO_CONNECTION_TYPE == 'pipe':
|
||||
@ -404,11 +391,8 @@ def format_time(text, local_time):
|
||||
unicode string and passes individual % placeholders to time.strftime().
|
||||
This ensures only ascii characters are passed to time.strftime().
|
||||
|
||||
``text``
|
||||
The text to be processed.
|
||||
|
||||
``local_time``
|
||||
The time to be used to add to the string. This is a time object
|
||||
:param text: The text to be processed.
|
||||
:param local_time: The time to be used to add to the string. This is a time object
|
||||
"""
|
||||
def match_formatting(match):
|
||||
"""
|
||||
@ -422,8 +406,7 @@ def get_locale_key(string):
|
||||
"""
|
||||
Creates a key for case insensitive, locale aware string sorting.
|
||||
|
||||
``string``
|
||||
The corresponding string.
|
||||
:param string: The corresponding string.
|
||||
"""
|
||||
string = string.lower()
|
||||
# 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:
|
||||
return locale.strxfrm(string).encode()
|
||||
|
||||
|
||||
def get_natural_key(string):
|
||||
"""
|
||||
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',
|
||||
'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']
|
||||
'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']
|
||||
|
@ -258,17 +258,12 @@ class ActionList(object):
|
||||
|
||||
**Note**: The action's objectName must be set when you want to add it!
|
||||
|
||||
``action``
|
||||
The action to add (QAction). **Note**, the action must not have an empty ``objectName``.
|
||||
|
||||
``category``
|
||||
The category this action belongs to. The category has to be a python string. . **Note**, if the category
|
||||
is ``None``, the category and its actions are being hidden in the shortcut dialog. However, if they are
|
||||
added, it is possible to avoid assigning shortcuts twice, which is important.
|
||||
|
||||
``weight``
|
||||
The weight specifies how important a category is. However, this only has an impact on the order the
|
||||
categories are displayed.
|
||||
:param action: The action to add (QAction). **Note**, the action must not have an empty ``objectName``.
|
||||
:param category: The category this action belongs to. The category has to be a python string. . **Note**,
|
||||
if the category is ``None``, the category and its actions are being hidden in the shortcut dialog. However,
|
||||
if they are added, it is possible to avoid assigning shortcuts twice, which is important.
|
||||
:param 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:
|
||||
self.categories.append(category)
|
||||
@ -319,11 +314,8 @@ class ActionList(object):
|
||||
"""
|
||||
This removes an action from its category. Empty categories are automatically removed.
|
||||
|
||||
``action``
|
||||
The ``QAction`` object to be removed.
|
||||
|
||||
``category``
|
||||
The name (unicode string) of the category, which contains the action. Defaults to None.
|
||||
:param action: The ``QAction`` object to be removed.
|
||||
:param category: The name (unicode string) of the category, which contains the action. Defaults to None.
|
||||
"""
|
||||
if category not in self.categories:
|
||||
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.
|
||||
|
||||
``name``
|
||||
The category's name.
|
||||
|
||||
``weight``
|
||||
The category's weight (int).
|
||||
:param name: The category's name.
|
||||
:param weight: The category's weight (int).
|
||||
"""
|
||||
if name in self.categories:
|
||||
# Only change the weight and resort the categories again.
|
||||
@ -361,15 +350,11 @@ class ActionList(object):
|
||||
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.
|
||||
|
||||
**Note**: The new action's shortcuts **must** be assigned to the given ``action`` **before** calling this
|
||||
method.
|
||||
|
||||
``action``
|
||||
The action whose shortcuts are supposed to be updated in the ``shortcut_map``.
|
||||
|
||||
``old_shortcuts``
|
||||
A list of unicode keysequences.
|
||||
:param action: The action whose shortcuts are supposed to be updated in the ``shortcut_map``.
|
||||
:param old_shortcuts: A list of unicode key sequences.
|
||||
"""
|
||||
for old_shortcut in old_shortcuts:
|
||||
# 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.
|
||||
|
||||
``existing_actions``
|
||||
A list of actions which already use a particular shortcut.
|
||||
|
||||
``action``
|
||||
The action which wants to use a particular shortcut.
|
||||
:param existing_actions: A list of actions which already use a particular shortcut.
|
||||
:param action: The action which wants to use a particular shortcut.
|
||||
"""
|
||||
global_context = action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]
|
||||
affected_actions = []
|
||||
|
@ -52,8 +52,7 @@ class LanguageManager(object):
|
||||
"""
|
||||
Set up a translator to use in this instance of OpenLP
|
||||
|
||||
``language``
|
||||
The language to load into the translator
|
||||
:param language: The language to load into the translator
|
||||
"""
|
||||
if LanguageManager.auto_language:
|
||||
language = QtCore.QLocale.system().name()
|
||||
@ -85,8 +84,7 @@ class LanguageManager(object):
|
||||
"""
|
||||
Load the language name from a language file
|
||||
|
||||
``qm_file``
|
||||
The file to obtain the name from
|
||||
:param qm_file: The file to obtain the name from
|
||||
"""
|
||||
translator = QtCore.QTranslator()
|
||||
translator.load(qm_file)
|
||||
@ -110,11 +108,8 @@ class LanguageManager(object):
|
||||
"""
|
||||
Set the language to translate OpenLP into
|
||||
|
||||
``action``
|
||||
The language menu option
|
||||
|
||||
``message``
|
||||
Display the message option
|
||||
:param action: The language menu option
|
||||
:param message: Display the message option
|
||||
"""
|
||||
language = 'en'
|
||||
if action:
|
||||
|
@ -136,8 +136,7 @@ class BiblePlugin(Plugin):
|
||||
"""
|
||||
Give the bible plugin the opportunity to add items to the **Tools** menu.
|
||||
|
||||
``tools_menu``
|
||||
The actual **Tools** menu item, so that your actions can use it as their parent.
|
||||
:param tools_menu: The actual **Tools** menu item, so that your actions can use it as their parent.
|
||||
"""
|
||||
log.debug('add tools menu')
|
||||
self.tools_upgrade_item = create_action(
|
||||
|
@ -67,14 +67,9 @@ class BibleImportForm(OpenLPWizard):
|
||||
"""
|
||||
Instantiate the wizard, and run any extra setup we need to.
|
||||
|
||||
``parent``
|
||||
The QWidget-derived parent of the wizard.
|
||||
|
||||
``manager``
|
||||
The Bible manager.
|
||||
|
||||
``bible_plugin``
|
||||
The Bible plugin.
|
||||
:param parent: The QWidget-derived parent of the wizard.
|
||||
:param manager: The Bible manager.
|
||||
:param bible_plugin: The Bible plugin.
|
||||
"""
|
||||
self.manager = manager
|
||||
self.web_bible_list = {}
|
||||
|
@ -57,14 +57,9 @@ class BibleUpgradeForm(OpenLPWizard):
|
||||
"""
|
||||
Instantiate the wizard, and run any extra setup we need to.
|
||||
|
||||
``parent``
|
||||
The QWidget-derived parent of the wizard.
|
||||
|
||||
``manager``
|
||||
The Bible manager.
|
||||
|
||||
``bible_plugin``
|
||||
The Bible plugin.
|
||||
:param parent: The QWidget-derived parent of the wizard.
|
||||
:param manager: The Bible manager.
|
||||
:param bible_plugin: The Bible plugin.
|
||||
"""
|
||||
self.manager = manager
|
||||
self.media_item = bible_plugin.media_item
|
||||
|
@ -41,6 +41,7 @@ from openlp.plugins.bibles.lib.db import BiblesResourcesDB
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
|
||||
"""
|
||||
Class to manage the editing of a bible
|
||||
@ -57,12 +58,13 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
|
||||
self.setupUi(self)
|
||||
self.manager = manager
|
||||
|
||||
def loadBible(self, bible):
|
||||
def load_bible(self, bible):
|
||||
"""
|
||||
Loads a bible.
|
||||
|
||||
``bible``
|
||||
The name of the bible.
|
||||
|
||||
:param bible: The name of the bible.
|
||||
"""
|
||||
log.debug('Load 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':
|
||||
self.language_selection_combo_box.setCurrentIndex(int(book_name_language.value) + 1)
|
||||
self.books = {}
|
||||
self.webbible = self.manager.get_meta_data(self.bible, 'download_source')
|
||||
if self.webbible:
|
||||
self.book_name_notice.setText(translate('BiblesPlugin.EditBibleForm',
|
||||
'This is a Web Download Bible.\nIt is not possible to customize the Book Names.'))
|
||||
self.web_bible = self.manager.get_meta_data(self.bible, 'download_source')
|
||||
if self.web_bible:
|
||||
self.book_name_notice.setText(
|
||||
translate('BiblesPlugin.EditBibleForm',
|
||||
'This is a Web Download Bible.\nIt is not possible to customize the Book Names.'))
|
||||
self.scroll_area.hide()
|
||||
else:
|
||||
self.book_name_notice.setText(translate('BiblesPlugin.EditBibleForm',
|
||||
'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.'))
|
||||
self.book_name_notice.setText(
|
||||
translate('BiblesPlugin.EditBibleForm',
|
||||
'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():
|
||||
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)
|
||||
else:
|
||||
# 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
|
||||
if book_name_language == -1:
|
||||
book_name_language = None
|
||||
if not self.validateMeta(version, copyright):
|
||||
if not self.validate_meta(version, copyright):
|
||||
return
|
||||
if not self.webbible:
|
||||
if not self.web_bible:
|
||||
custom_names = {}
|
||||
for abbr, book in self.books.items():
|
||||
if book:
|
||||
custom_names[abbr] = self.book_name_edit[abbr].text()
|
||||
if book.name != custom_names[abbr]:
|
||||
if not self.validateBook(custom_names[abbr], abbr):
|
||||
if not self.validate_book(custom_names[abbr], abbr):
|
||||
return
|
||||
self.application.set_busy_cursor()
|
||||
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():
|
||||
if book:
|
||||
if book.name != custom_names[abbr]:
|
||||
@ -135,47 +139,52 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
|
||||
self.application.set_normal_cursor()
|
||||
QtGui.QDialog.accept(self)
|
||||
|
||||
def validateMeta(self, name, copyright):
|
||||
def validate_meta(self, name, copyright):
|
||||
"""
|
||||
Validate the Meta before saving.
|
||||
"""
|
||||
if not name:
|
||||
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.'))
|
||||
return False
|
||||
elif not copyright:
|
||||
self.copyright_edit.setFocus()
|
||||
critical_error_message_box(UiStrings().EmptyField,
|
||||
critical_error_message_box(
|
||||
UiStrings().EmptyField,
|
||||
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
|
||||
elif self.manager.exists(name) and self.manager.get_meta_data(self.bible, 'name').value != \
|
||||
name:
|
||||
elif self.manager.exists(name) and self.manager.get_meta_data(self.bible, 'name').value != name:
|
||||
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 '
|
||||
'a different Bible or first delete the existing one.'))
|
||||
'a different Bible or first delete the existing one.'))
|
||||
return False
|
||||
return True
|
||||
|
||||
def validateBook(self, new_book_name, abbreviation):
|
||||
def validate_book(self, new_book_name, abbreviation):
|
||||
"""
|
||||
Validate a book.
|
||||
"""
|
||||
book_regex = re.compile('[\d]*[^\d]+$')
|
||||
if not new_book_name:
|
||||
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".') %
|
||||
self.book_names[abbreviation])
|
||||
self.book_names[abbreviation])
|
||||
return False
|
||||
elif not book_regex.match(new_book_name):
|
||||
self.book_name_edit[abbreviation].setFocus()
|
||||
critical_error_message_box(UiStrings().EmptyField,
|
||||
critical_error_message_box(
|
||||
UiStrings().EmptyField,
|
||||
translate('BiblesPlugin.BibleEditForm',
|
||||
'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)
|
||||
'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)
|
||||
return False
|
||||
for abbr, book in self.books.items():
|
||||
if book:
|
||||
@ -186,6 +195,6 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
|
||||
critical_error_message_box(
|
||||
translate('BiblesPlugin.BibleEditForm', 'Duplicate Book Name'),
|
||||
translate('BiblesPlugin.BibleEditForm', 'The Book Name "%s" has been entered more than once.')
|
||||
% new_book_name)
|
||||
% new_book_name)
|
||||
return False
|
||||
return True
|
||||
|
@ -74,8 +74,7 @@ def init_schema(url):
|
||||
"""
|
||||
Setup a bible database connection and initialise the database schema.
|
||||
|
||||
``url``
|
||||
The database to setup.
|
||||
:param url: The database to setup.
|
||||
"""
|
||||
session, metadata = init_db(url)
|
||||
|
||||
@ -711,9 +710,9 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
||||
@staticmethod
|
||||
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)
|
||||
if not isinstance(source, str):
|
||||
@ -735,10 +734,10 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
||||
@staticmethod
|
||||
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 source: The source of the webbible.
|
||||
:param abbreviation: The abbreviation of the web_bible.
|
||||
:param source: The source of the web_bible.
|
||||
"""
|
||||
log.debug('BiblesResourcesDB.get_webbibles("%s", "%s")', abbreviation, source)
|
||||
if not isinstance(abbreviation, str):
|
||||
|
@ -641,8 +641,7 @@ def send_error_message(error_type):
|
||||
"""
|
||||
Send a standard error message informing the user of an issue.
|
||||
|
||||
``error_type``
|
||||
The type of error that occured for the issue.
|
||||
:param error_type: The type of error that occurred for the issue.
|
||||
"""
|
||||
if error_type == 'download':
|
||||
critical_error_message_box(
|
||||
|
@ -475,7 +475,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
bible = self.advancedVersionComboBox.currentText()
|
||||
if bible:
|
||||
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_():
|
||||
self.reload_bibles()
|
||||
|
||||
|
@ -83,14 +83,10 @@ class CustomPlugin(Plugin):
|
||||
|
||||
def rename_theme(self, old_theme, new_theme):
|
||||
"""
|
||||
Renames a theme the custom plugin is using making the plugin use the
|
||||
new name.
|
||||
Renames a theme the custom plugin is using making the plugin use the new name.
|
||||
|
||||
``oldTheme``
|
||||
The name of the theme the plugin should stop using.
|
||||
|
||||
``newTheme``
|
||||
The new name the plugin should now use.
|
||||
:param old_theme: The name of the theme the plugin should stop using.
|
||||
:param new_theme: The new name the plugin should now use.
|
||||
"""
|
||||
customs_using_theme = self.db_manager.get_all_objects(CustomSlide, CustomSlide.theme_name == old_theme)
|
||||
for custom in customs_using_theme:
|
||||
|
@ -127,8 +127,7 @@ class CustomXMLParser(object):
|
||||
"""
|
||||
Set up our custom XML parser.
|
||||
|
||||
``xml``
|
||||
The XML of the custom to be parsed.
|
||||
:param xml: The XML of the custom to be parsed.
|
||||
"""
|
||||
self.custom_xml = None
|
||||
if xml[:5] == '<?xml':
|
||||
@ -140,8 +139,7 @@ class CustomXMLParser(object):
|
||||
|
||||
def get_verses(self):
|
||||
"""
|
||||
Iterates through the verses in the XML and returns a list of verses
|
||||
and their attributes.
|
||||
Iterates through the verses in the XML and returns a list of verses and their attributes.
|
||||
"""
|
||||
xml_iter = self.custom_xml.getiterator()
|
||||
verse_list = []
|
||||
|
@ -60,8 +60,7 @@ def init_schema(url):
|
||||
"""
|
||||
Setup the custom database connection and initialise the database schema
|
||||
|
||||
``url``
|
||||
The database to setup
|
||||
:param url: The database to setup
|
||||
"""
|
||||
session, metadata = init_db(url)
|
||||
|
||||
|
@ -41,8 +41,7 @@ class Ui_ChooseGroupDialog(object):
|
||||
"""
|
||||
Set up the UI.
|
||||
|
||||
``choose_group_dialog``
|
||||
The form object (not the class).
|
||||
:param choose_group_dialog: The form object (not the class).
|
||||
"""
|
||||
choose_group_dialog.setObjectName('choose_group_dialog')
|
||||
choose_group_dialog.resize(399, 119)
|
||||
@ -84,8 +83,7 @@ class Ui_ChooseGroupDialog(object):
|
||||
"""
|
||||
Translate the UI on the fly.
|
||||
|
||||
``choose_group_dialog``
|
||||
The form object (not the class).
|
||||
:param choose_group_dialog: The form object (not the class).
|
||||
"""
|
||||
choose_group_dialog.setWindowTitle(translate('ImagePlugin.ChooseGroupForm', 'Select Image Group'))
|
||||
self.group_question_label.setText(translate('ImagePlugin.ChooseGroupForm', 'Add images to group:'))
|
||||
|
@ -47,8 +47,7 @@ class ChooseGroupForm(QtGui.QDialog, Ui_ChooseGroupDialog):
|
||||
"""
|
||||
Show the form
|
||||
|
||||
``selected_group``
|
||||
The ID of the group that should be selected by default when showing the dialog.
|
||||
:param selected_group: The ID of the group that should be selected by default when showing the dialog.
|
||||
"""
|
||||
self.new_group_edit.clear()
|
||||
if selected_group is not None:
|
||||
|
@ -84,8 +84,7 @@ class ImagePlugin(Plugin):
|
||||
"""
|
||||
Upgrade the settings of this plugin.
|
||||
|
||||
``settings``
|
||||
The Settings object containing the old settings.
|
||||
:param settings: The Settings object containing the old settings.
|
||||
"""
|
||||
files_from_config = settings.get_files_from_config(self)
|
||||
if files_from_config:
|
||||
|
@ -54,9 +54,7 @@ def init_schema(url):
|
||||
"""
|
||||
Setup the images database connection and initialise the database schema.
|
||||
|
||||
``url``
|
||||
The database to setup
|
||||
|
||||
:param url: The database to setup
|
||||
The images database contains the following tables:
|
||||
|
||||
* image_groups
|
||||
|
@ -218,8 +218,7 @@ class PresentationDocument(object):
|
||||
"""
|
||||
Jumps directly to the requested slide.
|
||||
|
||||
``slide_no``
|
||||
The slide to jump to, starting at 1
|
||||
:param slide_no: The slide to jump to, starting at 1
|
||||
"""
|
||||
pass
|
||||
|
||||
@ -250,8 +249,8 @@ class PresentationDocument(object):
|
||||
"""
|
||||
Returns an image path containing a preview for the requested slide
|
||||
|
||||
``slide_no``
|
||||
The slide an image is required for, starting at 1
|
||||
:param slide_no: 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')
|
||||
if os.path.isfile(path) or not check_exists:
|
||||
|
@ -208,11 +208,8 @@ class HttpRouter(RegistryProperties):
|
||||
"""
|
||||
Invoke the route function passing the relevant values
|
||||
|
||||
``function``
|
||||
The function to be calledL.
|
||||
|
||||
``*args``
|
||||
Any passed data.
|
||||
:param function: The function to be called.
|
||||
:param args: Any passed data.
|
||||
"""
|
||||
response = function['function'](*args)
|
||||
if response:
|
||||
@ -223,11 +220,8 @@ class HttpRouter(RegistryProperties):
|
||||
"""
|
||||
Common function to process HTTP requests
|
||||
|
||||
``url_path``
|
||||
The requested URL.
|
||||
|
||||
``*args``
|
||||
Any passed data.
|
||||
:param url_path: The requested URL.
|
||||
:param args: Any passed data.
|
||||
"""
|
||||
self.request_data = None
|
||||
url_path_split = urlparse(url_path)
|
||||
@ -379,8 +373,7 @@ class HttpRouter(RegistryProperties):
|
||||
|
||||
def get_content_type(self, file_name):
|
||||
"""
|
||||
Examines the extension of the file and determines
|
||||
what the content_type should be, defaults to text/plain
|
||||
Examines the extension of the file and determines what the content_type should be, defaults to text/plain
|
||||
Returns the extension and the content_type
|
||||
"""
|
||||
content_type = 'text/plain'
|
||||
@ -432,8 +425,7 @@ class HttpRouter(RegistryProperties):
|
||||
Hide or show the display screen.
|
||||
This is a cross Thread call and UI is updated so Events need to be used.
|
||||
|
||||
``action``
|
||||
This is the action, either ``hide`` or ``show``.
|
||||
:param action: This is the action, either ``hide`` or ``show``.
|
||||
"""
|
||||
self.live_controller.emit(QtCore.SIGNAL('slidecontroller_toggle_display'), action)
|
||||
self.do_json_header()
|
||||
@ -489,11 +481,8 @@ class HttpRouter(RegistryProperties):
|
||||
"""
|
||||
Perform an action on the slide controller.
|
||||
|
||||
``display_type``
|
||||
This is the type of slide controller, either ``preview`` or ``live``.
|
||||
|
||||
``action``
|
||||
The action to perform.
|
||||
:param display_type: This is the type of slide controller, either ``preview`` or ``live``.
|
||||
:param action: The action to perform.
|
||||
"""
|
||||
event = 'slidecontroller_%s_%s' % (display_type, action)
|
||||
if self.request_data:
|
||||
@ -514,8 +503,6 @@ class HttpRouter(RegistryProperties):
|
||||
"""
|
||||
Handles requests for service items in the service manager
|
||||
|
||||
``action``
|
||||
The action to perform.
|
||||
"""
|
||||
self.do_json_header()
|
||||
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
|
||||
|
||||
``action``
|
||||
The action to perform.
|
||||
:param action: The action to perform.
|
||||
"""
|
||||
event = 'servicemanager_%s_item' % action
|
||||
if self.request_data:
|
||||
@ -543,9 +529,7 @@ class HttpRouter(RegistryProperties):
|
||||
"""
|
||||
Return plugin related information, based on the action.
|
||||
|
||||
``action``
|
||||
The action to perform. If *search* return a list of plugin names
|
||||
which support search.
|
||||
:param action: The action to perform. If *search* return a list of plugin names which support search.
|
||||
"""
|
||||
if action == 'search':
|
||||
searches = []
|
||||
@ -559,8 +543,7 @@ class HttpRouter(RegistryProperties):
|
||||
"""
|
||||
Return a list of items that match the search text.
|
||||
|
||||
``plugin``
|
||||
The plugin name to search in.
|
||||
:param plugin_name: The plugin name to search in.
|
||||
"""
|
||||
try:
|
||||
text = json.loads(self.request_data)['request']['text']
|
||||
|
@ -83,8 +83,7 @@ class HttpThread(QtCore.QThread):
|
||||
"""
|
||||
Constructor for the thread class.
|
||||
|
||||
``server``
|
||||
The http server class.
|
||||
:param server: The http server class.
|
||||
"""
|
||||
super(HttpThread, self).__init__(None)
|
||||
self.http_server = server
|
||||
|
@ -56,7 +56,7 @@ class RemoteTab(SettingsTab):
|
||||
self.address_edit = QtGui.QLineEdit(self.server_settings_group_box)
|
||||
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))
|
||||
self))
|
||||
self.address_edit.setObjectName('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)
|
||||
@ -177,14 +177,13 @@ class RemoteTab(SettingsTab):
|
||||
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.android_app_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'Android App'))
|
||||
self.qr_description_label.setText(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 '
|
||||
'Android app from Google Play.'))
|
||||
self.qr_description_label.setText(
|
||||
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 Android app from Google Play.'))
|
||||
self.https_settings_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'HTTPS Server'))
|
||||
self.https_error_label.setText(translate('RemotePlugin.RemoteTab',
|
||||
'Could not find an SSL certificate. The HTTPS server will not be available unless an SSL certificate '
|
||||
'is found. Please see the manual for more information.'))
|
||||
self.https_error_label.setText(
|
||||
translate('RemotePlugin.RemoteTab', 'Could not find an SSL certificate. The HTTPS server will not be '
|
||||
'available unless an SSL certificate is found. Please see the manual for more information.'))
|
||||
self.https_port_label.setText(self.port_label.text())
|
||||
self.remote_https_url_label.setText(self.remote_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
|
||||
"""
|
||||
self.http_settings_group_box.setEnabled(not self.https_settings_group_box.isChecked())
|
||||
|
||||
|
@ -83,9 +83,9 @@ class RemotesPlugin(Plugin):
|
||||
Information about this plugin
|
||||
"""
|
||||
about_text = translate('RemotePlugin', '<strong>Remote Plugin</strong>'
|
||||
'<br />The remote plugin provides the ability to send messages to '
|
||||
'a running version of OpenLP on a different computer via a web '
|
||||
'browser or through the remote API.')
|
||||
'<br />The remote plugin provides the ability to send messages to '
|
||||
'a running version of OpenLP on a different computer via a web '
|
||||
'browser or through the remote API.')
|
||||
return about_text
|
||||
|
||||
def set_plugin_text_strings(self):
|
||||
|
@ -52,8 +52,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
||||
"""
|
||||
Execute the dialog.
|
||||
|
||||
``clear``
|
||||
Clear the form fields before displaying the dialog.
|
||||
:param clear: Clear the form fields before displaying the dialog.
|
||||
"""
|
||||
if 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
|
||||
a display name from the first and last names.
|
||||
|
||||
``display_name``
|
||||
The text from the first_name_edit widget.
|
||||
:param display_name: The text from the first_name_edit widget.
|
||||
"""
|
||||
if not self.auto_display_name:
|
||||
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
|
||||
a display name from the first and last names.
|
||||
|
||||
``display_name``
|
||||
The text from the last_name_edit widget.
|
||||
:param display_name: The text from the last_name_edit widget.
|
||||
"""
|
||||
if not self.auto_display_name:
|
||||
return
|
||||
|
@ -334,11 +334,8 @@ def create_combo_box(parent, name):
|
||||
"""
|
||||
Utility method to generate a standard combo box for this dialog.
|
||||
|
||||
``parent``
|
||||
The parent widget for this combo box.
|
||||
|
||||
``name``
|
||||
The object name.
|
||||
:param parent: The parent widget for this combo box.
|
||||
:param name: The object name
|
||||
"""
|
||||
combo_box = QtGui.QComboBox(parent)
|
||||
combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
|
||||
|
@ -82,8 +82,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog, RegistryPrope
|
||||
"""
|
||||
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**.
|
||||
"""
|
||||
self.from_song_edit = from_song_edit
|
||||
|
@ -58,11 +58,8 @@ class SongReviewWidget(QtGui.QWidget):
|
||||
|
||||
def __init__(self, parent, song):
|
||||
"""
|
||||
``parent``
|
||||
The QWidget-derived parent of the wizard.
|
||||
|
||||
``song``
|
||||
The Song which this SongReviewWidget should represent.
|
||||
:param parent: The QWidget-derived parent of the wizard.
|
||||
:param song: The Song which this SongReviewWidget should represent.
|
||||
"""
|
||||
super(SongReviewWidget, self).__init__(parent)
|
||||
self.song = song
|
||||
|
@ -92,9 +92,7 @@ def init_schema(url):
|
||||
"""
|
||||
Setup the songs database connection and initialise the database schema.
|
||||
|
||||
``url``
|
||||
The database to setup
|
||||
|
||||
:param url: The database to setup
|
||||
The song database contains the following tables:
|
||||
|
||||
* authors
|
||||
|
@ -211,8 +211,7 @@ class FoilPresenter(object):
|
||||
"""
|
||||
Create and save a song from Foilpresenter format xml to the database.
|
||||
|
||||
``xml``
|
||||
The XML to parse (unicode).
|
||||
:param xml: The XML to parse (unicode).
|
||||
"""
|
||||
# No xml get out of here.
|
||||
if not xml:
|
||||
|
@ -361,11 +361,8 @@ class SongFormat(object):
|
||||
"""
|
||||
Return requested song format attribute(s).
|
||||
|
||||
``format``
|
||||
A song format from SongFormat.
|
||||
|
||||
``*attributes``
|
||||
Zero or more song format attributes from SongFormat.
|
||||
:param format: A song format from SongFormat.
|
||||
:param attributes: Zero or more song format attributes from SongFormat.
|
||||
|
||||
Return type depends on number of supplied attributes:
|
||||
|
||||
|
@ -65,8 +65,7 @@ class OpenLPSongImport(SongImport):
|
||||
"""
|
||||
Run the import for an OpenLP version 2 song database.
|
||||
|
||||
``progress_dialog``
|
||||
The QProgressDialog used when importing songs from the FRW.
|
||||
:param progress_dialog: The QProgressDialog used when importing songs from the FRW.
|
||||
"""
|
||||
|
||||
class OldAuthor(BaseModel):
|
||||
|
13
setup.py
13
setup.py
@ -41,8 +41,7 @@ def try_int(s):
|
||||
Convert string s to an integer if possible. Fail silently and return
|
||||
the string as-is if it isn't an integer.
|
||||
|
||||
``s``
|
||||
The string to try to convert.
|
||||
:param s: The string to try to convert.
|
||||
"""
|
||||
try:
|
||||
return int(s)
|
||||
@ -54,8 +53,7 @@ def natural_sort_key(s):
|
||||
"""
|
||||
Return a tuple by which s is sorted.
|
||||
|
||||
``s``
|
||||
A string value from the list we want to sort.
|
||||
:param s: A string value from the list we want to sort.
|
||||
"""
|
||||
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.
|
||||
|
||||
``a``
|
||||
A string to compare.
|
||||
|
||||
``b``
|
||||
A string to compare.
|
||||
:param a: A string to compare.
|
||||
:param b: A string to compare.
|
||||
"""
|
||||
return cmp(natural_sort_key(a), natural_sort_key(b))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user