openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #19844
[Merge] lp:~googol/openlp/short-lines into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/short-lines into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
Andreas Preikschat (googol)
For more details, see:
https://code.launchpad.net/~googol/openlp/short-lines/+merge/152249
Hello,
- fixed short lines
- renamed variables/attributes
- added clean_tags() test
- log a warning when a shortcut cannot be used
- new style to connect to signals (only a few are left which I think need special treatment, but that has to be looked at closer!)
--
https://code.launchpad.net/~googol/openlp/short-lines/+merge/152249
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py 2013-03-01 17:45:17 +0000
+++ openlp/core/__init__.py 2013-03-07 18:01:28 +0000
@@ -57,7 +57,7 @@
log = logging.getLogger()
-nt_repair_stylesheet = u"""
+NT_REPAIR_STYLESHEET = u"""
QMainWindow::separator
{
border: none;
@@ -102,11 +102,9 @@
Run the OpenLP application.
"""
self.is_event_loop_active = False
- # On Windows, the args passed into the constructor are ignored. Not
- # very handy, so set the ones we want to use. On Linux and FreeBSD, in
- # order to set the WM_CLASS property for X11, we pass "OpenLP" in as a
- # command line argument. This interferes with files being passed in as
- # command line arguments, so we remove it from the list.
+ # On Windows, the args passed into the constructor are ignored. Not very handy, so set the ones we want to use.
+ # On Linux and FreeBSD, in order to set the WM_CLASS property for X11, we pass "OpenLP" in as a command line
+ # argument. This interferes with files being passed in as command line arguments, so we remove it from the list.
if 'OpenLP' in args:
args.remove('OpenLP')
self.args.extend(args)
@@ -125,7 +123,7 @@
u'QTableWidget, QListWidget, QTreeWidget {alternate-background-color: ' + base_color.name() + ';}\n'
application_stylesheet += alternate_rows_repair_stylesheet
if os.name == u'nt':
- application_stylesheet += nt_repair_stylesheet
+ application_stylesheet += NT_REPAIR_STYLESHEET
if application_stylesheet:
self.setStyleSheet(application_stylesheet)
show_splash = Settings().value(u'general/show splash')
@@ -189,7 +187,7 @@
log.exception(''.join(format_exception(exctype, value, traceback)))
if not hasattr(self, u'exception_form'):
self.exception_form = ExceptionForm(self.main_window)
- self.exception_form.exceptionTextEdit.setPlainText(''.join(format_exception(exctype, value, traceback)))
+ self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exctype, value, traceback)))
self.set_normal_cursor()
self.exception_form.exec_()
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2013-03-01 17:45:17 +0000
+++ openlp/core/lib/__init__.py 2013-03-07 18:01:28 +0000
@@ -49,9 +49,8 @@
class ImageSource(object):
"""
- This enumeration class represents different image sources. An image sources
- states where an image is used. This enumeration class is need in the context
- of the :class:~openlp.core.lib.imagemanager`.
+ This enumeration class represents different image sources. An image sources states where an image is used. This
+ enumeration class is need in the context of the :class:~openlp.core.lib.imagemanager`.
``ImagePlugin``
This states that an image is being used by the image plugin.
@@ -73,8 +72,8 @@
class SlideLimits(object):
"""
- Provides an enumeration for behaviour of OpenLP at the end limits of each
- service item when pressing the up/down arrow keys
+ Provides an enumeration for behaviour of OpenLP at the end limits of each service item when pressing the up/down
+ arrow keys
"""
End = 1
Wrap = 2
@@ -83,8 +82,7 @@
class ServiceItemAction(object):
"""
- Provides an enumeration for the required action moving between service
- items by left/right arrow keys
+ Provides an enumeration for the required action moving between service items by left/right arrow keys
"""
Previous = 1
PreviousLastSlide = 2
@@ -92,32 +90,28 @@
def translate(context, text, comment=None, encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
- translate=QtCore.QCoreApplication.translate):
+ qt_translate=QtCore.QCoreApplication.translate):
"""
- 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.
+ 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.
+ 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.
+ An identifying string for when the same text is used in different roles within the same context.
"""
- return translate(context, text, comment, encoding, n)
+ return qt_translate(context, text, comment, encoding, n)
def get_text_file_string(text_file):
"""
- Open a file and return its content as unicode string. If the supplied file
- name is not a file then the function returns False. If there is an error
- loading the file or the content can't be decoded then the function will
- return None.
+ Open a file and return its content as unicode string. If the supplied file name is not a file then the function
+ returns False. If there is an error loading the file or the content can't be decoded then the function will return
+ None.
``textfile``
The name of the file.
@@ -141,28 +135,26 @@
return content_string
-def str_to_bool(stringvalue):
+def str_to_bool(string_value):
"""
Convert a string version of a boolean into a real boolean.
- ``stringvalue``
+ ``string_value``
The string value to examine and convert to a boolean type.
"""
- if isinstance(stringvalue, bool):
- return stringvalue
- return unicode(stringvalue).strip().lower() in (u'true', u'yes', u'y')
+ if isinstance(string_value, bool):
+ return string_value
+ return unicode(string_value).strip().lower() in (u'true', u'yes', u'y')
def build_icon(icon):
"""
- Build a QIcon instance from an existing QIcon, a resource location, or a
- physical file location. If the icon is a QIcon instance, that icon is
- simply returned. If not, it builds a QIcon instance from the resource or
- file name.
+ Build a QIcon instance from an existing QIcon, a resource location, or a physical file location. If the icon is a
+ QIcon instance, that icon is simply returned. If not, it builds a QIcon instance from the resource or file name.
``icon``
- The icon to build. This can be a QIcon, a resource string in the form
- ``:/resource/file.png``, or a file location like ``/path/to/file.png``.
+ The icon to build. This can be a QIcon, a resource string in the form ``:/resource/file.png``, or a file
+ location like ``/path/to/file.png``.
"""
button_icon = QtGui.QIcon()
if isinstance(icon, QtGui.QIcon):
@@ -179,8 +171,7 @@
def image_to_byte(image):
"""
- Resize an image to fit on the current screen for the web and returns
- it as a byte stream.
+ Resize an image to fit on the current screen for the web and returns it as a byte stream.
``image``
The image to converted.
@@ -198,8 +189,7 @@
def create_thumb(image_path, thumb_path, return_icon=True, size=None):
"""
- Create a thumbnail from the given image path and depending on
- ``return_icon`` it returns an icon from this thumb.
+ Create a thumbnail from the given image path and depending on ``return_icon`` it returns an icon from this thumb.
``image_path``
The image file to create the icon from.
@@ -208,12 +198,10 @@
The filename to save the thumbnail to.
``return_icon``
- States if an icon should be build and returned from the thumb. Defaults
- to ``True``.
+ States if an icon should be build and returned from the thumb. Defaults to ``True``.
``size``
- Allows to state a own size to use. Defaults to ``None``, which means
- that a default height of 88 is used.
+ Allows to state a own size to use. Defaults to ``None``, which means that a default height of 88 is used.
"""
ext = os.path.splitext(thumb_path)[1].lower()
reader = QtGui.QImageReader(image_path)
@@ -234,9 +222,8 @@
def validate_thumb(file_path, thumb_path):
"""
- Validates whether an file's thumb still exists and if is up to date.
- **Note**, you must **not** call this function, before checking the
- existence of the file.
+ Validates whether an file's thumb still exists and if is up to date. **Note**, you must **not** call this function,
+ before checking the existence of the file.
``file_path``
The path to the file. The file **must** exist!
@@ -359,10 +346,9 @@
def create_separated_list(stringlist):
"""
- Returns a string that represents a join of a list of strings with a
- localized separator. This function corresponds to
- QLocale::createSeparatedList which was introduced in Qt 4.8 and implements
- the algorithm from http://www.unicode.org/reports/tr35/#ListPatterns
+ Returns a string that represents a join of a list of strings with a localized separator. This function corresponds
+ to QLocale::createSeparatedList which was introduced in Qt 4.8 and implements the algorithm from
+ http://www.unicode.org/reports/tr35/#ListPatterns
``stringlist``
List of unicode strings
=== modified file 'openlp/core/lib/htmlbuilder.py'
--- openlp/core/lib/htmlbuilder.py 2013-03-06 21:49:46 +0000
+++ openlp/core/lib/htmlbuilder.py 2013-03-07 18:01:28 +0000
@@ -244,7 +244,7 @@
js_additions += plugin.getDisplayJavaScript()
html_additions += plugin.getDisplayHtml()
html = HTMLSRC % (
- build_background_css(item, width, height),
+ build_background_css(item, width),
css_additions,
build_footer_css(item, height),
build_lyrics_css(item, webkit_ver),
@@ -259,8 +259,7 @@
def webkit_version():
"""
- Return the Webkit version in use.
- Note method added relatively recently, so return 0 if prior to this
+ Return the Webkit version in use. Note method added relatively recently, so return 0 if prior to this
"""
try:
webkit_ver = float(QtWebKit.qWebKitVersion())
@@ -270,13 +269,12 @@
return webkit_ver
-def build_background_css(item, width, height):
+def build_background_css(item, width):
"""
Build the background css
``item``
Service Item containing theme and location information
-
"""
width = int(width) / 2
theme = item.themedata
@@ -348,21 +346,18 @@
if theme and item.main:
lyricstable = u'left: %spx; top: %spx;' % (item.main.x(), item.main.y())
lyrics = build_lyrics_format_css(theme, item.main.width(), item.main.height())
- # For performance reasons we want to show as few DIV's as possible,
- # especially when animating/transitions.
- # However some bugs in older versions of qtwebkit mean we need to
- # perform workarounds and add extra divs. Only do these when needed.
- #
- # Before 533.3 the webkit-text-fill colour wasn't displayed, only the
- # stroke (outline) color. So put stroke layer underneath the main text.
- #
- # Up to 534.3 the webkit-text-stroke was sometimes out of alignment
- # with the fill, or normal text. letter-spacing=1 is workaround
- # https://bugs.webkit.org/show_bug.cgi?id=44403
- #
- # Up to 534.3 the text-shadow didn't get displayed when
- # webkit-text-stroke was used. So use an offset text layer underneath.
- # https://bugs.webkit.org/show_bug.cgi?id=19728
+ # For performance reasons we want to show as few DIV's as possible, especially when animating/transitions.
+ # However some bugs in older versions of qtwebkit mean we need to perform workarounds and add extra divs. Only
+ # do these when needed.
+ #
+ # Before 533.3 the webkit-text-fill colour wasn't displayed, only the stroke (outline) color. So put stroke
+ # layer underneath the main text.
+ #
+ # Up to 534.3 the webkit-text-stroke was sometimes out of alignment with the fill, or normal text.
+ # letter-spacing=1 is workaround https://bugs.webkit.org/show_bug.cgi?id=44403
+ #
+ # Up to 534.3 the text-shadow didn't get displayed when webkit-text-stroke was used. So use an offset text
+ # layer underneath. https://bugs.webkit.org/show_bug.cgi?id=19728
if webkit_ver >= 533.3:
lyricsmain += build_lyrics_outline_css(theme)
else:
@@ -371,20 +366,18 @@
if theme.font_main_outline and webkit_ver <= 534.3:
shadow = u'padding-left: %spx; padding-top: %spx;' % \
(int(theme.font_main_shadow_size) + (int(theme.font_main_outline_size) * 2),
- theme.font_main_shadow_size)
+ theme.font_main_shadow_size)
shadow += build_lyrics_outline_css(theme, True)
else:
lyricsmain += u' text-shadow: %s %spx %spx;' % \
- (theme.font_main_shadow_color, theme.font_main_shadow_size,
- theme.font_main_shadow_size)
+ (theme.font_main_shadow_color, theme.font_main_shadow_size, theme.font_main_shadow_size)
lyrics_css = style % (lyricstable, lyrics, lyricsmain, outline, shadow)
return lyrics_css
def build_lyrics_outline_css(theme, is_shadow=False):
"""
- Build the css which controls the theme outline
- Also used by renderer for splitting verses
+ Build the css which controls the theme outline. Also used by renderer for splitting verses
``theme``
Object containing theme information
@@ -407,8 +400,7 @@
def build_lyrics_format_css(theme, width, height):
"""
- Build the css which controls the theme format
- Also used by renderer for splitting verses
+ Build the css which controls the theme format. Also used by renderer for splitting verses
``theme``
Object containing theme information
@@ -418,7 +410,6 @@
``height``
Height of the lyrics block
-
"""
align = HorizontalType.Names[theme.display_horizontal_align]
valign = VerticalType.Names[theme.display_vertical_align]
@@ -460,22 +451,18 @@
``webkitvers``
The version of qtwebkit we're using
"""
- # Bugs in some versions of QtWebKit mean we sometimes need additional
- # divs for outline and shadow, since the CSS doesn't work.
- # To support vertical alignment middle and bottom, nested div's using
- # display:table/display:table-cell are required for each lyric block.
+ # Bugs in some versions of QtWebKit mean we sometimes need additional divs for outline and shadow, since the CSS
+ # doesn't work. To support vertical alignment middle and bottom, nested div's using display:table/display:table-cell
+ # are required for each lyric block.
lyrics = u''
theme = item.themedata
if webkitvers <= 534.3 and theme and theme.font_main_outline:
- lyrics += u'<div class="lyricstable">' \
- u'<div id="lyricsshadow" style="opacity:1" ' \
+ lyrics += u'<div class="lyricstable"><div id="lyricsshadow" style="opacity:1" ' \
u'class="lyricscell lyricsshadow"></div></div>'
if webkitvers < 533.3:
- lyrics += u'<div class="lyricstable">' \
- u'<div id="lyricsoutline" style="opacity:1" ' \
+ lyrics += u'<div class="lyricstable"><div id="lyricsoutline" style="opacity:1" ' \
u'class="lyricscell lyricsoutline"></div></div>'
- lyrics += u'<div class="lyricstable">' \
- u'<div id="lyricsmain" style="opacity:1" ' \
+ lyrics += u'<div class="lyricstable"><div id="lyricsmain" style="opacity:1" ' \
u'class="lyricscell lyricsmain"></div></div>'
return lyrics
=== modified file 'openlp/core/lib/imagemanager.py'
--- openlp/core/lib/imagemanager.py 2013-02-07 07:17:19 +0000
+++ openlp/core/lib/imagemanager.py 2013-03-07 18:01:28 +0000
@@ -27,10 +27,9 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
-Provides the store and management for Images automatically caching them and
-resizing them when needed. Only one copy of each image is needed in the system.
-A Thread is used to convert the image to a byte array so the user does not need
-to wait for the conversion to happen.
+Provides the store and management for Images automatically caching them and resizing them when needed. Only one copy of
+each image is needed in the system. A Thread is used to convert the image to a byte array so the user does not need to
+wait for the conversion to happen.
"""
import logging
import os
@@ -46,8 +45,8 @@
class ImageThread(QtCore.QThread):
"""
- A special Qt thread class to speed up the display of images. This is
- threaded so it loads the frames and generates byte stream in background.
+ A special Qt thread class to speed up the display of images. This is threaded so it loads the frames and generates
+ byte stream in background.
"""
def __init__(self, manager):
"""
@@ -71,30 +70,25 @@
Enumeration class for different priorities.
``Lowest``
- Only the image's byte stream has to be generated. But neither the
- ``QImage`` nor the byte stream has been requested yet.
+ Only the image's byte stream has to be generated. But neither the ``QImage`` nor the byte stream has been
+ requested yet.
``Low``
- Only the image's byte stream has to be generated. Because the image's
- ``QImage`` has been requested previously it is reasonable to assume that
- the byte stream will be needed before the byte stream of other images
- whose ``QImage`` were not generated due to a request.
+ Only the image's byte stream has to be generated. Because the image's ``QImage`` has been requested previously
+ it is reasonable to assume that the byte stream will be needed before the byte stream of other images whose
+ ``QImage`` were not generated due to a request.
``Normal``
- The image's byte stream as well as the image has to be generated.
- Neither the ``QImage`` nor the byte stream has been requested yet.
+ The image's byte stream as well as the image has to be generated. Neither the ``QImage`` nor the byte stream has
+ been requested yet.
``High``
- The image's byte stream as well as the image has to be generated. The
- ``QImage`` for this image has been requested.
- **Note**, this priority is only set when the ``QImage`` has not been
- generated yet.
+ The image's byte stream as well as the image has to be generated. The ``QImage`` for this image has been
+ requested. **Note**, this priority is only set when the ``QImage`` has not been generated yet.
``Urgent``
- The image's byte stream as well as the image has to be generated. The
- byte stream for this image has been requested.
- **Note**, this priority is only set when the byte stream has not been
- generated yet.
+ The image's byte stream as well as the image has to be generated. The byte stream for this image has been
+ requested. **Note**, this priority is only set when the byte stream has not been generated yet.
"""
Lowest = 4
Low = 3
@@ -105,9 +99,8 @@
class Image(object):
"""
- This class represents an image. To mark an image as *dirty* call the
- :class:`ImageManager`'s ``_resetImage`` method with the Image instance as
- argument.
+ This class represents an image. To mark an image as *dirty* call the :class:`ImageManager`'s ``_reset_image`` method
+ with the Image instance as argument.
"""
secondary_priority = 0
@@ -119,12 +112,12 @@
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 :class:`~openlp.core.lib.ImageSource` class.
+ 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 match with the display ratio.
+ 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
@@ -133,6 +126,7 @@
self.source = source
self.background = background
self.timestamp = 0
+ # FIXME: We assume that the path exist. The caller has to take care that it exists!
if os.path.exists(path):
self.timestamp = os.stat(path).st_mtime
self.secondary_priority = Image.secondary_priority
@@ -143,16 +137,14 @@
"""
Customised ``Queue.PriorityQueue``.
- Each item in the queue must be a tuple with three values. The first value
- is the :class:`Image`'s ``priority`` attribute, the second value
- the :class:`Image`'s ``secondary_priority`` attribute. The last value the
- :class:`Image` instance itself::
+ Each item in the queue must be a tuple with three values. The first value is the :class:`Image`'s ``priority``
+ attribute, the second value the :class:`Image`'s ``secondary_priority`` attribute. The last value the :class:`Image`
+ instance itself::
(image.priority, image.secondary_priority, image)
- Doing this, the :class:`Queue.PriorityQueue` will sort the images according
- to their priorities, but also according to there number. However, the number
- only has an impact on the result if there are more images with the same
+ Doing this, the :class:`Queue.PriorityQueue` will sort the images according to their priorities, but also according
+ to there number. However, the number only has an impact on the result if there are more images with the same
priority. In such case the image which has been added earlier is privileged.
"""
def modify_priority(self, image, new_priority):
@@ -163,8 +155,7 @@
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.
+ The image's new priority. See the :class:`Priority` class for priorities.
"""
self.remove(image)
image.priority = new_priority
@@ -210,8 +201,7 @@
current_screen = ScreenList().current
self.width = current_screen[u'size'].width()
self.height = current_screen[u'size'].height()
- # Mark the images as dirty for a rebuild by setting the image and byte
- # stream to None.
+ # Mark the images as dirty for a rebuild by setting the image and byte stream to None.
for image in self._cache.values():
self._reset_image(image)
@@ -220,8 +210,7 @@
Border has changed so update all the images affected.
"""
log.debug(u'update_images_border')
- # Mark the images as dirty for a rebuild by setting the image and byte
- # stream to None.
+ # Mark the images as dirty for a rebuild by setting the image and byte stream to None.
for image in self._cache.values():
if image.source == source:
image.background = background
@@ -232,8 +221,7 @@
Border has changed so update the image affected.
"""
log.debug(u'update_image_border')
- # Mark the image as dirty for a rebuild by setting the image and byte
- # stream to None.
+ # Mark the image as dirty for a rebuild by setting the image and byte stream to None.
image = self._cache[(path, source)]
if image.source == source:
image.background = background
@@ -241,8 +229,7 @@
def _reset_image(self, image):
"""
- Mark the given :class:`Image` instance as dirty by setting its ``image``
- and ``image_bytes`` attributes to None.
+ Mark the given :class:`Image` instance as dirty by setting its ``image`` and ``image_bytes`` attributes to None.
"""
image.image = None
image.image_bytes = None
@@ -258,8 +245,7 @@
def get_image(self, path, source):
"""
- Return the ``QImage`` from the cache. If not present wait for the
- background thread to process it.
+ Return the ``QImage`` from the cache. If not present wait for the background thread to process it.
"""
log.debug(u'getImage %s' % path)
image = self._cache[(path, source)]
@@ -271,17 +257,15 @@
log.debug(u'getImage - waiting')
time.sleep(0.1)
elif image.image_bytes is None:
- # Set the priority to Low, because the image was requested but the
- # byte stream was not generated yet. However, we only need to do
- # this, when the image was generated before it was requested
- # (otherwise this is already taken care of).
+ # Set the priority to Low, because the image was requested but the byte stream was not generated yet.
+ # However, we only need to do this, when the image was generated before it was requested (otherwise this is
+ # already taken care of).
self._conversion_queue.modify_priority(image, Priority.Low)
return image.image
def get_image_bytes(self, path, source):
"""
- Returns the byte string for an image. If not present wait for the
- background thread to process it.
+ Returns the byte string for an image. If not present wait for the background thread to process it.
"""
log.debug(u'get_image_bytes %s' % path)
image = self._cache[(path, source)]
@@ -303,8 +287,7 @@
image = Image(path, source, background)
self._cache[(path, source)] = image
self._conversion_queue.put((image.priority, image.secondary_priority, image))
- # Check if the there are any images with the same path and check if the
- # timestamp has changed.
+ # Check if the there are any images with the same path and check if the timestamp has changed.
for image in self._cache.values():
if os.path.exists(path):
if image.path == path and image.timestamp != os.stat(path).st_mtime:
@@ -332,15 +315,12 @@
# Generate the QImage for the image.
if image.image is None:
image.image = resize_image(image.path, self.width, self.height, image.background)
- # Set the priority to Lowest and stop here as we need to process
- # more important images first.
+ # Set the priority to Lowest and stop here as we need to process more important images first.
if image.priority == Priority.Normal:
self._conversion_queue.modify_priority(image, Priority.Lowest)
return
- # For image with high priority we set the priority to Low, as the
- # byte stream might be needed earlier the byte stream of image with
- # Normal priority. We stop here as we need to process more important
- # images first.
+ # For image with high priority we set the priority to Low, as the byte stream might be needed earlier the
+ # byte stream of image with Normal priority. We stop here as we need to process more important images first.
elif image.priority == Priority.High:
self._conversion_queue.modify_priority(image, Priority.Low)
return
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2013-02-19 09:56:36 +0000
+++ openlp/core/lib/mediamanageritem.py 2013-03-07 18:01:28 +0000
@@ -47,49 +47,38 @@
"""
MediaManagerItem is a helper widget for plugins.
- None of the following *need* to be used, feel free to override
- them completely in your plugin's implementation. Alternatively,
- call them from your plugin before or after you've done extra
- things that you need to.
+ None of the following *need* to be used, feel free to override them completely in your plugin's implementation.
+ Alternatively, call them from your plugin before or after you've done extra things that you need to.
**Constructor Parameters**
``parent``
- The parent widget. Usually this will be the *Media Manager*
- itself. This needs to be a class descended from ``QWidget``.
+ The parent widget. Usually this will be the *Media Manager* itself. This needs to be a class descended from
+ ``QWidget``.
``plugin``
- The plugin widget. Usually this will be the *Plugin*
- itself. This needs to be a class descended from ``Plugin``.
-
- ``icon``
- Either a ``QIcon``, a resource path, or a file name. This is
- the icon which is displayed in the *Media Manager*.
+ The plugin widget. Usually this will be the *Plugin* itself. This needs to be a class descended from ``Plugin``.
**Member Variables**
- When creating a descendant class from this class for your plugin,
- the following member variables should be set.
+ When creating a descendant class from this class for your plugin, the following member variables should be set.
``self.onNewPrompt``
Defaults to *'Select Image(s)'*.
``self.onNewFileMasks``
- Defaults to *'Images (*.jpg *jpeg *.gif *.png *.bmp)'*. This
- assumes that the new action is to load a file. If not, you
- need to override the ``OnNew`` method.
+ Defaults to *'Images (*.jpg *jpeg *.gif *.png *.bmp)'*. This assumes that the new action is to load a file. If
+ not, you need to override the ``OnNew`` method.
``self.PreviewFunction``
- This must be a method which returns a QImage to represent the
- item (usually a preview). No scaling is required, that is
- performed automatically by OpenLP when necessary. If this
- method is not defined, a default will be used (treat the
- filename as an image).
+ This must be a method which returns a QImage to represent the item (usually a preview). No scaling is required,
+ that is performed automatically by OpenLP when necessary. If this method is not defined, a default will be used
+ (treat the filename as an image).
"""
log.info(u'Media Item loaded')
- def __init__(self, parent=None, plugin=None, icon=None):
+ def __init__(self, parent=None, plugin=None):
"""
Constructor to create the media manager item.
"""
@@ -101,9 +90,6 @@
self.title = unicode(visible_title[u'title'])
Registry().register(self.plugin.name, self)
self.settingsSection = self.plugin.name
- self.icon = None
- if icon:
- self.icon = build_icon(icon)
self.toolbar = None
self.remoteTriggered = None
self.singleServiceItem = True
@@ -120,9 +106,8 @@
def requiredIcons(self):
"""
- This method is called to define the icons for the plugin.
- It provides a default set and the plugin is able to override
- the if required.
+ This method is called to define the icons for the plugin. It provides a default set and the plugin is able to
+ override the if required.
"""
self.hasImportIcon = False
self.hasNewIcon = True
@@ -133,16 +118,14 @@
def retranslateUi(self):
"""
- This method is called automatically to provide OpenLP with the
- opportunity to translate the ``MediaManagerItem`` to another
- language.
+ This method is called automatically to provide OpenLP with the opportunity to translate the ``MediaManagerItem``
+ to another language.
"""
pass
def addToolbar(self):
"""
- A method to help developers easily add a toolbar to the media
- manager item.
+ A method to help developers easily add a toolbar to the media manager item.
"""
if self.toolbar is None:
self.toolbar = OpenLPToolbar(self)
@@ -150,9 +133,8 @@
def setupUi(self):
"""
- This method sets up the interface on the button. Plugin
- developers use this to add and create toolbars, and the rest
- of the interface of the media manager item.
+ This method sets up the interface on the button. Plugin developers use this to add and create toolbars, and the
+ rest of the interface of the media manager item.
"""
# Add a toolbar
self.addToolbar()
@@ -173,19 +155,16 @@
## Import Button ##
if self.hasImportIcon:
toolbar_actions.append([u'Import', StringContent.Import,
- u':/general/general_import.png', self.onImportClick])
+ u':/general/general_import.png', self.onImportClick])
## Load Button ##
if self.hasFileIcon:
- toolbar_actions.append([u'Load', StringContent.Load,
- u':/general/general_open.png', self.onFileClick])
+ toolbar_actions.append([u'Load', StringContent.Load, u':/general/general_open.png', self.onFileClick])
## New Button ##
if self.hasNewIcon:
- toolbar_actions.append([u'New', StringContent.New,
- u':/general/general_new.png', self.onNewClick])
+ toolbar_actions.append([u'New', StringContent.New, u':/general/general_new.png', self.onNewClick])
## Edit Button ##
if self.hasEditIcon:
- toolbar_actions.append([u'Edit', StringContent.Edit,
- u':/general/general_edit.png', self.onEditClick])
+ toolbar_actions.append([u'Edit', StringContent.Edit, u':/general/general_edit.png', self.onEditClick])
## Delete Button ##
if self.hasDeleteIcon:
toolbar_actions.append([u'Delete', StringContent.Delete,
@@ -194,15 +173,13 @@
toolbar_actions.append([u'Preview', StringContent.Preview,
u':/general/general_preview.png', self.onPreviewClick])
## Live Button ##
- toolbar_actions.append([u'Live', StringContent.Live,
- u':/general/general_live.png', self.onLiveClick])
+ toolbar_actions.append([u'Live', StringContent.Live, u':/general/general_live.png', self.onLiveClick])
## Add to service Button ##
- toolbar_actions.append([u'Service', StringContent.Service,
- u':/general/general_add.png', self.onAddClick])
+ toolbar_actions.append([u'Service', StringContent.Service, u':/general/general_add.png', self.onAddClick])
for action in toolbar_actions:
if action[0] == StringContent.Preview:
self.toolbar.addSeparator()
- self.toolbar.addToolbarAction(u'%s%sAction' % (self.plugin.name, action[0]),
+ self.toolbar.add_toolbar_action(u'%s%sAction' % (self.plugin.name, action[0]),
text=self.plugin.getString(action[1])[u'title'], icon=action[2],
tooltip=self.plugin.getString(action[1])[u'tooltip'],
triggers=action[3])
@@ -262,12 +239,9 @@
# Create the context menu and add all actions from the listView.
self.menu = QtGui.QMenu()
self.menu.addActions(self.listView.actions())
- QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
- self.onDoubleClicked)
- QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'itemSelectionChanged()'),
- self.onSelectionChange)
- QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'customContextMenuRequested(QPoint)'),
- self.contextMenu)
+ self.listView.doubleClicked.connect(self.onDoubleClicked)
+ self.listView.itemSelectionChanged.connect(self.onSelectionChange)
+ self.listView.customContextMenuRequested.connect(self.contextMenu)
def addSearchToToolBar(self):
"""
@@ -295,10 +269,9 @@
self.searchLayout.addLayout(self.searchButtonLayout)
self.pageLayout.addWidget(self.searchWidget)
# Signals and slots
- QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClicked)
- QtCore.QObject.connect(self.searchTextButton, QtCore.SIGNAL(u'clicked()'), self.onSearchTextButtonClicked)
- QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'textChanged(const QString&)'),
- self.onSearchTextEditChanged)
+ self.searchTextEdit.returnPressed.connect(self.onSearchTextButtonClicked)
+ self.searchTextButton.clicked.connect(self.onSearchTextButtonClicked)
+ self.searchTextEdit.textChanged.connect(self.onSearchTextEditChanged)
def addCustomContextActions(self):
"""
@@ -407,13 +380,11 @@
"""
Return the current list of files
"""
- count = 0
file_list = []
- while count < self.listView.count():
- bitem = self.listView.item(count)
+ for index in xrange(self.listView.count()):
+ bitem = self.listView.item(index)
filename = bitem.data(QtCore.Qt.UserRole)
file_list.append(filename)
- count += 1
return file_list
def loadList(self, list):
@@ -447,8 +418,8 @@
"""
pass
- def generateSlideData(self, serviceItem, item=None, xmlVersion=False, remote=False,
- context=ServiceItemContext.Live):
+ def generateSlideData(self, service_item, item=None, xml_version=False, remote=False,
+ context=ServiceItemContext.Live):
"""
Generate the slide data. Needs to be implemented by the plugin.
"""
@@ -473,25 +444,23 @@
def onPreviewClick(self, keepFocus=False):
"""
- Preview an item by building a service item then adding that service
- item to the preview slide controller.
+ Preview an item by building a service item then adding that service item to the preview slide controller.
"""
if not self.listView.selectedIndexes() and not self.remoteTriggered:
QtGui.QMessageBox.information(self, UiStrings().NISp,
translate('OpenLP.MediaManagerItem', 'You must select one or more items to preview.'))
else:
log.debug(u'%s Preview requested', self.plugin.name)
- serviceItem = self.buildServiceItem()
- if serviceItem:
- serviceItem.from_plugin = True
- self.preview_controller.add_service_item(serviceItem)
+ service_item = self.buildServiceItem()
+ if service_item:
+ service_item.from_plugin = True
+ self.preview_controller.add_service_item(service_item)
if keepFocus:
self.listView.setFocus()
def onLiveClick(self):
"""
- Send an item live by building a service item then adding that service
- item to the live slide controller.
+ Send an item live by building a service item then adding that service item to the live slide controller.
"""
if not self.listView.selectedIndexes():
QtGui.QMessageBox.information(self, UiStrings().NISp,
@@ -507,13 +476,13 @@
item = None
if item_id:
item = self.createItemFromId(item_id)
- serviceItem = self.buildServiceItem(item, remote=remote)
- if serviceItem:
+ service_item = self.buildServiceItem(item, remote=remote)
+ if service_item:
if not item_id:
- serviceItem.from_plugin = True
+ service_item.from_plugin = True
if remote:
- serviceItem.will_auto_start = True
- self.live_controller.add_service_item(serviceItem)
+ service_item.will_auto_start = True
+ self.live_controller.add_service_item(service_item)
def createItemFromId(self, item_id):
"""
@@ -545,10 +514,10 @@
"""
Add this item to the current service.
"""
- serviceItem = self.buildServiceItem(item, True, remote=remote, context=ServiceItemContext.Service)
- if serviceItem:
- serviceItem.from_plugin = False
- self.service_manager.add_service_item(serviceItem, replace=replace)
+ service_item = self.buildServiceItem(item, True, remote=remote, context=ServiceItemContext.Service)
+ if service_item:
+ service_item.from_plugin = False
+ self.service_manager.add_service_item(service_item, replace=replace)
def onAddEditClick(self):
"""
@@ -559,13 +528,13 @@
translate('OpenLP.MediaManagerItem', 'You must select one or more items.'))
else:
log.debug(u'%s Add requested', self.plugin.name)
- serviceItem = self.service_manager.get_service_item()
- if not serviceItem:
+ service_item = self.service_manager.get_service_item()
+ if not service_item:
QtGui.QMessageBox.information(self, UiStrings().NISs,
translate('OpenLP.MediaManagerItem', 'You must select an existing service item to add to.'))
- elif self.plugin.name == serviceItem.name:
- self.generateSlideData(serviceItem)
- self.service_manager.add_service_item(serviceItem, replace=True)
+ elif self.plugin.name == service_item.name:
+ self.generateSlideData(service_item)
+ self.service_manager.add_service_item(service_item, replace=True)
else:
# Turn off the remote edit update message indicator
QtGui.QMessageBox.information(self, translate('OpenLP.MediaManagerItem', 'Invalid Service Item'),
@@ -575,17 +544,17 @@
"""
Common method for generating a service item
"""
- serviceItem = ServiceItem(self.plugin)
- serviceItem.add_icon(self.plugin.iconPath)
- if self.generateSlideData(serviceItem, item, xmlVersion, remote, context):
- return serviceItem
+ service_item = ServiceItem(self.plugin)
+ service_item.add_icon(self.plugin.iconPath)
+ if self.generateSlideData(service_item, item, xmlVersion, remote, context):
+ return service_item
else:
return None
def serviceLoad(self, message):
"""
- Method to add processing when a service has been loaded and
- individual service items need to be processed by the plugins
+ Method to add processing when a service has been loaded and individual service items need to be processed by the
+ plugins.
"""
pass
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2013-02-19 21:23:56 +0000
+++ openlp/core/lib/plugin.py 2013-03-07 18:01:28 +0000
@@ -214,7 +214,7 @@
you need, and return it for integration into OpenLP.
"""
if self.mediaItemClass:
- self.mediaItem = self.mediaItemClass(self.main_window.mediaDockManager.media_dock, self, self.icon)
+ self.mediaItem = self.mediaItemClass(self.main_window.mediaDockManager.media_dock, self)
def addImportMenuItem(self, importMenu):
"""
=== modified file 'openlp/core/lib/registry.py'
--- openlp/core/lib/registry.py 2013-02-10 16:05:52 +0000
+++ openlp/core/lib/registry.py 2013-03-07 18:01:28 +0000
@@ -37,8 +37,8 @@
class Registry(object):
"""
- This is the Component Registry. It is a singleton object and is used to provide a
- look up service for common objects.
+ This is the Component Registry. It is a singleton object and is used to provide a look up service for common
+ objects.
"""
log.info(u'Registry loaded')
__instance__ = None
@@ -97,8 +97,8 @@
def remove(self, key):
"""
- Removes the registry value from the list based on the key passed in
- (Only valid and active for testing framework).
+ 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.
@@ -114,9 +114,9 @@
Register an event and associated function to be called
``event``
- The function description like "config_updated" or "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.
+ The function description like "config_updated" or "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.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2013-03-04 16:55:13 +0000
+++ openlp/core/lib/renderer.py 2013-03-07 18:01:28 +0000
@@ -45,28 +45,20 @@
'Get those children out of the muddy, muddy \n' \
'{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \
'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n'
-VERSE_FOR_LINE_COUNT = u'\n'.join(map(unicode, xrange(50)))
+VERSE_FOR_LINE_COUNT = u'\n'.join(map(unicode, xrange(100)))
FOOTER = [u'Arky Arky (Unknown)', u'Public Domain', u'CCLI 123456']
class Renderer(object):
"""
- Class to pull all Renderer interactions into one place. The plugins will
- call helper methods to do the rendering but this class will provide
- display defense code.
+ Class to pull all Renderer interactions into one place. The plugins will call helper methods to do the rendering but
+ this class will provide display defense code.
"""
log.info(u'Renderer Loaded')
def __init__(self):
"""
Initialise the renderer.
-
- ``image_manager``
- A image_manager instance which takes care of e. g. caching and
- resizing images.
-
- ``theme_manager``
- The theme_manager instance, used to get the current theme details.
"""
log.debug(u'Initialisation started')
self.screens = ScreenList()
@@ -99,19 +91,17 @@
def update_theme(self, theme_name, old_theme_name=None, only_delete=False):
"""
- This method updates the theme in ``_theme_dimensions`` when a theme
- has been edited or renamed.
+ This method updates the theme in ``_theme_dimensions`` when a theme has been edited or renamed.
``theme_name``
The current theme name.
``old_theme_name``
- The old theme name. Has only to be passed, when the theme has been
- renamed. Defaults to *None*.
+ The old theme name. Has only to be passed, when the theme has been renamed. Defaults to *None*.
``only_delete``
- Only remove the given ``theme_name`` from the ``_theme_dimensions``
- list. This can be used when a theme is permanently deleted.
+ Only remove the given ``theme_name`` from the ``_theme_dimensions`` list. This can be used when a theme is
+ permanently deleted.
"""
if old_theme_name is not None and old_theme_name in self._theme_dimensions:
del self._theme_dimensions[old_theme_name]
@@ -144,20 +134,17 @@
Set up the theme to be used before rendering an item.
``override_theme_data``
- The theme data should be passed, when we want to use our own theme
- data, regardless of the theme level. This should for example be used
- in the theme manager. **Note**, this is **not** to be mixed up with
- the ``set_item_theme`` method.
+ The theme data should be passed, when we want to use our own theme data, regardless of the theme level. This
+ should for example be used in the theme manager. **Note**, this is **not** to be mixed up with the
+ ``set_item_theme`` method.
"""
# Just assume we use the global theme.
theme_to_use = self.global_theme_name
- # The theme level is either set to Service or Item. Use the service
- # theme if one is set. We also have to use the service theme, even when
- # the theme level is set to Item, because the item does not necessarily
- # have to have a theme.
+ # The theme level is either set to Service or Item. Use the service theme if one is set. We also have to use the
+ # service theme, even when the theme level is set to Item, because the item does not necessarily have to have a
+ # theme.
if self.theme_level != ThemeLevel.Global:
- # When the theme level is at Service and we actually have a service
- # theme then use it.
+ # When the theme level is at Service and we actually have a service theme then use it.
if self.service_theme_name:
theme_to_use = self.service_theme_name
# If we have Item level and have an item theme then use it.
@@ -206,8 +193,7 @@
def set_item_theme(self, item_theme_name):
"""
- Set the item-level theme. **Note**, this has to be done for each item we
- are rendering.
+ Set the item-level theme. **Note**, this has to be done for each item we are rendering.
``item_theme_name``
The item theme's name.
@@ -229,26 +215,25 @@
# save value for use in format_slide
self.force_page = force_page
# build a service item to generate preview
- serviceItem = ServiceItem()
+ service_item = ServiceItem()
if self.force_page:
# make big page for theme edit dialog to get line count
- serviceItem.add_from_text(VERSE_FOR_LINE_COUNT)
+ service_item.add_from_text(VERSE_FOR_LINE_COUNT)
else:
- serviceItem.add_from_text(VERSE)
- serviceItem.raw_footer = FOOTER
+ service_item.add_from_text(VERSE)
+ service_item.raw_footer = FOOTER
# if No file do not update cache
if theme_data.background_filename:
- self.image_manager.add_image(theme_data.background_filename,
- ImageSource.Theme,
- QtGui.QColor(theme_data.background_border_color))
+ self.image_manager.add_image(
+ theme_data.background_filename, ImageSource.Theme, QtGui.QColor(theme_data.background_border_color))
theme_data, main, footer = self.pre_render(theme_data)
- serviceItem.themedata = theme_data
- serviceItem.main = main
- serviceItem.footer = footer
- serviceItem.render(True)
+ service_item.themedata = theme_data
+ service_item.main = main
+ service_item.footer = footer
+ service_item.render(True)
if not self.force_page:
- self.display.build_html(serviceItem)
- raw_html = serviceItem.get_rendered_frame(0)
+ self.display.build_html(service_item)
+ raw_html = service_item.get_rendered_frame(0)
self.display.text(raw_html, False)
preview = self.display.preview()
return preview
@@ -278,22 +263,21 @@
if u'[---]' in text:
while True:
slides = text.split(u'\n[---]\n', 2)
- # If there are (at least) two occurrences of [---] we use
- # the first two slides (and neglect the last for now).
+ # If there are (at least) two occurrences of [---] we use the first two slides (and neglect the last
+ # for now).
if len(slides) == 3:
html_text = expand_tags(u'\n'.join(slides[:2]))
- # We check both slides to determine if the optional split is
- # needed (there is only one optional split).
+ # We check both slides to determine if the optional split is needed (there is only one optional
+ # split).
else:
html_text = expand_tags(u'\n'.join(slides))
html_text = html_text.replace(u'\n', u'<br>')
if self._text_fits_on_slide(html_text):
- # The first two optional slides fit (as a whole) on one
- # slide. Replace the first occurrence of [---].
+ # The first two optional slides fit (as a whole) on one slide. Replace the first occurrence
+ # of [---].
text = text.replace(u'\n[---]', u'', 1)
else:
- # The first optional slide fits, which means we have to
- # render the first optional slide.
+ # The first optional slide fits, which means we have to render the first optional slide.
text_contains_split = u'[---]' in text
if text_contains_split:
try:
@@ -343,8 +327,7 @@
self.width = screen_size.width()
self.height = screen_size.height()
self.screen_ratio = float(self.height) / float(self.width)
- log.debug(u'_calculate default %s, %f' % (screen_size,
- self.screen_ratio))
+ log.debug(u'_calculate default %s, %f' % (screen_size, self.screen_ratio))
# 90% is start of footer
self.footer_start = int(self.height * 0.90)
@@ -369,12 +352,10 @@
The theme data.
"""
if not theme_data.font_footer_override:
- return QtCore.QRect(10, self.footer_start, self.width - 20,
- self.height - self.footer_start)
+ return QtCore.QRect(10, self.footer_start, self.width - 20, self.height - self.footer_start)
else:
return QtCore.QRect(theme_data.font_footer_x,
- theme_data.font_footer_y, theme_data.font_footer_width - 1,
- theme_data.font_footer_height - 1)
+ theme_data.font_footer_y, theme_data.font_footer_width - 1, theme_data.font_footer_height - 1)
def _set_text_rectangle(self, theme_data, rect_main, rect_footer):
"""
@@ -397,9 +378,8 @@
if theme_data.font_main_shadow:
self.page_width -= int(theme_data.font_main_shadow_size)
self.page_height -= int(theme_data.font_main_shadow_size)
- # For the life of my I don't know why we have to completely kill the
- # QWebView in order for the display to work properly, but we do. See
- # bug #1041366 for an example of what happens if we take this out.
+ # For the life of my I don't know why we have to completely kill the QWebView in order for the display to work
+ # properly, but we do. See bug #1041366 for an example of what happens if we take this out.
self.web = None
self.web = QtWebKit.QWebView()
self.web.setVisible(False)
@@ -425,10 +405,9 @@
def _paginate_slide(self, lines, line_end):
"""
- Figure out how much text can appear on a slide, using the current
- theme settings.
- **Note:** The smallest possible "unit" of text for a slide is one line.
- If the line is too long it will be cut off when displayed.
+ Figure out how much text can appear on a slide, using the current theme settings.
+ **Note:** The smallest possible "unit" of text for a slide is one line. If the line is too long it will be cut
+ off when displayed.
``lines``
The text to be fitted on the slide split into lines.
@@ -444,8 +423,8 @@
html_lines = map(expand_tags, lines)
# Text too long so go to next page.
if not self._text_fits_on_slide(separator.join(html_lines)):
- html_text, previous_raw = self._binary_chop(formatted,
- previous_html, previous_raw, html_lines, lines, separator, u'')
+ html_text, previous_raw = self._binary_chop(
+ formatted, previous_html, previous_raw, html_lines, lines, separator, u'')
else:
previous_raw = separator.join(lines)
formatted.append(previous_raw)
@@ -454,18 +433,15 @@
def _paginate_slide_words(self, lines, line_end):
"""
- Figure out how much text can appear on a slide, using the current
- theme settings.
- **Note:** The smallest possible "unit" of text for a slide is one word.
- If one line is too long it will be processed word by word. This is
- sometimes need for **bible** verses.
+ Figure out how much text can appear on a slide, using the current theme settings.
+ **Note:** The smallest possible "unit" of text for a slide is one word. If one line is too long it will be
+ processed word by word. This is sometimes need for **bible** verses.
``lines``
The text to be fitted on the slide split into lines.
``line_end``
- The text added after each line. Either ``u' '`` or ``u'<br>``.
- This is needed for **bibles**.
+ The text added after each line. Either ``u' '`` or ``u'<br>``. This is needed for **bibles**.
"""
log.debug(u'_paginate_slide_words - Start')
formatted = []
@@ -476,22 +452,19 @@
html_line = expand_tags(line)
# Text too long so go to next page.
if not self._text_fits_on_slide(previous_html + html_line):
- # Check if there was a verse before the current one and append
- # it, when it fits on the page.
+ # Check if there was a verse before the current one and append it, when it fits on the page.
if previous_html:
if self._text_fits_on_slide(previous_html):
formatted.append(previous_raw)
previous_html = u''
previous_raw = u''
- # Now check if the current verse will fit, if it does
- # not we have to start to process the verse word by
- # word.
+ # Now check if the current verse will fit, if it does not we have to start to process the verse
+ # word by word.
if self._text_fits_on_slide(html_line):
previous_html = html_line + line_end
previous_raw = line + line_end
continue
- # Figure out how many words of the line will fit on screen as
- # the line will not fit as a whole.
+ # Figure out how many words of the line will fit on screen as the line will not fit as a whole.
raw_words = self._words_split(line)
html_words = map(expand_tags, raw_words)
previous_html, previous_raw = \
@@ -505,19 +478,15 @@
def _get_start_tags(self, raw_text):
"""
- Tests the given text for not closed formatting tags and returns a tuple
- consisting of three unicode strings::
-
- (u'{st}{r}Text text text{/r}{/st}', u'{st}{r}', u'<strong>
- <span style="-webkit-text-fill-color:red">')
-
- The first unicode string is the text, with correct closing tags. The
- second unicode string are OpenLP's opening formatting tags and the third
- unicode string the html opening formatting tags.
+ Tests the given text for not closed formatting tags and returns a tuple consisting of three unicode strings::
+
+ (u'{st}{r}Text text text{/r}{/st}', u'{st}{r}', u'<strong><span style="-webkit-text-fill-color:red">')
+
+ The first unicode string is the text, with correct closing tags. The second unicode string are OpenLP's opening
+ formatting tags and the third unicode string the html opening formatting tags.
``raw_text``
- The text to test. The text must **not** contain html tags, only
- OpenLP formatting tags are allowed::
+ The text to test. The text must **not** contain html tags, only OpenLP formatting tags are allowed::
{st}{r}Text text text
"""
@@ -529,9 +498,8 @@
if raw_text.count(tag[u'start tag']) != raw_text.count(tag[u'end tag']):
raw_tags.append((raw_text.find(tag[u'start tag']), tag[u'start tag'], tag[u'end tag']))
html_tags.append((raw_text.find(tag[u'start tag']), tag[u'start html']))
- # Sort the lists, so that the tags which were opened first on the first
- # slide (the text we are checking) will be opened first on the next
- # slide as well.
+ # Sort the lists, so that the tags which were opened first on the first slide (the text we are checking) will be
+ # opened first on the next slide as well.
raw_tags.sort(key=lambda tag: tag[0])
html_tags.sort(key=lambda tag: tag[0])
# Create a list with closing tags for the raw_text.
@@ -547,46 +515,40 @@
def _binary_chop(self, formatted, previous_html, previous_raw, html_list, raw_list, separator, line_end):
"""
- This implements the binary chop algorithm for faster rendering. This
- algorithm works line based (line by line) and word based (word by word).
- It is assumed that this method is **only** called, when the lines/words
- to be rendered do **not** fit as a whole.
+ This implements the binary chop algorithm for faster rendering. This algorithm works line based (line by line)
+ and word based (word by word). It is assumed that this method is **only** called, when the lines/words to be
+ rendered do **not** fit as a whole.
``formatted``
The list to append any slides.
``previous_html``
- The html text which is know to fit on a slide, but is not yet added
- to the list of slides. (unicode string)
+ The html text which is know to fit on a slide, but is not yet added to the list of slides. (unicode string)
``previous_raw``
- The raw text (with formatting tags) which is know to fit on a slide,
- but is not yet added to the list of slides. (unicode string)
+ The raw text (with formatting tags) which is know to fit on a slide, but is not yet added to the list of
+ slides. (unicode string)
``html_list``
- The elements which do not fit on a slide and needs to be processed
- using the binary chop. The text contains html.
+ The elements which do not fit on a slide and needs to be processed using the binary chop. The text contains
+ html.
``raw_list``
- The elements which do not fit on a slide and needs to be processed
- using the binary chop. The elements can contain formatting tags.
+ The elements which do not fit on a slide and needs to be processed using the binary chop. The elements can
+ contain formatting tags.
``separator``
- The separator for the elements. For lines this is ``u'<br>'`` and
- for words this is ``u' '``.
+ The separator for the elements. For lines this is ``u'<br>'`` and for words this is ``u' '``.
``line_end``
- The text added after each "element line". Either ``u' '`` or
- ``u'<br>``. This is needed for bibles.
+ The text added after each "element line". Either ``u' '`` or ``u'<br>``. This is needed for bibles.
"""
smallest_index = 0
highest_index = len(html_list) - 1
index = int(highest_index / 2)
while True:
- if not self._text_fits_on_slide(
- previous_html + separator.join(html_list[:index + 1]).strip()):
- # We know that it does not fit, so change/calculate the
- # new index and highest_index accordingly.
+ if not self._text_fits_on_slide(previous_html + separator.join(html_list[:index + 1]).strip()):
+ # We know that it does not fit, so change/calculate the new index and highest_index accordingly.
highest_index = index
index = int(index - (index - smallest_index) / 2)
else:
@@ -607,14 +569,12 @@
else:
continue
# Check if the remaining elements fit on the slide.
- if self._text_fits_on_slide(
- html_tags + separator.join(html_list[index + 1:]).strip()):
+ if self._text_fits_on_slide(html_tags + separator.join(html_list[index + 1:]).strip()):
previous_html = html_tags + separator.join(html_list[index + 1:]).strip() + line_end
previous_raw = raw_tags + separator.join(raw_list[index + 1:]).strip() + line_end
break
else:
- # The remaining elements do not fit, thus reset the indexes,
- # create a new list and continue.
+ # The remaining elements do not fit, thus reset the indexes, create a new list and continue.
raw_list = raw_list[index + 1:]
raw_list[0] = raw_tags + raw_list[0]
html_list = html_list[index + 1:]
@@ -626,8 +586,7 @@
def _text_fits_on_slide(self, text):
"""
- Checks if the given ``text`` fits on a slide. If it does ``True`` is
- returned, otherwise ``False``.
+ Checks if the given ``text`` fits on a slide. If it does ``True`` is returned, otherwise ``False``.
``text``
The text to check. It may contain HTML tags.
=== modified file 'openlp/core/lib/screen.py'
--- openlp/core/lib/screen.py 2013-02-10 16:05:52 +0000
+++ openlp/core/lib/screen.py 2013-03-07 18:01:28 +0000
@@ -74,8 +74,8 @@
screen_list.display_count = 0
screen_list.screen_count_changed()
screen_list.load_screen_settings()
- QtCore.QObject.connect(desktop, QtCore.SIGNAL(u'resized(int)'), screen_list.screen_resolution_changed)
- QtCore.QObject.connect(desktop, QtCore.SIGNAL(u'screenCountChanged(int)'), screen_list.screen_count_changed)
+ desktop.resized.connect(screen_list.screen_resolution_changed)
+ desktop.screenCountChanged.connect(screen_list.screen_count_changed)
return screen_list
def screen_resolution_changed(self, number):
=== modified file 'openlp/core/lib/searchedit.py'
--- openlp/core/lib/searchedit.py 2013-02-01 19:58:18 +0000
+++ openlp/core/lib/searchedit.py 2013-03-07 18:01:28 +0000
@@ -47,34 +47,33 @@
Constructor.
"""
QtGui.QLineEdit.__init__(self, parent)
- self._currentSearchType = -1
- self.clearButton = QtGui.QToolButton(self)
- self.clearButton.setIcon(build_icon(u':/system/clear_shortcut.png'))
- self.clearButton.setCursor(QtCore.Qt.ArrowCursor)
- self.clearButton.setStyleSheet(
- u'QToolButton { border: none; padding: 0px; }')
- self.clearButton.resize(18, 18)
- self.clearButton.hide()
- QtCore.QObject.connect(self.clearButton, QtCore.SIGNAL(u'clicked()'), self._onClearButtonClicked)
- QtCore.QObject.connect(self, QtCore.SIGNAL(u'textChanged(const QString&)'), self._onSearchEditTextChanged)
- self._updateStyleSheet()
+ self._current_search_type = -1
+ self.clear_button = QtGui.QToolButton(self)
+ self.clear_button.setIcon(build_icon(u':/system/clear_shortcut.png'))
+ self.clear_button.setCursor(QtCore.Qt.ArrowCursor)
+ self.clear_button.setStyleSheet(u'QToolButton { border: none; padding: 0px; }')
+ self.clear_button.resize(18, 18)
+ self.clear_button.hide()
+ self.clear_button.clicked.connect(self._on_clear_button_clicked)
+ self.textChanged.connect(self._on_search_edit_text_changed)
+ self._update_style_sheet()
self.setAcceptDrops(False)
- def _updateStyleSheet(self):
- """
- Internal method to update the stylesheet depending on which widgets are
- available and visible.
- """
- frameWidth = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
- rightPadding = self.clearButton.width() + frameWidth
- if hasattr(self, u'menuButton'):
- leftPadding = self.menuButton.width()
- self.setStyleSheet(u'QLineEdit { padding-left: %spx; padding-right: %spx; } ' % (leftPadding, rightPadding))
+ def _update_style_sheet(self):
+ """
+ Internal method to update the stylesheet depending on which widgets are available and visible.
+ """
+ frame_width = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
+ right_padding = self.clear_button.width() + frame_width
+ if hasattr(self, u'menu_button'):
+ left_padding = self.menu_button.width()
+ stylesheet = u'QLineEdit { padding-left: %spx; padding-right: %spx; } ' % (left_padding, right_padding)
else:
- self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' % rightPadding)
+ stylesheet = u'QLineEdit { padding-right: %spx; } ' % right_padding
+ self.setStyleSheet(stylesheet)
msz = self.minimumSizeHint()
- self.setMinimumSize(max(msz.width(), self.clearButton.width() + (frameWidth * 2) + 2),
- max(msz.height(), self.clearButton.height() + (frameWidth * 2) + 2))
+ self.setMinimumSize(max(msz.width(), self.clear_button.width() + (frame_width * 2) + 2),
+ max(msz.height(), self.clear_button.height() + (frame_width * 2) + 2))
def resizeEvent(self, event):
"""
@@ -83,51 +82,49 @@
``event``
The event that happened.
"""
- size = self.clearButton.size()
- frameWidth = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
- self.clearButton.move(self.rect().right() - frameWidth - size.width(),
+ size = self.clear_button.size()
+ frame_width = self.style().pixelMetric(QtGui.QStyle.PM_DefaultFrameWidth)
+ self.clear_button.move(self.rect().right() - frame_width - size.width(),
(self.rect().bottom() + 1 - size.height()) / 2)
- if hasattr(self, u'menuButton'):
- size = self.menuButton.size()
- self.menuButton.move(self.rect().left() + frameWidth + 2, (self.rect().bottom() + 1 - size.height()) / 2)
+ if hasattr(self, u'menu_button'):
+ size = self.menu_button.size()
+ self.menu_button.move(self.rect().left() + frame_width + 2, (self.rect().bottom() + 1 - size.height()) / 2)
- def currentSearchType(self):
+ def current_search_type(self):
"""
Readonly property to return the current search type.
"""
- return self._currentSearchType
+ return self._current_search_type
- def setCurrentSearchType(self, identifier):
+ def set_current_search_type(self, identifier):
"""
Set a new current search type.
``identifier``
The search type identifier (int).
"""
- menu = self.menuButton.menu()
+ menu = self.menu_button.menu()
for action in menu.actions():
if identifier == action.data():
- # setPlaceholderText has been implemented in Qt 4.7 and in at
- # least PyQt 4.9 (I am not sure, if it was implemented in
- # PyQt 4.8).
+ # setPlaceholderText has been implemented in Qt 4.7 and in at least PyQt 4.9 (I am not sure, if it was
+ # implemented in PyQt 4.8).
try:
- self.setPlaceholderText(action.placeholderText)
+ self.setPlaceholderText(action.placeholder_text)
except AttributeError:
pass
- self.menuButton.setDefaultAction(action)
- self._currentSearchType = identifier
+ self.menu_button.setDefaultAction(action)
+ self._current_search_type = identifier
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), identifier)
return True
- def setSearchTypes(self, items):
+ def set_search_types(self, items):
"""
- A list of tuples to be used in the search type menu. The first item in
- the list will be preselected as the default.
+ 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 string) and a title for the
- item in the menu. In short, they should look like this::
+ 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>)
@@ -142,63 +139,58 @@
menu = QtGui.QMenu(self)
first = None
for identifier, icon, title, placeholder in items:
- action = create_widget_action(menu, text=title, icon=icon,
- data=identifier, triggers=self._onMenuActionTriggered)
- action.placeholderText = placeholder
+ action = create_widget_action(
+ menu, text=title, icon=icon, data=identifier, triggers=self._on_menu_action_triggered)
+ action.placeholder_text = placeholder
if first is None:
first = action
- self._currentSearchType = identifier
- if not hasattr(self, u'menuButton'):
- self.menuButton = QtGui.QToolButton(self)
- self.menuButton.setIcon(build_icon(u':/system/clear_shortcut.png'))
- self.menuButton.setCursor(QtCore.Qt.ArrowCursor)
- self.menuButton.setPopupMode(QtGui.QToolButton.InstantPopup)
- self.menuButton.setStyleSheet(
- u'QToolButton { border: none; padding: 0px 10px 0px 0px; }')
- self.menuButton.resize(QtCore.QSize(28, 18))
- self.menuButton.setMenu(menu)
- self.menuButton.setDefaultAction(first)
- self.menuButton.show()
- self._updateStyleSheet()
+ self._current_search_type = identifier
+ if not hasattr(self, u'menu_button'):
+ self.menu_button = QtGui.QToolButton(self)
+ self.menu_button.setIcon(build_icon(u':/system/clear_shortcut.png'))
+ self.menu_button.setCursor(QtCore.Qt.ArrowCursor)
+ self.menu_button.setPopupMode(QtGui.QToolButton.InstantPopup)
+ self.menu_button.setStyleSheet(u'QToolButton { border: none; padding: 0px 10px 0px 0px; }')
+ self.menu_button.resize(QtCore.QSize(28, 18))
+ self.menu_button.setMenu(menu)
+ self.menu_button.setDefaultAction(first)
+ self.menu_button.show()
+ self._update_style_sheet()
- def _onSearchEditTextChanged(self, text):
+ def _on_search_edit_text_changed(self, text):
"""
- 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.
+ 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.
+ A :class:`~PyQt4.QtCore.QString` instance which represents the text in the line edit.
"""
- self.clearButton.setVisible(bool(text))
+ self.clear_button.setVisible(bool(text))
- def _onClearButtonClicked(self):
+ def _on_clear_button_clicked(self):
"""
- Internally implemented slot to react to the clear button being clicked
- to clear the line edit. Once it has cleared the line edit, it emits the
- ``cleared()`` signal so that an application can react to the clearing
- of the line edit.
+ Internally implemented slot to react to the clear button being clicked to clear the line edit. Once it has
+ cleared the line edit, it emits the ``cleared()`` signal so that an application can react to the clearing of the
+ line edit.
"""
self.clear()
self.emit(QtCore.SIGNAL(u'cleared()'))
- def _onMenuActionTriggered(self):
+ def _on_menu_action_triggered(self):
"""
- Internally implemented slot to react to the select of one of the search
- types in the menu. Once it has set the correct action on the button,
- and set the current search type (using the list of identifiers provided
- by the developer), the ``searchTypeChanged(int)`` signal is emitted
- with the identifier.
+ Internally implemented slot to react to the select of one of the search types in the menu. Once it has set the
+ correct action on the button, and set the current search type (using the list of identifiers provided by the
+ developer), the ``searchTypeChanged(int)`` signal is emitted with the identifier.
"""
sender = self.sender()
- for action in self.menuButton.menu().actions():
+ for action in self.menu_button.menu().actions():
action.setChecked(False)
- self.menuButton.setDefaultAction(sender)
- self._currentSearchType = sender.data()
- # setPlaceholderText has been implemented in Qt 4.7 and in at least
+ self.menu_button.setDefaultAction(sender)
+ self._current_search_type = sender.data()
+ # setplaceholder_text has been implemented in Qt 4.7 and in at least
# PyQt 4.9 (I am not sure, if it was implemented in PyQt 4.8).
try:
- self.setPlaceholderText(self.menuButton.defaultAction().placeholderText)
+ self.setPlaceholderText(self.menu_button.defaultAction().placeholder_text)
except AttributeError:
pass
- self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), self._currentSearchType)
+ self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'), self._current_search_type)
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2013-02-16 18:24:31 +0000
+++ openlp/core/lib/serviceitem.py 2013-03-07 18:01:28 +0000
@@ -70,7 +70,7 @@
reordered.
``RequiresMedia``
- Determines is the serviceItem needs a Media Player
+ Determines is the service_item needs a Media Player
``CanLoop``
The capability to allow the SlideController to allow the loop
=== modified file 'openlp/core/lib/spelltextedit.py'
--- openlp/core/lib/spelltextedit.py 2013-02-01 19:58:18 +0000
+++ openlp/core/lib/spelltextedit.py 2013-03-07 18:01:28 +0000
@@ -41,8 +41,7 @@
except ImportError:
ENCHANT_AVAILABLE = False
-# based on code from
-# http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check
+# based on code from http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check
from PyQt4 import QtCore, QtGui
@@ -56,19 +55,19 @@
"""
Spell checking widget based on QPlanTextEdit.
"""
- def __init__(self, parent=None, formattingTagsAllowed=True):
+ def __init__(self, parent=None, formatting_tags_allowed=True):
"""
Constructor.
"""
global ENCHANT_AVAILABLE
QtGui.QPlainTextEdit.__init__(self, parent)
- self.formattingTagsAllowed = formattingTagsAllowed
+ self.formatting_tags_allowed = formatting_tags_allowed
# Default dictionary based on the current locale.
if ENCHANT_AVAILABLE:
try:
self.dictionary = enchant.Dict()
self.highlighter = Highlighter(self.document())
- self.highlighter.spellingDictionary = self.dictionary
+ self.highlighter.spelling_dictionary = self.dictionary
except (Error, DictNotFoundError):
ENCHANT_AVAILABLE = False
log.debug(u'Could not load default dictionary')
@@ -78,8 +77,7 @@
Handle mouse clicks within the text edit region.
"""
if event.button() == QtCore.Qt.RightButton:
- # Rewrite the mouse event to a left button event so the cursor is
- # moved to the location of the pointer.
+ # Rewrite the mouse event to a left button event so the cursor is moved to the location of the pointer.
event = QtGui.QMouseEvent(QtCore.QEvent.MouseButtonPress,
event.pos(), QtCore.Qt.LeftButton, QtCore.Qt.LeftButton, QtCore.Qt.NoModifier)
QtGui.QPlainTextEdit.mousePressEvent(self, event)
@@ -88,7 +86,7 @@
"""
Provide the context menu for the text edit region.
"""
- popupMenu = self.createStandardContextMenu()
+ popup_menu = self.createStandardContextMenu()
# Select the word under the cursor.
cursor = self.textCursor()
# only select text if not already selected
@@ -97,39 +95,36 @@
self.setTextCursor(cursor)
# Add menu with available languages.
if ENCHANT_AVAILABLE:
- lang_menu = QtGui.QMenu(
- translate('OpenLP.SpellTextEdit', 'Language:'))
+ lang_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Language:'))
for lang in enchant.list_languages():
action = create_action(lang_menu, lang, text=lang, checked=lang == self.dictionary.tag)
lang_menu.addAction(action)
- popupMenu.insertSeparator(popupMenu.actions()[0])
- popupMenu.insertMenu(popupMenu.actions()[0], lang_menu)
- QtCore.QObject.connect(lang_menu, QtCore.SIGNAL(u'triggered(QAction*)'), self.setLanguage)
- # Check if the selected word is misspelled and offer spelling
- # suggestions if it is.
+ popup_menu.insertSeparator(popup_menu.actions()[0])
+ popup_menu.insertMenu(popup_menu.actions()[0], lang_menu)
+ lang_menu.triggered.connect(self.set_language)
+ # Check if the selected word is misspelled and offer spelling suggestions if it is.
if ENCHANT_AVAILABLE and self.textCursor().hasSelection():
text = self.textCursor().selectedText()
if not self.dictionary.check(text):
spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Spelling Suggestions'))
for word in self.dictionary.suggest(text):
action = SpellAction(word, spell_menu)
- action.correct.connect(self.correctWord)
+ action.correct.connect(self.correct_word)
spell_menu.addAction(action)
- # Only add the spelling suggests to the menu if there are
- # suggestions.
+ # Only add the spelling suggests to the menu if there are suggestions.
if spell_menu.actions():
- popupMenu.insertMenu(popupMenu.actions()[0], spell_menu)
- tagMenu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Formatting Tags'))
- if self.formattingTagsAllowed:
+ popup_menu.insertMenu(popup_menu.actions()[0], spell_menu)
+ tag_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Formatting Tags'))
+ if self.formatting_tags_allowed:
for html in FormattingTags.get_html_tags():
- action = SpellAction(html[u'desc'], tagMenu)
- action.correct.connect(self.htmlTag)
- tagMenu.addAction(action)
- popupMenu.insertSeparator(popupMenu.actions()[0])
- popupMenu.insertMenu(popupMenu.actions()[0], tagMenu)
- popupMenu.exec_(event.globalPos())
+ action = SpellAction(html[u'desc'], tag_menu)
+ action.correct.connect(self.html_tag)
+ tag_menu.addAction(action)
+ popup_menu.insertSeparator(popup_menu.actions()[0])
+ popup_menu.insertMenu(popup_menu.actions()[0], tag_menu)
+ popup_menu.exec_(event.globalPos())
- def setLanguage(self, action):
+ def set_language(self, action):
"""
Changes the language for this spelltextedit.
@@ -137,11 +132,11 @@
The action.
"""
self.dictionary = enchant.Dict(action.text())
- self.highlighter.spellingDictionary = self.dictionary
+ self.highlighter.spelling_dictionary = self.dictionary
self.highlighter.highlightBlock(self.toPlainText())
self.highlighter.rehighlight()
- def correctWord(self, word):
+ def correct_word(self, word):
"""
Replaces the selected text with word.
"""
@@ -151,7 +146,7 @@
cursor.insertText(word)
cursor.endEditBlock()
- def htmlTag(self, tag):
+ def html_tag(self, tag):
"""
Replaces the selected text with word.
"""
@@ -183,22 +178,21 @@
Constructor
"""
QtGui.QSyntaxHighlighter.__init__(self, *args)
- self.spellingDictionary = None
+ self.spelling_dictionary = None
def highlightBlock(self, text):
"""
- Highlight misspelt words in a block of text
+ Highlight misspelt words in a block of text.
"""
- if not self.spellingDictionary:
+ if not self.spelling_dictionary:
return
text = unicode(text)
- charFormat = QtGui.QTextCharFormat()
- charFormat.setUnderlineColor(QtCore.Qt.red)
- charFormat.setUnderlineStyle(QtGui.QTextCharFormat.SpellCheckUnderline)
+ char_format = QtGui.QTextCharFormat()
+ char_format.setUnderlineColor(QtCore.Qt.red)
+ char_format.setUnderlineStyle(QtGui.QTextCharFormat.SpellCheckUnderline)
for word_object in re.finditer(self.WORDS, text):
- if not self.spellingDictionary.check(word_object.group()):
- self.setFormat(word_object.start(),
- word_object.end() - word_object.start(), charFormat)
+ if not self.spelling_dictionary.check(word_object.group()):
+ self.setFormat(word_object.start(), word_object.end() - word_object.start(), char_format)
class SpellAction(QtGui.QAction):
=== modified file 'openlp/core/lib/theme.py'
--- openlp/core/lib/theme.py 2013-02-02 21:16:42 +0000
+++ openlp/core/lib/theme.py 2013-03-07 18:01:28 +0000
@@ -200,12 +200,10 @@
Names = [u'top', u'middle', u'bottom']
-BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow',
- u'slide_transition']
+BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow', u'slide_transition']
-INTEGER_LIST = [u'size', u'line_adjustment', u'x', u'height', u'y',
- u'width', u'shadow_size', u'outline_size', u'horizontal_align',
- u'vertical_align', u'wrap_style']
+INTEGER_LIST = [u'size', u'line_adjustment', u'x', u'height', u'y', u'width', u'shadow_size', u'outline_size',
+ u'horizontal_align', u'vertical_align', u'wrap_style']
class ThemeXML(object):
@@ -234,8 +232,7 @@
if self.background_filename and path:
self.theme_name = self.theme_name.strip()
self.background_filename = self.background_filename.strip()
- self.background_filename = os.path.join(path, self.theme_name,
- self.background_filename)
+ self.background_filename = os.path.join(path, self.theme_name, self.background_filename)
def _new_document(self, name):
"""
@@ -308,11 +305,9 @@
# Create endColor element
self.child_element(background, u'borderColor', unicode(borderColor))
- def add_font(self, name, color, size, override, fonttype=u'main',
- bold=u'False', italics=u'False', line_adjustment=0,
- xpos=0, ypos=0, width=0, height=0, outline=u'False',
- outline_color=u'#ffffff', outline_pixel=2, shadow=u'False',
- shadow_color=u'#ffffff', shadow_pixel=5):
+ def add_font(self, name, color, size, override, fonttype=u'main', bold=u'False', italics=u'False',
+ line_adjustment=0, xpos=0, ypos=0, width=0, height=0, outline=u'False', outline_color=u'#ffffff',
+ outline_pixel=2, shadow=u'False', shadow_color=u'#ffffff', shadow_pixel=5):
"""
Add a Font.
=== modified file 'openlp/core/lib/toolbar.py'
--- openlp/core/lib/toolbar.py 2013-02-01 19:58:18 +0000
+++ openlp/core/lib/toolbar.py 2013-03-07 18:01:28 +0000
@@ -40,8 +40,8 @@
class OpenLPToolbar(QtGui.QToolBar):
"""
- Lots of toolbars around the place, so it makes sense to have a common way
- to manage them. This is the base toolbar class.
+ Lots of toolbars around the place, so it makes sense to have a common way to manage them. This is the base toolbar
+ class.
"""
def __init__(self, parent):
"""
@@ -53,25 +53,24 @@
self.actions = {}
log.debug(u'Init done for %s' % parent.__class__.__name__)
- def addToolbarAction(self, name, **kwargs):
+ def add_toolbar_action(self, name, **kwargs):
"""
- A method to help developers easily add a button to the toolbar.
- A new QAction is created by calling ``create_action()``. The action is
- added to the toolbar and the toolbar is set as parent.
- For more details please look at openlp.core.lib.ui.create_action()
+ A method to help developers easily add a button to the toolbar. A new QAction is created by calling
+ ``create_action()``. The action is added to the toolbar and the toolbar is set as parent. For more details
+ please look at openlp.core.lib.ui.create_action()
"""
action = create_widget_action(self, name, **kwargs)
self.actions[name] = action
return action
- def addToolbarWidget(self, widget):
+ def add_toolbar_widget(self, widget):
"""
Add a widget and store it's handle under the widgets object name.
"""
action = self.addWidget(widget)
self.actions[widget.objectName()] = action
- def setWidgetVisible(self, widgets, visible=True):
+ def set_widget_visible(self, widgets, visible=True):
"""
Set the visibitity for a widget or a list of widgets.
=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py 2013-02-21 21:26:24 +0000
+++ openlp/core/lib/ui.py 2013-03-07 18:01:28 +0000
@@ -50,21 +50,21 @@
``image``
A splash image for the wizard.
"""
- parent.welcomePage = QtGui.QWizardPage()
- parent.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(image))
- parent.welcomePage.setObjectName(u'WelcomePage')
- parent.welcomeLayout = QtGui.QVBoxLayout(parent.welcomePage)
- parent.welcomeLayout.setObjectName(u'WelcomeLayout')
- parent.titleLabel = QtGui.QLabel(parent.welcomePage)
- parent.titleLabel.setObjectName(u'TitleLabel')
- parent.welcomeLayout.addWidget(parent.titleLabel)
- parent.welcomeLayout.addSpacing(40)
- parent.informationLabel = QtGui.QLabel(parent.welcomePage)
- parent.informationLabel.setWordWrap(True)
- parent.informationLabel.setObjectName(u'InformationLabel')
- parent.welcomeLayout.addWidget(parent.informationLabel)
- parent.welcomeLayout.addStretch()
- parent.addPage(parent.welcomePage)
+ parent.welcome_page = QtGui.QWizardPage()
+ parent.welcome_page.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(image))
+ parent.welcome_page.setObjectName(u'welcome_page')
+ parent.welcome_layout = QtGui.QVBoxLayout(parent.welcome_page)
+ parent.welcome_layout.setObjectName(u'WelcomeLayout')
+ parent.title_label = QtGui.QLabel(parent.welcome_page)
+ parent.title_label.setObjectName(u'title_label')
+ parent.welcome_layout.addWidget(parent.title_label)
+ parent.welcome_layout.addSpacing(40)
+ parent.information_label = QtGui.QLabel(parent.welcome_page)
+ parent.information_label.setWordWrap(True)
+ parent.information_label.setObjectName(u'information_label')
+ parent.welcome_layout.addWidget(parent.information_label)
+ parent.welcome_layout.addStretch()
+ parent.addPage(parent.welcome_page)
def create_button_box(dialog, name, standard_buttons, custom_buttons=None):
=== modified file 'openlp/core/ui/aboutdialog.py'
--- openlp/core/ui/aboutdialog.py 2013-02-05 08:05:28 +0000
+++ openlp/core/ui/aboutdialog.py 2013-03-07 18:01:28 +0000
@@ -38,60 +38,60 @@
The actual GUI widgets for the About form.
"""
- def setupUi(self, aboutDialog):
+ def setupUi(self, about_dialog):
"""
Set up the UI for the dialog.
"""
- aboutDialog.setObjectName(u'aboutDialog')
- aboutDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
- self.aboutDialogLayout = QtGui.QVBoxLayout(aboutDialog)
- self.aboutDialogLayout.setObjectName(u'aboutDialogLayout')
- self.logoLabel = QtGui.QLabel(aboutDialog)
- self.logoLabel.setPixmap(QtGui.QPixmap(u':/graphics/openlp-about-logo.png'))
- self.logoLabel.setObjectName(u'logoLabel')
- self.aboutDialogLayout.addWidget(self.logoLabel)
- self.aboutNotebook = QtGui.QTabWidget(aboutDialog)
- self.aboutNotebook.setObjectName(u'aboutNotebook')
- self.aboutTab = QtGui.QWidget()
- self.aboutTab.setObjectName(u'aboutTab')
- self.aboutTabLayout = QtGui.QVBoxLayout(self.aboutTab)
- self.aboutTabLayout.setObjectName(u'aboutTabLayout')
- self.aboutTextEdit = QtGui.QPlainTextEdit(self.aboutTab)
- self.aboutTextEdit.setReadOnly(True)
- self.aboutTextEdit.setObjectName(u'aboutTextEdit')
- self.aboutTabLayout.addWidget(self.aboutTextEdit)
- self.aboutNotebook.addTab(self.aboutTab, u'')
- self.creditsTab = QtGui.QWidget()
- self.creditsTab.setObjectName(u'creditsTab')
- self.creditsTabLayout = QtGui.QVBoxLayout(self.creditsTab)
- self.creditsTabLayout.setObjectName(u'creditsTabLayout')
- self.creditsTextEdit = QtGui.QPlainTextEdit(self.creditsTab)
- self.creditsTextEdit.setReadOnly(True)
- self.creditsTextEdit.setObjectName(u'creditsTextEdit')
- self.creditsTabLayout.addWidget(self.creditsTextEdit)
- self.aboutNotebook.addTab(self.creditsTab, u'')
- self.licenseTab = QtGui.QWidget()
- self.licenseTab.setObjectName(u'licenseTab')
- self.licenseTabLayout = QtGui.QVBoxLayout(self.licenseTab)
- self.licenseTabLayout.setObjectName(u'licenseTabLayout')
- self.licenseTextEdit = QtGui.QPlainTextEdit(self.licenseTab)
- self.licenseTextEdit.setReadOnly(True)
- self.licenseTextEdit.setObjectName(u'licenseTextEdit')
- self.licenseTabLayout.addWidget(self.licenseTextEdit)
- self.aboutNotebook.addTab(self.licenseTab, u'')
- self.aboutDialogLayout.addWidget(self.aboutNotebook)
- self.volunteerButton = create_button(None, u'volunteerButton', icon=u':/system/system_volunteer.png')
- self.button_box = create_button_box(aboutDialog, u'button_box', [u'close'], [self.volunteerButton])
- self.aboutDialogLayout.addWidget(self.button_box)
- self.retranslateUi(aboutDialog)
- self.aboutNotebook.setCurrentIndex(0)
+ about_dialog.setObjectName(u'about_dialog')
+ about_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
+ self.about_dialog_layout = QtGui.QVBoxLayout(about_dialog)
+ self.about_dialog_layout.setObjectName(u'about_dialog_layout')
+ self.logo_label = QtGui.QLabel(about_dialog)
+ self.logo_label.setPixmap(QtGui.QPixmap(u':/graphics/openlp-about-logo.png'))
+ self.logo_label.setObjectName(u'logo_label')
+ self.about_dialog_layout.addWidget(self.logo_label)
+ self.about_notebook = QtGui.QTabWidget(about_dialog)
+ self.about_notebook.setObjectName(u'about_notebook')
+ self.about_tab = QtGui.QWidget()
+ self.about_tab.setObjectName(u'about_tab')
+ self.about_tab_layout = QtGui.QVBoxLayout(self.about_tab)
+ self.about_tab_layout.setObjectName(u'about_tab_layout')
+ self.about_text_edit = QtGui.QPlainTextEdit(self.about_tab)
+ self.about_text_edit.setReadOnly(True)
+ self.about_text_edit.setObjectName(u'about_text_edit')
+ self.about_tab_layout.addWidget(self.about_text_edit)
+ self.about_notebook.addTab(self.about_tab, u'')
+ self.credits_tab = QtGui.QWidget()
+ self.credits_tab.setObjectName(u'credits_tab')
+ self.credits_tab_layout = QtGui.QVBoxLayout(self.credits_tab)
+ self.credits_tab_layout.setObjectName(u'credits_tab_layout')
+ self.credits_text_edit = QtGui.QPlainTextEdit(self.credits_tab)
+ self.credits_text_edit.setReadOnly(True)
+ self.credits_text_edit.setObjectName(u'credits_text_edit')
+ self.credits_tab_layout.addWidget(self.credits_text_edit)
+ self.about_notebook.addTab(self.credits_tab, u'')
+ self.license_tab = QtGui.QWidget()
+ self.license_tab.setObjectName(u'license_tab')
+ self.license_tab_layout = QtGui.QVBoxLayout(self.license_tab)
+ self.license_tab_layout.setObjectName(u'license_tab_layout')
+ self.license_text_edit = QtGui.QPlainTextEdit(self.license_tab)
+ self.license_text_edit.setReadOnly(True)
+ self.license_text_edit.setObjectName(u'license_text_edit')
+ self.license_tab_layout.addWidget(self.license_text_edit)
+ self.about_notebook.addTab(self.license_tab, u'')
+ self.about_dialog_layout.addWidget(self.about_notebook)
+ self.volunteer_button = create_button(None, u'volunteer_button', icon=u':/system/system_volunteer.png')
+ self.button_box = create_button_box(about_dialog, u'button_box', [u'close'], [self.volunteer_button])
+ self.about_dialog_layout.addWidget(self.button_box)
+ self.retranslateUi(about_dialog)
+ self.about_notebook.setCurrentIndex(0)
- def retranslateUi(self, aboutDialog):
+ def retranslateUi(self, about_dialog):
"""
Dynamically translate the UI.
"""
- aboutDialog.setWindowTitle(u'%s OpenLP' % UiStrings().About)
- self.aboutTextEdit.setPlainText(translate('OpenLP.AboutForm',
+ about_dialog.setWindowTitle(u'%s OpenLP' % UiStrings().About)
+ self.about_text_edit.setPlainText(translate('OpenLP.AboutForm',
'OpenLP <version><revision> - Open Source Lyrics '
'Projection\n'
'\n'
@@ -107,7 +107,7 @@
'like to see more free Christian software being written, please '
'consider volunteering by using the button below.'
))
- self.aboutNotebook.setTabText(self.aboutNotebook.indexOf(self.aboutTab), UiStrings().About)
+ self.about_notebook.setTabText(self.about_notebook.indexOf(self.about_tab), UiStrings().About)
lead = u'Raoul "superfly" Snyman'
developers = [u'Tim "TRB143" Bentley', u'Jonathan "gushie" Corwin',
u'Michael "cocooncrash" Gorven',
@@ -165,7 +165,7 @@
}
documentors = [u'Wesley "wrst" Stout',
u'John "jseagull1" Cegalis (lead)']
- self.creditsTextEdit.setPlainText(translate('OpenLP.AboutForm',
+ self.credits_text_edit.setPlainText(translate('OpenLP.AboutForm',
'Project Lead\n'
' %s\n'
'\n'
@@ -268,7 +268,7 @@
u'\n '.join(translators[u'ta_LK']),
u'\n '.join(translators[u'zh_CN']),
u'\n '.join(documentors)))
- self.aboutNotebook.setTabText(self.aboutNotebook.indexOf(self.creditsTab),
+ self.about_notebook.setTabText(self.about_notebook.indexOf(self.credits_tab),
translate('OpenLP.AboutForm', 'Credits'))
copyright_note = translate('OpenLP.AboutForm',
'Copyright \xa9 2004-2013 %s\n'
@@ -662,7 +662,7 @@
'linking proprietary applications with the library. If this is '
'what you want to do, use the GNU Lesser General Public License '
'instead of this License.')
- self.licenseTextEdit.setPlainText(u'%s\n\n%s\n\n%s\n\n\n%s' % (copyright_note, licence, disclaimer, gpltext))
- self.aboutNotebook.setTabText(self.aboutNotebook.indexOf(self.licenseTab),
+ self.license_text_edit.setPlainText(u'%s\n\n%s\n\n%s\n\n\n%s' % (copyright_note, licence, disclaimer, gpltext))
+ self.about_notebook.setTabText(self.about_notebook.indexOf(self.license_tab),
translate('OpenLP.AboutForm', 'License'))
- self.volunteerButton.setText(translate('OpenLP.AboutForm', 'Volunteer'))
+ self.volunteer_button.setText(translate('OpenLP.AboutForm', 'Volunteer'))
=== modified file 'openlp/core/ui/aboutform.py'
--- openlp/core/ui/aboutform.py 2013-02-01 19:58:18 +0000
+++ openlp/core/ui/aboutform.py 2013-03-07 18:01:28 +0000
@@ -47,22 +47,21 @@
Do some initialisation stuff
"""
QtGui.QDialog.__init__(self, parent)
- applicationVersion = get_application_version()
+ application_version = get_application_version()
self.setupUi(self)
- about_text = self.aboutTextEdit.toPlainText()
- about_text = about_text.replace(u'<version>', applicationVersion[u'version'])
- if applicationVersion[u'build']:
- build_text = translate('OpenLP.AboutForm', ' build %s') % applicationVersion[u'build']
+ about_text = self.about_text_edit.toPlainText()
+ about_text = about_text.replace(u'<version>', application_version[u'version'])
+ if application_version[u'build']:
+ build_text = translate('OpenLP.AboutForm', ' build %s') % application_version[u'build']
else:
build_text = u''
about_text = about_text.replace(u'<revision>', build_text)
- self.aboutTextEdit.setPlainText(about_text)
- QtCore.QObject.connect(self.volunteerButton, QtCore.SIGNAL(u'clicked()'), self.onVolunteerButtonClicked)
+ self.about_text_edit.setPlainText(about_text)
+ self.volunteer_button.clicked.connect(self.on_volunteer_button_clicked)
- def onVolunteerButtonClicked(self):
+ def on_volunteer_button_clicked(self):
"""
Launch a web browser and go to the contribute page on the site.
"""
import webbrowser
- url = u'http://openlp.org/en/contribute'
- webbrowser.open_new(url)
+ webbrowser.open_new(u'http://openlp.org/en/contribute')
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py 2013-02-07 08:42:17 +0000
+++ openlp/core/ui/advancedtab.py 2013-03-07 18:01:28 +0000
@@ -243,40 +243,23 @@
self.rightLayout.addWidget(self.display_workaround_group_box)
self.rightLayout.addStretch()
self.should_update_service_name_example = False
- QtCore.QObject.connect(self.service_name_check_box, QtCore.SIGNAL(u'toggled(bool)'),
- self.service_name_check_box_toggled)
- QtCore.QObject.connect(self.service_name_day, QtCore.SIGNAL(u'currentIndexChanged(int)'),
- self.on_service_name_day_changed)
- QtCore.QObject.connect(self.service_name_time, QtCore.SIGNAL(u'timeChanged(QTime)'),
- self.update_service_name_example)
- QtCore.QObject.connect(self.service_name_edit, QtCore.SIGNAL(u'textChanged(QString)'),
- self.update_service_name_example)
- QtCore.QObject.connect(self.service_name_revert_button, QtCore.SIGNAL(u'clicked()'),
- self.on_service_name_revert_button_clicked)
- QtCore.QObject.connect(self.default_color_button, QtCore.SIGNAL(u'clicked()'),
- self.on_default_color_button_clicked)
- QtCore.QObject.connect(self.default_browse_button, QtCore.SIGNAL(u'clicked()'),
- self.on_default_browse_button_clicked)
- QtCore.QObject.connect(self.default_revert_button, QtCore.SIGNAL(u'clicked()'),
- self.on_default_revert_button_clicked)
- QtCore.QObject.connect(self.x11_bypass_check_box, QtCore.SIGNAL(u'toggled(bool)'),
- self.on_X11_bypass_check_box_toggled)
- QtCore.QObject.connect(self.alternate_rows_check_box,QtCore.SIGNAL(u'toggled(bool)'),
- self.on_alternate_rows_check_box_toggled)
- QtCore.QObject.connect(self.data_directory_browse_button, QtCore.SIGNAL(u'clicked()'),
- self.on_data_directory_browse_button_clicked)
- QtCore.QObject.connect(self.data_directory_default_button, QtCore.SIGNAL(u'clicked()'),
- self.on_data_directory_default_button_clicked)
- QtCore.QObject.connect(self.data_directory_cancel_button, QtCore.SIGNAL(u'clicked()'),
- self.on_data_directory_cancel_button_clicked)
- QtCore.QObject.connect(self.data_directory_copy_check_box, QtCore.SIGNAL(u'toggled(bool)'),
- self.on_data_directory_copy_check_box_toggled)
- QtCore.QObject.connect(self.end_slide_radio_button, QtCore.SIGNAL(u'clicked()'),
- self.on_end_slide_button_clicked)
- QtCore.QObject.connect(self.wrap_slide_radio_button, QtCore.SIGNAL(u'clicked()'),
- self.on_wrap_slide_button_clicked)
- QtCore.QObject.connect(self.next_item_radio_button, QtCore.SIGNAL(u'clicked()'),
- self.on_next_item_button_clicked)
+ self.service_name_check_box.toggled.connect(self.service_name_check_box_toggled)
+ self.service_name_day.currentIndexChanged.connect(self.on_service_name_day_changed)
+ self.service_name_time.timeChanged.connect(self.update_service_name_example)
+ self.service_name_edit.textChanged.connect(self.update_service_name_example)
+ self.service_name_revert_button.clicked.connect(self.on_service_name_revert_button_clicked)
+ self.default_color_button.clicked.connect(self.on_default_color_button_clicked)
+ self.default_browse_button.clicked.connect(self.on_default_browse_button_clicked)
+ self.default_revert_button.clicked.connect(self.on_default_revert_button_clicked)
+ self.x11_bypass_check_box.toggled.connect(self.on_X11_bypass_check_box_toggled)
+ self.alternate_rows_check_box.toggled.connect(self.on_alternate_rows_check_box_toggled)
+ self.data_directory_browse_button.clicked.connect(self.on_data_directory_browse_button_clicked)
+ self.data_directory_default_button.clicked.connect(self.on_data_directory_default_button_clicked)
+ self.data_directory_cancel_button.clicked.connect(self.on_data_directory_cancel_button_clicked)
+ self.data_directory_copy_check_box.toggled.connect(self.on_data_directory_copy_check_box_toggled)
+ self.end_slide_radio_button.clicked.connect(self.on_end_slide_button_clicked)
+ self.wrap_slide_radio_button.clicked.connect(self.on_wrap_slide_button_clicked)
+ self.next_item_radio_button.clicked.connect(self.on_next_item_button_clicked)
def retranslateUi(self):
@@ -308,8 +291,7 @@
self.service_name_day.setItemText(5, translate('OpenLP.AdvancedTab', 'Saturday'))
self.service_name_day.setItemText(6, translate('OpenLP.AdvancedTab', 'Sunday'))
self.service_name_day.setItemText(7, translate('OpenLP.AdvancedTab', 'Now'))
- self.service_name_time.setToolTip(translate('OpenLP.AdvancedTab',
- 'Time when usual service starts.'))
+ self.service_name_time.setToolTip(translate('OpenLP.AdvancedTab', 'Time when usual service starts.'))
self.service_name_label.setText(translate('OpenLP.AdvancedTab', 'Name:'))
self.service_name_edit.setToolTip(translate('OpenLP.AdvancedTab', 'Consult the OpenLP manual for usage.'))
self.service_name_revert_button.setToolTip(
@@ -524,8 +506,7 @@
"""
Select the background colour of the default display screen.
"""
- new_color = QtGui.QColorDialog.getColor(
- QtGui.QColor(self.default_color), self)
+ new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.default_color), self)
if new_color.isValid():
self.default_color = new_color.name()
self.default_color_button.setStyleSheet(u'background-color: %s' % self.default_color)
=== modified file 'openlp/core/ui/exceptiondialog.py'
--- openlp/core/ui/exceptiondialog.py 2013-02-01 19:58:18 +0000
+++ openlp/core/ui/exceptiondialog.py 2013-03-07 18:01:28 +0000
@@ -40,71 +40,67 @@
"""
The GUI widgets of the exception dialog.
"""
- def setupUi(self, exceptionDialog):
+ def setupUi(self, exception_dialog):
"""
Set up the UI.
"""
- exceptionDialog.setObjectName(u'exceptionDialog')
- self.exceptionLayout = QtGui.QVBoxLayout(exceptionDialog)
- self.exceptionLayout.setObjectName(u'exceptionLayout')
- self.messageLayout = QtGui.QHBoxLayout()
- self.messageLayout.setObjectName(u'messageLayout')
- self.messageLayout.addSpacing(12)
- self.bugLabel = QtGui.QLabel(exceptionDialog)
- self.bugLabel.setPixmap(QtGui.QPixmap(u':/graphics/exception.png'))
- self.bugLabel.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
- self.bugLabel.setObjectName(u'bugLabel')
- self.messageLayout.addWidget(self.bugLabel)
- self.messageLayout.addSpacing(12)
- self.messageLabel = QtGui.QLabel(exceptionDialog)
- self.messageLabel.setWordWrap(True)
- self.messageLabel.setObjectName(u'messageLabel')
- self.messageLayout.addWidget(self.messageLabel)
- self.exceptionLayout.addLayout(self.messageLayout)
- self.descriptionExplanation = QtGui.QLabel(exceptionDialog)
- self.descriptionExplanation.setObjectName(u'descriptionExplanation')
- self.exceptionLayout.addWidget(self.descriptionExplanation)
- self.descriptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog)
- self.descriptionTextEdit.setObjectName(u'descriptionTextEdit')
- self.exceptionLayout.addWidget(self.descriptionTextEdit)
- self.descriptionWordCount = QtGui.QLabel(exceptionDialog)
- self.descriptionWordCount.setObjectName(u'descriptionWordCount')
- self.exceptionLayout.addWidget(self.descriptionWordCount)
- self.exceptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog)
- self.exceptionTextEdit.setReadOnly(True)
- self.exceptionTextEdit.setObjectName(u'exceptionTextEdit')
- self.exceptionLayout.addWidget(self.exceptionTextEdit)
- self.sendReportButton = create_button(exceptionDialog, u'sendReportButton',
- icon=u':/general/general_email.png', click=self.onSendReportButtonClicked)
- self.saveReportButton = create_button(exceptionDialog, u'saveReportButton',
- icon=u':/general/general_save.png', click=self.onSaveReportButtonClicked)
- self.attachFileButton = create_button(exceptionDialog, u'attachFileButton',
- icon=u':/general/general_open.png', click=self.onAttachFileButtonClicked)
- self.button_box = create_button_box(exceptionDialog, u'button_box',
- [u'close'], [self.sendReportButton, self.saveReportButton, self.attachFileButton])
- self.exceptionLayout.addWidget(self.button_box)
-
- self.retranslateUi(exceptionDialog)
- QtCore.QObject.connect(self.descriptionTextEdit,
- QtCore.SIGNAL(u'textChanged()'), self.onDescriptionUpdated)
-
- def retranslateUi(self, exceptionDialog):
+ exception_dialog.setObjectName(u'exception_dialog')
+ self.exception_layout = QtGui.QVBoxLayout(exception_dialog)
+ self.exception_layout.setObjectName(u'exception_layout')
+ self.message_layout = QtGui.QHBoxLayout()
+ self.message_layout.setObjectName(u'messageLayout')
+ self.message_layout.addSpacing(12)
+ self.bug_label = QtGui.QLabel(exception_dialog)
+ self.bug_label.setPixmap(QtGui.QPixmap(u':/graphics/exception.png'))
+ self.bug_label.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ self.bug_label.setObjectName(u'bug_label')
+ self.message_layout.addWidget(self.bug_label)
+ self.message_layout.addSpacing(12)
+ self.message_label = QtGui.QLabel(exception_dialog)
+ self.message_label.setWordWrap(True)
+ self.message_label.setObjectName(u'message_label')
+ self.message_layout.addWidget(self.message_label)
+ self.exception_layout.addLayout(self.message_layout)
+ self.description_explanation = QtGui.QLabel(exception_dialog)
+ self.description_explanation.setObjectName(u'description_explanation')
+ self.exception_layout.addWidget(self.description_explanation)
+ self.description_text_edit = QtGui.QPlainTextEdit(exception_dialog)
+ self.description_text_edit.setObjectName(u'description_text_edit')
+ self.exception_layout.addWidget(self.description_text_edit)
+ self.description_word_count = QtGui.QLabel(exception_dialog)
+ self.description_word_count.setObjectName(u'description_word_count')
+ self.exception_layout.addWidget(self.description_word_count)
+ self.exception_text_edit = QtGui.QPlainTextEdit(exception_dialog)
+ self.exception_text_edit.setReadOnly(True)
+ self.exception_text_edit.setObjectName(u'exception_text_edit')
+ self.exception_layout.addWidget(self.exception_text_edit)
+ self.send_report_button = create_button(exception_dialog, u'send_report_button',
+ icon=u':/general/general_email.png', click=self.on_send_report_button_clicked)
+ self.save_report_button = create_button(exception_dialog, u'save_report_button',
+ icon=u':/general/general_save.png', click=self.on_save_report_button_clicked)
+ self.attach_tile_button = create_button(exception_dialog, u'attach_tile_button',
+ icon=u':/general/general_open.png', click=self.on_attach_file_button_clicked)
+ self.button_box = create_button_box(exception_dialog, u'button_box',
+ [u'close'], [self.send_report_button, self.save_report_button, self.attach_tile_button])
+ self.exception_layout.addWidget(self.button_box)
+
+ self.retranslateUi(exception_dialog)
+ self.description_text_edit.textChanged.connect(self.on_description_updated)
+
+ def retranslateUi(self, exception_dialog):
"""
Translate the widgets on the fly.
"""
- exceptionDialog.setWindowTitle(translate('OpenLP.ExceptionDialog', 'Error Occurred'))
- self.descriptionExplanation.setText(translate('OpenLP.ExceptionDialog',
+ exception_dialog.setWindowTitle(translate('OpenLP.ExceptionDialog', 'Error Occurred'))
+ self.description_explanation.setText(translate('OpenLP.ExceptionDialog',
'Please enter a description of what you were doing to cause this '
'error \n(Minimum 20 characters)'))
- self.messageLabel.setText(translate('OpenLP.ExceptionDialog', 'Oops! '
+ self.message_label.setText(translate('OpenLP.ExceptionDialog', 'Oops! '
'OpenLP hit a problem, and couldn\'t recover. The text in the box '
'below contains information that might be helpful to the OpenLP '
'developers, so please e-mail it to bugs@xxxxxxxxxx, along with a '
'detailed description of what you were doing when the problem '
'occurred.'))
- self.sendReportButton.setText(translate('OpenLP.ExceptionDialog',
- 'Send E-Mail'))
- self.saveReportButton.setText(translate('OpenLP.ExceptionDialog',
- 'Save to File'))
- self.attachFileButton.setText(translate('OpenLP.ExceptionDialog',
- 'Attach File'))
+ self.send_report_button.setText(translate('OpenLP.ExceptionDialog', 'Send E-Mail'))
+ self.save_report_button.setText(translate('OpenLP.ExceptionDialog', 'Save to File'))
+ self.attach_tile_button.setText(translate('OpenLP.ExceptionDialog', 'Attach File'))
=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py 2013-02-14 21:31:17 +0000
+++ openlp/core/ui/exceptionform.py 2013-03-07 18:01:28 +0000
@@ -112,18 +112,18 @@
"""
Show the dialog.
"""
- self.descriptionTextEdit.setPlainText(u'')
- self.onDescriptionUpdated()
- self.fileAttachment = None
+ self.description_text_edit.setPlainText(u'')
+ self.on_description_updated()
+ self.file_attachment = None
return QtGui.QDialog.exec_(self)
- def _createReport(self):
+ def _create_report(self):
"""
Create an exception report.
"""
openlp_version = get_application_version()
- description = self.descriptionTextEdit.toPlainText()
- traceback = self.exceptionTextEdit.toPlainText()
+ description = self.description_text_edit.toPlainText()
+ traceback = self.exception_text_edit.toPlainText()
system = translate('OpenLP.ExceptionForm', 'Platform: %s\n') % platform.platform()
libraries = u'Python: %s\n' % platform.python_version() + \
u'Qt4: %s\n' % Qt.qVersion() + \
@@ -146,7 +146,7 @@
system += u'Desktop: GNOME\n'
return (openlp_version, description, traceback, system, libraries)
- def onSaveReportButtonClicked(self):
+ def on_save_report_button_clicked(self):
"""
Saving exception log and system information to a file.
"""
@@ -164,7 +164,7 @@
if filename:
filename = unicode(filename).replace(u'/', os.path.sep)
Settings().setValue(self.settings_section + u'/last directory', os.path.dirname(filename))
- report_text = report_text % self._createReport()
+ report_text = report_text % self._create_report()
try:
report_file = open(filename, u'w')
try:
@@ -180,7 +180,7 @@
finally:
report_file.close()
- def onSendReportButtonClicked(self):
+ def on_send_report_button_clicked(self):
"""
Opening systems default email client and inserting exception log and
system informations.
@@ -194,7 +194,7 @@
'--- Library Versions ---\n%s\n',
'Please add the information that bug reports are favoured written '
'in English.')
- content = self._createReport()
+ content = self._create_report()
source = u''
exception = u''
for line in content[2].split(u'\n'):
@@ -206,24 +206,24 @@
mailto_url = QtCore.QUrl(u'mailto:bugs@xxxxxxxxxx')
mailto_url.addQueryItem(u'subject', subject)
mailto_url.addQueryItem(u'body', body % content)
- if self.fileAttachment:
- mailto_url.addQueryItem(u'attach', self.fileAttachment)
+ if self.file_attachment:
+ mailto_url.addQueryItem(u'attach', self.file_attachment)
QtGui.QDesktopServices.openUrl(mailto_url)
- def onDescriptionUpdated(self):
+ def on_description_updated(self):
"""
Update the minimum number of characters needed in the description.
"""
- count = int(20 - len(self.descriptionTextEdit.toPlainText()))
+ count = int(20 - len(self.description_text_edit.toPlainText()))
if count < 0:
count = 0
- self.__buttonState(True)
+ self.__button_state(True)
else:
- self.__buttonState(False)
- self.descriptionWordCount.setText(
+ self.__button_state(False)
+ self.description_word_count.setText(
translate('OpenLP.ExceptionDialog', 'Description characters to enter : %s') % count)
- def onAttachFileButtonClicked(self):
+ def on_attach_file_button_clicked(self):
"""
Attache files to the bug report e-mail.
"""
@@ -232,11 +232,11 @@
Settings().value(self.settings_section + u'/last directory'), u'%s (*.*) (*)' % UiStrings().AllFiles)
log.info(u'New files(s) %s', unicode(files))
if files:
- self.fileAttachment = unicode(files)
+ self.file_attachment = unicode(files)
- def __buttonState(self, state):
+ def __button_state(self, state):
"""
Toggle the button state.
"""
- self.saveReportButton.setEnabled(state)
- self.sendReportButton.setEnabled(state)
+ self.save_report_button.setEnabled(state)
+ self.send_report_button.setEnabled(state)
=== modified file 'openlp/core/ui/filerenamedialog.py'
--- openlp/core/ui/filerenamedialog.py 2013-02-01 19:58:18 +0000
+++ openlp/core/ui/filerenamedialog.py 2013-03-07 18:01:28 +0000
@@ -39,28 +39,28 @@
"""
The UI widgets for the rename dialog
"""
- def setupUi(self, fileRenameDialog):
+ def setupUi(self, file_rename_dialog):
"""
Set up the UI
"""
- fileRenameDialog.setObjectName(u'fileRenameDialog')
- fileRenameDialog.resize(300, 10)
- self.dialogLayout = QtGui.QGridLayout(fileRenameDialog)
- self.dialogLayout.setObjectName(u'dialog_layout')
- self.fileNameLabel = QtGui.QLabel(fileRenameDialog)
- self.fileNameLabel.setObjectName(u'fileNameLabel')
- self.dialogLayout.addWidget(self.fileNameLabel, 0, 0)
- self.fileNameEdit = QtGui.QLineEdit(fileRenameDialog)
- self.fileNameEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
- self.fileNameEdit.setObjectName(u'fileNameEdit')
- self.dialogLayout.addWidget(self.fileNameEdit, 0, 1)
- self.button_box = create_button_box(fileRenameDialog, u'button_box', [u'cancel', u'ok'])
- self.dialogLayout.addWidget(self.button_box, 1, 0, 1, 2)
- self.retranslateUi(fileRenameDialog)
+ file_rename_dialog.setObjectName(u'file_rename_dialog')
+ file_rename_dialog.resize(300, 10)
+ self.dialog_layout = QtGui.QGridLayout(file_rename_dialog)
+ self.dialog_layout.setObjectName(u'dialog_layout')
+ self.file_name_label = QtGui.QLabel(file_rename_dialog)
+ self.file_name_label.setObjectName(u'file_name_label')
+ self.dialog_layout.addWidget(self.file_name_label, 0, 0)
+ self.file_name_edit = QtGui.QLineEdit(file_rename_dialog)
+ self.file_name_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
+ self.file_name_edit.setObjectName(u'file_name_edit')
+ self.dialog_layout.addWidget(self.file_name_edit, 0, 1)
+ self.button_box = create_button_box(file_rename_dialog, u'button_box', [u'cancel', u'ok'])
+ self.dialog_layout.addWidget(self.button_box, 1, 0, 1, 2)
+ self.retranslateUi(file_rename_dialog)
self.setMaximumHeight(self.sizeHint().height())
- def retranslateUi(self, fileRenameDialog):
+ def retranslateUi(self, file_rename_dialog):
"""
Translate the UI on the fly.
"""
- self.fileNameLabel.setText(translate('OpenLP.FileRenameForm', 'New File Name:'))
+ self.file_name_label.setText(translate('OpenLP.FileRenameForm', 'New File Name:'))
=== modified file 'openlp/core/ui/filerenameform.py'
--- openlp/core/ui/filerenameform.py 2013-02-07 21:55:22 +0000
+++ openlp/core/ui/filerenameform.py 2013-03-07 18:01:28 +0000
@@ -56,7 +56,7 @@
self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Copy'))
else:
self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename'))
- self.fileNameEdit.setFocus()
+ self.file_name_edit.setFocus()
return QtGui.QDialog.exec_(self)
def _get_main_window(self):
=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py 2013-02-10 16:10:32 +0000
+++ openlp/core/ui/firsttimeform.py 2013-03-07 18:01:28 +0000
@@ -98,11 +98,9 @@
self.update_screen_list_combo()
self.was_download_cancelled = False
self.downloading = translate('OpenLP.FirstTimeWizard', 'Downloading %s...')
- QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
- self.onCancelButtonClicked)
- QtCore.QObject.connect(self.noInternetFinishButton, QtCore.SIGNAL('clicked()'),
- self.onNoInternetFinishButtonClicked)
- QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
+ self.cancelButton.clicked.connect(self.onCancelButtonClicked)
+ self.noInternetFinishButton.clicked.connect(self.onNoInternetFinishButtonClicked)
+ self.currentIdChanged.connect(self.onCurrentIdChanged)
Registry().register_function(u'config_screen_changed', self.update_screen_list_combo)
def exec_(self):
=== modified file 'openlp/core/ui/firsttimelanguageform.py'
--- openlp/core/ui/firsttimelanguageform.py 2013-02-01 20:36:27 +0000
+++ openlp/core/ui/firsttimelanguageform.py 2013-03-07 18:01:28 +0000
@@ -48,8 +48,7 @@
self.setupUi(self)
self.qmList = LanguageManager.get_qm_list()
self.languageComboBox.addItem(u'Autodetect')
- for key in sorted(self.qmList.keys()):
- self.languageComboBox.addItem(key)
+ self.languageComboBox.addItems(sorted(self.qmList.keys()))
def exec_(self):
"""
=== modified file 'openlp/core/ui/firsttimewizard.py'
--- openlp/core/ui/firsttimewizard.py 2013-02-01 20:36:27 +0000
+++ openlp/core/ui/firsttimewizard.py 2013-03-07 18:01:28 +0000
@@ -208,13 +208,11 @@
"""
Translate the UI on the fly
"""
- FirstTimeWizard.setWindowTitle(translate(
- 'OpenLP.FirstTimeWizard', 'First Time Wizard'))
- self.titleLabel.setText(u'<span style="font-size:14pt; font-weight:600;">%s</span>' %
+ FirstTimeWizard.setWindowTitle(translate('OpenLP.FirstTimeWizard', 'First Time Wizard'))
+ self.title_label.setText(u'<span style="font-size:14pt; font-weight:600;">%s</span>' %
translate('OpenLP.FirstTimeWizard', 'Welcome to the First Time Wizard'))
- self.informationLabel.setText(translate('OpenLP.FirstTimeWizard',
- 'This wizard will help you to configure OpenLP for initial use.'
- ' Click the next button below to start.'))
+ self.information_label.setText(translate('OpenLP.FirstTimeWizard',
+ 'This wizard will help you to configure OpenLP for initial use. Click the next button below to start.'))
self.pluginPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Activate required Plugins'))
self.pluginPage.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select the Plugins you wish to use. '))
self.songsCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Songs'))
@@ -240,8 +238,7 @@
'check your Internet connection and re-run this wizard by '
'selecting "Tools/Re-run First Time Wizard" from OpenLP.')
self.cancelWizardText = translate('OpenLP.FirstTimeWizard',
- '\n\nTo cancel the First Time Wizard completely (and not start '
- 'OpenLP), click the Cancel button now.')
+ '\n\nTo cancel the First Time Wizard completely (and not start OpenLP), click the Cancel button now.')
self.songsPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Songs'))
self.songsPage.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download public domain songs.'))
self.biblesPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Bibles'))
=== modified file 'openlp/core/ui/formattingtagdialog.py'
--- openlp/core/ui/formattingtagdialog.py 2013-02-05 08:05:28 +0000
+++ openlp/core/ui/formattingtagdialog.py 2013-03-07 18:01:28 +0000
@@ -39,106 +39,106 @@
"""
The UI widgets for the formatting tags window.
"""
- def setupUi(self, formattingTagDialog):
+ def setupUi(self, formatting_tag_dialog):
"""
Set up the UI
"""
- formattingTagDialog.setObjectName(u'formattingTagDialog')
- formattingTagDialog.resize(725, 548)
- self.listdataGridLayout = QtGui.QGridLayout(formattingTagDialog)
- self.listdataGridLayout.setMargin(8)
- self.listdataGridLayout.setObjectName(u'listdataGridLayout')
- self.tagTableWidget = QtGui.QTableWidget(formattingTagDialog)
- self.tagTableWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
- self.tagTableWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
- self.tagTableWidget.setAlternatingRowColors(True)
- self.tagTableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
- self.tagTableWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
- self.tagTableWidget.setCornerButtonEnabled(False)
- self.tagTableWidget.setObjectName(u'tagTableWidget')
- self.tagTableWidget.setColumnCount(4)
- self.tagTableWidget.setRowCount(0)
- self.tagTableWidget.horizontalHeader().setStretchLastSection(True)
- item = QtGui.QTableWidgetItem()
- self.tagTableWidget.setHorizontalHeaderItem(0, item)
- item = QtGui.QTableWidgetItem()
- self.tagTableWidget.setHorizontalHeaderItem(1, item)
- item = QtGui.QTableWidgetItem()
- self.tagTableWidget.setHorizontalHeaderItem(2, item)
- item = QtGui.QTableWidgetItem()
- self.tagTableWidget.setHorizontalHeaderItem(3, item)
- self.listdataGridLayout.addWidget(self.tagTableWidget, 0, 0, 1, 1)
- self.horizontalLayout = QtGui.QHBoxLayout()
- self.horizontalLayout.setObjectName(u'horizontalLayout')
- spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.horizontalLayout.addItem(spacerItem)
- self.deletePushButton = QtGui.QPushButton(formattingTagDialog)
- self.deletePushButton.setObjectName(u'deletePushButton')
- self.horizontalLayout.addWidget(self.deletePushButton)
- self.listdataGridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
- self.editGroupBox = QtGui.QGroupBox(formattingTagDialog)
- self.editGroupBox.setObjectName(u'editGroupBox')
- self.dataGridLayout = QtGui.QGridLayout(self.editGroupBox)
- self.dataGridLayout.setObjectName(u'dataGridLayout')
- self.descriptionLabel = QtGui.QLabel(self.editGroupBox)
- self.descriptionLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.descriptionLabel.setObjectName(u'descriptionLabel')
- self.dataGridLayout.addWidget(self.descriptionLabel, 0, 0, 1, 1)
- self.descriptionLineEdit = QtGui.QLineEdit(self.editGroupBox)
- self.descriptionLineEdit.setObjectName(u'descriptionLineEdit')
- self.dataGridLayout.addWidget(self.descriptionLineEdit, 0, 1, 2, 1)
- self.newPushButton = QtGui.QPushButton(self.editGroupBox)
- self.newPushButton.setObjectName(u'newPushButton')
- self.dataGridLayout.addWidget(self.newPushButton, 0, 2, 2, 1)
- self.tagLabel = QtGui.QLabel(self.editGroupBox)
- self.tagLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.tagLabel.setObjectName(u'tagLabel')
- self.dataGridLayout.addWidget(self.tagLabel, 2, 0, 1, 1)
- self.tagLineEdit = QtGui.QLineEdit(self.editGroupBox)
- self.tagLineEdit.setMaximumSize(QtCore.QSize(50, 16777215))
- self.tagLineEdit.setMaxLength(5)
- self.tagLineEdit.setObjectName(u'tagLineEdit')
- self.dataGridLayout.addWidget(self.tagLineEdit, 2, 1, 1, 1)
- self.startTagLabel = QtGui.QLabel(self.editGroupBox)
- self.startTagLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.startTagLabel.setObjectName(u'startTagLabel')
- self.dataGridLayout.addWidget(self.startTagLabel, 3, 0, 1, 1)
- self.startTagLineEdit = QtGui.QLineEdit(self.editGroupBox)
- self.startTagLineEdit.setObjectName(u'startTagLineEdit')
- self.dataGridLayout.addWidget(self.startTagLineEdit, 3, 1, 1, 1)
- self.endTagLabel = QtGui.QLabel(self.editGroupBox)
- self.endTagLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.endTagLabel.setObjectName(u'endTagLabel')
- self.dataGridLayout.addWidget(self.endTagLabel, 4, 0, 1, 1)
- self.endTagLineEdit = QtGui.QLineEdit(self.editGroupBox)
- self.endTagLineEdit.setObjectName(u'endTagLineEdit')
- self.dataGridLayout.addWidget(self.endTagLineEdit, 4, 1, 1, 1)
- self.savePushButton = QtGui.QPushButton(self.editGroupBox)
- self.savePushButton.setObjectName(u'savePushButton')
- self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1)
- self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1)
- self.button_box = create_button_box(formattingTagDialog, u'button_box', [u'close'])
- self.listdataGridLayout.addWidget(self.button_box, 3, 0, 1, 1)
-
- self.retranslateUi(formattingTagDialog)
-
- def retranslateUi(self, formattingTagDialog):
+ formatting_tag_dialog.setObjectName(u'formatting_tag_dialog')
+ formatting_tag_dialog.resize(725, 548)
+ self.list_data_grid_layout = QtGui.QGridLayout(formatting_tag_dialog)
+ self.list_data_grid_layout.setMargin(8)
+ self.list_data_grid_layout.setObjectName(u'list_data_grid_layout')
+ self.tag_table_widget = QtGui.QTableWidget(formatting_tag_dialog)
+ self.tag_table_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
+ self.tag_table_widget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
+ self.tag_table_widget.setAlternatingRowColors(True)
+ self.tag_table_widget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.tag_table_widget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
+ self.tag_table_widget.setCornerButtonEnabled(False)
+ self.tag_table_widget.setObjectName(u'tag_table_widget')
+ self.tag_table_widget.setColumnCount(4)
+ self.tag_table_widget.setRowCount(0)
+ self.tag_table_widget.horizontalHeader().setStretchLastSection(True)
+ item = QtGui.QTableWidgetItem()
+ self.tag_table_widget.setHorizontalHeaderItem(0, item)
+ item = QtGui.QTableWidgetItem()
+ self.tag_table_widget.setHorizontalHeaderItem(1, item)
+ item = QtGui.QTableWidgetItem()
+ self.tag_table_widget.setHorizontalHeaderItem(2, item)
+ item = QtGui.QTableWidgetItem()
+ self.tag_table_widget.setHorizontalHeaderItem(3, item)
+ self.list_data_grid_layout.addWidget(self.tag_table_widget, 0, 0, 1, 1)
+ self.horizontal_layout = QtGui.QHBoxLayout()
+ self.horizontal_layout.setObjectName(u'horizontal_layout')
+ spacer_item = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.horizontal_layout.addItem(spacer_item)
+ self.delete_push_button = QtGui.QPushButton(formatting_tag_dialog)
+ self.delete_push_button.setObjectName(u'delete_push_button')
+ self.horizontal_layout.addWidget(self.delete_push_button)
+ self.list_data_grid_layout.addLayout(self.horizontal_layout, 1, 0, 1, 1)
+ self.edit_group_box = QtGui.QGroupBox(formatting_tag_dialog)
+ self.edit_group_box.setObjectName(u'edit_group_box')
+ self.data_grid_layout = QtGui.QGridLayout(self.edit_group_box)
+ self.data_grid_layout.setObjectName(u'data_grid_layout')
+ self.description_label = QtGui.QLabel(self.edit_group_box)
+ self.description_label.setAlignment(QtCore.Qt.AlignCenter)
+ self.description_label.setObjectName(u'description_label')
+ self.data_grid_layout.addWidget(self.description_label, 0, 0, 1, 1)
+ self.description_line_edit = QtGui.QLineEdit(self.edit_group_box)
+ self.description_line_edit.setObjectName(u'description_line_edit')
+ self.data_grid_layout.addWidget(self.description_line_edit, 0, 1, 2, 1)
+ self.new_push_button = QtGui.QPushButton(self.edit_group_box)
+ self.new_push_button.setObjectName(u'new_push_button')
+ self.data_grid_layout.addWidget(self.new_push_button, 0, 2, 2, 1)
+ self.tag_label = QtGui.QLabel(self.edit_group_box)
+ self.tag_label.setAlignment(QtCore.Qt.AlignCenter)
+ self.tag_label.setObjectName(u'tag_label')
+ self.data_grid_layout.addWidget(self.tag_label, 2, 0, 1, 1)
+ self.tag_line_edit = QtGui.QLineEdit(self.edit_group_box)
+ self.tag_line_edit.setMaximumSize(QtCore.QSize(50, 16777215))
+ self.tag_line_edit.setMaxLength(5)
+ self.tag_line_edit.setObjectName(u'tag_line_edit')
+ self.data_grid_layout.addWidget(self.tag_line_edit, 2, 1, 1, 1)
+ self.start_tag_label = QtGui.QLabel(self.edit_group_box)
+ self.start_tag_label.setAlignment(QtCore.Qt.AlignCenter)
+ self.start_tag_label.setObjectName(u'start_tag_label')
+ self.data_grid_layout.addWidget(self.start_tag_label, 3, 0, 1, 1)
+ self.start_tag_line_edit = QtGui.QLineEdit(self.edit_group_box)
+ self.start_tag_line_edit.setObjectName(u'start_tag_line_edit')
+ self.data_grid_layout.addWidget(self.start_tag_line_edit, 3, 1, 1, 1)
+ self.end_tag_label = QtGui.QLabel(self.edit_group_box)
+ self.end_tag_label.setAlignment(QtCore.Qt.AlignCenter)
+ self.end_tag_label.setObjectName(u'end_tag_label')
+ self.data_grid_layout.addWidget(self.end_tag_label, 4, 0, 1, 1)
+ self.end_tag_line_edit = QtGui.QLineEdit(self.edit_group_box)
+ self.end_tag_line_edit.setObjectName(u'end_tag_line_edit')
+ self.data_grid_layout.addWidget(self.end_tag_line_edit, 4, 1, 1, 1)
+ self.save_push_button = QtGui.QPushButton(self.edit_group_box)
+ self.save_push_button.setObjectName(u'save_push_button')
+ self.data_grid_layout.addWidget(self.save_push_button, 4, 2, 1, 1)
+ self.list_data_grid_layout.addWidget(self.edit_group_box, 2, 0, 1, 1)
+ self.button_box = create_button_box(formatting_tag_dialog, u'button_box', [u'close'])
+ self.list_data_grid_layout.addWidget(self.button_box, 3, 0, 1, 1)
+
+ self.retranslateUi(formatting_tag_dialog)
+
+ def retranslateUi(self, formatting_tag_dialog):
"""
Translate the UI on the fly
"""
- formattingTagDialog.setWindowTitle(translate('OpenLP.FormattingTagDialog', 'Configure Formatting Tags'))
- self.editGroupBox.setTitle(translate('OpenLP.FormattingTagDialog', 'Edit Selection'))
- self.savePushButton.setText(translate('OpenLP.FormattingTagDialog', 'Save'))
- self.descriptionLabel.setText(translate('OpenLP.FormattingTagDialog', 'Description'))
- self.tagLabel.setText(translate('OpenLP.FormattingTagDialog', 'Tag'))
- self.startTagLabel.setText(translate('OpenLP.FormattingTagDialog', 'Start HTML'))
- self.endTagLabel.setText(translate('OpenLP.FormattingTagDialog', 'End HTML'))
- self.deletePushButton.setText(UiStrings().Delete)
- self.newPushButton.setText(UiStrings().New)
- self.tagTableWidget.horizontalHeaderItem(0).setText(translate('OpenLP.FormattingTagDialog', 'Description'))
- self.tagTableWidget.horizontalHeaderItem(1).setText(translate('OpenLP.FormattingTagDialog', 'Tag'))
- self.tagTableWidget.horizontalHeaderItem(2).setText(translate('OpenLP.FormattingTagDialog', 'Start HTML'))
- self.tagTableWidget.horizontalHeaderItem(3).setText(translate('OpenLP.FormattingTagDialog', 'End HTML'))
- self.tagTableWidget.setColumnWidth(0, 120)
- self.tagTableWidget.setColumnWidth(1, 80)
- self.tagTableWidget.setColumnWidth(2, 330)
+ formatting_tag_dialog.setWindowTitle(translate('OpenLP.FormattingTagDialog', 'Configure Formatting Tags'))
+ self.edit_group_box.setTitle(translate('OpenLP.FormattingTagDialog', 'Edit Selection'))
+ self.save_push_button.setText(translate('OpenLP.FormattingTagDialog', 'Save'))
+ self.description_label.setText(translate('OpenLP.FormattingTagDialog', 'Description'))
+ self.tag_label.setText(translate('OpenLP.FormattingTagDialog', 'Tag'))
+ self.start_tag_label.setText(translate('OpenLP.FormattingTagDialog', 'Start HTML'))
+ self.end_tag_label.setText(translate('OpenLP.FormattingTagDialog', 'End HTML'))
+ self.delete_push_button.setText(UiStrings().Delete)
+ self.new_push_button.setText(UiStrings().New)
+ self.tag_table_widget.horizontalHeaderItem(0).setText(translate('OpenLP.FormattingTagDialog', 'Description'))
+ self.tag_table_widget.horizontalHeaderItem(1).setText(translate('OpenLP.FormattingTagDialog', 'Tag'))
+ self.tag_table_widget.horizontalHeaderItem(2).setText(translate('OpenLP.FormattingTagDialog', 'Start HTML'))
+ self.tag_table_widget.horizontalHeaderItem(3).setText(translate('OpenLP.FormattingTagDialog', 'End HTML'))
+ self.tag_table_widget.setColumnWidth(0, 120)
+ self.tag_table_widget.setColumnWidth(1, 80)
+ self.tag_table_widget.setColumnWidth(2, 330)
=== modified file 'openlp/core/ui/formattingtagform.py'
--- openlp/core/ui/formattingtagform.py 2013-02-05 08:05:28 +0000
+++ openlp/core/ui/formattingtagform.py 2013-03-07 18:01:28 +0000
@@ -48,15 +48,15 @@
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
- QtCore.QObject.connect(self.tagTableWidget, QtCore.SIGNAL(u'itemSelectionChanged()'), self.onRowSelected)
- QtCore.QObject.connect(self.newPushButton, QtCore.SIGNAL(u'clicked()'), self.onNewClicked)
- QtCore.QObject.connect(self.savePushButton, QtCore.SIGNAL(u'clicked()'), self.onSavedClicked)
- QtCore.QObject.connect(self.deletePushButton, QtCore.SIGNAL(u'clicked()'), self.onDeleteClicked)
- QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(u'rejected()'), self.close)
- QtCore.QObject.connect(self.descriptionLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
- QtCore.QObject.connect(self.tagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
- QtCore.QObject.connect(self.startTagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
- QtCore.QObject.connect(self.endTagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
+ self.tag_table_widget.itemSelectionChanged.connect(self.on_row_selected)
+ self.new_push_button.clicked.connect(self.on_new_clicked)
+ self.save_push_button.clicked.connect(self.on_saved_clicked)
+ self.delete_push_button.clicked.connect(self.on_delete_clicked)
+ self.button_box.rejected.connect(self.close)
+ self.description_line_edit.textEdited.connect(self.on_text_edited)
+ self.tag_line_edit.textEdited.connect(self.on_text_edited)
+ self.start_tag_line_edit.textEdited.connect(self.on_text_edited)
+ self.end_tag_line_edit.textEdited.connect(self.on_text_edited)
# Forces reloading of tags from openlp configuration.
FormattingTags.load_tags()
@@ -69,38 +69,38 @@
self.selected = -1
return QtGui.QDialog.exec_(self)
- def onRowSelected(self):
+ def on_row_selected(self):
"""
Table Row selected so display items and set field state.
"""
- self.savePushButton.setEnabled(False)
- self.selected = self.tagTableWidget.currentRow()
+ self.save_push_button.setEnabled(False)
+ self.selected = self.tag_table_widget.currentRow()
html = FormattingTags.get_html_tags()[self.selected]
- self.descriptionLineEdit.setText(html[u'desc'])
- self.tagLineEdit.setText(self._strip(html[u'start tag']))
- self.startTagLineEdit.setText(html[u'start html'])
- self.endTagLineEdit.setText(html[u'end html'])
+ self.description_line_edit.setText(html[u'desc'])
+ self.tag_line_edit.setText(self._strip(html[u'start tag']))
+ self.start_tag_line_edit.setText(html[u'start html'])
+ self.end_tag_line_edit.setText(html[u'end html'])
if html[u'protected']:
- self.descriptionLineEdit.setEnabled(False)
- self.tagLineEdit.setEnabled(False)
- self.startTagLineEdit.setEnabled(False)
- self.endTagLineEdit.setEnabled(False)
- self.deletePushButton.setEnabled(False)
+ self.description_line_edit.setEnabled(False)
+ self.tag_line_edit.setEnabled(False)
+ self.start_tag_line_edit.setEnabled(False)
+ self.end_tag_line_edit.setEnabled(False)
+ self.delete_push_button.setEnabled(False)
else:
- self.descriptionLineEdit.setEnabled(True)
- self.tagLineEdit.setEnabled(True)
- self.startTagLineEdit.setEnabled(True)
- self.endTagLineEdit.setEnabled(True)
- self.deletePushButton.setEnabled(True)
+ self.description_line_edit.setEnabled(True)
+ self.tag_line_edit.setEnabled(True)
+ self.start_tag_line_edit.setEnabled(True)
+ self.end_tag_line_edit.setEnabled(True)
+ self.delete_push_button.setEnabled(True)
- def onTextEdited(self, text):
+ def on_text_edited(self, text):
"""
- Enable the ``savePushButton`` when any of the selected tag's properties
+ Enable the ``save_push_button`` when any of the selected tag's properties
has been changed.
"""
- self.savePushButton.setEnabled(True)
+ self.save_push_button.setEnabled(True)
- def onNewClicked(self):
+ def on_new_clicked(self):
"""
Add a new tag to list only if it is not a duplicate.
"""
@@ -124,12 +124,11 @@
FormattingTags.save_html_tags()
self._reloadTable()
# Highlight new row
- self.tagTableWidget.selectRow(self.tagTableWidget.rowCount() - 1)
- self.onRowSelected()
- self.tagTableWidget.scrollToBottom()
- #self.savePushButton.setEnabled(False)
+ self.tag_table_widget.selectRow(self.tag_table_widget.rowCount() - 1)
+ self.on_row_selected()
+ self.tag_table_widget.scrollToBottom()
- def onDeleteClicked(self):
+ def on_delete_clicked(self):
"""
Delete selected custom tag.
"""
@@ -137,28 +136,28 @@
FormattingTags.remove_html_tag(self.selected)
# As the first items are protected we should not have to take care
# of negative indexes causing tracebacks.
- self.tagTableWidget.selectRow(self.selected - 1)
+ self.tag_table_widget.selectRow(self.selected - 1)
self.selected = -1
FormattingTags.save_html_tags()
self._reloadTable()
- def onSavedClicked(self):
+ def on_saved_clicked(self):
"""
Update Custom Tag details if not duplicate and save the data.
"""
html_expands = FormattingTags.get_html_tags()
if self.selected != -1:
html = html_expands[self.selected]
- tag = self.tagLineEdit.text()
+ tag = self.tag_line_edit.text()
for linenumber, html1 in enumerate(html_expands):
if self._strip(html1[u'start tag']) == tag and linenumber != self.selected:
critical_error_message_box(
translate('OpenLP.FormattingTagForm', 'Update Error'),
translate('OpenLP.FormattingTagForm', 'Tag %s already defined.') % tag)
return
- html[u'desc'] = self.descriptionLineEdit.text()
- html[u'start html'] = self.startTagLineEdit.text()
- html[u'end html'] = self.endTagLineEdit.text()
+ html[u'desc'] = self.description_line_edit.text()
+ html[u'start html'] = self.start_tag_line_edit.text()
+ html[u'end html'] = self.end_tag_line_edit.text()
html[u'start tag'] = u'{%s}' % tag
html[u'end tag'] = u'{/%s}' % tag
# Keep temporary tags when the user changes one.
@@ -171,29 +170,29 @@
"""
Reset List for loading.
"""
- self.tagTableWidget.clearContents()
- self.tagTableWidget.setRowCount(0)
- self.newPushButton.setEnabled(True)
- self.savePushButton.setEnabled(False)
- self.deletePushButton.setEnabled(False)
+ self.tag_table_widget.clearContents()
+ self.tag_table_widget.setRowCount(0)
+ self.new_push_button.setEnabled(True)
+ self.save_push_button.setEnabled(False)
+ self.delete_push_button.setEnabled(False)
for linenumber, html in enumerate(FormattingTags.get_html_tags()):
- self.tagTableWidget.setRowCount(self.tagTableWidget.rowCount() + 1)
- self.tagTableWidget.setItem(linenumber, 0, QtGui.QTableWidgetItem(html[u'desc']))
- self.tagTableWidget.setItem(linenumber, 1, QtGui.QTableWidgetItem(self._strip(html[u'start tag'])))
- self.tagTableWidget.setItem(linenumber, 2, QtGui.QTableWidgetItem(html[u'start html']))
- self.tagTableWidget.setItem(linenumber, 3, QtGui.QTableWidgetItem(html[u'end html']))
+ self.tag_table_widget.setRowCount(self.tag_table_widget.rowCount() + 1)
+ self.tag_table_widget.setItem(linenumber, 0, QtGui.QTableWidgetItem(html[u'desc']))
+ self.tag_table_widget.setItem(linenumber, 1, QtGui.QTableWidgetItem(self._strip(html[u'start tag'])))
+ self.tag_table_widget.setItem(linenumber, 2, QtGui.QTableWidgetItem(html[u'start html']))
+ self.tag_table_widget.setItem(linenumber, 3, QtGui.QTableWidgetItem(html[u'end html']))
# Permanent (persistent) tags do not have this key.
if u'temporary' not in html:
html[u'temporary'] = False
- self.tagTableWidget.resizeRowsToContents()
- self.descriptionLineEdit.setText(u'')
- self.tagLineEdit.setText(u'')
- self.startTagLineEdit.setText(u'')
- self.endTagLineEdit.setText(u'')
- self.descriptionLineEdit.setEnabled(False)
- self.tagLineEdit.setEnabled(False)
- self.startTagLineEdit.setEnabled(False)
- self.endTagLineEdit.setEnabled(False)
+ self.tag_table_widget.resizeRowsToContents()
+ self.description_line_edit.setText(u'')
+ self.tag_line_edit.setText(u'')
+ self.start_tag_line_edit.setText(u'')
+ self.end_tag_line_edit.setText(u'')
+ self.description_line_edit.setEnabled(False)
+ self.tag_line_edit.setEnabled(False)
+ self.start_tag_line_edit.setEnabled(False)
+ self.end_tag_line_edit.setEnabled(False)
def _strip(self, tag):
"""
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2013-02-19 19:50:14 +0000
+++ openlp/core/ui/generaltab.py 2013-03-07 18:01:28 +0000
@@ -191,13 +191,12 @@
self.rightLayout.addWidget(self.settingsGroupBox)
self.rightLayout.addStretch()
# Signals and slots
- QtCore.QObject.connect(self.overrideRadioButton, QtCore.SIGNAL(u'toggled(bool)'),
- self.onOverrideRadioButtonPressed)
- QtCore.QObject.connect(self.customHeightValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
- QtCore.QObject.connect(self.customWidthValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
- QtCore.QObject.connect(self.customYValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
- QtCore.QObject.connect(self.customXValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
- QtCore.QObject.connect(self.monitorComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onDisplayChanged)
+ self.overrideRadioButton.toggled.connect(self.onOverrideRadioButtonPressed)
+ self.customHeightValueEdit.valueChanged.connect(self.onDisplayChanged)
+ self.customWidthValueEdit.valueChanged.connect(self.onDisplayChanged)
+ self.customYValueEdit.valueChanged.connect(self.onDisplayChanged)
+ self.customXValueEdit.valueChanged.connect(self.onDisplayChanged)
+ self.monitorComboBox.currentIndexChanged.connect(self.onDisplayChanged)
# Reload the tab, as the screen resolution/count may have changed.
Registry().register_function(u'config_screen_changed', self.load)
# Remove for now
@@ -231,8 +230,7 @@
self.usernameLabel.setText(translate('OpenLP.GeneralTab', 'SongSelect username:'))
self.passwordLabel.setText(translate('OpenLP.GeneralTab', 'SongSelect password:'))
# Moved from display tab
- self.overrideRadioButton.setText(translate('OpenLP.GeneralTab',
- 'Override display position:'))
+ self.overrideRadioButton.setText(translate('OpenLP.GeneralTab', 'Override display position:'))
self.customXLabel.setText(translate('OpenLP.GeneralTab', 'X'))
self.customYLabel.setText(translate('OpenLP.GeneralTab', 'Y'))
self.customHeightLabel.setText(translate('OpenLP.GeneralTab', 'Height'))
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2013-03-06 21:49:46 +0000
+++ openlp/core/ui/maindisplay.py 2013-03-07 18:01:28 +0000
@@ -113,7 +113,7 @@
Called by webView event to show display is fully loaded
"""
log.debug(u'is web loaded')
- self.webLoaded = True
+ self.web_loaded = True
class MainDisplay(Display):
@@ -132,26 +132,26 @@
self.retranslateUi()
self.media_object = None
if live:
- self.audioPlayer = AudioPlayer(self)
+ self.audio_player = AudioPlayer(self)
else:
- self.audioPlayer = None
- self.firstTime = True
- self.webLoaded = True
+ self.audio_player = None
+ self.first_time = True
+ self.web_loaded = True
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
- windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint
+ window_flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint
if Settings().value(u'advanced/x11 bypass wm'):
- windowFlags |= QtCore.Qt.X11BypassWindowManagerHint
- # TODO: The following combination of windowFlags works correctly
+ window_flags |= QtCore.Qt.X11BypassWindowManagerHint
+ # TODO: The following combination of window_flags works correctly
# on Mac OS X. For next OpenLP version we should test it on other
# platforms. For OpenLP 2.0 keep it only for OS X to not cause any
# regressions on other platforms.
if sys.platform == 'darwin':
- windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Window
+ window_flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Window
# For primary screen ensure it stays above the OS X dock
# and menu bar
if self.screens.current[u'primary']:
self.setWindowState(QtCore.Qt.WindowFullScreen)
- self.setWindowFlags(windowFlags)
+ self.setWindowFlags(window_flags)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.set_transparency(False)
if self.is_live:
@@ -209,20 +209,20 @@
background_color = QtCore.Qt.white
image_file = Settings().value(u'advanced/default image')
splash_image = QtGui.QImage(image_file)
- self.initialFrame = QtGui.QImage(
+ self.initial_fame = QtGui.QImage(
self.screen[u'size'].width(),
self.screen[u'size'].height(),
QtGui.QImage.Format_ARGB32_Premultiplied)
painter_image = QtGui.QPainter()
- painter_image.begin(self.initialFrame)
- painter_image.fillRect(self.initialFrame.rect(), background_color)
+ painter_image.begin(self.initial_fame)
+ painter_image.fillRect(self.initial_fame.rect(), background_color)
painter_image.drawImage(
(self.screen[u'size'].width() - splash_image.width()) / 2,
(self.screen[u'size'].height() - splash_image.height()) / 2,
splash_image)
- serviceItem = ServiceItem()
- serviceItem.bg_image_bytes = image_to_byte(self.initialFrame)
- self.web_view.setHtml(build_html(serviceItem, self.screen, self.is_live, None,
+ service_item = ServiceItem()
+ service_item.bg_image_bytes = image_to_byte(self.initial_fame)
+ self.web_view.setHtml(build_html(service_item, self.screen, self.is_live, None,
plugins=self.plugin_manager.plugins))
self.__hideMouse()
log.debug(u'Finished MainDisplay setup')
@@ -239,7 +239,7 @@
"""
log.debug(u'text to display')
# Wait for the webview to update before displaying text.
- while not self.webLoaded:
+ while not self.web_loaded:
self.application.process_events()
self.setGeometry(self.screen[u'size'])
if animate:
@@ -290,10 +290,10 @@
API for replacement backgrounds so Images are added directly to cache.
"""
self.image_manager.add_image(path, ImageSource.ImagePlugin, background)
- if not hasattr(self, u'serviceItem'):
+ if not hasattr(self, u'service_item'):
return False
self.override[u'image'] = path
- self.override[u'theme'] = self.serviceItem.themedata.background_filename
+ self.override[u'theme'] = self.service_item.themedata.background_filename
self.image(path)
# Update the preview frame.
if self.is_live:
@@ -332,8 +332,8 @@
image plugin has changed the background.
"""
log.debug(u'reset_image')
- if hasattr(self, u'serviceItem'):
- self.display_image(self.serviceItem.bg_image_bytes)
+ if hasattr(self, u'service_item'):
+ self.display_image(self.service_item.bg_image_bytes)
else:
self.display_image(None)
# clear the cache
@@ -347,15 +347,15 @@
was_visible = self.isVisible()
self.application.process_events()
# We must have a service item to preview.
- if self.is_live and hasattr(self, u'serviceItem'):
+ if self.is_live and hasattr(self, u'service_item'):
# Wait for the fade to finish before geting the preview.
# Important otherwise preview will have incorrect text if at all!
- if self.serviceItem.themedata and self.serviceItem.themedata.display_slide_transition:
+ if self.service_item.themedata and self.service_item.themedata.display_slide_transition:
while not self.frame.evaluateJavaScript(u'show_text_completed()'):
self.application.process_events()
# Wait for the webview to update before getting the preview.
# Important otherwise first preview will miss the background !
- while not self.webLoaded:
+ while not self.web_loaded:
self.application.process_events()
# if was hidden keep it hidden
if self.is_live:
@@ -373,15 +373,15 @@
self.setVisible(True)
return QtGui.QPixmap.grabWidget(self)
- def build_html(self, serviceItem, image_path=u''):
+ def build_html(self, service_item, image_path=u''):
"""
- Store the serviceItem and build the new HTML from it. Add the
+ Store the service_item and build the new HTML from it. Add the
HTML to the display
"""
log.debug(u'build_html')
- self.webLoaded = False
- self.initialFrame = None
- self.serviceItem = serviceItem
+ self.web_loaded = False
+ self.initial_fame = None
+ self.service_item = service_item
background = None
# We have an image override so keep the image till the theme changes.
if self.override:
@@ -390,31 +390,31 @@
Registry().execute(u'video_background_replaced')
self.override = {}
# We have a different theme.
- elif self.override[u'theme'] != serviceItem.themedata.background_filename:
+ elif self.override[u'theme'] != service_item.themedata.background_filename:
Registry().execute(u'live_theme_changed')
self.override = {}
else:
# replace the background
background = self.image_manager.get_image_bytes(self.override[u'image'], ImageSource.ImagePlugin)
- self.set_transparency(self.serviceItem.themedata.background_type ==
+ self.set_transparency(self.service_item.themedata.background_type ==
BackgroundType.to_string(BackgroundType.Transparent))
- if self.serviceItem.themedata.background_filename:
- self.serviceItem.bg_image_bytes = self.image_manager.get_image_bytes(
- self.serviceItem.themedata.background_filename, ImageSource.Theme
+ if self.service_item.themedata.background_filename:
+ self.service_item.bg_image_bytes = self.image_manager.get_image_bytes(
+ self.service_item.themedata.background_filename, ImageSource.Theme
)
if image_path:
image_bytes = self.image_manager.get_image_bytes(image_path, ImageSource.ImagePlugin)
else:
image_bytes = None
- html = build_html(self.serviceItem, self.screen, self.is_live, background, image_bytes,
+ html = build_html(self.service_item, self.screen, self.is_live, background, image_bytes,
plugins=self.plugin_manager.plugins)
log.debug(u'buildHtml - pre setHtml')
self.web_view.setHtml(html)
log.debug(u'buildHtml - post setHtml')
- if serviceItem.foot_text:
- self.footer(serviceItem.foot_text)
+ if service_item.foot_text:
+ self.footer(service_item.foot_text)
# if was hidden keep it hidden
- if self.hide_mode and self.is_live and not serviceItem.is_media():
+ if self.hide_mode and self.is_live and not service_item.is_media():
if Settings().value(u'general/auto unblank'):
Registry().execute(u'slidecontroller_live_unblank')
else:
@@ -442,7 +442,7 @@
if mode == HideMode.Screen:
self.frame.evaluateJavaScript(u'show_blank("desktop");')
self.setVisible(False)
- elif mode == HideMode.Blank or self.initialFrame:
+ elif mode == HideMode.Blank or self.initial_fame:
self.frame.evaluateJavaScript(u'show_blank("black");')
else:
self.frame.evaluateJavaScript(u'show_blank("theme");')
@@ -657,4 +657,5 @@
"""
Connect a slot to a signal on the media object. Used by slidecontroller to connect to audio object.
"""
- QtCore.QObject.connect(self.media_object, signal, slot)
\ No newline at end of file
+ QtCore.QObject.connect(self.media_object, signal, slot)
+
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2013-03-05 17:11:58 +0000
+++ openlp/core/ui/mainwindow.py 2013-03-07 18:01:28 +0000
@@ -346,7 +346,7 @@
self.retranslateUi(main_window)
self.mediaToolBox.setCurrentIndex(0)
# Connect up some signals and slots
- QtCore.QObject.connect(self.fileMenu, QtCore.SIGNAL(u'aboutToShow()'), self.updateRecentFilesMenu)
+ self.fileMenu.aboutToShow.connect(self.updateRecentFilesMenu)
# Hide the entry, as it does not have any functionality yet.
self.toolsAddToolItem.setVisible(False)
self.importLanguageItem.setVisible(False)
@@ -506,12 +506,9 @@
self.updateRecentFilesMenu()
self.pluginForm = PluginForm(self)
# Set up signals and slots
- QtCore.QObject.connect(self.mediaManagerDock, QtCore.SIGNAL(u'visibilityChanged(bool)'),
- self.viewMediaManagerItem.setChecked)
- QtCore.QObject.connect(self.serviceManagerDock, QtCore.SIGNAL(u'visibilityChanged(bool)'),
- self.viewServiceManagerItem.setChecked)
- QtCore.QObject.connect(self.themeManagerDock, QtCore.SIGNAL(u'visibilityChanged(bool)'),
- self.viewThemeManagerItem.setChecked)
+ self.mediaManagerDock.visibilityChanged.connect(self.viewMediaManagerItem.setChecked)
+ self.serviceManagerDock.visibilityChanged.connect(self.viewServiceManagerItem.setChecked)
+ self.themeManagerDock.visibilityChanged.connect(self.viewThemeManagerItem.setChecked)
self.importThemeItem.triggered.connect(self.themeManagerContents.on_import_theme)
self.exportThemeItem.triggered.connect(self.themeManagerContents.on_export_theme)
self.webSiteItem.triggered.connect(self.onHelpWebSiteClicked)
@@ -1290,7 +1287,7 @@
self.loadProgressBar.setValue(0)
self.application.process_events()
- def incrementProgressBar(self):
+ def increment_progress_bar(self):
"""
Increase the Progress Bar value by 1
"""
=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py 2013-03-06 21:49:46 +0000
+++ openlp/core/ui/media/mediacontroller.py 2013-03-07 18:01:28 +0000
@@ -49,7 +49,7 @@
"""
Allows the mouse events of a slider to be overridden and extra functionality added
"""
- def __init__(self, direction, manager, controller, parent=None):
+ def __init__(self, direction, manager, controller):
"""
Constructor
"""
@@ -84,7 +84,7 @@
The implementation of the Media Controller. The Media Controller adds an own
class for every Player. Currently these are QtWebkit, Phonon and Vlc.
- displayControllers are an array of controllers keyed on the
+ display_controllers are an array of controllers keyed on the
slidecontroller or plugin which built them. ControllerType is the class
containing the key values.
@@ -100,7 +100,7 @@
Registry().register(u'media_controller', self)
Registry().register_function(u'bootstrap_initialise', self.check_available_media_players)
self.media_players = {}
- self.displayControllers = {}
+ self.display_controllers = {}
self.current_media_players = {}
# Timer for video state
self.timer = QtCore.QTimer()
@@ -125,9 +125,9 @@
"""
Set the active players and available media files
"""
- savedPlayers = get_media_players()[0]
+ saved_players = get_media_players()[0]
for player in self.media_players.keys():
- self.media_players[player].isActive = player in savedPlayers
+ self.media_players[player].isActive = player in saved_players
def _generate_extensions_lists(self):
"""
@@ -203,7 +203,7 @@
else:
any_active = False
for source in self.current_media_players.keys():
- display = self._define_display(self.displayControllers[source])
+ display = self._define_display(self.display_controllers[source])
self.current_media_players[source].resize(display)
self.current_media_players[source].update_ui(display)
if self.current_media_players[source].state == MediaState.Playing:
@@ -214,7 +214,7 @@
# no players are active anymore
for source in self.current_media_players.keys():
if self.current_media_players[source].state != MediaState.Paused:
- display = self._define_display(self.displayControllers[source])
+ display = self._define_display(self.display_controllers[source])
display.controller.seekSlider.setSliderPosition(0)
self.timer.stop()
@@ -255,7 +255,7 @@
``controller``
The controller where a player will be placed
"""
- self.displayControllers[controller.controller_type] = controller
+ self.display_controllers[controller.controller_type] = controller
self.setup_generic_controls(controller)
def setup_generic_controls(self, controller):
@@ -268,13 +268,13 @@
controller.media_info = MediaInfo()
# Build a Media ToolBar
controller.mediabar = OpenLPToolbar(controller)
- controller.mediabar.addToolbarAction(u'playbackPlay', text=u'media_playback_play',
+ controller.mediabar.add_toolbar_action(u'playbackPlay', text=u'media_playback_play',
icon=u':/slides/media_playback_start.png',
tooltip=translate('OpenLP.SlideController', 'Start playing media.'), triggers=controller.send_to_plugins)
- controller.mediabar.addToolbarAction(u'playbackPause', text=u'media_playback_pause',
+ controller.mediabar.add_toolbar_action(u'playbackPause', text=u'media_playback_pause',
icon=u':/slides/media_playback_pause.png',
tooltip=translate('OpenLP.SlideController', 'Pause playing media.'), triggers=controller.send_to_plugins)
- controller.mediabar.addToolbarAction(u'playbackStop', text=u'media_playback_stop',
+ controller.mediabar.add_toolbar_action(u'playbackStop', text=u'media_playback_stop',
icon=u':/slides/media_playback_stop.png',
tooltip=translate('OpenLP.SlideController', 'Stop playing media.'), triggers=controller.send_to_plugins)
# Build the seekSlider.
@@ -285,7 +285,7 @@
controller.seekSlider.setToolTip(translate('OpenLP.SlideController', 'Video position.'))
controller.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
controller.seekSlider.setObjectName(u'seekSlider')
- controller.mediabar.addToolbarWidget(controller.seekSlider)
+ controller.mediabar.add_toolbar_widget(controller.seekSlider)
# Build the volumeSlider.
controller.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
controller.volumeSlider.setTickInterval(10)
@@ -297,7 +297,7 @@
controller.volumeSlider.setValue(controller.media_info.volume)
controller.volumeSlider.setGeometry(QtCore.QRect(90, 160, 221, 24))
controller.volumeSlider.setObjectName(u'volumeSlider')
- controller.mediabar.addToolbarWidget(controller.volumeSlider)
+ controller.mediabar.add_toolbar_widget(controller.volumeSlider)
controller.controller_layout.addWidget(controller.mediabar)
controller.mediabar.setVisible(False)
# Signals
@@ -319,11 +319,11 @@
self.finalise()
# update player status
self._set_active_players()
- display.hasAudio = True
+ display.has_audio = True
if display.is_live and preview:
return
if preview:
- display.hasAudio = False
+ display.has_audio = False
for player in self.media_players.values():
if player.isActive:
player.setup(display)
@@ -359,34 +359,34 @@
"""
player.resize(display)
- def video(self, source, serviceItem, hidden=False, videoBehindText=False):
+ def video(self, source, service_item, hidden=False, video_behind_text=False):
"""
Loads and starts a video to run with the option of sound
``source``
Where the call originated form
- ``serviceItem``
+ ``service_item``
The player which is doing the playing
``hidden``
The player which is doing the playing
- ``videoBehindText``
+ ``video_behind_text``
Is the video to be played behind text.
"""
log.debug(u'video')
- isValid = False
- controller = self.displayControllers[source]
+ is_valid = False
+ controller = self.display_controllers[source]
# stop running videos
self.media_reset(controller)
controller.media_info = MediaInfo()
controller.media_info.volume = controller.volumeSlider.value()
- controller.media_info.is_background = videoBehindText
- controller.media_info.file_info = QtCore.QFileInfo(serviceItem.get_frame_path())
+ controller.media_info.is_background = video_behind_text
+ controller.media_info.file_info = QtCore.QFileInfo(service_item.get_frame_path())
display = self._define_display(controller)
if controller.is_live:
- isValid = self._check_file_type(controller, display, serviceItem)
+ is_valid = self._check_file_type(controller, display, service_item)
display.override[u'theme'] = u''
display.override[u'video'] = True
if controller.media_info.is_background:
@@ -394,11 +394,11 @@
controller.media_info.start_time = 0
controller.media_info.end_time = 0
else:
- controller.media_info.start_time = serviceItem.start_time
- controller.media_info.end_time = serviceItem.end_time
+ controller.media_info.start_time = service_item.start_time
+ controller.media_info.end_time = service_item.end_time
elif controller.preview_display:
- isValid = self._check_file_type(controller, display, serviceItem)
- if not isValid:
+ is_valid = self._check_file_type(controller, display, service_item)
+ if not is_valid:
# Media could not be loaded correctly
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
translate('MediaPlugin.MediaItem', 'Unsupported File'))
@@ -412,7 +412,7 @@
if not controller.is_live:
autoplay = True
# Visible or background requested or Service Item wants to autostart
- elif not hidden or controller.media_info.is_background or serviceItem.will_auto_start:
+ elif not hidden or controller.media_info.is_background or service_item.will_auto_start:
autoplay = True
# Unblank on load set
elif Settings().value(u'general/auto unblank'):
@@ -426,22 +426,22 @@
log.debug(u'use %s controller' % self.current_media_players[controller.controller_type])
return True
- def media_length(self, serviceItem):
+ def media_length(self, service_item):
"""
Loads and starts a media item to obtain the media length
- ``serviceItem``
+ ``service_item``
The ServiceItem containing the details to be played.
"""
- controller = self.displayControllers[DisplayControllerType.Plugin]
+ controller = self.display_controllers[DisplayControllerType.Plugin]
log.debug(u'media_length')
# stop running videos
self.media_reset(controller)
controller.media_info = MediaInfo()
controller.media_info.volume = 0
- controller.media_info.file_info = QtCore.QFileInfo(serviceItem.get_frame_path())
+ controller.media_info.file_info = QtCore.QFileInfo(service_item.get_frame_path())
display = controller._display
- if not self._check_file_type(controller, display, serviceItem):
+ if not self._check_file_type(controller, display, service_item):
# Media could not be loaded correctly
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
translate('MediaPlugin.MediaItem', 'Unsupported File'))
@@ -450,31 +450,31 @@
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
translate('MediaPlugin.MediaItem', 'Unsupported File'))
return False
- serviceItem.set_media_length(controller.media_info.length)
+ service_item.set_media_length(controller.media_info.length)
self.media_stop(controller)
log.debug(u'use %s controller' % self.current_media_players[controller.controller_type])
return True
- def _check_file_type(self, controller, display, serviceItem):
+ def _check_file_type(self, controller, display, service_item):
"""
Select the correct media Player type from the prioritized Player list
``controller``
First element is the controller which should be used
- ``serviceItem``
+ ``service_item``
The ServiceItem containing the details to be played.
"""
usedPlayers = get_media_players()[0]
- if serviceItem.title != UiStrings().Automatic:
- usedPlayers = [serviceItem.title.lower()]
+ if service_item.title != UiStrings().Automatic:
+ usedPlayers = [service_item.title.lower()]
if controller.media_info.file_info.isFile():
suffix = u'*.%s' % controller.media_info.file_info.suffix().lower()
for title in usedPlayers:
player = self.media_players[title]
if suffix in player.video_extensions_list:
if not controller.media_info.is_background or controller.media_info.is_background and \
- player.canBackground:
+ player.can_background:
self.resize(display, player)
if player.load(display):
self.current_media_players[controller.controller_type] = player
@@ -488,7 +488,7 @@
else:
for title in usedPlayers:
player = self.media_players[title]
- if player.canFolder:
+ if player.can_folder:
self.resize(display, player)
if player.load(display):
self.current_media_players[controller.controller_type] = player
@@ -721,8 +721,8 @@
Reset all the media controllers when OpenLP shuts down
"""
self.timer.stop()
- for controller in self.displayControllers:
- self.media_reset(self.displayControllers[controller])
+ for controller in self.display_controllers:
+ self.media_reset(self.display_controllers[controller])
def _define_display(self, controller):
"""
=== modified file 'openlp/core/ui/media/mediaplayer.py'
--- openlp/core/ui/media/mediaplayer.py 2013-02-03 19:23:12 +0000
+++ openlp/core/ui/media/mediaplayer.py 2013-03-07 18:01:28 +0000
@@ -47,10 +47,10 @@
self.name = name
self.available = self.check_available()
self.isActive = False
- self.canBackground = False
- self.canFolder = False
+ self.can_background = False
+ self.can_folder = False
self.state = MediaState.Off
- self.hasOwnWidget = False
+ self.has_own_widget = False
self.audio_extensions_list = []
self.video_extensions_list = []
=== modified file 'openlp/core/ui/media/phononplayer.py'
--- openlp/core/ui/media/phononplayer.py 2013-02-05 08:05:28 +0000
+++ openlp/core/ui/media/phononplayer.py 2013-03-07 18:01:28 +0000
@@ -126,16 +126,16 @@
"""
Set up the player widgets
"""
- display.phononWidget = Phonon.VideoWidget(display)
- display.phononWidget.resize(display.size())
- display.mediaObject = Phonon.MediaObject(display)
- Phonon.createPath(display.mediaObject, display.phononWidget)
- if display.hasAudio:
- display.audio = Phonon.AudioOutput(Phonon.VideoCategory, display.mediaObject)
- Phonon.createPath(display.mediaObject, display.audio)
- display.phononWidget.raise_()
- display.phononWidget.hide()
- self.hasOwnWidget = True
+ display.phonon_widget = Phonon.VideoWidget(display)
+ display.phonon_widget.resize(display.size())
+ display.media_object = Phonon.MediaObject(display)
+ Phonon.createPath(display.media_object, display.phonon_widget)
+ if display.has_audio:
+ display.audio = Phonon.AudioOutput(Phonon.VideoCategory, display.media_object)
+ Phonon.createPath(display.media_object, display.audio)
+ display.phonon_widget.raise_()
+ display.phonon_widget.hide()
+ self.has_own_widget = True
def check_available(self):
"""
@@ -151,7 +151,7 @@
controller = display.controller
volume = controller.media_info.volume
path = controller.media_info.file_info.absoluteFilePath()
- display.mediaObject.setCurrentSource(Phonon.MediaSource(path))
+ display.media_object.setCurrentSource(Phonon.MediaSource(path))
if not self.media_state_wait(display, Phonon.StoppedState):
return False
self.volume(display, volume)
@@ -163,9 +163,9 @@
Wait no longer than 5 seconds.
"""
start = datetime.now()
- current_state = display.mediaObject.state()
+ current_state = display.media_object.state()
while current_state != mediaState:
- current_state = display.mediaObject.state()
+ current_state = display.media_object.state()
if current_state == Phonon.ErrorState:
return False
self.application.process_events()
@@ -177,7 +177,7 @@
"""
Resize the display
"""
- display.phononWidget.resize(display.size())
+ display.phonon_widget.resize(display.size())
def play(self, display):
"""
@@ -185,26 +185,26 @@
"""
controller = display.controller
start_time = 0
- if display.mediaObject.state() != Phonon.PausedState and \
+ if display.media_object.state() != Phonon.PausedState and \
controller.media_info.start_time > 0:
start_time = controller.media_info.start_time
- display.mediaObject.play()
+ display.media_object.play()
if not self.media_state_wait(display, Phonon.PlayingState):
return False
if start_time > 0:
self.seek(display, controller.media_info.start_time * 1000)
self.volume(display, controller.media_info.volume)
- controller.media_info.length = int(display.mediaObject.totalTime() / 1000)
+ controller.media_info.length = int(display.media_object.totalTime() / 1000)
controller.seekSlider.setMaximum(controller.media_info.length * 1000)
self.state = MediaState.Playing
- display.phononWidget.raise_()
+ display.phonon_widget.raise_()
return True
def pause(self, display):
"""
Pause the current media item
"""
- display.mediaObject.pause()
+ display.media_object.pause()
if self.media_state_wait(display, Phonon.PausedState):
self.state = MediaState.Paused
@@ -212,7 +212,7 @@
"""
Stop the current media item
"""
- display.mediaObject.stop()
+ display.media_object.stop()
self.set_visible(display, False)
self.state = MediaState.Stopped
@@ -221,7 +221,7 @@
Set the volume
"""
# 1.0 is the highest value
- if display.hasAudio:
+ if display.has_audio:
vol = float(vol) / float(100)
display.audio.setVolume(vol)
@@ -229,39 +229,39 @@
"""
Go to a particular point in the current media item
"""
- display.mediaObject.seek(seekVal)
+ display.media_object.seek(seekVal)
def reset(self, display):
"""
Reset the media player
"""
- display.mediaObject.stop()
- display.mediaObject.clearQueue()
+ display.media_object.stop()
+ display.media_object.clearQueue()
self.set_visible(display, False)
- display.phononWidget.setVisible(False)
+ display.phonon_widget.setVisible(False)
self.state = MediaState.Off
def set_visible(self, display, status):
"""
Set the visibility of the widget
"""
- if self.hasOwnWidget:
- display.phononWidget.setVisible(status)
+ if self.has_own_widget:
+ display.phonon_widget.setVisible(status)
def update_ui(self, display):
"""
Update the UI
"""
- if display.mediaObject.state() == Phonon.PausedState and self.state != MediaState.Paused:
+ if display.media_object.state() == Phonon.PausedState and self.state != MediaState.Paused:
self.stop(display)
controller = display.controller
if controller.media_info.end_time > 0:
- if display.mediaObject.currentTime() > controller.media_info.end_time * 1000:
+ if display.media_object.currentTime() > controller.media_info.end_time * 1000:
self.stop(display)
self.set_visible(display, False)
if not controller.seekSlider.isSliderDown():
controller.seekSlider.blockSignals(True)
- controller.seekSlider.setSliderPosition(display.mediaObject.currentTime())
+ controller.seekSlider.setSliderPosition(display.media_object.currentTime())
controller.seekSlider.blockSignals(False)
def get_media_display_css(self):
=== modified file 'openlp/core/ui/media/playertab.py'
--- openlp/core/ui/media/playertab.py 2013-03-06 17:46:19 +0000
+++ openlp/core/ui/media/playertab.py 2013-03-07 18:01:28 +0000
@@ -79,10 +79,10 @@
self.backgroundColorButton.setObjectName(u'BackgroundColorButton')
self.colorLayout.addWidget(self.backgroundColorButton)
self.formLayout.addRow(self.colorLayout)
- self.informationLabel = QtGui.QLabel(self.bgColorGroupBox)
- self.informationLabel.setObjectName(u'InformationLabel')
- self.informationLabel.setWordWrap(True)
- self.formLayout.addRow(self.informationLabel)
+ self.information_label = QtGui.QLabel(self.bgColorGroupBox)
+ self.information_label.setObjectName(u'information_label')
+ self.information_label.setWordWrap(True)
+ self.formLayout.addRow(self.information_label)
self.leftLayout.addWidget(self.bgColorGroupBox)
self.leftLayout.addStretch()
self.rightColumn.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
@@ -122,8 +122,7 @@
self.leftLayout.addStretch()
self.rightLayout.addStretch()
# Signals and slots
- QtCore.QObject.connect(self.backgroundColorButton, QtCore.SIGNAL(u'clicked()'),
- self.onbackgroundColorButtonClicked)
+ self.backgroundColorButton.clicked.connect(self.onbackgroundColorButtonClicked)
def retranslateUi(self):
"""
@@ -133,7 +132,7 @@
self.playerOrderGroupBox.setTitle(translate('OpenLP.PlayerTab', 'Player Search Order'))
self.bgColorGroupBox.setTitle(UiStrings().BackgroundColor)
self.backgroundColorLabel.setText(UiStrings().DefaultColor)
- self.informationLabel.setText(translate('OpenLP.PlayerTab',
+ self.information_label.setText(translate('OpenLP.PlayerTab',
'Visible background for videos with aspect ratio different to screen.'))
self.retranslatePlayers()
@@ -245,7 +244,7 @@
checkbox.setToolTip(player.get_info())
checkbox.setPlayerName(player.name)
self.playerCheckBoxes[player.name] = checkbox
- QtCore.QObject.connect(checkbox, QtCore.SIGNAL(u'stateChanged(int)'), self.onPlayerCheckBoxChanged)
+ checkbox.stateChanged.connect(self.onPlayerCheckBoxChanged)
self.mediaPlayerLayout.addWidget(checkbox)
if player.available and player.name in self.usedPlayers:
checkbox.setChecked(True)
=== modified file 'openlp/core/ui/media/vlcplayer.py'
--- openlp/core/ui/media/vlcplayer.py 2013-03-01 17:36:43 +0000
+++ openlp/core/ui/media/vlcplayer.py 2013-03-07 18:01:28 +0000
@@ -108,7 +108,7 @@
self.original_name = u'VLC'
self.display_name = u'&VLC'
self.parent = parent
- self.canFolder = True
+ self.can_folder = True
self.audio_extensions_list = AUDIO_EXT
self.video_extensions_list = VIDEO_EXT
@@ -120,7 +120,7 @@
display.vlcWidget.setFrameStyle(QtGui.QFrame.NoFrame)
# creating a basic vlc instance
command_line_options = u'--no-video-title-show'
- if not display.hasAudio:
+ if not display.has_audio:
command_line_options += u' --no-audio --no-video-title-show'
if Settings().value(u'advanced/hide mouse') and display.controller.is_live:
command_line_options += u' --mouse-hide-timeout=0'
@@ -145,7 +145,7 @@
else:
# for Linux using the X Server
display.vlcMediaPlayer.set_xwindow(win_id)
- self.hasOwnWidget = True
+ self.has_own_widget = True
def check_available(self):
"""
@@ -238,7 +238,7 @@
"""
Set the volume
"""
- if display.hasAudio:
+ if display.has_audio:
display.vlcMediaPlayer.audio_set_volume(vol)
def seek(self, display, seekVal):
@@ -260,7 +260,7 @@
"""
Set the visibility
"""
- if self.hasOwnWidget:
+ if self.has_own_widget:
display.vlcWidget.setVisible(status)
def update_ui(self, display):
=== modified file 'openlp/core/ui/media/webkitplayer.py'
--- openlp/core/ui/media/webkitplayer.py 2013-02-20 19:31:51 +0000
+++ openlp/core/ui/media/webkitplayer.py 2013-03-07 18:01:28 +0000
@@ -279,7 +279,7 @@
self.original_name = u'WebKit'
self.display_name = u'&WebKit'
self.parent = parent
- self.canBackground = True
+ self.can_background = True
self.audio_extensions_list = AUDIO_EXT
self.video_extensions_list = VIDEO_EXT
@@ -309,7 +309,7 @@
"""
display.web_view.resize(display.size())
display.web_view.raise_()
- self.hasOwnWidget = False
+ self.has_own_widget = False
def check_available(self):
"""
@@ -323,7 +323,7 @@
"""
log.debug(u'load vid in Webkit Controller')
controller = display.controller
- if display.hasAudio and not controller.media_info.is_background:
+ if display.has_audio and not controller.media_info.is_background:
volume = controller.media_info.volume
vol = float(volume) / float(100)
else:
@@ -399,7 +399,7 @@
"""
controller = display.controller
# 1.0 is the highest value
- if display.hasAudio:
+ if display.has_audio:
vol = float(vol) / float(100)
if not controller.media_info.is_flash:
display.frame.evaluateJavaScript(u'show_video(null, null, %s);' % str(vol))
=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py 2013-02-03 19:23:12 +0000
+++ openlp/core/ui/pluginform.py 2013-03-07 18:01:28 +0000
@@ -54,10 +54,8 @@
self.load()
self._clearDetails()
# Right, now let's put some signals and slots together!
- QtCore.QObject.connect(self.pluginListWidget, QtCore.SIGNAL(u'itemSelectionChanged()'),
- self.onPluginListWidgetSelectionChanged)
- QtCore.QObject.connect(self.statusComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'),
- self.onStatusComboBoxChanged)
+ self.pluginListWidget.itemSelectionChanged.connect(self.onPluginListWidgetSelectionChanged)
+ self.statusComboBox.currentIndexChanged.connect(self.onStatusComboBoxChanged)
def load(self):
"""
=== modified file 'openlp/core/ui/printservicedialog.py'
--- openlp/core/ui/printservicedialog.py 2013-02-05 08:05:28 +0000
+++ openlp/core/ui/printservicedialog.py 2013-03-07 18:01:28 +0000
@@ -50,107 +50,107 @@
"""
The UI of the print service dialog
"""
- def setupUi(self, printServiceDialog):
+ def setupUi(self, print_service_dialog):
"""
Set up the UI
"""
- printServiceDialog.setObjectName(u'printServiceDialog')
- printServiceDialog.resize(664, 594)
- self.mainLayout = QtGui.QVBoxLayout(printServiceDialog)
- self.mainLayout.setSpacing(0)
- self.mainLayout.setMargin(0)
- self.mainLayout.setObjectName(u'mainLayout')
- self.toolbar = QtGui.QToolBar(printServiceDialog)
+ print_service_dialog.setObjectName(u'print_service_dialog')
+ print_service_dialog.resize(664, 594)
+ self.main_layout = QtGui.QVBoxLayout(print_service_dialog)
+ self.main_layout.setSpacing(0)
+ self.main_layout.setMargin(0)
+ self.main_layout.setObjectName(u'main_layout')
+ self.toolbar = QtGui.QToolBar(print_service_dialog)
self.toolbar.setIconSize(QtCore.QSize(22, 22))
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
- self.printButton = self.toolbar.addAction(build_icon(u':/general/general_print.png'),
+ self.print_button = self.toolbar.addAction(build_icon(u':/general/general_print.png'),
translate('OpenLP.PrintServiceForm', 'Print'))
- self.optionsButton = QtGui.QToolButton(self.toolbar)
- self.optionsButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
- self.optionsButton.setIcon(build_icon(u':/system/system_configure.png'))
- self.optionsButton.setCheckable(True)
- self.toolbar.addWidget(self.optionsButton)
+ self.options_button = QtGui.QToolButton(self.toolbar)
+ self.options_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
+ self.options_button.setIcon(build_icon(u':/system/system_configure.png'))
+ self.options_button.setCheckable(True)
+ self.toolbar.addWidget(self.options_button)
self.toolbar.addSeparator()
- self.plainCopy = self.toolbar.addAction(build_icon(u':/system/system_edit_copy.png'),
+ self.plain_copy = self.toolbar.addAction(build_icon(u':/system/system_edit_copy.png'),
translate('OpenLP.PrintServiceForm', 'Copy'))
- self.htmlCopy = self.toolbar.addAction(build_icon(u':/system/system_edit_copy.png'),
+ self.html_copy = self.toolbar.addAction(build_icon(u':/system/system_edit_copy.png'),
translate('OpenLP.PrintServiceForm', 'Copy as HTML'))
self.toolbar.addSeparator()
- self.zoomInButton = QtGui.QToolButton(self.toolbar)
- self.zoomInButton.setIcon(build_icon(u':/general/general_zoom_in.png'))
- self.zoomInButton.setObjectName(u'zoomInButton')
- self.zoomInButton.setIconSize(QtCore.QSize(22, 22))
- self.toolbar.addWidget(self.zoomInButton)
- self.zoomOutButton = QtGui.QToolButton(self.toolbar)
- self.zoomOutButton.setIcon(build_icon(u':/general/general_zoom_out.png'))
- self.zoomOutButton.setObjectName(u'zoomOutButton')
- self.zoomOutButton.setIconSize(QtCore.QSize(22, 22))
- self.toolbar.addWidget(self.zoomOutButton)
- self.zoomOriginalButton = QtGui.QToolButton(self.toolbar)
- self.zoomOriginalButton.setIcon(build_icon(u':/general/general_zoom_original.png'))
- self.zoomOriginalButton.setObjectName(u'zoomOriginalButton')
- self.zoomOriginalButton.setIconSize(QtCore.QSize(22, 22))
- self.toolbar.addWidget(self.zoomOriginalButton)
- self.zoomComboBox = QtGui.QComboBox(printServiceDialog)
- self.zoomComboBox.setObjectName(u'zoomComboBox')
- self.toolbar.addWidget(self.zoomComboBox)
- self.mainLayout.addWidget(self.toolbar)
- self.previewWidget = QtGui.QPrintPreviewWidget(printServiceDialog)
- self.mainLayout.addWidget(self.previewWidget)
- self.optionsWidget = QtGui.QWidget(printServiceDialog)
- self.optionsWidget.hide()
- self.optionsWidget.resize(400, 300)
- self.optionsWidget.setAutoFillBackground(True)
- self.optionsLayout = QtGui.QVBoxLayout(self.optionsWidget)
- self.optionsLayout.setContentsMargins(8, 8, 8, 8)
- self.titleLabel = QtGui.QLabel(self.optionsWidget)
- self.titleLabel.setObjectName(u'titleLabel')
- self.optionsLayout.addWidget(self.titleLabel)
- self.titleLineEdit = QtGui.QLineEdit(self.optionsWidget)
- self.titleLineEdit.setObjectName(u'titleLineEdit')
- self.optionsLayout.addWidget(self.titleLineEdit)
- self.footerLabel = QtGui.QLabel(self.optionsWidget)
- self.footerLabel.setObjectName(u'footerLabel')
- self.optionsLayout.addWidget(self.footerLabel)
- self.footerTextEdit = SpellTextEdit(self.optionsWidget, False)
- self.footerTextEdit.setObjectName(u'footerTextEdit')
- self.optionsLayout.addWidget(self.footerTextEdit)
- self.optionsGroupBox = QtGui.QGroupBox()
- self.groupLayout = QtGui.QVBoxLayout()
- self.slideTextCheckBox = QtGui.QCheckBox()
- self.groupLayout.addWidget(self.slideTextCheckBox)
- self.pageBreakAfterText = QtGui.QCheckBox()
- self.groupLayout.addWidget(self.pageBreakAfterText)
- self.notesCheckBox = QtGui.QCheckBox()
- self.groupLayout.addWidget(self.notesCheckBox)
- self.metaDataCheckBox = QtGui.QCheckBox()
- self.groupLayout.addWidget(self.metaDataCheckBox)
- self.groupLayout.addStretch(1)
- self.optionsGroupBox.setLayout(self.groupLayout)
- self.optionsLayout.addWidget(self.optionsGroupBox)
-
- self.retranslateUi(printServiceDialog)
- QtCore.QObject.connect(self.optionsButton, QtCore.SIGNAL(u'toggled(bool)'), self.toggleOptions)
-
- def retranslateUi(self, printServiceDialog):
+ self.zoom_in_button = QtGui.QToolButton(self.toolbar)
+ self.zoom_in_button.setIcon(build_icon(u':/general/general_zoom_in.png'))
+ self.zoom_in_button.setObjectName(u'zoom_in_button')
+ self.zoom_in_button.setIconSize(QtCore.QSize(22, 22))
+ self.toolbar.addWidget(self.zoom_in_button)
+ self.zoom_out_button = QtGui.QToolButton(self.toolbar)
+ self.zoom_out_button.setIcon(build_icon(u':/general/general_zoom_out.png'))
+ self.zoom_out_button.setObjectName(u'zoom_out_button')
+ self.zoom_out_button.setIconSize(QtCore.QSize(22, 22))
+ self.toolbar.addWidget(self.zoom_out_button)
+ self.zoom_original_button = QtGui.QToolButton(self.toolbar)
+ self.zoom_original_button.setIcon(build_icon(u':/general/general_zoom_original.png'))
+ self.zoom_original_button.setObjectName(u'zoom_original_button')
+ self.zoom_original_button.setIconSize(QtCore.QSize(22, 22))
+ self.toolbar.addWidget(self.zoom_original_button)
+ self.zoom_combo_box = QtGui.QComboBox(print_service_dialog)
+ self.zoom_combo_box.setObjectName(u'zoom_combo_box')
+ self.toolbar.addWidget(self.zoom_combo_box)
+ self.main_layout.addWidget(self.toolbar)
+ self.preview_widget = QtGui.QPrintPreviewWidget(print_service_dialog)
+ self.main_layout.addWidget(self.preview_widget)
+ self.options_widget = QtGui.QWidget(print_service_dialog)
+ self.options_widget.hide()
+ self.options_widget.resize(400, 300)
+ self.options_widget.setAutoFillBackground(True)
+ self.options_layout = QtGui.QVBoxLayout(self.options_widget)
+ self.options_layout.setContentsMargins(8, 8, 8, 8)
+ self.title_label = QtGui.QLabel(self.options_widget)
+ self.title_label.setObjectName(u'title_label')
+ self.options_layout.addWidget(self.title_label)
+ self.title_line_edit = QtGui.QLineEdit(self.options_widget)
+ self.title_line_edit.setObjectName(u'title_line_edit')
+ self.options_layout.addWidget(self.title_line_edit)
+ self.footer_label = QtGui.QLabel(self.options_widget)
+ self.footer_label.setObjectName(u'footer_label')
+ self.options_layout.addWidget(self.footer_label)
+ self.footer_text_edit = SpellTextEdit(self.options_widget, False)
+ self.footer_text_edit.setObjectName(u'footer_text_edit')
+ self.options_layout.addWidget(self.footer_text_edit)
+ self.options_group_box = QtGui.QGroupBox()
+ self.group_layout = QtGui.QVBoxLayout()
+ self.slide_text_check_box = QtGui.QCheckBox()
+ self.group_layout.addWidget(self.slide_text_check_box)
+ self.page_break_after_text = QtGui.QCheckBox()
+ self.group_layout.addWidget(self.page_break_after_text)
+ self.notes_check_box = QtGui.QCheckBox()
+ self.group_layout.addWidget(self.notes_check_box)
+ self.meta_data_check_box = QtGui.QCheckBox()
+ self.group_layout.addWidget(self.meta_data_check_box)
+ self.group_layout.addStretch(1)
+ self.options_group_box.setLayout(self.group_layout)
+ self.options_layout.addWidget(self.options_group_box)
+
+ self.retranslateUi(print_service_dialog)
+ self.options_button.toggled.connect(self.toggle_options)
+
+ def retranslateUi(self, print_service_dialog):
"""
Translate the UI on the fly
"""
- printServiceDialog.setWindowTitle(UiStrings().PrintService)
- self.zoomOutButton.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom Out'))
- self.zoomOriginalButton.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom Original'))
- self.zoomInButton.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom In'))
- self.optionsButton.setText(translate('OpenLP.PrintServiceForm', 'Options'))
- self.titleLabel.setText(translate('OpenLP.PrintServiceForm', 'Title:'))
- self.footerLabel.setText(translate('OpenLP.PrintServiceForm', 'Custom Footer Text:'))
- self.optionsGroupBox.setTitle(translate('OpenLP.PrintServiceForm', 'Other Options'))
- self.slideTextCheckBox.setText(translate('OpenLP.PrintServiceForm', 'Include slide text if available'))
- self.pageBreakAfterText.setText(translate('OpenLP.PrintServiceForm', 'Add page break before each text item'))
- self.notesCheckBox.setText(translate('OpenLP.PrintServiceForm', 'Include service item notes'))
- self.metaDataCheckBox.setText(translate('OpenLP.PrintServiceForm', 'Include play length of media items'))
- self.titleLineEdit.setText(translate('OpenLP.PrintServiceForm', 'Service Sheet'))
+ print_service_dialog.setWindowTitle(UiStrings().PrintService)
+ self.zoom_out_button.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom Out'))
+ self.zoom_original_button.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom Original'))
+ self.zoom_in_button.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom In'))
+ self.options_button.setText(translate('OpenLP.PrintServiceForm', 'Options'))
+ self.title_label.setText(translate('OpenLP.PrintServiceForm', 'Title:'))
+ self.footer_label.setText(translate('OpenLP.PrintServiceForm', 'Custom Footer Text:'))
+ self.options_group_box.setTitle(translate('OpenLP.PrintServiceForm', 'Other Options'))
+ self.slide_text_check_box.setText(translate('OpenLP.PrintServiceForm', 'Include slide text if available'))
+ self.page_break_after_text.setText(translate('OpenLP.PrintServiceForm', 'Add page break before each text item'))
+ self.notes_check_box.setText(translate('OpenLP.PrintServiceForm', 'Include service item notes'))
+ self.meta_data_check_box.setText(translate('OpenLP.PrintServiceForm', 'Include play length of media items'))
+ self.title_line_edit.setText(translate('OpenLP.PrintServiceForm', 'Service Sheet'))
# Do not change the order.
- self.zoomComboBox.addItems([
+ self.zoom_combo_box.addItems([
translate('OpenLP.PrintServiceDialog', 'Fit Page'),
translate('OpenLP.PrintServiceDialog', 'Fit Width'),
u'100%',
=== modified file 'openlp/core/ui/printserviceform.py'
--- openlp/core/ui/printserviceform.py 2013-03-01 08:38:25 +0000
+++ openlp/core/ui/printserviceform.py 2013-03-07 18:01:28 +0000
@@ -120,129 +120,123 @@
"""
QtGui.QDialog.__init__(self, self.main_window)
self.printer = QtGui.QPrinter()
- self.printDialog = QtGui.QPrintDialog(self.printer, self)
+ self.print_dialog = QtGui.QPrintDialog(self.printer, self)
self.document = QtGui.QTextDocument()
self.zoom = 0
self.setupUi(self)
# Load the settings for the dialog.
settings = Settings()
settings.beginGroup(u'advanced')
- self.slideTextCheckBox.setChecked(settings.value(u'print slide text'))
- self.pageBreakAfterText.setChecked(settings.value(u'add page break'))
- if not self.slideTextCheckBox.isChecked():
- self.pageBreakAfterText.setDisabled(True)
- self.metaDataCheckBox.setChecked(settings.value(u'print file meta data'))
- self.notesCheckBox.setChecked(settings.value(u'print notes'))
- self.zoomComboBox.setCurrentIndex(settings.value(u'display size'))
+ self.slide_text_check_box.setChecked(settings.value(u'print slide text'))
+ self.page_break_after_text.setChecked(settings.value(u'add page break'))
+ if not self.slide_text_check_box.isChecked():
+ self.page_break_after_text.setDisabled(True)
+ self.meta_data_check_box.setChecked(settings.value(u'print file meta data'))
+ self.notes_check_box.setChecked(settings.value(u'print notes'))
+ self.zoom_combo_box.setCurrentIndex(settings.value(u'display size'))
settings.endGroup()
# Signals
- QtCore.QObject.connect(self.printButton, QtCore.SIGNAL(u'triggered()'), self.printServiceOrder)
- QtCore.QObject.connect(self.zoomOutButton, QtCore.SIGNAL(u'clicked()'), self.zoomOut)
- QtCore.QObject.connect(self.zoomInButton, QtCore.SIGNAL(u'clicked()'), self.zoomIn)
- QtCore.QObject.connect(self.zoomOriginalButton, QtCore.SIGNAL(u'clicked()'), self.zoomOriginal)
- QtCore.QObject.connect(self.previewWidget, QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested)
- QtCore.QObject.connect(self.zoomComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.displaySizeChanged)
- QtCore.QObject.connect(self.plainCopy, QtCore.SIGNAL(u'triggered()'), self.copyText)
- QtCore.QObject.connect(self.htmlCopy, QtCore.SIGNAL(u'triggered()'), self.copyHtmlText)
- QtCore.QObject.connect(self.slideTextCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onSlideTextCheckBoxChanged)
- self.updatePreviewText()
+ self.print_button.triggered.connect(self.print_service_order)
+ self.zoom_out_button.clicked.connect(self.zoom_out)
+ self.zoom_in_button.clicked.connect(self.zoom_in)
+ self.zoom_original_button.clicked.connect(self.zoom_original)
+ self.preview_widget.paintRequested.connect(self.paint_requested)
+ self.zoom_combo_box.currentIndexChanged.connect(self.display_size_changed)
+ self.plain_copy.triggered.connect(self.copy_text)
+ self.html_copy.triggered.connect(self.copy_html_text)
+ self.slide_text_check_box.stateChanged.connect(self.on_slide_text_check_box_changed)
+ self.update_preview_text()
- def toggleOptions(self, checked):
+ def toggle_options(self, checked):
"""
Toggle various options
"""
- self.optionsWidget.setVisible(checked)
+ self.options_widget.setVisible(checked)
if checked:
- left = self.optionsButton.pos().x()
+ left = self.options_button.pos().x()
top = self.toolbar.height()
- self.optionsWidget.move(left, top)
- self.titleLineEdit.setFocus()
+ self.options_widget.move(left, top)
+ self.title_line_edit.setFocus()
else:
- self.saveOptions()
- self.updatePreviewText()
+ self.save_options()
+ self.update_preview_text()
- def updatePreviewText(self):
+ def update_preview_text(self):
"""
Creates the html text and updates the html of *self.document*.
"""
- html_data = self._addElement(u'html')
- self._addElement(u'head', parent=html_data)
- self._addElement(u'title', self.titleLineEdit.text(), html_data.head)
+ html_data = self._add_element(u'html')
+ self._add_element(u'head', parent=html_data)
+ self._add_element(u'title', self.title_line_edit.text(), html_data.head)
css_path = os.path.join(AppLocation.get_data_path(), u'service_print.css')
custom_css = get_text_file_string(css_path)
if not custom_css:
custom_css = DEFAULT_CSS
- self._addElement(u'style', custom_css, html_data.head,
- attribute=(u'type', u'text/css'))
- self._addElement(u'body', parent=html_data)
- self._addElement(u'h1', cgi.escape(self.titleLineEdit.text()),
- html_data.body, classId=u'serviceTitle')
+ self._add_element(u'style', custom_css, html_data.head, attribute=(u'type', u'text/css'))
+ self._add_element(u'body', parent=html_data)
+ self._add_element(u'h1', cgi.escape(self.title_line_edit.text()), html_data.body, classId=u'serviceTitle')
for index, item in enumerate(self.service_manager.service_items):
- self._addPreviewItem(html_data.body, item[u'service_item'], index)
+ self._add_preview_item(html_data.body, item[u'service_item'], index)
# Add the custom service notes:
- if self.footerTextEdit.toPlainText():
- div = self._addElement(u'div', parent=html_data.body, classId=u'customNotes')
- self._addElement(u'span', translate('OpenLP.ServiceManager', 'Custom Service Notes: '), div,
- classId=u'customNotesTitle')
- self._addElement(u'span', cgi.escape(self.footerTextEdit.toPlainText()), div, classId=u'customNotesText')
+ if self.footer_text_edit.toPlainText():
+ div = self._add_element(u'div', parent=html_data.body, classId=u'customNotes')
+ self._add_element(
+ u'span', translate('OpenLP.ServiceManager', 'Custom Service Notes: '), div, classId=u'customNotesTitle')
+ self._add_element(u'span', cgi.escape(self.footer_text_edit.toPlainText()), div, classId=u'customNotesText')
self.document.setHtml(html.tostring(html_data))
- self.previewWidget.updatePreview()
+ self.preview_widget.updatePreview()
- def _addPreviewItem(self, body, item, index):
+ def _add_preview_item(self, body, item, index):
"""
Add a preview item
"""
- div = self._addElement(u'div', classId=u'item', parent=body)
+ div = self._add_element(u'div', classId=u'item', parent=body)
# Add the title of the service item.
- item_title = self._addElement(u'h2', parent=div, classId=u'itemTitle')
- self._addElement(u'img', parent=item_title, attribute=(u'src', item.icon))
- self._addElement(u'span', u' ' + cgi.escape(item.get_display_title()), item_title)
- if self.slideTextCheckBox.isChecked():
+ item_title = self._add_element(u'h2', parent=div, classId=u'itemTitle')
+ self._add_element(u'img', parent=item_title, attribute=(u'src', item.icon))
+ self._add_element(u'span', u' ' + cgi.escape(item.get_display_title()), item_title)
+ if self.slide_text_check_box.isChecked():
# Add the text of the service item.
if item.is_text():
verse_def = None
for slide in item.get_frames():
if not verse_def or verse_def != slide[u'verseTag']:
- text_div = self._addElement(u'div', parent=div, classId=u'itemText')
+ text_div = self._add_element(u'div', parent=div, classId=u'itemText')
else:
- self._addElement(u'br', parent=text_div)
- self._addElement(u'span', slide[u'html'], text_div)
+ self._add_element(u'br', parent=text_div)
+ self._add_element(u'span', slide[u'html'], text_div)
verse_def = slide[u'verseTag']
# Break the page before the div element.
- if index != 0 and self.pageBreakAfterText.isChecked():
+ if index != 0 and self.page_break_after_text.isChecked():
div.set(u'class', u'item newPage')
# Add the image names of the service item.
elif item.is_image():
- ol = self._addElement(u'ol', parent=div, classId=u'imageList')
+ ol = self._add_element(u'ol', parent=div, classId=u'imageList')
for slide in range(len(item.get_frames())):
- self._addElement(u'li', item.get_frame_title(slide), ol)
+ self._add_element(u'li', item.get_frame_title(slide), ol)
# add footer
foot_text = item.foot_text
foot_text = foot_text.partition(u'<br>')[2]
if foot_text:
foot_text = cgi.escape(foot_text.replace(u'<br>', u'\n'))
- self._addElement(u'div', foot_text.replace(u'\n', u'<br>'), parent=div, classId=u'itemFooter')
+ self._add_element(u'div', foot_text.replace(u'\n', u'<br>'), parent=div, classId=u'itemFooter')
# Add service items' notes.
- if self.notesCheckBox.isChecked():
+ if self.notes_check_box.isChecked():
if item.notes:
- p = self._addElement(u'div', classId=u'itemNotes', parent=div)
- self._addElement(u'span', translate('OpenLP.ServiceManager', 'Notes: '), p,
- classId=u'itemNotesTitle')
- self._addElement(u'span', cgi.escape(item.notes).replace(u'\n', u'<br>'), p, classId=u'itemNotesText')
+ p = self._add_element(u'div', classId=u'itemNotes', parent=div)
+ self._add_element(u'span', translate('OpenLP.ServiceManager', 'Notes: '), p, classId=u'itemNotesTitle')
+ self._add_element(u'span', cgi.escape(item.notes).replace(u'\n', u'<br>'), p, classId=u'itemNotesText')
# Add play length of media files.
- if item.is_media() and self.metaDataCheckBox.isChecked():
+ if item.is_media() and self.meta_data_check_box.isChecked():
tme = item.media_length
if item.end_time > 0:
tme = item.end_time - item.start_time
- title = self._addElement(u'div', classId=u'media', parent=div)
- self._addElement(u'span', translate('OpenLP.ServiceManager', 'Playing time: '), title,
- classId=u'mediaTitle')
- self._addElement(u'span', unicode(datetime.timedelta(seconds=tme)),
- title, classId=u'mediaText')
+ title = self._add_element(u'div', classId=u'media', parent=div)
+ self._add_element(
+ u'span', translate('OpenLP.ServiceManager', 'Playing time: '), title, classId=u'mediaTitle')
+ self._add_element(u'span', unicode(datetime.timedelta(seconds=tme)), title, classId=u'mediaText')
- def _addElement(self, tag, text=None, parent=None, classId=None,
- attribute=None):
+ def _add_element(self, tag, text=None, parent=None, classId=None, attribute=None):
"""
Creates a html element. If ``text`` is given, the element's text will
set and if a ``parent`` is given, the element is appended.
@@ -274,7 +268,7 @@
element.set(attribute[0], attribute[1])
return element
- def paintRequested(self, printer):
+ def paint_requested(self, printer):
"""
Paint the preview of the *self.document*.
@@ -283,32 +277,32 @@
"""
self.document.print_(printer)
- def displaySizeChanged(self, display):
+ def display_size_changed(self, display):
"""
The Zoom Combo box has changed so set up the size.
"""
if display == ZoomSize.Page:
- self.previewWidget.fitInView()
+ self.preview_widget.fitInView()
elif display == ZoomSize.Width:
- self.previewWidget.fitToWidth()
+ self.preview_widget.fitToWidth()
elif display == ZoomSize.OneHundred:
- self.previewWidget.fitToWidth()
- self.previewWidget.zoomIn(1)
+ self.preview_widget.fitToWidth()
+ self.preview_widget.zoomIn(1)
elif display == ZoomSize.SeventyFive:
- self.previewWidget.fitToWidth()
- self.previewWidget.zoomIn(0.75)
+ self.preview_widget.fitToWidth()
+ self.preview_widget.zoomIn(0.75)
elif display == ZoomSize.Fifty:
- self.previewWidget.fitToWidth()
- self.previewWidget.zoomIn(0.5)
+ self.preview_widget.fitToWidth()
+ self.preview_widget.zoomIn(0.5)
elif display == ZoomSize.TwentyFive:
- self.previewWidget.fitToWidth()
- self.previewWidget.zoomIn(0.25)
+ self.preview_widget.fitToWidth()
+ self.preview_widget.zoomIn(0.25)
settings = Settings()
settings.beginGroup(u'advanced')
settings.setValue(u'display size', display)
settings.endGroup()
- def copyText(self):
+ def copy_text(self):
"""
Copies the display text to the clipboard as plain text
"""
@@ -332,45 +326,45 @@
# and put it all on the clipboard
self.main_window.clipboard.setText(clipboard_text)
- def copyHtmlText(self):
+ def copy_html_text(self):
"""
Copies the display text to the clipboard as Html
"""
self.update_song_usage()
self.main_window.clipboard.setText(self.document.toHtml())
- def printServiceOrder(self):
- """
- Called, when the *printButton* is clicked. Opens the *printDialog*.
- """
- if not self.printDialog.exec_():
+ def print_service_order(self):
+ """
+ Called, when the *print_button* is clicked. Opens the *print_dialog*.
+ """
+ if not self.print_dialog.exec_():
return
self.update_song_usage()
# Print the document.
self.document.print_(self.printer)
- def zoomIn(self):
- """
- Called when *zoomInButton* is clicked.
- """
- self.previewWidget.zoomIn()
+ def zoom_in(self):
+ """
+ Called when *zoom_in_button* is clicked.
+ """
+ self.preview_widget.zoomIn()
self.zoom -= 0.1
- def zoomOut(self):
- """
- Called when *zoomOutButton* is clicked.
- """
- self.previewWidget.zoomOut()
+ def zoom_out(self):
+ """
+ Called when *zoom_out_button* is clicked.
+ """
+ self.preview_widget.zoomOut()
self.zoom += 0.1
- def zoomOriginal(self):
- """
- Called when *zoomOutButton* is clicked.
- """
- self.previewWidget.zoomIn(1 + self.zoom)
+ def zoom_original(self):
+ """
+ Called when *zoom_out_button* is clicked.
+ """
+ self.preview_widget.zoomIn(1 + self.zoom)
self.zoom = 0
- def updateTextFormat(self, value):
+ def update_text_format(self, value):
"""
Called when html copy check box is selected.
"""
@@ -379,24 +373,24 @@
else:
self.copyTextButton.setText(UiStrings().CopyToText)
- def onSlideTextCheckBoxChanged(self, state):
- """
- Disable or enable the ``pageBreakAfterText`` checkbox as it should only
- be enabled, when the ``slideTextCheckBox`` is enabled.
- """
- self.pageBreakAfterText.setDisabled(state == QtCore.Qt.Unchecked)
+ def on_slide_text_check_box_changed(self, state):
+ """
+ Disable or enable the ``page_break_after_text`` checkbox as it should only
+ be enabled, when the ``slide_text_check_box`` is enabled.
+ """
+ self.page_break_after_text.setDisabled(state == QtCore.Qt.Unchecked)
- def saveOptions(self):
+ def save_options(self):
"""
Save the settings and close the dialog.
"""
# Save the settings for this dialog.
settings = Settings()
settings.beginGroup(u'advanced')
- settings.setValue(u'print slide text', self.slideTextCheckBox.isChecked())
- settings.setValue(u'add page break', self.pageBreakAfterText.isChecked())
- settings.setValue(u'print file meta data', self.metaDataCheckBox.isChecked())
- settings.setValue(u'print notes', self.notesCheckBox.isChecked())
+ settings.setValue(u'print slide text', self.slide_text_check_box.isChecked())
+ settings.setValue(u'add page break', self.page_break_after_text.isChecked())
+ settings.setValue(u'print file meta data', self.meta_data_check_box.isChecked())
+ settings.setValue(u'print notes', self.notes_check_box.isChecked())
settings.endGroup()
def update_song_usage(self):
@@ -404,7 +398,7 @@
Update the song usage
"""
# Only continue when we include the song's text.
- if not self.slideTextCheckBox.isChecked():
+ if not self.slide_text_check_box.isChecked():
return
for item in self.service_manager.service_items:
# Trigger Audit requests
=== modified file 'openlp/core/ui/serviceitemeditform.py'
--- openlp/core/ui/serviceitemeditform.py 2013-02-01 21:34:23 +0000
+++ openlp/core/ui/serviceitemeditform.py 2013-03-07 18:01:28 +0000
@@ -46,8 +46,7 @@
QtGui.QDialog.__init__(self, self.main_window)
self.setupUi(self)
self.item_list = []
- QtCore.QObject.connect(self.list_widget, QtCore.SIGNAL(u'currentRowChanged(int)'),
- self.on_current_row_changed)
+ self.list_widget.currentRowChanged.connect(self.on_current_row_changed)
def set_service_item(self, item):
"""
@@ -57,8 +56,7 @@
self.item_list = []
if self.item.is_image():
self.data = True
- for frame in self.item._raw_frames:
- self.item_list.append(frame)
+ self.item_list.extend(self.item._raw_frames)
self.load_data()
self.list_widget.setCurrentItem(self.list_widget.currentItem())
@@ -94,9 +92,8 @@
self.item_list.pop(row)
self.load_data()
if row == self.list_widget.count():
- self.list_widget.setCurrentRow(row - 1)
- else:
- self.list_widget.setCurrentRow(row)
+ row -= 1
+ self.list_widget.setCurrentRow(row)
def on_up_button_clicked(self):
"""
@@ -163,4 +160,5 @@
self._main_window = Registry().get(u'main_window')
return self._main_window
- main_window = property(_get_main_window)
\ No newline at end of file
+ main_window = property(_get_main_window)
+
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2013-03-01 17:36:43 +0000
+++ openlp/core/ui/servicemanager.py 2013-03-07 18:01:28 +0000
@@ -111,24 +111,24 @@
"""
# Create the top toolbar
self.toolbar = OpenLPToolbar(self)
- self.toolbar.addToolbarAction(u'newService', text=UiStrings().NewService, icon=u':/general/general_new.png',
+ self.toolbar.add_toolbar_action(u'newService', text=UiStrings().NewService, icon=u':/general/general_new.png',
tooltip=UiStrings().CreateService, triggers=self.on_new_service_clicked)
- self.toolbar.addToolbarAction(u'openService', text=UiStrings().OpenService, icon=u':/general/general_open.png',
+ self.toolbar.add_toolbar_action(u'openService', text=UiStrings().OpenService, icon=u':/general/general_open.png',
tooltip=translate('OpenLP.ServiceManager', 'Load an existing service.'),
triggers=self.on_load_service_clicked)
- self.toolbar.addToolbarAction(u'saveService', text=UiStrings().SaveService, icon=u':/general/general_save.png',
+ self.toolbar.add_toolbar_action(u'saveService', text=UiStrings().SaveService, icon=u':/general/general_save.png',
tooltip=translate('OpenLP.ServiceManager', 'Save this service.'), triggers=self.decide_save_method)
self.toolbar.addSeparator()
self.theme_label = QtGui.QLabel(u'%s:' % UiStrings().Theme, self)
self.theme_label.setMargin(3)
self.theme_label.setObjectName(u'theme_label')
- self.toolbar.addToolbarWidget(self.theme_label)
+ self.toolbar.add_toolbar_widget(self.theme_label)
self.theme_combo_box = QtGui.QComboBox(self.toolbar)
self.theme_combo_box.setToolTip(translate('OpenLP.ServiceManager', 'Select a theme for the service.'))
self.theme_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.theme_combo_box.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.theme_combo_box.setObjectName(u'theme_combo_box')
- self.toolbar.addToolbarWidget(self.theme_combo_box)
+ self.toolbar.add_toolbar_widget(self.theme_combo_box)
self.toolbar.setObjectName(u'toolbar')
self.layout.addWidget(self.toolbar)
# Create the service manager list
@@ -153,48 +153,48 @@
self.order_toolbar = OpenLPToolbar(self)
action_list = ActionList.get_instance()
action_list.add_category(UiStrings().Service, CategoryOrder.standard_toolbar)
- self.service_manager_list.moveTop = self.order_toolbar.addToolbarAction(u'moveTop',
+ self.service_manager_list.moveTop = self.order_toolbar.add_toolbar_action(u'moveTop',
text=translate('OpenLP.ServiceManager', 'Move to &top'), icon=u':/services/service_top.png',
tooltip=translate('OpenLP.ServiceManager', 'Move item to the top of the service.'),
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceTop)
- self.service_manager_list.moveUp = self.order_toolbar.addToolbarAction(u'moveUp',
+ self.service_manager_list.moveUp = self.order_toolbar.add_toolbar_action(u'moveUp',
text=translate('OpenLP.ServiceManager', 'Move &up'), icon=u':/services/service_up.png',
tooltip=translate('OpenLP.ServiceManager', 'Move item up one position in the service.'),
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceUp)
- self.service_manager_list.moveDown = self.order_toolbar.addToolbarAction(u'moveDown',
+ self.service_manager_list.moveDown = self.order_toolbar.add_toolbar_action(u'moveDown',
text=translate('OpenLP.ServiceManager', 'Move &down'), icon=u':/services/service_down.png',
tooltip=translate('OpenLP.ServiceManager', 'Move item down one position in the service.'),
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceDown)
- self.service_manager_list.moveBottom = self.order_toolbar.addToolbarAction(u'moveBottom',
+ self.service_manager_list.moveBottom = self.order_toolbar.add_toolbar_action(u'moveBottom',
text=translate('OpenLP.ServiceManager', 'Move to &bottom'), icon=u':/services/service_bottom.png',
tooltip=translate('OpenLP.ServiceManager', 'Move item to the end of the service.'),
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceEnd)
- self.service_manager_list.down = self.order_toolbar.addToolbarAction(u'down',
+ self.service_manager_list.down = self.order_toolbar.add_toolbar_action(u'down',
text=translate('OpenLP.ServiceManager', 'Move &down'), can_shortcuts=True,
tooltip=translate('OpenLP.ServiceManager', 'Moves the selection down the window.'), visible=False,
triggers=self.on_move_selection_down)
action_list.add_action(self.service_manager_list.down)
- self.service_manager_list.up = self.order_toolbar.addToolbarAction(u'up',
+ self.service_manager_list.up = self.order_toolbar.add_toolbar_action(u'up',
text=translate('OpenLP.ServiceManager', 'Move up'), can_shortcuts=True,
tooltip=translate('OpenLP.ServiceManager', 'Moves the selection up the window.'), visible=False,
triggers=self.on_move_selection_up)
action_list.add_action(self.service_manager_list.up)
self.order_toolbar.addSeparator()
- self.service_manager_list.delete = self.order_toolbar.addToolbarAction(u'delete', can_shortcuts=True,
+ self.service_manager_list.delete = self.order_toolbar.add_toolbar_action(u'delete', can_shortcuts=True,
text=translate('OpenLP.ServiceManager', '&Delete From Service'), icon=u':/general/general_delete.png',
tooltip=translate('OpenLP.ServiceManager', 'Delete the selected item from the service.'),
triggers=self.onDeleteFromService)
self.order_toolbar.addSeparator()
- self.service_manager_list.expand = self.order_toolbar.addToolbarAction(u'expand', can_shortcuts=True,
+ self.service_manager_list.expand = self.order_toolbar.add_toolbar_action(u'expand', can_shortcuts=True,
text=translate('OpenLP.ServiceManager', '&Expand all'), icon=u':/services/service_expand_all.png',
tooltip=translate('OpenLP.ServiceManager', 'Expand all the service items.'),
category=UiStrings().Service, triggers=self.onExpandAll)
- self.service_manager_list.collapse = self.order_toolbar.addToolbarAction(u'collapse', can_shortcuts=True,
+ self.service_manager_list.collapse = self.order_toolbar.add_toolbar_action(u'collapse', can_shortcuts=True,
text=translate('OpenLP.ServiceManager', '&Collapse all'), icon=u':/services/service_collapse_all.png',
tooltip=translate('OpenLP.ServiceManager', 'Collapse all the service items.'),
category=UiStrings().Service, triggers=self.onCollapseAll)
self.order_toolbar.addSeparator()
- self.service_manager_list.make_live = self.order_toolbar.addToolbarAction(u'make_live', can_shortcuts=True,
+ self.service_manager_list.make_live = self.order_toolbar.add_toolbar_action(u'make_live', can_shortcuts=True,
text=translate('OpenLP.ServiceManager', 'Go Live'), icon=u':/general/general_live.png',
tooltip=translate('OpenLP.ServiceManager', 'Send the selected item to Live.'),
category=UiStrings().Service,
@@ -303,9 +303,9 @@
self._modified = False
self._file_name = u''
self.service_has_all_original_files = True
- self.serviceNoteForm = ServiceNoteForm()
- self.serviceItemEditForm = ServiceItemEditForm()
- self.startTimeForm = StartTimeForm()
+ self.service_note_form = ServiceNoteForm()
+ self.service_item_edit_form = ServiceItemEditForm()
+ self.start_time_form = StartTimeForm()
# start with the layout
self.layout = QtGui.QVBoxLayout(self)
self.layout.setSpacing(0)
@@ -337,7 +337,7 @@
self._file_name = unicode(file_name)
self.main_window.setServiceModified(self.is_modified(), self.short_file_name())
Settings().setValue(u'servicemanager/last file', file_name)
- self._saveLite = self._file_name.endswith(u'.oszl')
+ self._save_lite = self._file_name.endswith(u'.oszl')
def file_name(self):
"""
@@ -500,12 +500,12 @@
return False
# Check if item contains a missing file.
for item in list(self.service_items):
- self.main_window.incrementProgressBar()
+ self.main_window.increment_progress_bar()
item[u'service_item'].remove_invalid_frames(missing_list)
if item[u'service_item'].missing_frames():
self.service_items.remove(item)
else:
- service_item = item[u'service_item'].get_service_repr(self._saveLite)
+ service_item = item[u'service_item'].get_service_repr(self._save_lite)
if service_item[u'header'][u'background_audio']:
for i, file_name in enumerate(service_item[u'header'][u'background_audio']):
new_file = os.path.join(u'audio', item[u'service_item'].unique_identifier, file_name)
@@ -525,7 +525,7 @@
log.debug(u'ServiceManager.save_file - allowZip64 is %s' % allow_zip_64)
zip_file = None
success = True
- self.main_window.incrementProgressBar()
+ self.main_window.increment_progress_bar()
try:
zip_file = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64)
# First we add service contents.
@@ -590,15 +590,15 @@
# Number of items + 1 to zip it
self.main_window.displayProgressBar(len(self.service_items) + 1)
for item in self.service_items:
- self.main_window.incrementProgressBar()
- service_item = item[u'service_item'].get_service_repr(self._saveLite)
+ self.main_window.increment_progress_bar()
+ service_item = item[u'service_item'].get_service_repr(self._save_lite)
#@todo check for file item on save.
service.append({u'serviceitem': service_item})
- self.main_window.incrementProgressBar()
+ self.main_window.increment_progress_bar()
service_content = cPickle.dumps(service)
zip_file = None
success = True
- self.main_window.incrementProgressBar()
+ self.main_window.increment_progress_bar()
try:
zip_file = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED,
True)
@@ -675,7 +675,7 @@
"""
if not self.file_name():
return self.save_file_as()
- if self._saveLite:
+ if self._save_lite:
return self.save_local_file()
else:
return self.save_file()
@@ -719,9 +719,9 @@
self.set_file_name(file_name)
self.main_window.displayProgressBar(len(items))
for item in items:
- self.main_window.incrementProgressBar()
+ self.main_window.increment_progress_bar()
service_item = ServiceItem()
- if self._saveLite:
+ if self._save_lite:
service_item.set_from_service(item)
else:
service_item.set_from_service(item, self.servicePath)
@@ -848,9 +848,9 @@
Allow the service note to be edited
"""
item = self.find_service_item()[0]
- self.serviceNoteForm.text_edit.setPlainText(self.service_items[item][u'service_item'].notes)
- if self.serviceNoteForm.exec_():
- self.service_items[item][u'service_item'].notes = self.serviceNoteForm.text_edit.toPlainText()
+ self.service_note_form.text_edit.setPlainText(self.service_items[item][u'service_item'].notes)
+ if self.service_note_form.exec_():
+ self.service_items[item][u'service_item'].notes = self.service_note_form.text_edit.toPlainText()
self.repaint_service_list(item, -1)
self.set_modified()
@@ -859,8 +859,8 @@
Opens a dialog to type in service item notes.
"""
item = self.find_service_item()[0]
- self.startTimeForm.item = self.service_items[item]
- if self.startTimeForm.exec_():
+ self.start_time_form.item = self.service_items[item]
+ if self.start_time_form.exec_():
self.repaint_service_list(item, -1)
def toggle_auto_play_slides_once(self):
@@ -931,9 +931,9 @@
display if changes are saved.
"""
item = self.find_service_item()[0]
- self.serviceItemEditForm.set_service_item(self.service_items[item][u'service_item'])
- if self.serviceItemEditForm.exec_():
- self.add_service_item(self.serviceItemEditForm.get_service_item(),
+ self.service_item_edit_form.set_service_item(self.service_items[item][u'service_item'])
+ if self.service_item_edit_form.exec_():
+ self.add_service_item(self.service_item_edit_form.get_service_item(),
replace=True, expand=self.service_items[item][u'expanded'])
def preview_live(self, unique_identifier, row):
@@ -1136,17 +1136,17 @@
self.repaint_service_list(item - 1, -1)
self.set_modified()
- def repaint_service_list(self, serviceItem, serviceItemChild):
+ def repaint_service_list(self, service_item, service_item_child):
"""
Clear the existing service list and prepaint all the items. This is
used when moving items as the move takes place in a supporting list,
and when regenerating all the items due to theme changes.
- ``serviceItem``
+ ``service_item``
The item which changed. (int)
- ``serviceItemChild``
- The child of the ``serviceItem``, which will be selected. (int)
+ ``service_item_child``
+ The child of the ``service_item``, which will be selected. (int)
"""
# Correct order of items in array
count = 1
@@ -1207,10 +1207,10 @@
text = frame[u'title'].replace(u'\n', u' ')
child.setText(0, text[:40])
child.setData(0, QtCore.Qt.UserRole, count)
- if serviceItem == item_count:
- if item[u'expanded'] and serviceItemChild == count:
+ if service_item == item_count:
+ if item[u'expanded'] and service_item_child == count:
self.service_manager_list.setCurrentItem(child)
- elif serviceItemChild == -1:
+ elif service_item_child == -1:
self.service_manager_list.setCurrentItem(treewidgetitem)
treewidgetitem.setExpanded(item[u'expanded'])
@@ -1443,20 +1443,20 @@
(1, 2)
"""
items = self.service_manager_list.selectedItems()
- serviceItem = -1
- serviceItemChild = -1
+ service_item = -1
+ service_item_child = -1
for item in items:
parent_item = item.parent()
if parent_item is None:
- serviceItem = item.data(0, QtCore.Qt.UserRole)
+ service_item = item.data(0, QtCore.Qt.UserRole)
else:
- serviceItem = parent_item.data(0, QtCore.Qt.UserRole)
- serviceItemChild = item.data(0, QtCore.Qt.UserRole)
+ service_item = parent_item.data(0, QtCore.Qt.UserRole)
+ service_item_child = item.data(0, QtCore.Qt.UserRole)
# Adjust for zero based arrays.
- serviceItem -= 1
+ service_item -= 1
# Only process the first item on the list for this method.
break
- return serviceItem, serviceItemChild
+ return service_item, service_item_child
def drop_event(self, event):
"""
=== modified file 'openlp/core/ui/settingsdialog.py'
--- openlp/core/ui/settingsdialog.py 2013-02-01 21:34:23 +0000
+++ openlp/core/ui/settingsdialog.py 2013-03-07 18:01:28 +0000
@@ -61,7 +61,7 @@
self.button_box = create_button_box(settingsDialog, u'button_box', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.button_box, 1, 1, 1, 1)
self.retranslateUi(settingsDialog)
- QtCore.QObject.connect(self.settingListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.tabChanged)
+ self.settingListWidget.currentRowChanged.connect(self.tabChanged)
def retranslateUi(self, settingsDialog):
"""
=== modified file 'openlp/core/ui/shortcutlistdialog.py'
--- openlp/core/ui/shortcutlistdialog.py 2013-02-01 21:34:23 +0000
+++ openlp/core/ui/shortcutlistdialog.py 2013-03-07 18:01:28 +0000
@@ -68,10 +68,10 @@
shortcutListDialog.resize(500, 438)
self.shortcutListLayout = QtGui.QVBoxLayout(shortcutListDialog)
self.shortcutListLayout.setObjectName(u'shortcutListLayout')
- self.descriptionLabel = QtGui.QLabel(shortcutListDialog)
- self.descriptionLabel.setObjectName(u'descriptionLabel')
- self.descriptionLabel.setWordWrap(True)
- self.shortcutListLayout.addWidget(self.descriptionLabel)
+ self.description_label = QtGui.QLabel(shortcutListDialog)
+ self.description_label.setObjectName(u'description_label')
+ self.description_label.setWordWrap(True)
+ self.shortcutListLayout.addWidget(self.description_label)
self.treeWidget = QtGui.QTreeWidget(shortcutListDialog)
self.treeWidget.setObjectName(u'treeWidget')
self.treeWidget.setAlternatingRowColors(True)
@@ -129,7 +129,7 @@
Translate the UI on the fly
"""
shortcutListDialog.setWindowTitle(translate('OpenLP.ShortcutListDialog', 'Configure Shortcuts'))
- self.descriptionLabel.setText(
+ self.description_label.setText(
translate('OpenLP.ShortcutListDialog', 'Select an action and click one of the buttons below to start '
'capturing a new primary or alternate shortcut, respectively.'))
self.treeWidget.setHeaderLabels([translate('OpenLP.ShortcutListDialog', 'Action'),
=== modified file 'openlp/core/ui/shortcutlistform.py'
--- openlp/core/ui/shortcutlistform.py 2013-02-20 07:29:03 +0000
+++ openlp/core/ui/shortcutlistform.py 2013-03-07 18:01:28 +0000
@@ -57,22 +57,15 @@
self.changedActions = {}
self.action_list = ActionList.get_instance()
self.dialog_was_shown = False
- QtCore.QObject.connect(self.primaryPushButton, QtCore.SIGNAL(u'toggled(bool)'), self.onPrimaryPushButtonClicked)
- QtCore.QObject.connect(self.alternatePushButton, QtCore.SIGNAL(u'toggled(bool)'),
- self.onAlternatePushButtonClicked)
- QtCore.QObject.connect(self.treeWidget,
- QtCore.SIGNAL(u'currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)'), self.onCurrentItemChanged)
- QtCore.QObject.connect(self.treeWidget, QtCore.SIGNAL(u'itemDoubleClicked(QTreeWidgetItem*, int)'),
- self.onItemDoubleClicked)
- QtCore.QObject.connect(self.clearPrimaryButton, QtCore.SIGNAL(u'clicked(bool)'),
- self.onClearPrimaryButtonClicked)
- QtCore.QObject.connect(self.clearAlternateButton, QtCore.SIGNAL(u'clicked(bool)'),
- self.onClearAlternateButtonClicked)
- QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(u'clicked(QAbstractButton*)'),
- self.onRestoreDefaultsClicked)
- QtCore.QObject.connect(self.defaultRadioButton, QtCore.SIGNAL(u'clicked(bool)'),
- self.onDefaultRadioButtonClicked)
- QtCore.QObject.connect(self.customRadioButton, QtCore.SIGNAL(u'clicked(bool)'), self.onCustomRadioButtonClicked)
+ self.primaryPushButton.toggled.connect(self.onPrimaryPushButtonClicked)
+ self.alternatePushButton.toggled.connect(self.onAlternatePushButtonClicked)
+ self.treeWidget.currentItemChanged.connect(self.onCurrentItemChanged)
+ self.treeWidget.itemDoubleClicked.connect(self.onItemDoubleClicked)
+ self.clearPrimaryButton.clicked.connect(self.onClearPrimaryButtonClicked)
+ self.clearAlternateButton.clicked.connect(self.onClearAlternateButtonClicked)
+ self.button_box.clicked.connect(self.onRestoreDefaultsClicked)
+ self.defaultRadioButton.clicked.connect(self.onDefaultRadioButtonClicked)
+ self.customRadioButton.clicked.connect(self.onCustomRadioButtonClicked)
def keyPressEvent(self, event):
"""
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2013-03-05 17:11:58 +0000
+++ openlp/core/ui/slidecontroller.py 2013-03-07 18:01:28 +0000
@@ -195,7 +195,7 @@
self.hide_menu.setText(translate('OpenLP.SlideController', 'Hide'))
self.hide_menu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.hide_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
- self.toolbar.addToolbarWidget(self.hide_menu)
+ self.toolbar.add_toolbar_widget(self.hide_menu)
self.blank_screen = create_action(self, u'blankScreen',
text=translate('OpenLP.SlideController', 'Blank Screen'), icon=u':/slides/slide_blank.png',
checked=False, can_shortcuts=True, category=self.category, triggers=self.onBlankDisplay)
@@ -214,24 +214,24 @@
# Wide menu of display control buttons.
self.blank_screen_button = QtGui.QToolButton(self.toolbar)
self.blank_screen_button.setObjectName(u'blank_screen_button')
- self.toolbar.addToolbarWidget(self.blank_screen_button)
+ self.toolbar.add_toolbar_widget(self.blank_screen_button)
self.blank_screen_button.setDefaultAction(self.blank_screen)
self.theme_screen_button = QtGui.QToolButton(self.toolbar)
self.theme_screen_button.setObjectName(u'theme_screen_button')
- self.toolbar.addToolbarWidget(self.theme_screen_button)
+ self.toolbar.add_toolbar_widget(self.theme_screen_button)
self.theme_screen_button.setDefaultAction(self.theme_screen)
self.desktop_screen_button = QtGui.QToolButton(self.toolbar)
self.desktop_screen_button.setObjectName(u'desktop_screen_button')
- self.toolbar.addToolbarWidget(self.desktop_screen_button)
+ self.toolbar.add_toolbar_widget(self.desktop_screen_button)
self.desktop_screen_button.setDefaultAction(self.desktop_screen)
- self.toolbar.addToolbarAction(u'loop_separator', separator=True)
+ self.toolbar.add_toolbar_action(u'loop_separator', separator=True)
# Play Slides Menu
self.play_slides_menu = QtGui.QToolButton(self.toolbar)
self.play_slides_menu.setObjectName(u'play_slides_menu')
self.play_slides_menu.setText(translate('OpenLP.SlideController', 'Play Slides'))
self.play_slides_menu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.play_slides_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Play Slides'), self.toolbar))
- self.toolbar.addToolbarWidget(self.play_slides_menu)
+ self.toolbar.add_toolbar_widget(self.play_slides_menu)
self.play_slides_loop = create_action(self, u'playSlidesLoop', text=UiStrings().PlaySlidesInLoop,
icon=u':/media/media_time.png', checked=False, can_shortcuts=True,
category=self.category, triggers=self.onPlaySlidesLoop)
@@ -250,14 +250,14 @@
self.delay_spin_box.setRange(1, 180)
self.delay_spin_box.setSuffix(UiStrings().Seconds)
self.delay_spin_box.setToolTip(translate('OpenLP.SlideController', 'Delay between slides in seconds.'))
- self.toolbar.addToolbarWidget(self.delay_spin_box)
+ self.toolbar.add_toolbar_widget(self.delay_spin_box)
else:
- self.toolbar.addToolbarAction(u'goLive', icon=u':/general/general_live.png',
+ self.toolbar.add_toolbar_action(u'goLive', icon=u':/general/general_live.png',
tooltip=translate('OpenLP.SlideController', 'Move to live.'), triggers=self.onGoLive)
- self.toolbar.addToolbarAction(u'addToService', icon=u':/general/general_add.png',
+ self.toolbar.add_toolbar_action(u'addToService', icon=u':/general/general_add.png',
tooltip=translate('OpenLP.SlideController', 'Add to Service.'), triggers=self.onPreviewAddToService)
self.toolbar.addSeparator()
- self.toolbar.addToolbarAction(u'editSong', icon=u':/general/general_edit.png',
+ self.toolbar.add_toolbar_action(u'editSong', icon=u':/general/general_edit.png',
tooltip=translate('OpenLP.SlideController', 'Edit and reload song preview.'), triggers=self.onEditSong)
self.controller_layout.addWidget(self.toolbar)
# Build the Media Toolbar
@@ -269,15 +269,16 @@
self.song_menu.setText(translate('OpenLP.SlideController', 'Go To'))
self.song_menu.setPopupMode(QtGui.QToolButton.InstantPopup)
self.song_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Go To'), self.toolbar))
- self.toolbar.addToolbarWidget(self.song_menu)
+ self.toolbar.add_toolbar_widget(self.song_menu)
# Stuff for items with background audio.
- self.audio_pause_item = self.toolbar.addToolbarAction(u'audioPauseItem',
+ # FIXME: object name should be changed. But this requires that we migrate the shortcut.
+ self.audio_pause_item = self.toolbar.add_toolbar_action(u'audioPauseItem',
icon=u':/slides/media_playback_pause.png', text=translate('OpenLP.SlideController', 'Pause Audio'),
tooltip=translate('OpenLP.SlideController', 'Pause audio.'),
checked=False, visible=False, category=self.category, context=QtCore.Qt.WindowShortcut,
can_shortcuts=True, triggers=self.onAudioPauseClicked)
- self.audioMenu = QtGui.QMenu(translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
- self.audio_pause_item.setMenu(self.audioMenu)
+ self.audio_menu = QtGui.QMenu(translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
+ self.audio_pause_item.setMenu(self.audio_menu)
self.audio_pause_item.setParent(self.toolbar)
self.toolbar.widgetForAction(self.audio_pause_item).setPopupMode(
QtGui.QToolButton.MenuButtonPopup)
@@ -285,15 +286,15 @@
icon=u':/slides/media_playback_next.png',
tooltip=translate('OpenLP.SlideController', 'Go to next audio track.'),
category=self.category, can_shortcuts=True, triggers=self.onNextTrackClicked)
- self.audioMenu.addAction(self.nextTrackItem)
- self.trackMenu = self.audioMenu.addMenu(translate('OpenLP.SlideController', 'Tracks'))
+ self.audio_menu.addAction(self.nextTrackItem)
+ self.trackMenu = self.audio_menu.addMenu(translate('OpenLP.SlideController', 'Tracks'))
self.audio_time_label = QtGui.QLabel(u' 00:00 ', self.toolbar)
self.audio_time_label.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignHCenter)
self.audio_time_label.setStyleSheet(AUDIO_TIME_LABEL_STYLESHEET)
self.audio_time_label.setObjectName(u'audio_time_label')
- self.toolbar.addToolbarWidget(self.audio_time_label)
- self.toolbar.setWidgetVisible(self.audio_list, False)
- self.toolbar.setWidgetVisible([u'songMenu'], False)
+ self.toolbar.add_toolbar_widget(self.audio_time_label)
+ self.toolbar.set_widget_visible(self.audio_list, False)
+ self.toolbar.set_widget_visible([u'song_menu'], False)
# Screen preview area
self.preview_frame = QtGui.QFrame(self.splitter)
self.preview_frame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio))
@@ -352,20 +353,17 @@
context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category if s.get(u'configurable') else None,
triggers=self._slideShortcutActivated) for s in shortcuts])
- QtCore.QObject.connect(
- self.shortcutTimer, QtCore.SIGNAL(u'timeout()'),
- self._slideShortcutActivated)
+ self.shortcutTimer.timeout.connect(self._slideShortcutActivated)
# Signals
- QtCore.QObject.connect(self.preview_list_widget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
+ self.preview_list_widget.clicked.connect(self.onSlideSelected)
if self.is_live:
Registry().register_function(u'slidecontroller_live_spin_delay', self.receive_spin_delay)
Registry().register_function(u'slidecontroller_toggle_display', self.toggle_display)
- self.toolbar.setWidgetVisible(self.loop_list, False)
- self.toolbar.setWidgetVisible(self.wide_menu, False)
+ self.toolbar.set_widget_visible(self.loop_list, False)
+ self.toolbar.set_widget_visible(self.wide_menu, False)
else:
- QtCore.QObject.connect(self.preview_list_widget,
- QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLiveClick)
- self.toolbar.setWidgetVisible([u'editSong'], False)
+ self.preview_list_widget.doubleClicked.connect(self.onGoLiveClick)
+ self.toolbar.set_widget_visible([u'editSong'], False)
if self.is_live:
self.setLiveHotkeys(self)
self.__addActionsToWidget(self.preview_list_widget)
@@ -524,7 +522,7 @@
self.display.setup()
if self.is_live:
self.__addActionsToWidget(self.display)
- self.display.audioPlayer.connectSlot(QtCore.SIGNAL(u'tick(qint64)'), self.on_audio_time_remaining)
+ self.display.audio_player.connectSlot(QtCore.SIGNAL(u'tick(qint64)'), self.on_audio_time_remaining)
# The SlidePreview's ratio.
try:
self.ratio = float(self.screens.current[u'size'].width()) / float(self.screens.current[u'size'].height())
@@ -580,9 +578,9 @@
width = self.main_window.controlSplitter.sizes()[self.split]
for framenumber in range(len(self.service_item.get_frames())):
self.preview_list_widget.setRowHeight(framenumber, width / self.ratio)
- self.onControllerSizeChanged(self.controller.width(), self.controller.height())
+ self.onControllerSizeChanged(self.controller.width())
- def onControllerSizeChanged(self, width, height):
+ def onControllerSizeChanged(self, width):
"""
Change layout of display control buttons on controller size change
"""
@@ -591,12 +589,12 @@
used_space = self.toolbar.size().width() + self.hide_menu.size().width()
# The + 40 is needed to prevent flickering. This can be considered a "buffer".
if width > used_space + 40 and self.hide_menu.isVisible():
- self.toolbar.setWidgetVisible(self.narrow_menu, False)
- self.toolbar.setWidgetVisible(self.wide_menu)
+ self.toolbar.set_widget_visible(self.narrow_menu, False)
+ self.toolbar.set_widget_visible(self.wide_menu)
# The - 40 is needed to prevent flickering. This can be considered a "buffer".
elif width < used_space - 40 and not self.hide_menu.isVisible():
- self.toolbar.setWidgetVisible(self.wide_menu, False)
- self.toolbar.setWidgetVisible(self.narrow_menu)
+ self.toolbar.set_widget_visible(self.wide_menu, False)
+ self.toolbar.set_widget_visible(self.narrow_menu)
def onSongBarHandler(self):
"""
@@ -638,8 +636,8 @@
self.toolbar.hide()
self.mediabar.hide()
self.song_menu.hide()
- self.toolbar.setWidgetVisible(self.loop_list, False)
- self.toolbar.setWidgetVisible([u'songMenu'], False)
+ self.toolbar.set_widget_visible(self.loop_list, False)
+ self.toolbar.set_widget_visible([u'song_menu'], False)
# Reset the button
self.play_slides_once.setChecked(False)
self.play_slides_once.setIcon(build_icon(u':/media/media_time.png'))
@@ -647,9 +645,9 @@
self.play_slides_loop.setIcon(build_icon(u':/media/media_time.png'))
if item.is_text():
if Settings().value(self.main_window.songsSettingsSection + u'/display songbar') and self.slideList:
- self.toolbar.setWidgetVisible([u'songMenu'], True)
+ self.toolbar.set_widget_visible([u'song_menu'], True)
if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1:
- self.toolbar.setWidgetVisible(self.loop_list)
+ self.toolbar.set_widget_visible(self.loop_list)
if item.is_media():
self.mediabar.show()
self.previous_item.setVisible(not item.is_media())
@@ -666,9 +664,9 @@
# See bug #791050
self.toolbar.hide()
self.mediabar.hide()
- self.toolbar.setWidgetVisible([u'editSong'], False)
+ self.toolbar.set_widget_visible([u'editSong'], False)
if item.is_capable(ItemCapabilities.CanEdit) and item.from_plugin:
- self.toolbar.setWidgetVisible([u'editSong'])
+ self.toolbar.set_widget_visible([u'editSong'])
elif item.is_media():
self.mediabar.show()
self.previous_item.setVisible(not item.is_media())
@@ -754,25 +752,25 @@
self.preview_list_widget.setColumnWidth(0, width)
if self.is_live:
self.song_menu.menu().clear()
- self.display.audioPlayer.reset()
+ self.display.audio_player.reset()
self.setAudioItemsVisibility(False)
self.audio_pause_item.setChecked(False)
# If the current item has background audio
if self.service_item.is_capable(ItemCapabilities.HasBackgroundAudio):
log.debug(u'Starting to play...')
- self.display.audioPlayer.add_to_playlist(self.service_item.background_audio)
+ self.display.audio_player.add_to_playlist(self.service_item.background_audio)
self.trackMenu.clear()
for counter in range(len(self.service_item.background_audio)):
action = self.trackMenu.addAction(os.path.basename(self.service_item.background_audio[counter]))
action.setData(counter)
- QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), self.onTrackTriggered)
- self.display.audioPlayer.repeat = Settings().value(
+ action.triggered.connect(self.onTrackTriggered)
+ self.display.audio_player.repeat = Settings().value(
self.main_window.generalSettingsSection + u'/audio repeat list')
if Settings().value(self.main_window.generalSettingsSection + u'/audio start paused'):
self.audio_pause_item.setChecked(True)
- self.display.audioPlayer.pause()
+ self.display.audio_player.pause()
else:
- self.display.audioPlayer.play()
+ self.display.audio_player.play()
self.setAudioItemsVisibility(True)
row = 0
text = []
@@ -1203,7 +1201,7 @@
"""
Set the visibility of the audio stuff
"""
- self.toolbar.setWidgetVisible(self.audio_list, visible)
+ self.toolbar.set_widget_visible(self.audio_list, visible)
def onAudioPauseClicked(self, checked):
"""
@@ -1212,9 +1210,9 @@
if not self.audio_pause_item.isVisible():
return
if checked:
- self.display.audioPlayer.pause()
+ self.display.audio_player.pause()
else:
- self.display.audioPlayer.play()
+ self.display.audio_player.play()
def timerEvent(self, event):
"""
@@ -1316,13 +1314,13 @@
"""
Go to the next track when next is clicked
"""
- self.display.audioPlayer.next()
+ self.display.audio_player.next()
def on_audio_time_remaining(self, time):
"""
Update how much time is remaining
"""
- seconds = self.display.audioPlayer.mediaObject.remainingTime() // 1000
+ seconds = self.display.audio_player.media_object.remainingTime() // 1000
minutes = seconds // 60
seconds %= 60
self.audio_time_label.setText(u' %02d:%02d ' % (minutes, seconds))
@@ -1332,7 +1330,7 @@
Start playing a track
"""
action = self.sender()
- self.display.audioPlayer.go_to(action.data())
+ self.display.audio_player.go_to(action.data())
def _get_plugin_manager(self):
"""
=== modified file 'openlp/core/ui/starttimeform.py'
--- openlp/core/ui/starttimeform.py 2013-02-05 08:05:28 +0000
+++ openlp/core/ui/starttimeform.py 2013-03-07 18:01:28 +0000
@@ -69,12 +69,9 @@
"""
When the dialog succeeds, this is run
"""
- start = self.hourSpinBox.value() * 3600 + \
- self.minuteSpinBox.value() * 60 + \
- self.secondSpinBox.value()
+ start = self.hourSpinBox.value() * 3600 + self.minuteSpinBox.value() * 60 + self.secondSpinBox.value()
end = self.hourFinishSpinBox.value() * 3600 + \
- self.minuteFinishSpinBox.value() * 60 + \
- self.secondFinishSpinBox.value()
+ self.minuteFinishSpinBox.value() * 60 + self.secondFinishSpinBox.value()
if end > self.item[u'service_item'].media_length:
critical_error_message_box(title=translate('OpenLP.StartTimeForm', 'Time Validation Error'),
message=translate('OpenLP.StartTimeForm', 'Finish time is set after the end of the media item'))
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py 2013-02-07 08:42:17 +0000
+++ openlp/core/ui/themeform.py 2013-03-07 18:01:28 +0000
@@ -64,38 +64,31 @@
self.updateThemeAllowed = True
self.temp_background_filename = u''
self.themeLayoutForm = ThemeLayoutForm(self)
- QtCore.QObject.connect(self.backgroundComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'),
- self.onBackgroundComboBoxCurrentIndexChanged)
- QtCore.QObject.connect(self.gradientComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'),
- self.onGradientComboBoxCurrentIndexChanged)
- QtCore.QObject.connect(self.colorButton, QtCore.SIGNAL(u'clicked()'), self.onColorButtonClicked)
- QtCore.QObject.connect(self.imageColorButton, QtCore.SIGNAL(u'clicked()'), self.onImageColorButtonClicked)
- QtCore.QObject.connect(self.gradientStartButton, QtCore.SIGNAL(u'clicked()'),
- self.onGradientStartButtonClicked)
- QtCore.QObject.connect(self.gradientEndButton, QtCore.SIGNAL(u'clicked()'), self.onGradientEndButtonClicked)
- QtCore.QObject.connect(self.imageBrowseButton, QtCore.SIGNAL(u'clicked()'), self.onImageBrowseButtonClicked)
- QtCore.QObject.connect(self.mainColorButton, QtCore.SIGNAL(u'clicked()'), self.onMainColorButtonClicked)
- QtCore.QObject.connect(self.outlineColorButton, QtCore.SIGNAL(u'clicked()'), self.onOutlineColorButtonClicked)
- QtCore.QObject.connect(self.shadowColorButton, QtCore.SIGNAL(u'clicked()'), self.onShadowColorButtonClicked)
- QtCore.QObject.connect(self.outlineCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onOutlineCheckCheckBoxStateChanged)
- QtCore.QObject.connect(self.shadowCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onShadowCheckCheckBoxStateChanged)
- QtCore.QObject.connect(self.footerColorButton, QtCore.SIGNAL(u'clicked()'), self.onFooterColorButtonClicked)
- QtCore.QObject.connect(self, QtCore.SIGNAL(u'customButtonClicked(int)'), self.onCustom1ButtonClicked)
- QtCore.QObject.connect(self.mainPositionCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onMainPositionCheckBoxStateChanged)
- QtCore.QObject.connect(self.footerPositionCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onFooterPositionCheckBoxStateChanged)
- QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
+ self.backgroundComboBox.currentIndexChanged.connect(self.onBackgroundComboBoxCurrentIndexChanged)
+ self.gradientComboBox.currentIndexChanged.connect(self.onGradientComboBoxCurrentIndexChanged)
+ self.colorButton.clicked.connect(self.onColorButtonClicked)
+ self.imageColorButton.clicked.connect(self.onImageColorButtonClicked)
+ self.gradientStartButton.clicked.connect(self.onGradientStartButtonClicked)
+ self.gradientEndButton.clicked.connect(self.onGradientEndButtonClicked)
+ self.imageBrowseButton.clicked.connect(self.onImageBrowseButtonClicked)
+ self.mainColorButton.clicked.connect(self.onMainColorButtonClicked)
+ self.outlineColorButton.clicked.connect(self.onOutlineColorButtonClicked)
+ self.shadowColorButton.clicked.connect(self.onShadowColorButtonClicked)
+ self.outlineCheckBox.stateChanged.connect(self.onOutlineCheckCheckBoxStateChanged)
+ self.shadowCheckBox.stateChanged.connect(self.onShadowCheckCheckBoxStateChanged)
+ self.footerColorButton.clicked.connect(self.onFooterColorButtonClicked)
+ self.customButtonClicked.connect(self.onCustom1ButtonClicked)
+ self.mainPositionCheckBox.stateChanged.connect(self.onMainPositionCheckBoxStateChanged)
+ self.footerPositionCheckBox.stateChanged.connect(self.onFooterPositionCheckBoxStateChanged)
+ self.currentIdChanged.connect(self.onCurrentIdChanged)
Registry().register_function(u'theme_line_count', self.updateLinesText)
- QtCore.QObject.connect(self.mainSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
- QtCore.QObject.connect(self.lineSpacingSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
- QtCore.QObject.connect(self.outlineSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
- QtCore.QObject.connect(self.shadowSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
- QtCore.QObject.connect(self.mainFontComboBox, QtCore.SIGNAL(u'activated(int)'), self.calculateLines)
- QtCore.QObject.connect(self.footerFontComboBox, QtCore.SIGNAL(u'activated(int)'), self.updateTheme)
- QtCore.QObject.connect(self.footerSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.updateTheme)
+ self.mainSizeSpinBox.valueChanged.connect(self.calculateLines)
+ self.lineSpacingSpinBox.valueChanged.connect(self.calculateLines)
+ self.outlineSizeSpinBox.valueChanged.connect(self.calculateLines)
+ self.shadowSizeSpinBox.valueChanged.connect(self.calculateLines)
+ self.mainFontComboBox.activated.connect(self.calculateLines)
+ self.footerFontComboBox.activated.connect(self.updateTheme)
+ self.footerSizeSpinBox.valueChanged.connect(self.updateTheme)
def setDefaults(self):
"""
@@ -149,7 +142,7 @@
Calculate the number of lines on a page by rendering text
"""
# Do not trigger on start up
- if self.currentPage != self.welcomePage:
+ if self.currentPage != self.welcome_page:
self.updateTheme()
self.theme_manager.generate_image(self.theme, True)
@@ -281,12 +274,12 @@
self.setWindowTitle(UiStrings().NewTheme)
return QtGui.QWizard.exec_(self)
- def initializePage(self, id):
+ def initializePage(self, page_id):
"""
Set up the pages for Initial run through dialog
"""
- log.debug(u'initializePage %s' % id)
- wizardPage = self.page(id)
+ log.debug(u'initializePage %s' % page_id)
+ wizardPage = self.page(page_id)
if wizardPage == self.backgroundPage:
self.setBackgroundPageValues()
elif wizardPage == self.mainAreaPage:
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2013-03-05 17:11:58 +0000
+++ openlp/core/ui/thememanager.py 2013-03-07 18:01:28 +0000
@@ -70,27 +70,27 @@
self.layout.setObjectName(u'layout')
self.toolbar = OpenLPToolbar(self)
self.toolbar.setObjectName(u'toolbar')
- self.toolbar.addToolbarAction(u'newTheme',
+ self.toolbar.add_toolbar_action(u'newTheme',
text=UiStrings().NewTheme, icon=u':/themes/theme_new.png',
tooltip=translate('OpenLP.ThemeManager', 'Create a new theme.'),
triggers=self.onAddTheme)
- self.toolbar.addToolbarAction(u'editTheme',
+ self.toolbar.add_toolbar_action(u'editTheme',
text=translate('OpenLP.ThemeManager', 'Edit Theme'),
icon=u':/themes/theme_edit.png',
tooltip=translate('OpenLP.ThemeManager', 'Edit a theme.'),
triggers=self.on_edit_theme)
- self.deleteToolbarAction = self.toolbar.addToolbarAction(u'delete_theme',
+ self.deleteToolbarAction = self.toolbar.add_toolbar_action(u'delete_theme',
text=translate('OpenLP.ThemeManager', 'Delete Theme'),
icon=u':/general/general_delete.png',
tooltip=translate('OpenLP.ThemeManager', 'Delete a theme.'),
triggers=self.on_delete_theme)
self.toolbar.addSeparator()
- self.toolbar.addToolbarAction(u'importTheme',
+ self.toolbar.add_toolbar_action(u'importTheme',
text=translate('OpenLP.ThemeManager', 'Import Theme'),
icon=u':/general/general_import.png',
tooltip=translate('OpenLP.ThemeManager', 'Import a theme.'),
triggers=self.on_import_theme)
- self.toolbar.addToolbarAction(u'exportTheme',
+ self.toolbar.add_toolbar_action(u'exportTheme',
text=translate('OpenLP.ThemeManager', 'Export Theme'),
icon=u':/general/general_export.png',
tooltip=translate('OpenLP.ThemeManager', 'Export a theme.'),
@@ -243,9 +243,9 @@
translate('OpenLP.ThemeManager', 'Rename %s theme?'), False, False):
item = self.theme_list_widget.currentItem()
old_theme_name = item.data(QtCore.Qt.UserRole)
- self.fileRenameForm.fileNameEdit.setText(old_theme_name)
+ self.fileRenameForm.file_name_edit.setText(old_theme_name)
if self.fileRenameForm.exec_():
- new_theme_name = self.fileRenameForm.fileNameEdit.text()
+ new_theme_name = self.fileRenameForm.file_name_edit.text()
if old_theme_name == new_theme_name:
return
if self.check_if_theme_exists(new_theme_name):
@@ -264,10 +264,10 @@
"""
item = self.theme_list_widget.currentItem()
old_theme_name = item.data(QtCore.Qt.UserRole)
- self.fileRenameForm.fileNameEdit.setText(translate('OpenLP.ThemeManager',
+ self.fileRenameForm.file_name_edit.setText(translate('OpenLP.ThemeManager',
'Copy of %s', 'Copy of <theme name>') % old_theme_name)
if self.fileRenameForm.exec_(True):
- new_theme_name = self.fileRenameForm.fileNameEdit.text()
+ new_theme_name = self.fileRenameForm.file_name_edit.text()
if self.check_if_theme_exists(new_theme_name):
theme_data = self.get_theme_data(old_theme_name)
self.cloneThemeData(theme_data, new_theme_name)
@@ -361,8 +361,7 @@
for files in os.walk(source):
for name in files[2]:
theme_zip.write(
- os.path.join(source, name).encode(u'utf-8'),
- os.path.join(theme, name).encode(u'utf-8')
+ os.path.join(source, name).encode(u'utf-8'), os.path.join(theme, name).encode(u'utf-8')
)
QtGui.QMessageBox.information(self,
translate('OpenLP.ThemeManager', 'Theme Exported'),
@@ -682,7 +681,7 @@
log.debug('update_preview_images')
self.main_window.displayProgressBar(len(self.theme_list))
for theme in self.theme_list:
- self.main_window.incrementProgressBar()
+ self.main_window.increment_progress_bar()
self.generate_and_save_image(self.path, theme, self.get_theme_data(theme))
self.main_window.finishedProgressBar()
self.load_themes()
@@ -768,20 +767,20 @@
theme = Theme(xml_data)
new_theme = ThemeXML()
new_theme.theme_name = self.badV1NameChars.sub(u'', theme.Name)
- if theme.BackgroundType == 0:
+ if theme.BackgroundType == BackgroundType.Solid:
new_theme.background_type = BackgroundType.to_string(BackgroundType.Solid)
new_theme.background_color = unicode(theme.BackgroundParameter1.name())
- elif theme.BackgroundType == 1:
+ elif theme.BackgroundType == BackgroundType.Horizontal:
new_theme.background_type = BackgroundType.to_string(BackgroundType.Gradient)
new_theme.background_direction = BackgroundGradientType.to_string(BackgroundGradientType.Horizontal)
if theme.BackgroundParameter3.name() == 1:
new_theme.background_direction = BackgroundGradientType.to_string(BackgroundGradientType.Horizontal)
new_theme.background_start_color = unicode(theme.BackgroundParameter1.name())
new_theme.background_end_color = unicode(theme.BackgroundParameter2.name())
- elif theme.BackgroundType == 2:
+ elif theme.BackgroundType == BackgroundType.Image:
new_theme.background_type = BackgroundType.to_string(BackgroundType.Image)
new_theme.background_filename = unicode(theme.BackgroundParameter1)
- elif theme.BackgroundType == 3:
+ elif theme.BackgroundType == BackgroundType.Transparent:
new_theme.background_type = BackgroundType.to_string(BackgroundType.Transparent)
new_theme.font_main_name = theme.FontName
new_theme.font_main_color = unicode(theme.FontColor.name())
=== modified file 'openlp/core/ui/themestab.py'
--- openlp/core/ui/themestab.py 2013-02-19 19:50:14 +0000
+++ openlp/core/ui/themestab.py 2013-03-07 18:01:28 +0000
@@ -98,12 +98,10 @@
label.setWordWrap(True)
self.rightLayout.addWidget(self.LevelGroupBox)
self.rightLayout.addStretch()
- QtCore.QObject.connect(self.SongLevelRadioButton, QtCore.SIGNAL(u'clicked()'), self.onSongLevelButtonClicked)
- QtCore.QObject.connect(self.ServiceLevelRadioButton, QtCore.SIGNAL(u'clicked()'),
- self.onServiceLevelButtonClicked)
- QtCore.QObject.connect(self.GlobalLevelRadioButton, QtCore.SIGNAL(u'clicked()'),
- self.onGlobalLevelButtonClicked)
- QtCore.QObject.connect(self.DefaultComboBox, QtCore.SIGNAL(u'activated(int)'), self.onDefaultComboBoxChanged)
+ self.SongLevelRadioButton.clicked.connect(self.onSongLevelButtonClicked)
+ self.ServiceLevelRadioButton.clicked.connect(self.onServiceLevelButtonClicked)
+ self.GlobalLevelRadioButton.clicked.connect(self.onGlobalLevelButtonClicked)
+ self.DefaultComboBox.activated.connect(self.onDefaultComboBoxChanged)
Registry().register_function(u'theme_update_list', self.update_theme_list)
def retranslateUi(self):
=== modified file 'openlp/core/ui/themewizard.py'
--- openlp/core/ui/themewizard.py 2013-02-05 08:05:28 +0000
+++ openlp/core/ui/themewizard.py 2013-03-07 18:01:28 +0000
@@ -48,8 +48,7 @@
themeWizard.setModal(True)
themeWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
themeWizard.setOptions(QtGui.QWizard.IndependentPages |
- QtGui.QWizard.NoBackButtonOnStartPage |
- QtGui.QWizard.HaveCustomButton1)
+ QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.HaveCustomButton1)
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
# Welcome Page
add_welcome_page(themeWizard, u':/wizards/wizard_createtheme.bmp')
@@ -395,12 +394,11 @@
Translate the UI on the fly
"""
themeWizard.setWindowTitle(translate('OpenLP.ThemeWizard', 'Theme Wizard'))
- self.titleLabel.setText(u'<span style="font-size:14pt; font-weight:600;">%s</span>' %
+ self.title_label.setText(u'<span style="font-size:14pt; font-weight:600;">%s</span>' %
translate('OpenLP.ThemeWizard', 'Welcome to the Theme Wizard'))
- self.informationLabel.setText(
- translate('OpenLP.ThemeWizard', 'This wizard will help you to '
- 'create and edit your themes. Click the next button below to '
- 'start the process by setting up your background.'))
+ self.information_label.setText(
+ translate('OpenLP.ThemeWizard', 'This wizard will help you to create and edit your themes. Click the next '
+ 'button below to start the process by setting up your background.'))
self.backgroundPage.setTitle(translate('OpenLP.ThemeWizard', 'Set Up Background'))
self.backgroundPage.setSubTitle(translate('OpenLP.ThemeWizard', 'Set up your theme\'s background '
'according to the parameters below.'))
@@ -417,10 +415,8 @@
self.gradientTypeLabel.setText(translate('OpenLP.ThemeWizard', 'Gradient:'))
self.gradientComboBox.setItemText(BackgroundGradientType.Horizontal,
translate('OpenLP.ThemeWizard', 'Horizontal'))
- self.gradientComboBox.setItemText(BackgroundGradientType.Vertical,
- translate('OpenLP.ThemeWizard', 'Vertical'))
- self.gradientComboBox.setItemText(BackgroundGradientType.Circular,
- translate('OpenLP.ThemeWizard', 'Circular'))
+ self.gradientComboBox.setItemText(BackgroundGradientType.Vertical, translate('OpenLP.ThemeWizard', 'Vertical'))
+ self.gradientComboBox.setItemText(BackgroundGradientType.Circular, translate('OpenLP.ThemeWizard', 'Circular'))
self.gradientComboBox.setItemText(BackgroundGradientType.LeftTop,
translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right'))
self.gradientComboBox.setItemText(BackgroundGradientType.LeftBottom,
@@ -484,12 +480,10 @@
self.footerHeightSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
self.footerPositionCheckBox.setText(translate('OpenLP.ThemeWizard', 'Use default location'))
themeWizard.setOption(QtGui.QWizard.HaveCustomButton1, False)
- themeWizard.setButtonText(QtGui.QWizard.CustomButton1,
- translate('OpenLP.ThemeWizard', 'Layout Preview'))
+ themeWizard.setButtonText(QtGui.QWizard.CustomButton1, translate('OpenLP.ThemeWizard', 'Layout Preview'))
self.previewPage.setTitle(translate('OpenLP.ThemeWizard', 'Preview and Save'))
self.previewPage.setSubTitle(translate('OpenLP.ThemeWizard', 'Preview the theme and save it.'))
self.themeNameLabel.setText(translate('OpenLP.ThemeWizard', 'Theme name:'))
# Align all QFormLayouts towards each other.
- labelWidth = max(self.backgroundLabel.minimumSizeHint().width(),
- self.horizontalLabel.minimumSizeHint().width())
+ labelWidth = max(self.backgroundLabel.minimumSizeHint().width(), self.horizontalLabel.minimumSizeHint().width())
self.spacer.changeSize(labelWidth, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
=== modified file 'openlp/core/ui/wizard.py'
--- openlp/core/ui/wizard.py 2013-02-07 08:42:17 +0000
+++ openlp/core/ui/wizard.py 2013-03-07 18:01:28 +0000
@@ -57,11 +57,9 @@
Importing = translate('OpenLP.Ui', 'Importing')
ImportingType = translate('OpenLP.Ui', 'Importing "%s"...')
ImportSelect = translate('OpenLP.Ui', 'Select Import Source')
- ImportSelectLong = translate('OpenLP.Ui',
- 'Select the import format and the location to import from.')
- NoSqlite = translate('OpenLP.Ui', 'The openlp.org 1.x importer has been '
- 'disabled due to a missing Python module. If you want to use this '
- 'importer, you will need to install the "python-sqlite" module.')
+ ImportSelectLong = translate('OpenLP.Ui', 'Select the import format and the location to import from.')
+ NoSqlite = translate('OpenLP.Ui', 'The openlp.org 1.x importer has been disabled due to a missing Python module. '
+ 'If you want to use this importer, you will need to install the "python-sqlite" module.')
OpenTypeFile = translate('OpenLP.Ui', 'Open %s File')
OpenTypeFolder = translate('OpenLP.Ui', 'Open %s Folder')
PercentSymbolFormat = translate('OpenLP.Ui', '%p%')
@@ -87,17 +85,17 @@
QtGui.QWizard.__init__(self, parent)
self.plugin = plugin
self.setObjectName(name)
- self.openIcon = build_icon(u':/general/general_open.png')
- self.deleteIcon = build_icon(u':/general/general_delete.png')
- self.finishButton = self.button(QtGui.QWizard.FinishButton)
- self.cancelButton = self.button(QtGui.QWizard.CancelButton)
+ self.open_icon = build_icon(u':/general/general_open.png')
+ self.delete_icon = build_icon(u':/general/general_delete.png')
+ self.finish_button = self.button(QtGui.QWizard.FinishButton)
+ self.cancel_button = self.button(QtGui.QWizard.CancelButton)
self.setupUi(image)
- self.registerFields()
+ self.register_fields()
self.customInit()
self.customSignals()
- QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
- QtCore.QObject.connect(self.errorCopyToButton, QtCore.SIGNAL(u'clicked()'), self.onErrorCopyToButtonClicked)
- QtCore.QObject.connect(self.errorSaveToButton, QtCore.SIGNAL(u'clicked()'), self.onErrorSaveToButtonClicked)
+ self.currentIdChanged.connect(self.on_current_id_changed)
+ self.error_copy_to_button.clicked.connect(self.on_error_copy_to_button_clicked)
+ self.error_save_to_button.clicked.connect(self.on_error_save_to_button_clicked)
def setupUi(self, image):
"""
@@ -106,14 +104,13 @@
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.addCustomPages()
self.addProgressPage()
self.retranslateUi()
- def registerFields(self):
+ def register_fields(self):
"""
Hook method for wizards to register any fields they need.
"""
@@ -124,41 +121,41 @@
Add the progress page for the wizard. This page informs the user how
the wizard is progressing with its task.
"""
- self.progressPage = QtGui.QWizardPage()
- self.progressPage.setObjectName(u'progressPage')
- self.progressLayout = QtGui.QVBoxLayout(self.progressPage)
- self.progressLayout.setMargin(48)
- self.progressLayout.setObjectName(u'progressLayout')
- self.progressLabel = QtGui.QLabel(self.progressPage)
- self.progressLabel.setObjectName(u'progressLabel')
- self.progressLabel.setWordWrap(True)
- self.progressLayout.addWidget(self.progressLabel)
- self.progressBar = QtGui.QProgressBar(self.progressPage)
- self.progressBar.setObjectName(u'progressBar')
- self.progressLayout.addWidget(self.progressBar)
+ self.progress_page = QtGui.QWizardPage()
+ self.progress_page.setObjectName(u'progress_page')
+ self.progress_layout = QtGui.QVBoxLayout(self.progress_page)
+ self.progress_layout.setMargin(48)
+ self.progress_layout.setObjectName(u'progress_layout')
+ self.progress_label = QtGui.QLabel(self.progress_page)
+ self.progress_label.setObjectName(u'progress_label')
+ self.progress_label.setWordWrap(True)
+ self.progress_layout.addWidget(self.progress_label)
+ self.progress_bar = QtGui.QProgressBar(self.progress_page)
+ self.progress_bar.setObjectName(u'progress_bar')
+ self.progress_layout.addWidget(self.progress_bar)
# Add a QTextEdit and a copy to file and copy to clipboard button to be
# able to provide feedback to the user. Hidden by default.
- self.errorReportTextEdit = QtGui.QTextEdit(self.progressPage)
- self.errorReportTextEdit.setObjectName(u'progresserrorReportTextEdit')
- self.errorReportTextEdit.setHidden(True)
- self.errorReportTextEdit.setReadOnly(True)
- self.progressLayout.addWidget(self.errorReportTextEdit)
- self.errorButtonLayout = QtGui.QHBoxLayout()
- self.errorButtonLayout.setObjectName(u'errorButtonLayout')
+ self.error_report_text_edit = QtGui.QTextEdit(self.progress_page)
+ self.error_report_text_edit.setObjectName(u'error_report_text_edit')
+ self.error_report_text_edit.setHidden(True)
+ self.error_report_text_edit.setReadOnly(True)
+ self.progress_layout.addWidget(self.error_report_text_edit)
+ self.error_button_layout = QtGui.QHBoxLayout()
+ self.error_button_layout.setObjectName(u'error_button_layout')
spacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.errorButtonLayout.addItem(spacer)
- self.errorCopyToButton = QtGui.QPushButton(self.progressPage)
- self.errorCopyToButton.setObjectName(u'errorCopyToButton')
- self.errorCopyToButton.setHidden(True)
- self.errorCopyToButton.setIcon(build_icon(u':/system/system_edit_copy.png'))
- self.errorButtonLayout.addWidget(self.errorCopyToButton)
- self.errorSaveToButton = QtGui.QPushButton(self.progressPage)
- self.errorSaveToButton.setObjectName(u'errorSaveToButton')
- self.errorSaveToButton.setHidden(True)
- self.errorSaveToButton.setIcon(build_icon(u':/general/general_save.png'))
- self.errorButtonLayout.addWidget(self.errorSaveToButton)
- self.progressLayout.addLayout(self.errorButtonLayout)
- self.addPage(self.progressPage)
+ self.error_button_layout.addItem(spacer)
+ self.error_copy_to_button = QtGui.QPushButton(self.progress_page)
+ self.error_copy_to_button.setObjectName(u'error_copy_to_button')
+ self.error_copy_to_button.setHidden(True)
+ self.error_copy_to_button.setIcon(build_icon(u':/system/system_edit_copy.png'))
+ self.error_button_layout.addWidget(self.error_copy_to_button)
+ self.error_save_to_button = QtGui.QPushButton(self.progress_page)
+ self.error_save_to_button.setObjectName(u'error_save_to_button')
+ self.error_save_to_button.setHidden(True)
+ self.error_save_to_button.setIcon(build_icon(u':/general/general_save.png'))
+ self.error_button_layout.addWidget(self.error_save_to_button)
+ self.progress_layout.addLayout(self.error_button_layout)
+ self.addPage(self.progress_page)
def exec_(self):
"""
@@ -172,40 +169,40 @@
Stop the wizard on cancel button, close button or ESC key.
"""
log.debug(u'Wizard cancelled by user.')
- if self.currentPage() == self.progressPage:
+ if self.currentPage() == self.progress_page:
Registry().execute(u'openlp_stop_wizard')
self.done(QtGui.QDialog.Rejected)
- def onCurrentIdChanged(self, pageId):
+ def on_current_id_changed(self, pageId):
"""
Perform necessary functions depending on which wizard page is active.
"""
- if self.page(pageId) == self.progressPage:
- self.preWizard()
+ if self.page(pageId) == self.progress_page:
+ self.pre_wizard()
self.performWizard()
self.postWizard()
else:
- self.customPageChanged(pageId)
+ self.custom_cage_changed(pageId)
- def customPageChanged(self, pageId):
+ def custom_cage_changed(self, pageId):
"""
Called when changing to a page other than the progress page
"""
pass
- def onErrorCopyToButtonClicked(self):
- """
- Called when the ``onErrorCopyToButtonClicked`` has been clicked.
- """
- pass
-
- def onErrorSaveToButtonClicked(self):
- """
- Called when the ``onErrorSaveToButtonClicked`` has been clicked.
- """
- pass
-
- def incrementProgressBar(self, status_text, increment=1):
+ def on_error_copy_to_button_clicked(self):
+ """
+ Called when the ``error_copy_to_button`` has been clicked.
+ """
+ pass
+
+ def on_error_save_to_button_clicked(self):
+ """
+ Called when the ``error_save_to_button`` has been clicked.
+ """
+ pass
+
+ def increment_progress_bar(self, status_text, increment=1):
"""
Update the wizard progress page.
@@ -216,30 +213,30 @@
The value to increment the progress bar by.
"""
log.debug(u'IncrementBar %s', status_text)
- self.progressLabel.setText(status_text)
+ self.progress_label.setText(status_text)
if increment > 0:
- self.progressBar.setValue(self.progressBar.value() + increment)
+ self.progress_bar.setValue(self.progress_bar.value() + increment)
self.application.process_events()
- def preWizard(self):
+ def pre_wizard(self):
"""
Prepare the UI for the import.
"""
- self.finishButton.setVisible(False)
- self.progressBar.setMinimum(0)
- self.progressBar.setMaximum(1188)
- self.progressBar.setValue(0)
+ self.finish_button.setVisible(False)
+ self.progress_bar.setMinimum(0)
+ self.progress_bar.setMaximum(1188)
+ self.progress_bar.setValue(0)
def postWizard(self):
"""
Clean up the UI after the import has finished.
"""
- self.progressBar.setValue(self.progressBar.maximum())
- self.finishButton.setVisible(True)
- self.cancelButton.setVisible(False)
+ self.progress_bar.setValue(self.progress_bar.maximum())
+ self.finish_button.setVisible(True)
+ self.cancel_button.setVisible(False)
self.application.process_events()
- def getFileName(self, title, editbox, setting_name, filters=u''):
+ def get_file_name(self, title, editbox, setting_name, filters=u''):
"""
Opens a QFileDialog and saves the filename to the given editbox.
@@ -267,7 +264,7 @@
editbox.setText(filename)
Settings().setValue(self.plugin.settingsSection + u'/' + setting_name, filename)
- def getFolder(self, title, editbox, setting_name):
+ def get_folder(self, title, editbox, setting_name):
"""
Opens a QFileDialog and saves the selected folder to the given editbox.
@@ -281,8 +278,7 @@
The place where to save the last opened directory.
"""
folder = QtGui.QFileDialog.getExistingDirectory(self, title,
- Settings().value(self.plugin.settingsSection + u'/' + setting_name),
- QtGui.QFileDialog.ShowDirsOnly)
+ Settings().value(self.plugin.settingsSection + u'/' + setting_name), QtGui.QFileDialog.ShowDirsOnly)
if folder:
editbox.setText(folder)
Settings().setValue(self.plugin.settingsSection + u'/' + setting_name, folder)
=== modified file 'openlp/core/utils/actions.py'
--- openlp/core/utils/actions.py 2013-02-27 12:41:04 +0000
+++ openlp/core/utils/actions.py 2013-03-07 18:01:28 +0000
@@ -30,11 +30,16 @@
The :mod:`~openlp.core.utils.actions` module provides action list classes used
by the shortcuts system.
"""
+import logging
+
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Settings
+log = logging.getLogger(__name__)
+
+
class ActionCategory(object):
"""
The :class:`~openlp.core.utils.ActionCategory` class encapsulates a category for the
@@ -312,6 +317,8 @@
actions.append(action)
ActionList.shortcut_map[shortcuts[1]] = actions
else:
+ log.warn(u'Shortcut "%s" is removed from "%s" because another action already uses this shortcut.' %
+ (shortcuts[1], action.objectName()))
shortcuts.remove(shortcuts[1])
# Check the primary shortcut.
existing_actions = ActionList.shortcut_map.get(shortcuts[0], [])
@@ -321,6 +328,8 @@
actions.append(action)
ActionList.shortcut_map[shortcuts[0]] = actions
else:
+ log.warn(u'Shortcut "%s" is removed from "%s" because another action already uses this shortcut.' %
+ (shortcuts[0], action.objectName()))
shortcuts.remove(shortcuts[0])
action.setShortcuts([QtGui.QKeySequence(shortcut) for shortcut in shortcuts])
=== modified file 'openlp/plugins/alerts/lib/alertstab.py'
--- openlp/plugins/alerts/lib/alertstab.py 2013-02-07 08:42:17 +0000
+++ openlp/plugins/alerts/lib/alertstab.py 2013-03-07 18:01:28 +0000
@@ -93,12 +93,11 @@
self.rightLayout.addWidget(self.previewGroupBox)
self.rightLayout.addStretch()
# Signals and slots
- QtCore.QObject.connect(self.backgroundColorButton, QtCore.SIGNAL(u'clicked()'),
- self.onBackgroundColorButtonClicked)
- QtCore.QObject.connect(self.fontColorButton, QtCore.SIGNAL(u'clicked()'), self.onFontColorButtonClicked)
- QtCore.QObject.connect(self.fontComboBox, QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked)
- QtCore.QObject.connect(self.timeoutSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)
- QtCore.QObject.connect(self.fontSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.onFontSizeSpinBoxChanged)
+ self.backgroundColorButton.clicked.connect(self.onBackgroundColorButtonClicked)
+ self.fontColorButton.clicked.connect(self.onFontColorButtonClicked)
+ self.fontComboBox.activated.connect(self.onFontComboBoxClicked)
+ self.timeoutSpinBox.valueChanged.connect(self.onTimeoutSpinBoxChanged)
+ self.fontSizeSpinBox.valueChanged.connect(self.onFontSizeSpinBoxChanged)
def retranslateUi(self):
self.fontGroupBox.setTitle(translate('AlertsPlugin.AlertsTab', 'Font'))
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py 2013-02-05 08:05:28 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py 2013-03-07 18:01:28 +0000
@@ -85,8 +85,7 @@
Set up the UI for the bible wizard.
"""
OpenLPWizard.setupUi(self, image)
- QtCore.QObject.connect(self.formatComboBox,QtCore.SIGNAL(u'currentIndexChanged(int)'),
- self.onCurrentIndexChanged)
+ self.formatComboBox.currentIndexChanged.connect(self.onCurrentIndexChanged)
def onCurrentIndexChanged(self, index):
"""
@@ -117,18 +116,12 @@
"""
Set up the signals used in the bible importer.
"""
- QtCore.QObject.connect(self.webSourceComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'),
- self.onWebSourceComboBoxIndexChanged)
- QtCore.QObject.connect(self.osisBrowseButton, QtCore.SIGNAL(u'clicked()'),
- self.onOsisBrowseButtonClicked)
- QtCore.QObject.connect(self.csvBooksButton, QtCore.SIGNAL(u'clicked()'),
- self.onCsvBooksBrowseButtonClicked)
- QtCore.QObject.connect(self.csvVersesButton, QtCore.SIGNAL(u'clicked()'),
- self.onCsvVersesBrowseButtonClicked)
- QtCore.QObject.connect(self.openSongBrowseButton, QtCore.SIGNAL(u'clicked()'),
- self.onOpenSongBrowseButtonClicked)
- QtCore.QObject.connect(self.openlp1BrowseButton, QtCore.SIGNAL(u'clicked()'),
- self.onOpenlp1BrowseButtonClicked)
+ self.webSourceComboBox.currentIndexChanged.connect(self.onWebSourceComboBoxIndexChanged)
+ self.osisBrowseButton.clicked.connect(self.onOsisBrowseButtonClicked)
+ self.csvBooksButton.clicked.connect(self.onCsvBooksBrowseButtonClicked)
+ self.csvVersesButton.clicked.connect(self.onCsvVersesBrowseButtonClicked)
+ self.openSongBrowseButton.clicked.connect(self.onOpenSongBrowseButtonClicked)
+ self.openlp1BrowseButton.clicked.connect(self.onOpenlp1BrowseButtonClicked)
def addCustomPages(self):
"""
@@ -165,7 +158,7 @@
self.osisFileEdit.setObjectName(u'OsisFileEdit')
self.osisFileLayout.addWidget(self.osisFileEdit)
self.osisBrowseButton = QtGui.QToolButton(self.osisWidget)
- self.osisBrowseButton.setIcon(self.openIcon)
+ self.osisBrowseButton.setIcon(self.open_icon)
self.osisBrowseButton.setObjectName(u'OsisBrowseButton')
self.osisFileLayout.addWidget(self.osisBrowseButton)
self.osisLayout.addRow(self.osisFileLabel, self.osisFileLayout)
@@ -184,7 +177,7 @@
self.csvBooksEdit.setObjectName(u'CsvBooksEdit')
self.csvBooksLayout.addWidget(self.csvBooksEdit)
self.csvBooksButton = QtGui.QToolButton(self.csvWidget)
- self.csvBooksButton.setIcon(self.openIcon)
+ self.csvBooksButton.setIcon(self.open_icon)
self.csvBooksButton.setObjectName(u'CsvBooksButton')
self.csvBooksLayout.addWidget(self.csvBooksButton)
self.csvLayout.addRow(self.csvBooksLabel, self.csvBooksLayout)
@@ -196,7 +189,7 @@
self.csvVersesEdit.setObjectName(u'CsvVersesEdit')
self.csvVersesLayout.addWidget(self.csvVersesEdit)
self.csvVersesButton = QtGui.QToolButton(self.csvWidget)
- self.csvVersesButton.setIcon(self.openIcon)
+ self.csvVersesButton.setIcon(self.open_icon)
self.csvVersesButton.setObjectName(u'CsvVersesButton')
self.csvVersesLayout.addWidget(self.csvVersesButton)
self.csvLayout.addRow(self.csvVersesLabel, self.csvVersesLayout)
@@ -215,7 +208,7 @@
self.openSongFileEdit.setObjectName(u'OpenSongFileEdit')
self.openSongFileLayout.addWidget(self.openSongFileEdit)
self.openSongBrowseButton = QtGui.QToolButton(self.openSongWidget)
- self.openSongBrowseButton.setIcon(self.openIcon)
+ self.openSongBrowseButton.setIcon(self.open_icon)
self.openSongBrowseButton.setObjectName(u'OpenSongBrowseButton')
self.openSongFileLayout.addWidget(self.openSongBrowseButton)
self.openSongLayout.addRow(self.openSongFileLabel, self.openSongFileLayout)
@@ -279,7 +272,7 @@
self.openlp1FileEdit.setObjectName(u'Openlp1FileEdit')
self.openlp1FileLayout.addWidget(self.openlp1FileEdit)
self.openlp1BrowseButton = QtGui.QToolButton(self.openlp1Widget)
- self.openlp1BrowseButton.setIcon(self.openIcon)
+ self.openlp1BrowseButton.setIcon(self.open_icon)
self.openlp1BrowseButton.setObjectName(u'Openlp1BrowseButton')
self.openlp1FileLayout.addWidget(self.openlp1BrowseButton)
self.openlp1Layout.addRow(self.openlp1FileLabel, self.openlp1FileLayout)
@@ -322,9 +315,9 @@
Allow for localisation of the bible import wizard.
"""
self.setWindowTitle(translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
- self.titleLabel.setText(WizardStrings.HeaderStyle %
+ self.title_label.setText(WizardStrings.HeaderStyle %
translate('OpenLP.Ui', 'Welcome to the Bible Import Wizard'))
- self.informationLabel.setText(
+ self.information_label.setText(
translate('BiblesPlugin.ImportWizardForm',
'This wizard will help you to import Bibles from a variety of '
'formats. Click the next button below to start the process by '
@@ -366,11 +359,11 @@
self.versionNameLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
self.copyrightLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
self.permissionsLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
- self.progressPage.setTitle(WizardStrings.Importing)
- self.progressPage.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
+ self.progress_page.setTitle(WizardStrings.Importing)
+ self.progress_page.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
'Please wait while your Bible is imported.'))
- self.progressLabel.setText(WizardStrings.Ready)
- self.progressBar.setFormat(u'%p%')
+ self.progress_label.setText(WizardStrings.Ready)
+ self.progress_bar.setFormat(u'%p%')
self.openlp1DisabledLabel.setText(WizardStrings.NoSqlite)
# Align all QFormLayouts towards each other.
labelWidth = max(self.formatLabel.minimumSizeHint().width(),
@@ -385,7 +378,7 @@
"""
Validate the current page before moving on to the next page.
"""
- if self.currentPage() == self.welcomePage:
+ if self.currentPage() == self.welcome_page:
return True
elif self.currentPage() == self.selectPage:
if self.field(u'source_format') == BibleFormat.OSIS:
@@ -449,7 +442,7 @@
self.versionNameEdit.setFocus()
return False
return True
- if self.currentPage() == self.progressPage:
+ if self.currentPage() == self.progress_page:
return True
def onWebSourceComboBoxIndexChanged(self, index):
@@ -469,36 +462,36 @@
"""
Show the file open dialog for the OSIS file.
"""
- self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OSIS, self.osisFileEdit, u'last directory import')
+ self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.OSIS, self.osisFileEdit, u'last directory import')
def onCsvBooksBrowseButtonClicked(self):
"""
Show the file open dialog for the books CSV file.
"""
- self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csvBooksEdit, u'last directory import',
+ self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csvBooksEdit, u'last directory import',
u'%s (*.csv)' % translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
def onCsvVersesBrowseButtonClicked(self):
"""
Show the file open dialog for the verses CSV file.
"""
- self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csvVersesEdit, u'last directory import',
+ self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csvVersesEdit, u'last directory import',
u'%s (*.csv)' % translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
def onOpenSongBrowseButtonClicked(self):
"""
Show the file open dialog for the OpenSong file.
"""
- self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OS, self.openSongFileEdit, u'last directory import')
+ self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.OS, self.openSongFileEdit, u'last directory import')
def onOpenlp1BrowseButtonClicked(self):
"""
Show the file open dialog for the openlp.org 1.x file.
"""
- self.getFileName(WizardStrings.OpenTypeFile % UiStrings().OLPV1, self.openlp1FileEdit, u'last directory import',
+ self.get_file_name(WizardStrings.OpenTypeFile % UiStrings().OLPV1, self.openlp1FileEdit, u'last directory import',
u'%s (*.bible)' % translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x Bible Files'))
- def registerFields(self):
+ def register_fields(self):
"""
Register the bible import wizard fields.
"""
@@ -524,8 +517,8 @@
settings = Settings()
settings.beginGroup(self.plugin.settingsSection)
self.restart()
- self.finishButton.setVisible(False)
- self.cancelButton.setVisible(True)
+ self.finish_button.setVisible(False)
+ self.cancel_button.setVisible(True)
self.setField(u'source_format', 0)
self.setField(u'osis_location', '')
self.setField(u'csv_booksfile', '')
@@ -572,12 +565,12 @@
"""
Prepare the UI for the import.
"""
- OpenLPWizard.preWizard(self)
+ OpenLPWizard.pre_wizard(self)
bible_type = self.field(u'source_format')
if bible_type == BibleFormat.WebDownload:
- self.progressLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Registering Bible...'))
+ self.progress_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Registering Bible...'))
else:
- self.progressLabel.setText(WizardStrings.StartingImport)
+ self.progress_label.setText(WizardStrings.StartingImport)
self.application.process_events()
def performWizard(self):
@@ -610,7 +603,7 @@
)
elif bible_type == BibleFormat.WebDownload:
# Import a bible from the web.
- self.progressBar.setMaximum(1)
+ self.progress_bar.setMaximum(1)
download_location = self.field(u'web_location')
bible_version = self.webTranslationComboBox.currentText()
bible = self.web_bible_list[download_location][bible_version]
@@ -633,12 +626,12 @@
license_copyright, license_permissions)
self.manager.reload_bibles()
if bible_type == BibleFormat.WebDownload:
- self.progressLabel.setText(
+ self.progress_label.setText(
translate('BiblesPlugin.ImportWizardForm', 'Registered Bible. Please note, that verses will be '
'downloaded on\ndemand and thus an internet connection is required.'))
else:
- self.progressLabel.setText(WizardStrings.FinishedImport)
+ self.progress_label.setText(WizardStrings.FinishedImport)
else:
- self.progressLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
+ self.progress_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
del self.manager.db_cache[importer.name]
delete_database(self.plugin.settingsSection, importer.file)
=== modified file 'openlp/plugins/bibles/forms/bibleupgradeform.py'
--- openlp/plugins/bibles/forms/bibleupgradeform.py 2013-02-07 08:42:17 +0000
+++ openlp/plugins/bibles/forms/bibleupgradeform.py 2013-03-07 18:01:28 +0000
@@ -97,14 +97,14 @@
"""
log.debug(u'Wizard cancelled by user')
self.stop_import_flag = True
- if not self.currentPage() == self.progressPage:
+ if not self.currentPage() == self.progress_page:
self.done(QtGui.QDialog.Rejected)
def onCurrentIdChanged(self, pageId):
"""
Perform necessary functions depending on which wizard page is active.
"""
- if self.page(pageId) == self.progressPage:
+ if self.page(pageId) == self.progress_page:
self.preWizard()
self.performWizard()
self.postWizard()
@@ -151,8 +151,8 @@
"""
Set up the signals used in the bible importer.
"""
- QtCore.QObject.connect(self.backupBrowseButton, QtCore.SIGNAL(u'clicked()'), self.onBackupBrowseButtonClicked)
- QtCore.QObject.connect(self.noBackupCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.onNoBackupCheckBoxToggled)
+ self.backupBrowseButton.clicked.connect(self.onBackupBrowseButtonClicked)
+ self.noBackupCheckBox.toggled.connect(self.onNoBackupCheckBoxToggled)
def addCustomPages(self):
"""
@@ -183,7 +183,7 @@
self.backupDirectoryEdit.setObjectName(u'BackupFolderEdit')
self.backupDirectoryLayout.addWidget(self.backupDirectoryEdit)
self.backupBrowseButton = QtGui.QToolButton(self.backupPage)
- self.backupBrowseButton.setIcon(self.openIcon)
+ self.backupBrowseButton.setIcon(self.open_icon)
self.backupBrowseButton.setObjectName(u'BackupBrowseButton')
self.backupDirectoryLayout.addWidget(self.backupBrowseButton)
self.formLayout.addRow(self.backupDirectoryLabel, self.backupDirectoryLayout)
@@ -224,8 +224,8 @@
self.checkBox[number].setText(bible.get_name())
self.checkBox[number].setCheckState(QtCore.Qt.Checked)
self.formLayout.addWidget(self.checkBox[number])
- self.spacerItem = QtGui.QSpacerItem(20, 5, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self.formLayout.addItem(self.spacerItem)
+ self.spacer_item = QtGui.QSpacerItem(20, 5, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.formLayout.addItem(self.spacer_item)
self.scrollArea.setWidget(self.scrollAreaContents)
def clearScrollArea(self):
@@ -235,16 +235,16 @@
for number, filename in enumerate(self.files):
self.formLayout.removeWidget(self.checkBox[number])
self.checkBox[number].setParent(None)
- self.formLayout.removeItem(self.spacerItem)
+ self.formLayout.removeItem(self.spacer_item)
def retranslateUi(self):
"""
Allow for localisation of the bible import wizard.
"""
self.setWindowTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Bible Upgrade Wizard'))
- self.titleLabel.setText(WizardStrings.HeaderStyle %
+ self.title_label.setText(WizardStrings.HeaderStyle %
translate('OpenLP.Ui', 'Welcome to the Bible Upgrade Wizard'))
- self.informationLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
+ self.information_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
'This wizard will help you to upgrade your existing Bibles from a prior version of OpenLP 2. '
'Click the next button below to start the upgrade process.'))
self.backupPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Select Backup Directory'))
@@ -265,17 +265,17 @@
self.selectPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Select Bibles'))
self.selectPage.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
'Please select the Bibles to upgrade'))
- self.progressPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading'))
- self.progressPage.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
+ self.progress_page.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading'))
+ self.progress_page.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
'Please wait while your Bibles are upgraded.'))
- self.progressLabel.setText(WizardStrings.Ready)
- self.progressBar.setFormat(u'%p%')
+ self.progress_label.setText(WizardStrings.Ready)
+ self.progress_bar.setFormat(u'%p%')
def validateCurrentPage(self):
"""
Validate the current page before moving on to the next page.
"""
- if self.currentPage() == self.welcomePage:
+ if self.currentPage() == self.welcome_page:
return True
elif self.currentPage() == self.backupPage:
if not self.noBackupCheckBox.checkState() == QtCore.Qt.Checked:
@@ -304,7 +304,7 @@
else:
delete_file(os.path.join(self.path, filename[0]))
return True
- if self.currentPage() == self.progressPage:
+ if self.currentPage() == self.progress_page:
return True
def setDefaults(self):
@@ -323,18 +323,18 @@
self.retranslateUi()
for number, filename in enumerate(self.files):
self.checkBox[number].setCheckState(QtCore.Qt.Checked)
- self.progressBar.show()
+ self.progress_bar.show()
self.restart()
- self.finishButton.setVisible(False)
- self.cancelButton.setVisible(True)
+ self.finish_button.setVisible(False)
+ self.cancel_button.setVisible(True)
settings.endGroup()
def preWizard(self):
"""
Prepare the UI for the upgrade.
"""
- OpenLPWizard.preWizard(self)
- self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Starting upgrade...'))
+ OpenLPWizard.pre_wizard(self)
+ self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Starting upgrade...'))
self.application.process_events()
def performWizard(self):
@@ -344,9 +344,9 @@
self.includeWebBible = False
proxy_server = None
if not self.files:
- self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
+ self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
'There are no Bibles that need to be upgraded.'))
- self.progressBar.hide()
+ self.progress_bar.hide()
return
max_bibles = 0
for number, file in enumerate(self.files):
@@ -366,11 +366,11 @@
if not self.checkBox[number].checkState() == QtCore.Qt.Checked:
self.success[number] = False
continue
- self.progressBar.reset()
+ self.progress_bar.reset()
old_bible = OldBibleDB(self.mediaItem, path=self.temp_dir,
file=filename[0])
name = filename[1]
- self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
+ self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nUpgrading ...') % (number + 1, max_bibles, name))
self.newbibles[number] = BibleDB(self.mediaItem, path=self.path, name=name, file=filename[0])
self.newbibles[number].register(self.plugin.upgrade_wizard)
@@ -409,9 +409,9 @@
translate('BiblesPlugin.UpgradeWizardForm', 'Download Error'),
translate('BiblesPlugin.UpgradeWizardForm',
'To upgrade your Web Bibles an Internet connection is required.'))
- self.incrementProgressBar(translate(
+ self.increment_progress_bar(translate(
'BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible %s of %s: "%s"\nFailed') %
- (number + 1, max_bibles, name), self.progressBar.maximum() - self.progressBar.value())
+ (number + 1, max_bibles, name), self.progress_bar.maximum() - self.progress_bar.value())
self.success[number] = False
continue
bible = BiblesResourcesDB.get_webbible(
@@ -427,17 +427,17 @@
log.warn(u'Upgrading from "%s" failed' % filename[0])
self.newbibles[number].session.close()
del self.newbibles[number]
- self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
+ self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
- self.progressBar.maximum() - self.progressBar.value())
+ self.progress_bar.maximum() - self.progress_bar.value())
self.success[number] = False
continue
- self.progressBar.setMaximum(len(books))
+ self.progress_bar.setMaximum(len(books))
for book in books:
if self.stop_import_flag:
self.success[number] = False
break
- self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
+ self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') % (number + 1, max_bibles, name, book))
book_ref_id = self.newbibles[number].\
get_book_ref_id_by_name(book, len(books), language_id)
@@ -475,18 +475,18 @@
log.warn(u'Upgrading books from "%s" failed' % name)
self.newbibles[number].session.close()
del self.newbibles[number]
- self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
+ self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
- self.progressBar.maximum() - self.progressBar.value())
+ self.progress_bar.maximum() - self.progress_bar.value())
self.success[number] = False
continue
books = old_bible.get_books()
- self.progressBar.setMaximum(len(books))
+ self.progress_bar.setMaximum(len(books))
for book in books:
if self.stop_import_flag:
self.success[number] = False
break
- self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
+ self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') %
(number + 1, max_bibles, name, book[u'name']))
book_ref_id = self.newbibles[number].get_book_ref_id_by_name(book[u'name'], len(books), language_id)
@@ -514,13 +514,13 @@
self.application.process_events()
self.newbibles[number].session.commit()
if not self.success.get(number, True):
- self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
+ self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
- self.progressBar.maximum() - self.progressBar.value())
+ self.progress_bar.maximum() - self.progress_bar.value())
else:
self.success[number] = True
self.newbibles[number].save_meta(u'name', name)
- self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
+ self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nComplete') % (number + 1, max_bibles, name))
if number in self.newbibles:
self.newbibles[number].session.close()
@@ -549,14 +549,14 @@
failed_import_text = u''
if successful_import > 0:
if self.includeWebBible:
- self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
+ self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible(s): %s successful%s\nPlease note that verses from Web Bibles will be downloaded '
'on demand and so an Internet connection is required.') % (successful_import, failed_import_text))
else:
- self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
+ self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible(s): %s successful%s') % (successful_import, failed_import_text))
else:
- self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade failed.'))
+ self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade failed.'))
# Remove temp directory.
shutil.rmtree(self.temp_dir, True)
OpenLPWizard.postWizard(self)
=== modified file 'openlp/plugins/bibles/forms/booknameform.py'
--- openlp/plugins/bibles/forms/booknameform.py 2013-01-01 16:33:41 +0000
+++ openlp/plugins/bibles/forms/booknameform.py 2013-03-07 18:01:28 +0000
@@ -65,12 +65,9 @@
"""
Set up the signals used in the booknameform.
"""
- QtCore.QObject.connect(self.oldTestamentCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onCheckBoxIndexChanged)
- QtCore.QObject.connect(self.newTestamentCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onCheckBoxIndexChanged)
- QtCore.QObject.connect(self.apocryphaCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onCheckBoxIndexChanged)
+ self.oldTestamentCheckBox.stateChanged.connect(self.onCheckBoxIndexChanged)
+ self.newTestamentCheckBox.stateChanged.connect(self.onCheckBoxIndexChanged)
+ self.apocryphaCheckBox.stateChanged.connect(self.onCheckBoxIndexChanged)
def onCheckBoxIndexChanged(self, index):
"""
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2013-02-07 08:42:17 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2013-03-07 18:01:28 +0000
@@ -134,43 +134,25 @@
self.leftLayout.addStretch()
self.rightLayout.addStretch()
# Signals and slots
- QtCore.QObject.connect(self.newChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onNewChaptersCheckBoxChanged)
- QtCore.QObject.connect(self.displayStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
- self.onDisplayStyleComboBoxChanged)
- QtCore.QObject.connect(self.bibleThemeComboBox, QtCore.SIGNAL(u'activated(int)'),
- self.onBibleThemeComboBoxChanged)
- QtCore.QObject.connect(self.layoutStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
- self.onLayoutStyleComboBoxChanged)
- QtCore.QObject.connect(self.bibleSecondCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onBibleSecondCheckBox)
- QtCore.QObject.connect(self.verseSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
- self.onVerseSeparatorCheckBoxClicked)
- QtCore.QObject.connect(self.verseSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
- self.onVerseSeparatorLineEditEdited)
- QtCore.QObject.connect(self.verseSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
- self.onVerseSeparatorLineEditFinished)
- QtCore.QObject.connect(self.rangeSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
- self.onRangeSeparatorCheckBoxClicked)
- QtCore.QObject.connect(self.rangeSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
- self.onRangeSeparatorLineEditEdited)
- QtCore.QObject.connect(self.rangeSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
- self.onRangeSeparatorLineEditFinished)
- QtCore.QObject.connect(self.listSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
- self.onListSeparatorCheckBoxClicked)
- QtCore.QObject.connect(self.listSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
- self.onListSeparatorLineEditEdited)
- QtCore.QObject.connect(self.listSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
- self.onListSeparatorLineEditFinished)
- QtCore.QObject.connect(self.endSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
- self.onEndSeparatorCheckBoxClicked)
- QtCore.QObject.connect(self.endSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
- self.onEndSeparatorLineEditEdited)
- QtCore.QObject.connect(self.endSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
- self.onEndSeparatorLineEditFinished)
+ self.newChaptersCheckBox.stateChanged.connect(self.onNewChaptersCheckBoxChanged)
+ self.displayStyleComboBox.activated.connect(self.onDisplayStyleComboBoxChanged)
+ self.bibleThemeComboBox.activated.connect(self.onBibleThemeComboBoxChanged)
+ self.layoutStyleComboBox.activated.connect(self.onLayoutStyleComboBoxChanged)
+ self.bibleSecondCheckBox.stateChanged.connect(self.onBibleSecondCheckBox)
+ self.verseSeparatorCheckBox.clicked.connect(self.onVerseSeparatorCheckBoxClicked)
+ self.verseSeparatorLineEdit.textEdited.connect(self.onVerseSeparatorLineEditEdited)
+ self.verseSeparatorLineEdit.editingFinished.connect(self.onVerseSeparatorLineEditFinished)
+ self.rangeSeparatorCheckBox.clicked.connect(self.onRangeSeparatorCheckBoxClicked)
+ self.rangeSeparatorLineEdit.textEdited.connect(self.onRangeSeparatorLineEditEdited)
+ self.rangeSeparatorLineEdit.editingFinished.connect(self.onRangeSeparatorLineEditFinished)
+ self.listSeparatorCheckBox.clicked.connect(self.onListSeparatorCheckBoxClicked)
+ self.listSeparatorLineEdit.textEdited.connect(self.onListSeparatorLineEditEdited)
+ self.listSeparatorLineEdit.editingFinished.connect(self.onListSeparatorLineEditFinished)
+ self.endSeparatorCheckBox.clicked.connect(self.onEndSeparatorCheckBoxClicked)
+ self.endSeparatorLineEdit.textEdited.connect(self.onEndSeparatorLineEditEdited)
+ self.endSeparatorLineEdit.editingFinished.connect(self.onEndSeparatorLineEditFinished)
Registry().register_function(u'theme_update_list', self.update_theme_list)
- QtCore.QObject.connect(self.languageSelectionComboBox, QtCore.SIGNAL(u'activated(int)'),
- self.onLanguageSelectionComboBoxChanged)
+ self.languageSelectionComboBox.activated.connect(self.onLanguageSelectionComboBoxChanged)
def retranslateUi(self):
self.verseDisplayGroupBox.setTitle(translate('BiblesPlugin.BiblesTab', 'Verse Display'))
=== modified file 'openlp/plugins/bibles/lib/csvbible.py'
--- openlp/plugins/bibles/lib/csvbible.py 2013-02-05 06:47:03 +0000
+++ openlp/plugins/bibles/lib/csvbible.py 2013-03-07 18:01:28 +0000
@@ -88,9 +88,9 @@
"""
Import the bible books and verses.
"""
- self.wizard.progressBar.setValue(0)
- self.wizard.progressBar.setMinimum(0)
- self.wizard.progressBar.setMaximum(66)
+ self.wizard.progress_bar.setValue(0)
+ self.wizard.progress_bar.setMinimum(0)
+ self.wizard.progress_bar.setMaximum(66)
success = True
language_id = self.get_language(bible_name)
if not language_id:
@@ -109,7 +109,7 @@
for line in books_reader:
if self.stop_import_flag:
break
- self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible', 'Importing books... %s') %
+ self.wizard.increment_progress_bar(translate('BiblesPlugin.CSVBible', 'Importing books... %s') %
unicode(line[2], details['encoding']))
book_ref_id = self.get_book_ref_id_by_name(unicode(line[2], details['encoding']), 67, language_id)
if not book_ref_id:
@@ -127,8 +127,8 @@
books_file.close()
if self.stop_import_flag or not success:
return False
- self.wizard.progressBar.setValue(0)
- self.wizard.progressBar.setMaximum(67)
+ self.wizard.progress_bar.setValue(0)
+ self.wizard.progress_bar.setMaximum(67)
verse_file = None
try:
book_ptr = None
@@ -148,7 +148,7 @@
if book_ptr != line_book:
book = self.get_book(line_book)
book_ptr = book.name
- self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible',
+ self.wizard.increment_progress_bar(translate('BiblesPlugin.CSVBible',
'Importing verses from %s... Importing verses from <book name>...') % book.name)
self.session.commit()
try:
@@ -156,7 +156,7 @@
except UnicodeError:
verse_text = unicode(line[3], u'cp1252')
self.create_verse(book.id, line[1], line[2], verse_text)
- self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible', 'Importing verses... done.'))
+ self.wizard.increment_progress_bar(translate('BiblesPlugin.CSVBible', 'Importing verses... done.'))
self.application.process_events()
self.session.commit()
except IOError:
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py 2013-02-07 07:17:19 +0000
+++ openlp/plugins/bibles/lib/http.py 2013-03-07 18:01:28 +0000
@@ -511,8 +511,8 @@
Run the import. This method overrides the parent class method. Returns
``True`` on success, ``False`` on failure.
"""
- self.wizard.progressBar.setMaximum(68)
- self.wizard.incrementProgressBar(translate('BiblesPlugin.HTTPBible', 'Registering Bible and loading books...'))
+ self.wizard.progress_bar.setMaximum(68)
+ self.wizard.increment_progress_bar(translate('BiblesPlugin.HTTPBible', 'Registering Bible and loading books...'))
self.save_meta(u'download_source', self.download_source)
self.save_meta(u'download_name', self.download_name)
if self.proxy_server:
@@ -534,8 +534,8 @@
log.exception(u'Importing books from %s - download name: "%s" '\
'failed' % (self.download_source, self.download_name))
return False
- self.wizard.progressBar.setMaximum(len(books) + 2)
- self.wizard.incrementProgressBar(translate( 'BiblesPlugin.HTTPBible', 'Registering Language...'))
+ self.wizard.progress_bar.setMaximum(len(books) + 2)
+ self.wizard.increment_progress_bar(translate( 'BiblesPlugin.HTTPBible', 'Registering Language...'))
bible = BiblesResourcesDB.get_webbible(self.download_name, self.download_source.lower())
if bible[u'language_id']:
language_id = bible[u'language_id']
@@ -548,7 +548,7 @@
for book in books:
if self.stop_import_flag:
break
- self.wizard.incrementProgressBar(translate(
+ self.wizard.increment_progress_bar(translate(
'BiblesPlugin.HTTPBible', 'Importing %s...',
'Importing <book name>...') % book)
book_ref_id = self.get_book_ref_id_by_name(book, len(books), language_id)
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2013-03-07 18:01:28 +0000
@@ -58,11 +58,11 @@
"""
log.info(u'Bible Media Item loaded')
- def __init__(self, parent, plugin, icon):
+ def __init__(self, parent, plugin):
self.IconPath = u'songs/song'
self.lockIcon = build_icon(u':/bibles/bibles_search_lock.png')
self.unlockIcon = build_icon(u':/bibles/bibles_search_unlock.png')
- MediaManagerItem.__init__(self, parent, plugin, icon)
+ MediaManagerItem.__init__(self, parent, plugin)
# Place to store the search results for both bibles.
self.settings = self.plugin.settingsTab
self.quickPreviewAllowed = True
@@ -166,7 +166,7 @@
layout.addLayout(searchButtonLayout, idx + 3, 1, 1, 2)
self.pageLayout.addWidget(tab)
tab.setVisible(False)
- QtCore.QObject.connect(lockButton, QtCore.SIGNAL(u'toggled(bool)'), self.onLockButtonToggled)
+ lockButton.toggled.connect(self.onLockButtonToggled)
setattr(self, prefix + u'VersionLabel', versionLabel)
setattr(self, prefix + u'VersionComboBox', versionComboBox)
setattr(self, prefix + u'SecondLabel', secondLabel)
@@ -228,29 +228,24 @@
self.advancedLayout.addWidget(self.advancedToVerse, 4, 2)
self.addSearchFields(u'advanced', UiStrings().Advanced)
# Combo Boxes
- QtCore.QObject.connect(self.quickVersionComboBox, QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
- QtCore.QObject.connect(self.quickSecondComboBox, QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
- QtCore.QObject.connect(self.advancedVersionComboBox,QtCore.SIGNAL(u'activated(int)'),
- self.onAdvancedVersionComboBox)
- QtCore.QObject.connect(self.advancedSecondComboBox, QtCore.SIGNAL(u'activated(int)'),
- self.onAdvancedSecondComboBox)
- QtCore.QObject.connect(self.advancedBookComboBox, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox)
- QtCore.QObject.connect(self.advancedFromChapter, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromChapter)
- QtCore.QObject.connect(self.advancedFromVerse, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromVerse)
- QtCore.QObject.connect(self.advancedToChapter, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedToChapter)
+ self.quickVersionComboBox.activated.connect(self.updateAutoCompleter)
+ self.quickSecondComboBox.activated.connect(self.updateAutoCompleter)
+ self.advancedVersionComboBox.activated.connect(self.onAdvancedVersionComboBox)
+ self.advancedSecondComboBox.activated.connect(self.onAdvancedSecondComboBox)
+ self.advancedBookComboBox.activated.connect(self.onAdvancedBookComboBox)
+ self.advancedFromChapter.activated.connect(self.onAdvancedFromChapter)
+ self.advancedFromVerse.activated.connect(self.onAdvancedFromVerse)
+ self.advancedToChapter.activated.connect(self.onAdvancedToChapter)
QtCore.QObject.connect(self.quickSearchEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'), self.updateAutoCompleter)
- QtCore.QObject.connect(self.quickVersionComboBox, QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
- QtCore.QObject.connect(self.quickStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
- self.onQuickStyleComboBoxChanged)
- QtCore.QObject.connect( self.advancedStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
- self.onAdvancedStyleComboBoxChanged)
+ self.quickVersionComboBox.activated.connect(self.updateAutoCompleter)
+ self.quickStyleComboBox.activated.connect(self.onQuickStyleComboBoxChanged)
+ self.advancedStyleComboBox.activated.connect(self.onAdvancedStyleComboBoxChanged)
# Buttons
- QtCore.QObject.connect(self.advancedSearchButton, QtCore.SIGNAL(u'clicked()'), self.onAdvancedSearchButton)
- QtCore.QObject.connect(self.quickSearchButton, QtCore.SIGNAL(u'clicked()'), self.onQuickSearchButton)
+ self.advancedSearchButton.clicked.connect(self.onAdvancedSearchButton)
+ self.quickSearchButton.clicked.connect(self.onQuickSearchButton)
# Other stuff
- QtCore.QObject.connect(self.quickSearchEdit, QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton)
- QtCore.QObject.connect(self.searchTabBar, QtCore.SIGNAL(u'currentChanged(int)'),
- self.onSearchTabBarCurrentChanged)
+ self.quickSearchEdit.returnPressed.connect(self.onQuickSearchButton)
+ self.searchTabBar.currentChanged.connect(self.onSearchTabBarCurrentChanged)
def onFocus(self):
if self.quickTab.isVisible():
@@ -304,7 +299,7 @@
log.debug(u'bible manager initialise')
self.plugin.manager.media = self
self.loadBibles()
- self.quickSearchEdit.setSearchTypes([
+ self.quickSearchEdit.set_search_types([
(BibleSearch.Reference, u':/bibles/bibles_search_reference.png',
translate('BiblesPlugin.MediaItem', 'Scripture Reference'),
translate('BiblesPlugin.MediaItem', 'Search Scripture Reference...')),
@@ -312,7 +307,7 @@
translate('BiblesPlugin.MediaItem', 'Text Search'),
translate('BiblesPlugin.MediaItem', 'Search Text...'))
])
- self.quickSearchEdit.setCurrentSearchType(Settings().value(u'%s/last search type' % self.settingsSection))
+ self.quickSearchEdit.set_current_search_type(Settings().value(u'%s/last search type' % self.settingsSection))
self.config_update()
log.debug(u'bible manager initialise complete')
@@ -432,12 +427,12 @@
"""
log.debug(u'updateAutoCompleter')
# Save the current search type to the configuration.
- Settings().setValue(u'%s/last search type' % self.settingsSection, self.quickSearchEdit.currentSearchType())
+ Settings().setValue(u'%s/last search type' % self.settingsSection, self.quickSearchEdit.current_search_type())
# Save the current bible to the configuration.
Settings().setValue(self.settingsSection + u'/quick bible', self.quickVersionComboBox.currentText())
books = []
# We have to do a 'Reference Search'.
- if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
+ if self.quickSearchEdit.current_search_type() == BibleSearch.Reference:
bibles = self.plugin.manager.get_bibles()
bible = self.quickVersionComboBox.currentText()
if bible:
@@ -653,7 +648,7 @@
bible = self.quickVersionComboBox.currentText()
second_bible = self.quickSecondComboBox.currentText()
text = self.quickSearchEdit.text()
- if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
+ if self.quickSearchEdit.current_search_type() == BibleSearch.Reference:
# We are doing a 'Reference Search'.
self.search_results = self.plugin.manager.get_verses(bible, text)
if second_bible and self.search_results:
=== modified file 'openlp/plugins/bibles/lib/openlp1.py'
--- openlp/plugins/bibles/lib/openlp1.py 2013-02-04 21:22:12 +0000
+++ openlp/plugins/bibles/lib/openlp1.py 2013-03-07 18:01:28 +0000
@@ -77,7 +77,7 @@
# This file is not an openlp.org 1.x bible database.
return False
books = cursor.fetchall()
- self.wizard.progressBar.setMaximum(len(books) + 1)
+ self.wizard.progress_bar.setMaximum(len(books) + 1)
for book in books:
if self.stop_import_flag:
connection.close()
@@ -94,7 +94,7 @@
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
db_book = self.create_book(name, book_ref_id, book_details[u'testament_id'])
# Update the progess bar.
- self.wizard.incrementProgressBar(WizardStrings.ImportingType % name)
+ self.wizard.increment_progress_bar(WizardStrings.ImportingType % name)
# Import the verses for this book.
cursor.execute(u'SELECT chapter, verse, text || \'\' AS text FROM '
'verse WHERE book_id=%s' % book_id)
=== modified file 'openlp/plugins/bibles/lib/opensong.py'
--- openlp/plugins/bibles/lib/opensong.py 2013-02-03 19:23:12 +0000
+++ openlp/plugins/bibles/lib/opensong.py 2013-03-07 18:01:28 +0000
@@ -126,7 +126,7 @@
chapter_number,
verse_number,
self.get_text(verse))
- self.wizard.incrementProgressBar(translate('BiblesPlugin.Opensong', 'Importing %s %s...',
+ self.wizard.increment_progress_bar(translate('BiblesPlugin.Opensong', 'Importing %s %s...',
'Importing <book name> <chapter>...')) % (db_book.name, chapter_number)
self.session.commit()
self.application.process_events()
=== modified file 'openlp/plugins/bibles/lib/osis.py'
--- openlp/plugins/bibles/lib/osis.py 2013-02-03 19:23:12 +0000
+++ openlp/plugins/bibles/lib/osis.py 2013-03-07 18:01:28 +0000
@@ -85,7 +85,7 @@
success = True
last_chapter = 0
match_count = 0
- self.wizard.incrementProgressBar(translate('BiblesPlugin.OsisImport',
+ self.wizard.increment_progress_bar(translate('BiblesPlugin.OsisImport',
'Detecting encoding (this may take a few minutes)...'))
try:
detect_file = open(self.filename, u'r')
@@ -151,11 +151,11 @@
book_ref_id,
book_details[u'testament_id'])
if last_chapter == 0:
- self.wizard.progressBar.setMaximum(chapter_count)
+ self.wizard.progress_bar.setMaximum(chapter_count)
if last_chapter != chapter:
if last_chapter != 0:
self.session.commit()
- self.wizard.incrementProgressBar(translate('BiblesPlugin.OsisImport', 'Importing %s %s...',
+ self.wizard.increment_progress_bar(translate('BiblesPlugin.OsisImport', 'Importing %s %s...',
'Importing <book name> <chapter>...') % (book_details[u'name'], chapter))
last_chapter = chapter
# All of this rigmarol below is because the mod2osis
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2013-02-19 21:23:56 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2013-03-07 18:01:28 +0000
@@ -54,9 +54,9 @@
"""
log.info(u'Custom Media Item loaded')
- def __init__(self, parent, plugin, icon):
+ def __init__(self, parent, plugin):
self.IconPath = u'custom/custom'
- MediaManagerItem.__init__(self, parent, plugin, icon)
+ MediaManagerItem.__init__(self, parent, plugin)
self.edit_custom_form = EditCustomForm(self, self.main_window, self.plugin.manager)
self.singleServiceItem = False
self.quickPreviewAllowed = True
@@ -86,14 +86,14 @@
self.searchTextButton.setText(UiStrings().Search)
def initialise(self):
- self.searchTextEdit.setSearchTypes([
+ self.searchTextEdit.set_search_types([
(CustomSearch.Titles, u':/songs/song_search_title.png',
translate('SongsPlugin.MediaItem', 'Titles'),
translate('SongsPlugin.MediaItem', 'Search Titles...')),
(CustomSearch.Themes, u':/slides/slide_theme.png', UiStrings().Themes, UiStrings().SearchThemes)
])
self.loadList(self.manager.get_all_objects(CustomSlide, order_by_ref=CustomSlide.title))
- self.searchTextEdit.setCurrentSearchType(Settings().value( u'%s/last search type' % self.settingsSection))
+ self.searchTextEdit.set_current_search_type(Settings().value( u'%s/last search type' % self.settingsSection))
self.config_updated()
def loadList(self, custom_slides):
@@ -207,11 +207,11 @@
def onSearchTextButtonClicked(self):
# Save the current search type to the configuration.
- Settings().setValue(u'%s/last search type' % self.settingsSection, self.searchTextEdit.currentSearchType())
+ Settings().setValue(u'%s/last search type' % self.settingsSection, self.searchTextEdit.current_search_type())
# Reload the list considering the new search type.
search_keywords = self.searchTextEdit.displayText()
search_results = []
- search_type = self.searchTextEdit.currentSearchType()
+ search_type = self.searchTextEdit.current_search_type()
if search_type == CustomSearch.Titles:
log.debug(u'Titles Search')
search_results = self.plugin.manager.get_all_objects(CustomSlide,
=== modified file 'openlp/plugins/images/lib/imagetab.py'
--- openlp/plugins/images/lib/imagetab.py 2013-02-07 08:42:17 +0000
+++ openlp/plugins/images/lib/imagetab.py 2013-03-07 18:01:28 +0000
@@ -53,22 +53,21 @@
self.backgroundColorButton.setObjectName(u'BackgroundColorButton')
self.colorLayout.addWidget(self.backgroundColorButton)
self.formLayout.addRow(self.colorLayout)
- self.informationLabel = QtGui.QLabel(self.bgColorGroupBox)
- self.informationLabel.setObjectName(u'InformationLabel')
- self.informationLabel.setWordWrap(True)
- self.formLayout.addRow(self.informationLabel)
+ self.information_label = QtGui.QLabel(self.bgColorGroupBox)
+ self.information_label.setObjectName(u'information_label')
+ self.information_label.setWordWrap(True)
+ self.formLayout.addRow(self.information_label)
self.leftLayout.addWidget(self.bgColorGroupBox)
self.leftLayout.addStretch()
self.rightColumn.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.rightLayout.addStretch()
# Signals and slots
- QtCore.QObject.connect(self.backgroundColorButton, QtCore.SIGNAL(u'clicked()'),
- self.onbackgroundColorButtonClicked)
+ self.backgroundColorButton.clicked.connect(self.onbackgroundColorButtonClicked)
def retranslateUi(self):
self.bgColorGroupBox.setTitle(UiStrings().BackgroundColor)
self.backgroundColorLabel.setText(UiStrings().DefaultColor)
- self.informationLabel.setText(
+ self.information_label.setText(
translate('ImagesPlugin.ImageTab', 'Visible background for images with aspect ratio different to screen.'))
def onbackgroundColorButtonClicked(self):
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2013-03-01 17:36:43 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2013-03-07 18:01:28 +0000
@@ -45,9 +45,9 @@
"""
log.info(u'Image Media Item loaded')
- def __init__(self, parent, plugin, icon):
+ def __init__(self, parent, plugin):
self.IconPath = u'images/image'
- MediaManagerItem.__init__(self, parent, plugin, icon)
+ MediaManagerItem.__init__(self, parent, plugin)
self.quickPreviewAllowed = True
self.hasSearch = True
Registry().register_function(u'live_theme_changed', self.live_theme_changed)
@@ -84,9 +84,9 @@
self.listView.addAction(self.replaceAction)
def addEndHeaderBar(self):
- self.replaceAction = self.toolbar.addToolbarAction(u'replaceAction',
+ self.replaceAction = self.toolbar.add_toolbar_action(u'replaceAction',
icon=u':/slides/slide_blank.png', triggers=self.onReplaceClick)
- self.resetAction = self.toolbar.addToolbarAction(u'resetAction',
+ self.resetAction = self.toolbar.add_toolbar_action(u'resetAction',
icon=u':/system/system_close.png', visible=False, triggers=self.onResetClick)
def onDeleteClick(self):
@@ -105,7 +105,7 @@
if text:
delete_file(os.path.join(self.servicePath, text.text()))
self.listView.takeItem(row)
- self.main_window.incrementProgressBar()
+ self.main_window.increment_progress_bar()
Settings.setValue(self.settingsSection + u'/images files', self.getFileList())
self.main_window.finishedProgressBar()
self.application.set_normal_cursor()
@@ -134,7 +134,7 @@
item_name.setData(QtCore.Qt.UserRole, imageFile)
self.listView.addItem(item_name)
if not initialLoad:
- self.main_window.incrementProgressBar()
+ self.main_window.increment_progress_bar()
if not initialLoad:
self.main_window.finishedProgressBar()
self.application.set_normal_cursor()
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2013-03-06 17:46:19 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2013-03-07 18:01:28 +0000
@@ -53,14 +53,14 @@
"""
log.info(u'%s MediaMediaItem loaded', __name__)
- def __init__(self, parent, plugin, icon):
+ def __init__(self, parent, plugin):
self.iconPath = u'images/image'
self.background = False
self.automatic = u''
- MediaManagerItem.__init__(self, parent, plugin, icon)
+ MediaManagerItem.__init__(self, parent, plugin)
self.singleServiceItem = False
self.hasSearch = True
- self.mediaObject = None
+ self.media_object = None
self.display_controller = DisplayController(parent)
self.display_controller.controller_layout = QtGui.QVBoxLayout()
self.media_controller.register_controller(self.display_controller)
@@ -99,9 +99,9 @@
def addEndHeaderBar(self):
# Replace backgrounds do not work at present so remove functionality.
- self.replaceAction = self.toolbar.addToolbarAction(u'replaceAction', icon=u':/slides/slide_blank.png',
+ self.replaceAction = self.toolbar.add_toolbar_action(u'replaceAction', icon=u':/slides/slide_blank.png',
triggers=self.onReplaceClick)
- self.resetAction = self.toolbar.addToolbarAction(u'resetAction', icon=u':/system/system_close.png',
+ self.resetAction = self.toolbar.add_toolbar_action(u'resetAction', icon=u':/system/system_close.png',
visible=False, triggers=self.onResetClick)
self.mediaWidget = QtGui.QWidget(self)
self.mediaWidget.setObjectName(u'mediaWidget')
@@ -115,8 +115,7 @@
self.displayLayout.addRow(self.displayTypeLabel, self.displayTypeComboBox)
# Add the Media widget to the page layout
self.pageLayout.addWidget(self.mediaWidget)
- QtCore.QObject.connect(self.displayTypeComboBox, QtCore.SIGNAL(u'currentIndexChanged (int)'),
- self.overridePlayerChanged)
+ self.displayTypeComboBox.currentIndexChanged.connect(self.overridePlayerChanged)
def overridePlayerChanged(self, index):
player = get_media_players()[0]
@@ -152,8 +151,7 @@
service_item.shortname = service_item.title
(path, name) = os.path.split(filename)
service_item.add_from_command(path, name,CLAPPERBOARD)
- if self.media_controller.video(DisplayControllerType.Live, service_item,
- videoBehindText=True):
+ if self.media_controller.video(DisplayControllerType.Live, service_item, video_behind_text=True):
self.resetAction.setVisible(True)
else:
critical_error_message_box(UiStrings().LiveBGError,
@@ -214,7 +212,7 @@
u' '.join(self.media_controller.audio_extensions_list), UiStrings().AllFiles)
def display_setup(self):
- self.media_controller.setup_display(self.display_controller.previewDisplay, False)
+ self.media_controller.setup_display(self.display_controller.preview_display, False)
def populateDisplayTypes(self):
"""
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2013-03-07 18:01:28 +0000
@@ -56,7 +56,7 @@
self.controllers = controllers
self.IconPath = u'presentations/presentation'
self.Automatic = u''
- MediaManagerItem.__init__(self, parent, plugin, icon)
+ MediaManagerItem.__init__(self, parent, plugin)
self.message_listener = MessageListener(self)
self.hasSearch = True
self.singleServiceItem = False
@@ -157,7 +157,7 @@
key=lambda filename: os.path.split(unicode(filename))[1])
for file in files:
if not initialLoad:
- self.main_window.incrementProgressBar()
+ self.main_window.increment_progress_bar()
if currlist.count(file) > 0:
continue
filename = os.path.split(unicode(file))[1]
@@ -224,7 +224,7 @@
doc = self.controllers[cidx].add_document(filepath)
doc.presentation_deleted()
doc.close_presentation()
- self.main_window.incrementProgressBar()
+ self.main_window.increment_progress_bar()
self.main_window.finishedProgressBar()
self.application.set_busy_cursor()
for row in row_list:
=== modified file 'openlp/plugins/presentations/lib/messagelistener.py'
--- openlp/plugins/presentations/lib/messagelistener.py 2013-02-07 08:42:17 +0000
+++ openlp/plugins/presentations/lib/messagelistener.py 2013-03-07 18:01:28 +0000
@@ -306,7 +306,7 @@
Registry().register_function(u'presentations_unblank', self.unblank)
self.timer = QtCore.QTimer()
self.timer.setInterval(500)
- QtCore.QObject.connect(self.timer, QtCore.SIGNAL(u'timeout()'), self.timeout)
+ self.timer.timeout.connect(self.timeout)
def startup(self, message):
"""
=== modified file 'openlp/plugins/songs/forms/authorsform.py'
--- openlp/plugins/songs/forms/authorsform.py 2013-01-05 22:17:30 +0000
+++ openlp/plugins/songs/forms/authorsform.py 2013-03-07 18:01:28 +0000
@@ -44,10 +44,8 @@
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self._autoDisplayName = False
- QtCore.QObject.connect(self.firstNameEdit, QtCore.SIGNAL(u'textEdited(QString)'),
- self.onFirstNameEditTextEdited)
- QtCore.QObject.connect(self.lastNameEdit, QtCore.SIGNAL(u'textEdited(QString)'),
- self.onLastNameEditTextEdited)
+ self.firstNameEdit.textEdited.connect(self.onFirstNameEditTextEdited)
+ self.lastNameEdit.textEdited.connect(self.onLastNameEditTextEdited)
def exec_(self, clear=True):
if clear:
=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py 2013-02-05 08:05:28 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py 2013-03-07 18:01:28 +0000
@@ -50,19 +50,19 @@
self.lyricsTab.setObjectName(u'lyricsTab')
self.lyricsTabLayout = QtGui.QGridLayout(self.lyricsTab)
self.lyricsTabLayout.setObjectName(u'lyricsTabLayout')
- self.titleLabel = QtGui.QLabel(self.lyricsTab)
- self.titleLabel.setObjectName(u'titleLabel')
- self.lyricsTabLayout.addWidget(self.titleLabel, 0, 0)
+ self.title_label = QtGui.QLabel(self.lyricsTab)
+ self.title_label.setObjectName(u'title_label')
+ self.lyricsTabLayout.addWidget(self.title_label, 0, 0)
self.titleEdit = QtGui.QLineEdit(self.lyricsTab)
self.titleEdit.setObjectName(u'titleEdit')
- self.titleLabel.setBuddy(self.titleEdit)
+ self.title_label.setBuddy(self.titleEdit)
self.lyricsTabLayout.addWidget(self.titleEdit, 0, 1, 1, 2)
- self.alternativeTitleLabel = QtGui.QLabel(self.lyricsTab)
- self.alternativeTitleLabel.setObjectName(u'alternativeTitleLabel')
- self.lyricsTabLayout.addWidget(self.alternativeTitleLabel, 1, 0)
+ self.alternative_title_label = QtGui.QLabel(self.lyricsTab)
+ self.alternative_title_label.setObjectName(u'alternative_title_label')
+ self.lyricsTabLayout.addWidget(self.alternative_title_label, 1, 0)
self.alternativeEdit = QtGui.QLineEdit(self.lyricsTab)
self.alternativeEdit.setObjectName(u'alternativeEdit')
- self.alternativeTitleLabel.setBuddy(self.alternativeEdit)
+ self.alternative_title_label.setBuddy(self.alternativeEdit)
self.lyricsTabLayout.addWidget(self.alternativeEdit, 1, 1, 1, 2)
self.lyricsLabel = QtGui.QLabel(self.lyricsTab)
self.lyricsLabel.setFixedHeight(self.titleEdit.sizeHint().height())
@@ -279,8 +279,8 @@
def retranslateUi(self, editSongDialog):
editSongDialog.setWindowTitle(translate('SongsPlugin.EditSongForm', 'Song Editor'))
- self.titleLabel.setText(translate('SongsPlugin.EditSongForm', '&Title:'))
- self.alternativeTitleLabel.setText(translate('SongsPlugin.EditSongForm', 'Alt&ernate title:'))
+ self.title_label.setText(translate('SongsPlugin.EditSongForm', '&Title:'))
+ self.alternative_title_label.setText(translate('SongsPlugin.EditSongForm', 'Alt&ernate title:'))
self.lyricsLabel.setText(translate('SongsPlugin.EditSongForm', '&Lyrics:'))
self.verseOrderLabel.setText(translate('SongsPlugin.EditSongForm', '&Verse order:'))
self.verseAddButton.setText(UiStrings().Add)
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2013-03-04 20:58:28 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2013-03-07 18:01:28 +0000
@@ -68,41 +68,32 @@
self.width = 400
self.setupUi(self)
# Connecting signals and slots
- QtCore.QObject.connect(self.authorAddButton, QtCore.SIGNAL(u'clicked()'), self.onAuthorAddButtonClicked)
- QtCore.QObject.connect(self.authorRemoveButton, QtCore.SIGNAL(u'clicked()'), self.onAuthorRemoveButtonClicked)
- QtCore.QObject.connect(self.authorsListView, QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
- self.onAuthorsListViewClicked)
- QtCore.QObject.connect(self.topicAddButton, QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked)
- QtCore.QObject.connect(self.topicRemoveButton, QtCore.SIGNAL(u'clicked()'), self.onTopicRemoveButtonClicked)
- QtCore.QObject.connect(self.topicsListView, QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
- self.onTopicListViewClicked)
- QtCore.QObject.connect(self.copyrightInsertButton, QtCore.SIGNAL(u'clicked()'),
- self.onCopyrightInsertButtonTriggered)
- QtCore.QObject.connect(self.verseAddButton, QtCore.SIGNAL(u'clicked()'), self.onVerseAddButtonClicked)
- QtCore.QObject.connect(self.verseListWidget, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
- self.onVerseEditButtonClicked)
- QtCore.QObject.connect(self.verseEditButton, QtCore.SIGNAL(u'clicked()'), self.onVerseEditButtonClicked)
- QtCore.QObject.connect(self.verseEditAllButton, QtCore.SIGNAL(u'clicked()'), self.onVerseEditAllButtonClicked)
- QtCore.QObject.connect(self.verseDeleteButton, QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked)
- QtCore.QObject.connect(self.verseListWidget, QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'),
- self.onVerseListViewClicked)
- QtCore.QObject.connect(self.verseOrderEdit, QtCore.SIGNAL(u'textChanged(QString)'),
- self.onVerseOrderTextChanged)
- QtCore.QObject.connect(self.themeAddButton, QtCore.SIGNAL(u'clicked()'), self.theme_manager.onAddTheme)
- QtCore.QObject.connect(self.maintenanceButton, QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
- QtCore.QObject.connect(self.audioAddFromFileButton, QtCore.SIGNAL(u'clicked()'),
- self.onAudioAddFromFileButtonClicked)
- QtCore.QObject.connect(self.audioAddFromMediaButton, QtCore.SIGNAL(u'clicked()'),
- self.onAudioAddFromMediaButtonClicked)
- QtCore.QObject.connect(self.audioRemoveButton, QtCore.SIGNAL(u'clicked()'), self.onAudioRemoveButtonClicked)
- QtCore.QObject.connect(self.audioRemoveAllButton, QtCore.SIGNAL(u'clicked()'),
- self.onAudioRemoveAllButtonClicked)
+ self.authorAddButton.clicked.connect(self.onAuthorAddButtonClicked)
+ self.authorRemoveButton.clicked.connect(self.onAuthorRemoveButtonClicked)
+ self.authorsListView.itemClicked.connect(self.onAuthorsListViewClicked)
+ self.topicAddButton.clicked.connect(self.onTopicAddButtonClicked)
+ self.topicRemoveButton.clicked.connect(self.onTopicRemoveButtonClicked)
+ self.topicsListView.itemClicked.connect(self.onTopicListViewClicked)
+ self.copyrightInsertButton.clicked.connect(self.onCopyrightInsertButtonTriggered)
+ self.verseAddButton.clicked.connect(self.onVerseAddButtonClicked)
+ self.verseListWidget.doubleClicked.connect(self.onVerseEditButtonClicked)
+ self.verseEditButton.clicked.connect(self.onVerseEditButtonClicked)
+ self.verseEditAllButton.clicked.connect(self.onVerseEditAllButtonClicked)
+ self.verseDeleteButton.clicked.connect(self.onVerseDeleteButtonClicked)
+ self.verseListWidget.itemClicked.connect(self.onVerseListViewClicked)
+ self.verseOrderEdit.textChanged.connect(self.onVerseOrderTextChanged)
+ self.themeAddButton.clicked.connect(self.theme_manager.onAddTheme)
+ self.maintenanceButton.clicked.connect(self.onMaintenanceButtonClicked)
+ self.audioAddFromFileButton.clicked.connect(self.onAudioAddFromFileButtonClicked)
+ self.audioAddFromMediaButton.clicked.connect(self.onAudioAddFromMediaButtonClicked)
+ self.audioRemoveButton.clicked.connect(self.onAudioRemoveButtonClicked)
+ self.audioRemoveAllButton.clicked.connect(self.onAudioRemoveAllButtonClicked)
Registry().register_function(u'theme_update_list', self.load_themes)
self.previewButton = QtGui.QPushButton()
self.previewButton.setObjectName(u'previewButton')
self.previewButton.setText(UiStrings().SaveAndPreview)
self.button_box.addButton(self.previewButton, QtGui.QDialogButtonBox.ActionRole)
- QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
+ self.button_box.clicked.connect(self.onPreview)
# Create other objects and forms
self.manager = manager
self.verseForm = EditVerseForm(self)
=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py 2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/forms/editverseform.py 2013-03-07 18:01:28 +0000
@@ -50,14 +50,11 @@
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
- QtCore.QObject.connect(self.verseTextEdit, QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
- self.contextMenu)
- QtCore.QObject.connect(self.insertButton, QtCore.SIGNAL(u'clicked()'), self.onInsertButtonClicked)
- QtCore.QObject.connect(self.splitButton, QtCore.SIGNAL(u'clicked()'), self.onSplitButtonClicked)
- QtCore.QObject.connect(self.verseTextEdit, QtCore.SIGNAL(u'cursorPositionChanged()'),
- self.onCursorPositionChanged)
- QtCore.QObject.connect(self.verseTypeComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'),
- self.onVerseTypeComboBoxChanged)
+ self.verseTextEdit.customContextMenuRequested.connect(self.contextMenu)
+ self.insertButton.clicked.connect(self.onInsertButtonClicked)
+ self.splitButton.clicked.connect(self.onSplitButtonClicked)
+ self.verseTextEdit.cursorPositionChanged.connect(self.onCursorPositionChanged)
+ self.verseTypeComboBox.currentIndexChanged.connect(self.onVerseTypeComboBoxChanged)
def contextMenu(self, point):
item = self.serviceManagerList.itemAt(point)
=== modified file 'openlp/plugins/songs/forms/songexportform.py'
--- openlp/plugins/songs/forms/songexportform.py 2013-02-07 08:42:17 +0000
+++ openlp/plugins/songs/forms/songexportform.py 2013-03-07 18:01:28 +0000
@@ -87,13 +87,11 @@
"""
Song wizard specific signals.
"""
- QtCore.QObject.connect(self.availableListWidget, QtCore.SIGNAL(u'itemActivated(QListWidgetItem*)'),
- self.onItemActivated)
- QtCore.QObject.connect(self.searchLineEdit, QtCore.SIGNAL(u'textEdited(const QString&)'),
- self.onSearchLineEditChanged)
- QtCore.QObject.connect(self.uncheckButton, QtCore.SIGNAL(u'clicked()'), self.onUncheckButtonClicked)
- QtCore.QObject.connect(self.checkButton, QtCore.SIGNAL(u'clicked()'), self.onCheckButtonClicked)
- QtCore.QObject.connect(self.directoryButton, QtCore.SIGNAL(u'clicked()'), self.onDirectoryButtonClicked)
+ self.availableListWidget.itemActivated.connect(self.onItemActivated)
+ self.searchLineEdit.textEdited.connect(self.onSearchLineEditChanged)
+ self.uncheckButton.clicked.connect(self.onUncheckButtonClicked)
+ self.checkButton.clicked.connect(self.onCheckButtonClicked)
+ self.directoryButton.clicked.connect(self.onDirectoryButtonClicked)
def addCustomPages(self):
"""
@@ -117,8 +115,8 @@
self.searchLineEdit = QtGui.QLineEdit(self.availableSongsPage)
self.searchLineEdit.setObjectName(u'searchLineEdit')
self.horizontalLayout.addWidget(self.searchLineEdit)
- spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.horizontalLayout.addItem(spacerItem)
+ spacer_item = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.horizontalLayout.addItem(spacer_item)
self.uncheckButton = QtGui.QPushButton(self.availableSongsPage)
self.uncheckButton.setObjectName(u'uncheckButton')
self.horizontalLayout.addWidget(self.uncheckButton)
@@ -138,6 +136,7 @@
self.selectedListWidget = QtGui.QListWidget(self.exportSongPage)
self.selectedListWidget.setObjectName(u'selectedListWidget')
self.gridLayout.addWidget(self.selectedListWidget, 1, 0, 1, 1)
+ # FIXME: self.horizontalLayout is already defined above?!?!?
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(u'horizontalLayout')
self.directoryLabel = QtGui.QLabel(self.exportSongPage)
@@ -159,9 +158,9 @@
Song wizard localisation.
"""
self.setWindowTitle(translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard'))
- self.titleLabel.setText(WizardStrings.HeaderStyle %
+ self.title_label.setText(WizardStrings.HeaderStyle %
translate('OpenLP.Ui', 'Welcome to the Song Export Wizard'))
- self.informationLabel.setText(translate('SongsPlugin.ExportWizardForm', 'This wizard will help to'
+ self.information_label.setText(translate('SongsPlugin.ExportWizardForm', 'This wizard will help to'
' export your songs to the open and free <strong>OpenLyrics </strong> worship song format.'))
self.availableSongsPage.setTitle(translate('SongsPlugin.ExportWizardForm', 'Select Songs'))
self.availableSongsPage.setSubTitle(translate('SongsPlugin.ExportWizardForm',
@@ -173,17 +172,17 @@
self.exportSongPage.setSubTitle(translate('SongsPlugin.ExportWizardForm',
'Select the directory where you want the songs to be saved.'))
self.directoryLabel.setText(translate('SongsPlugin.ExportWizardForm', 'Directory:'))
- self.progressPage.setTitle(translate('SongsPlugin.ExportWizardForm', 'Exporting'))
- self.progressPage.setSubTitle(translate('SongsPlugin.ExportWizardForm',
+ self.progress_page.setTitle(translate('SongsPlugin.ExportWizardForm', 'Exporting'))
+ self.progress_page.setSubTitle(translate('SongsPlugin.ExportWizardForm',
'Please wait while your songs are exported.'))
- self.progressLabel.setText(WizardStrings.Ready)
- self.progressBar.setFormat(WizardStrings.PercentSymbolFormat)
+ self.progress_label.setText(WizardStrings.Ready)
+ self.progress_bar.setFormat(WizardStrings.PercentSymbolFormat)
def validateCurrentPage(self):
"""
Validate the current page before moving on to the next page.
"""
- if self.currentPage() == self.welcomePage:
+ if self.currentPage() == self.welcome_page:
return True
elif self.currentPage() == self.availableSongsPage:
items = [
@@ -209,7 +208,7 @@
translate('SongsPlugin.ExportWizardForm', 'You need to specify a directory.'))
return False
return True
- elif self.currentPage() == self.progressPage:
+ elif self.currentPage() == self.progress_page:
self.availableListWidget.clear()
self.selectedListWidget.clear()
return True
@@ -219,8 +218,8 @@
Set default form values for the song export wizard.
"""
self.restart()
- self.finishButton.setVisible(False)
- self.cancelButton.setVisible(True)
+ self.finish_button.setVisible(False)
+ self.cancel_button.setVisible(True)
self.availableListWidget.clear()
self.selectedListWidget.clear()
self.directoryLineEdit.clear()
@@ -246,8 +245,8 @@
"""
Perform pre export tasks.
"""
- OpenLPWizard.preWizard(self)
- self.progressLabel.setText(translate('SongsPlugin.ExportWizardForm', 'Starting export...'))
+ OpenLPWizard.pre_wizard(self)
+ self.progress_label.setText(translate('SongsPlugin.ExportWizardForm', 'Starting export...'))
self.application.process_events()
def performWizard(self):
@@ -261,10 +260,10 @@
]
exporter = OpenLyricsExport(self, songs, self.directoryLineEdit.text())
if exporter.do_export():
- self.progressLabel.setText(translate('SongsPlugin.SongExportForm',
+ self.progress_label.setText(translate('SongsPlugin.SongExportForm',
'Finished export. To import these files use the <strong>OpenLyrics</strong> importer.'))
else:
- self.progressLabel.setText(translate('SongsPlugin.SongExportForm', 'Your song export failed.'))
+ self.progress_label.setText(translate('SongsPlugin.SongExportForm', 'Your song export failed.'))
def _findListWidgetItems(self, listWidget, text=u''):
"""
@@ -331,5 +330,5 @@
Called when the *directoryButton* was clicked. Opens a dialog and writes
the path to *directoryLineEdit*.
"""
- self.getFolder(translate('SongsPlugin.ExportWizardForm', 'Select Destination Folder'),
+ self.get_folder(translate('SongsPlugin.ExportWizardForm', 'Select Destination Folder'),
self.directoryLineEdit, u'last directory export')
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py 2013-02-28 11:25:05 +0000
+++ openlp/plugins/songs/forms/songimportform.py 2013-03-07 18:01:28 +0000
@@ -67,20 +67,19 @@
"""
Set up the song wizard UI.
"""
- self.formatWidgets = dict([(format, {}) for format in SongFormat.get_format_list()])
+ self.format_widgets = dict([(format, {}) for format in SongFormat.get_format_list()])
OpenLPWizard.setupUi(self, image)
- self.currentFormat = SongFormat.OpenLyrics
- self.formatStack.setCurrentIndex(self.currentFormat)
- QtCore.QObject.connect(self.formatComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'),
- self.onCurrentIndexChanged)
+ self.current_format = SongFormat.OpenLyrics
+ self.format_stack.setCurrentIndex(self.current_format)
+ self.format_combo_box.currentIndexChanged.connect(self.onCurrentIndexChanged)
def onCurrentIndexChanged(self, index):
"""
Called when the format combo box's index changed.
"""
- self.currentFormat = index
- self.formatStack.setCurrentIndex(index)
- self.sourcePage.emit(QtCore.SIGNAL(u'completeChanged()'))
+ self.current_format = index
+ self.format_stack.setCurrentIndex(index)
+ self.source_page.emit(QtCore.SIGNAL(u'completeChanged()'))
def customInit(self):
"""
@@ -88,8 +87,8 @@
"""
for format in SongFormat.get_format_list():
if not SongFormat.get(format, u'availability'):
- self.formatWidgets[format][u'disabledWidget'].setVisible(True)
- self.formatWidgets[format][u'importWidget'].setVisible(False)
+ self.format_widgets[format][u'disabled_widget'].setVisible(True)
+ self.format_widgets[format][u'import_widget'].setVisible(False)
def customSignals(self):
"""
@@ -98,94 +97,90 @@
for format in SongFormat.get_format_list():
select_mode = SongFormat.get(format, u'selectMode')
if select_mode == SongFormatSelect.MultipleFiles:
- QtCore.QObject.connect(self.formatWidgets[format][u'addButton'],
- QtCore.SIGNAL(u'clicked()'), self.onAddButtonClicked)
- QtCore.QObject.connect(self.formatWidgets[format][u'removeButton'],
- QtCore.SIGNAL(u'clicked()'), self.onRemoveButtonClicked)
+ self.format_widgets[format][u'addButton'].clicked.connect(self.on_add_button_clicked)
+ self.format_widgets[format][u'removeButton'].clicked.connect(self.onRemoveButtonClicked)
else:
- QtCore.QObject.connect(self.formatWidgets[format][u'browseButton'],
- QtCore.SIGNAL(u'clicked()'), self.onBrowseButtonClicked)
- QtCore.QObject.connect(self.formatWidgets[format][u'filepathEdit'],
- QtCore.SIGNAL(u'textChanged (const QString&)'), self.onFilepathEditTextChanged)
+ self.format_widgets[format][u'browseButton'].clicked.connect(self.on_browse_button_clicked)
+ self.format_widgets[format][u'file_path_edit'].textChanged.connect(self.onFilepathEditTextChanged)
def addCustomPages(self):
"""
Add song wizard specific pages.
"""
# Source Page
- self.sourcePage = SongImportSourcePage()
- self.sourcePage.setObjectName(u'SourcePage')
- self.sourceLayout = QtGui.QVBoxLayout(self.sourcePage)
- self.sourceLayout.setObjectName(u'SourceLayout')
- self.formatLayout = QtGui.QFormLayout()
- self.formatLayout.setObjectName(u'FormatLayout')
- self.formatLabel = QtGui.QLabel(self.sourcePage)
- self.formatLabel.setObjectName(u'FormatLabel')
- self.formatComboBox = QtGui.QComboBox(self.sourcePage)
- self.formatComboBox.setObjectName(u'FormatComboBox')
- self.formatLayout.addRow(self.formatLabel, self.formatComboBox)
- self.formatSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
- self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.formatSpacer)
- self.sourceLayout.addLayout(self.formatLayout)
- self.formatHSpacing = self.formatLayout.horizontalSpacing()
- self.formatVSpacing = self.formatLayout.verticalSpacing()
- self.formatLayout.setVerticalSpacing(0)
- self.stackSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
- self.formatStack = QtGui.QStackedLayout()
- self.formatStack.setObjectName(u'FormatStack')
- self.disablableFormats = []
- for self.currentFormat in SongFormat.get_format_list():
+ self.source_page = SongImportSourcePage()
+ self.source_page.setObjectName(u'source_page')
+ self.source_layout = QtGui.QVBoxLayout(self.source_page)
+ self.source_layout.setObjectName(u'source_layout')
+ self.format_layout = QtGui.QFormLayout()
+ self.format_layout.setObjectName(u'format_layout')
+ self.format_label = QtGui.QLabel(self.source_page)
+ self.format_label.setObjectName(u'format_label')
+ self.format_combo_box = QtGui.QComboBox(self.source_page)
+ self.format_combo_box.setObjectName(u'format_combo_box')
+ self.format_layout.addRow(self.format_label, self.format_combo_box)
+ self.format_spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
+ self.format_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.format_spacer)
+ self.source_layout.addLayout(self.format_layout)
+ self.format_h_spacing = self.format_layout.horizontalSpacing()
+ self.format_v_spacing = self.format_layout.verticalSpacing()
+ self.format_layout.setVerticalSpacing(0)
+ self.stack_spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
+ self.format_stack = QtGui.QStackedLayout()
+ self.format_stack.setObjectName(u'format_stack')
+ self.disablable_formats = []
+ for self.current_format in SongFormat.get_format_list():
self.addFileSelectItem()
- self.sourceLayout.addLayout(self.formatStack)
- self.addPage(self.sourcePage)
+ self.source_layout.addLayout(self.format_stack)
+ self.addPage(self.source_page)
def retranslateUi(self):
"""
Song wizard localisation.
"""
self.setWindowTitle(translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard'))
- self.titleLabel.setText(WizardStrings.HeaderStyle % translate('OpenLP.Ui', 'Welcome to the Song Import Wizard'))
- self.informationLabel.setText(translate('SongsPlugin.ImportWizardForm',
+ self.title_label.setText(WizardStrings.HeaderStyle % translate('OpenLP.Ui', 'Welcome to the Song Import Wizard'))
+ self.information_label.setText(translate('SongsPlugin.ImportWizardForm',
'This wizard will help you to import songs from a variety of '
'formats. Click the next button below to start the process by selecting a format to import from.'))
- self.sourcePage.setTitle(WizardStrings.ImportSelect)
- self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)
- self.formatLabel.setText(WizardStrings.FormatLabel)
+ self.source_page.setTitle(WizardStrings.ImportSelect)
+ self.source_page.setSubTitle(WizardStrings.ImportSelectLong)
+ self.format_label.setText(WizardStrings.FormatLabel)
for format in SongFormat.get_format_list():
format_name, custom_combo_text, description_text, select_mode = \
SongFormat.get(format, u'name', u'comboBoxText', u'descriptionText', u'selectMode')
combo_box_text = (custom_combo_text if custom_combo_text else format_name)
- self.formatComboBox.setItemText(format, combo_box_text)
+ self.format_combo_box.setItemText(format, combo_box_text)
if description_text is not None:
- self.formatWidgets[format][u'descriptionLabel'].setText(description_text)
+ self.format_widgets[format][u'description_label'].setText(description_text)
if select_mode == SongFormatSelect.MultipleFiles:
- self.formatWidgets[format][u'addButton'].setText(
+ self.format_widgets[format][u'addButton'].setText(
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
- self.formatWidgets[format][u'removeButton'].setText(
+ self.format_widgets[format][u'removeButton'].setText(
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
else:
- self.formatWidgets[format][u'browseButton'].setText(UiStrings().Browse)
+ self.format_widgets[format][u'browseButton'].setText(UiStrings().Browse)
f_label = 'Filename:'
if select_mode == SongFormatSelect.SingleFolder:
f_label = 'Folder:'
- self.formatWidgets[format][u'filepathLabel'].setText(translate('SongsPlugin.ImportWizardForm', f_label))
- for format in self.disablableFormats:
- self.formatWidgets[format][u'disabledLabel'].setText(SongFormat.get(format, u'disabledLabelText'))
- self.progressPage.setTitle(WizardStrings.Importing)
- self.progressPage.setSubTitle(
+ self.format_widgets[format][u'filepathLabel'].setText(translate('SongsPlugin.ImportWizardForm', f_label))
+ for format in self.disablable_formats:
+ self.format_widgets[format][u'disabled_label'].setText(SongFormat.get(format, u'disabledLabelText'))
+ self.progress_page.setTitle(WizardStrings.Importing)
+ self.progress_page.setSubTitle(
translate('SongsPlugin.ImportWizardForm', 'Please wait while your songs are imported.'))
- self.progressLabel.setText(WizardStrings.Ready)
- self.progressBar.setFormat(WizardStrings.PercentSymbolFormat)
- self.errorCopyToButton.setText(translate('SongsPlugin.ImportWizardForm', 'Copy'))
- self.errorSaveToButton.setText(translate('SongsPlugin.ImportWizardForm', 'Save to File'))
+ self.progress_label.setText(WizardStrings.Ready)
+ self.progress_bar.setFormat(WizardStrings.PercentSymbolFormat)
+ self.error_copy_to_button.setText(translate('SongsPlugin.ImportWizardForm', 'Copy'))
+ self.error_save_to_button.setText(translate('SongsPlugin.ImportWizardForm', 'Save to File'))
# Align all QFormLayouts towards each other.
- formats = filter(lambda f: u'filepathLabel' in self.formatWidgets[f], SongFormat.get_format_list())
- labels = [self.formatWidgets[f][u'filepathLabel'] for f in formats]
+ formats = filter(lambda f: u'filepathLabel' in self.format_widgets[f], SongFormat.get_format_list())
+ labels = [self.format_widgets[f][u'filepathLabel'] for f in formats]
# Get max width of all labels
- max_label_width = max(self.formatLabel.minimumSizeHint().width(),
+ max_label_width = max(self.format_label.minimumSizeHint().width(),
max([label.minimumSizeHint().width() for label in labels]))
- self.formatSpacer.changeSize(max_label_width, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
- spacers = [self.formatWidgets[f][u'filepathSpacer'] for f in formats]
+ self.format_spacer.changeSize(max_label_width, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ spacers = [self.format_widgets[f][u'filepathSpacer'] for f in formats]
for index, spacer in enumerate(spacers):
spacer.changeSize(
max_label_width - labels[index].minimumSizeHint().width(), 0,
@@ -193,45 +188,44 @@
# Align descriptionLabels with rest of layout
for format in SongFormat.get_format_list():
if SongFormat.get(format, u'descriptionText') is not None:
- self.formatWidgets[format][u'descriptionSpacer'].changeSize(
- max_label_width + self.formatHSpacing, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ self.format_widgets[format][u'descriptionSpacer'].changeSize(
+ max_label_width + self.format_h_spacing, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
- def customPageChanged(self, pageId):
+ def custom_page_changed(self, page_id):
"""
Called when changing to a page other than the progress page.
"""
- if self.page(pageId) == self.sourcePage:
- self.onCurrentIndexChanged(self.formatStack.currentIndex())
+ if self.page(page_id) == self.source_page:
+ self.onCurrentIndexChanged(self.format_stack.currentIndex())
def validateCurrentPage(self):
"""
- Validate the current page before moving on to the next page.
- Provide each song format class with a chance to validate its input by
- overriding isValidSource().
+ Re-implement te validateCurrentPage() method. Validate the current page before moving on to the next page.
+ Provide each song format class with a chance to validate its input by overriding isValidSource().
"""
- if self.currentPage() == self.welcomePage:
+ if self.currentPage() == self.welcome_page:
return True
- elif self.currentPage() == self.sourcePage:
- this_format = self.currentFormat
+ elif self.currentPage() == self.source_page:
+ this_format = self.current_format
Settings().setValue(u'songs/last import type', this_format)
select_mode, class_, error_msg = SongFormat.get(this_format, u'selectMode', u'class', u'invalidSourceMsg')
if select_mode == SongFormatSelect.MultipleFiles:
- import_source = self.getListOfFiles(self.formatWidgets[this_format][u'fileListWidget'])
+ import_source = self.get_list_of_files(self.format_widgets[this_format][u'fileListWidget'])
error_title = UiStrings().IFSp
- focus_button = self.formatWidgets[this_format][u'addButton']
+ focus_button = self.format_widgets[this_format][u'addButton']
else:
- import_source = self.formatWidgets[this_format][u'filepathEdit'].text()
+ import_source = self.format_widgets[this_format][u'file_path_edit'].text()
error_title = (UiStrings().IFSs if select_mode == SongFormatSelect.SingleFile else UiStrings().IFdSs)
- focus_button = self.formatWidgets[this_format][u'browseButton']
+ focus_button = self.format_widgets[this_format][u'browseButton']
if not class_.isValidSource(import_source):
critical_error_message_box(error_title, error_msg)
focus_button.setFocus()
return False
return True
- elif self.currentPage() == self.progressPage:
+ elif self.currentPage() == self.progress_page:
return True
- def getFiles(self, title, listbox, filters=u''):
+ def get_files(self, title, listbox, filters=u''):
"""
Opens a QFileDialog and writes the filenames to the given listbox.
@@ -257,88 +251,86 @@
Settings().setValue(self.plugin.settingsSection + u'/last directory import',
os.path.split(unicode(filenames[0]))[0])
- def getListOfFiles(self, listbox):
+ def get_list_of_files(self, listbox):
"""
Return a list of file from the listbox
"""
return [listbox.item(i).text() for i in range(listbox.count())]
- def removeSelectedItems(self, listbox):
- """
- Remove selected listbox items
- """
- for item in listbox.selectedItems():
- item = listbox.takeItem(listbox.row(item))
+ def remove_selected_items(self, list_box):
+ """
+ Remove selected list_box items
+ """
+ for item in list_box.selectedItems():
+ item = list_box.takeItem(list_box.row(item))
del item
- def onBrowseButtonClicked(self):
+ def on_browse_button_clicked(self):
"""
Browse for files or a directory.
"""
- this_format = self.currentFormat
- select_mode, format_name, ext_filter = SongFormat.get(this_format, u'selectMode',
- u'name', u'filter')
- filepathEdit = self.formatWidgets[this_format][u'filepathEdit']
+ this_format = self.current_format
+ select_mode, format_name, ext_filter = SongFormat.get(this_format, u'selectMode', u'name', u'filter')
+ file_path_edit = self.format_widgets[this_format][u'file_path_edit']
if select_mode == SongFormatSelect.SingleFile:
- self.getFileName(WizardStrings.OpenTypeFile % format_name, filepathEdit,
- u'last directory import', ext_filter)
+ self.get_file_name(
+ WizardStrings.OpenTypeFile % format_name, file_path_edit, u'last directory import', ext_filter)
elif select_mode == SongFormatSelect.SingleFolder:
- self.getFolder(WizardStrings.OpenTypeFolder % format_name, filepathEdit, u'last directory import')
+ self.get_folder(WizardStrings.OpenTypeFolder % format_name, file_path_edit, u'last directory import')
- def onAddButtonClicked(self):
+ def on_add_button_clicked(self):
"""
Add a file or directory.
"""
- this_format = self.currentFormat
+ this_format = self.current_format
select_mode, format_name, ext_filter, custom_title = \
SongFormat.get(this_format, u'selectMode', u'name', u'filter', u'getFilesTitle')
title = custom_title if custom_title else WizardStrings.OpenTypeFile % format_name
if select_mode == SongFormatSelect.MultipleFiles:
- self.getFiles(title, self.formatWidgets[this_format][u'fileListWidget'], ext_filter)
- self.sourcePage.emit(QtCore.SIGNAL(u'completeChanged()'))
+ self.get_files(title, self.format_widgets[this_format][u'fileListWidget'], ext_filter)
+ self.source_page.emit(QtCore.SIGNAL(u'completeChanged()'))
def onRemoveButtonClicked(self):
"""
Remove a file from the list.
"""
- self.removeSelectedItems(
- self.formatWidgets[self.currentFormat][u'fileListWidget'])
- self.sourcePage.emit(QtCore.SIGNAL(u'completeChanged()'))
+ self.remove_selected_items(self.format_widgets[self.current_format][u'fileListWidget'])
+ self.source_page.emit(QtCore.SIGNAL(u'completeChanged()'))
def onFilepathEditTextChanged(self):
"""
Called when the content of the Filename/Folder edit box changes.
"""
- self.sourcePage.emit(QtCore.SIGNAL(u'completeChanged()'))
+ self.source_page.emit(QtCore.SIGNAL(u'completeChanged()'))
def setDefaults(self):
"""
Set default form values for the song import wizard.
"""
self.restart()
- self.finishButton.setVisible(False)
- self.cancelButton.setVisible(True)
+ self.finish_button.setVisible(False)
+ self.cancel_button.setVisible(True)
last_import_type = Settings().value(u'songs/last import type')
- if last_import_type < 0 or last_import_type >= self.formatComboBox.count():
+ if last_import_type < 0 or last_import_type >= self.format_combo_box.count():
last_import_type = 0
- self.formatComboBox.setCurrentIndex(last_import_type)
+ self.format_combo_box.setCurrentIndex(last_import_type)
for format in SongFormat.get_format_list():
select_mode = SongFormat.get(format, u'selectMode')
if select_mode == SongFormatSelect.MultipleFiles:
- self.formatWidgets[format][u'fileListWidget'].clear()
+ self.format_widgets[format][u'fileListWidget'].clear()
else:
- self.formatWidgets[format][u'filepathEdit'].setText(u'')
- self.errorReportTextEdit.clear()
- self.errorReportTextEdit.setHidden(True)
- self.errorCopyToButton.setHidden(True)
- self.errorSaveToButton.setHidden(True)
+ self.format_widgets[format][u'file_path_edit'].setText(u'')
+ self.error_report_text_edit.clear()
+ self.error_report_text_edit.setHidden(True)
+ self.error_copy_to_button.setHidden(True)
+ self.error_save_to_button.setHidden(True)
def preWizard(self):
"""
Perform pre import tasks
"""
- OpenLPWizard.preWizard(self)
- self.progressLabel.setText(WizardStrings.StartingImport)
+ OpenLPWizard.pre_wizard(self)
+ self.progress_label.setText(WizardStrings.StartingImport)
self.application.process_events()
def performWizard(self):
@@ -347,43 +339,43 @@
class, and then runs the ``doImport`` method of the importer to do
the actual importing.
"""
- source_format = self.currentFormat
+ source_format = self.current_format
select_mode = SongFormat.get(source_format, u'selectMode')
if select_mode == SongFormatSelect.SingleFile:
importer = self.plugin.importSongs(source_format,
- filename=self.formatWidgets[source_format][u'filepathEdit'].text())
+ filename=self.format_widgets[source_format][u'file_path_edit'].text())
elif select_mode == SongFormatSelect.SingleFolder:
importer = self.plugin.importSongs(source_format,
- folder=self.formatWidgets[source_format][u'filepathEdit'].text())
+ folder=self.format_widgets[source_format][u'file_path_edit'].text())
else:
importer = self.plugin.importSongs(source_format,
- filenames=self.getListOfFiles(self.formatWidgets[source_format][u'fileListWidget']))
+ filenames=self.get_list_of_files(self.format_widgets[source_format][u'fileListWidget']))
importer.doImport()
- self.progressLabel.setText(WizardStrings.FinishedImport)
+ self.progress_label.setText(WizardStrings.FinishedImport)
- def onErrorCopyToButtonClicked(self):
+ def on_error_copy_to_button_clicked(self):
"""
Copy the error report to the clipboard.
"""
- self.clipboard.setText(self.errorReportTextEdit.toPlainText())
+ self.clipboard.setText(self.error_report_text_edit.toPlainText())
- def onErrorSaveToButtonClicked(self):
+ def on_error_save_to_button_clicked(self):
"""
Save the error report to a file.
"""
filename = QtGui.QFileDialog.getSaveFileName(self,
- Settings().value(self.plugin.settingsSection + u'last directory import'))
+ Settings().value(self.plugin.settingsSection + u'/last directory import'))
if not filename:
return
report_file = codecs.open(filename, u'w', u'utf-8')
- report_file.write(self.errorReportTextEdit.toPlainText())
+ report_file.write(self.error_report_text_edit.toPlainText())
report_file.close()
def addFileSelectItem(self):
"""
Add a file selection page.
"""
- this_format = self.currentFormat
+ this_format = self.current_format
prefix, can_disable, description_text, select_mode = \
SongFormat.get(this_format, u'prefix', u'canDisable', u'descriptionText', u'selectMode')
page = QtGui.QWidget()
@@ -400,94 +392,94 @@
descriptionLayout.setObjectName(prefix + u'DescriptionLayout')
descriptionSpacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
descriptionLayout.addSpacerItem(descriptionSpacer)
- descriptionLabel = QtGui.QLabel(importWidget)
- descriptionLabel.setWordWrap(True)
- descriptionLabel.setOpenExternalLinks(True)
- descriptionLabel.setObjectName(prefix + u'DescriptionLabel')
- descriptionLayout.addWidget(descriptionLabel)
+ description_label = QtGui.QLabel(importWidget)
+ description_label.setWordWrap(True)
+ description_label.setOpenExternalLinks(True)
+ description_label.setObjectName(prefix + u'_description_label')
+ descriptionLayout.addWidget(description_label)
importLayout.addLayout(descriptionLayout)
- self.formatWidgets[this_format][u'descriptionLabel'] = descriptionLabel
- self.formatWidgets[this_format][u'descriptionSpacer'] = descriptionSpacer
+ self.format_widgets[this_format][u'description_label'] = description_label
+ self.format_widgets[this_format][u'descriptionSpacer'] = descriptionSpacer
if select_mode == SongFormatSelect.SingleFile or select_mode == SongFormatSelect.SingleFolder:
- filepathLayout = QtGui.QHBoxLayout()
- filepathLayout.setObjectName(prefix + u'FilepathLayout')
- filepathLayout.setContentsMargins(0, self.formatVSpacing, 0, 0)
+ file_path_layout = QtGui.QHBoxLayout()
+ file_path_layout.setObjectName(prefix + u'_file_path_layout')
+ file_path_layout.setContentsMargins(0, self.format_v_spacing, 0, 0)
filepathLabel = QtGui.QLabel(importWidget)
filepathLabel.setObjectName(prefix + u'FilepathLabel')
- filepathLayout.addWidget(filepathLabel)
+ file_path_layout.addWidget(filepathLabel)
filepathSpacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
- filepathLayout.addSpacerItem(filepathSpacer)
- filepathEdit = QtGui.QLineEdit(importWidget)
- filepathEdit.setObjectName(prefix + u'FilepathEdit')
- filepathLayout.addWidget(filepathEdit)
+ file_path_layout.addSpacerItem(filepathSpacer)
+ file_path_edit = QtGui.QLineEdit(importWidget)
+ file_path_edit.setObjectName(prefix + u'_file_path_edit')
+ file_path_layout.addWidget(file_path_edit)
browseButton = QtGui.QToolButton(importWidget)
- browseButton.setIcon(self.openIcon)
+ browseButton.setIcon(self.open_icon)
browseButton.setObjectName(prefix + u'BrowseButton')
- filepathLayout.addWidget(browseButton)
- importLayout.addLayout(filepathLayout)
- importLayout.addSpacerItem(self.stackSpacer)
- self.formatWidgets[this_format][u'filepathLabel'] = filepathLabel
- self.formatWidgets[this_format][u'filepathSpacer'] = filepathSpacer
- self.formatWidgets[this_format][u'filepathLayout'] = filepathLayout
- self.formatWidgets[this_format][u'filepathEdit'] = filepathEdit
- self.formatWidgets[this_format][u'browseButton'] = browseButton
+ file_path_layout.addWidget(browseButton)
+ importLayout.addLayout(file_path_layout)
+ importLayout.addSpacerItem(self.stack_spacer)
+ self.format_widgets[this_format][u'filepathLabel'] = filepathLabel
+ self.format_widgets[this_format][u'filepathSpacer'] = filepathSpacer
+ self.format_widgets[this_format][u'file_path_layout'] = file_path_layout
+ self.format_widgets[this_format][u'file_path_edit'] = file_path_edit
+ self.format_widgets[this_format][u'browseButton'] = browseButton
elif select_mode == SongFormatSelect.MultipleFiles:
fileListWidget = QtGui.QListWidget(importWidget)
fileListWidget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
fileListWidget.setObjectName(prefix + u'FileListWidget')
importLayout.addWidget(fileListWidget)
- buttonLayout = QtGui.QHBoxLayout()
- buttonLayout.setObjectName(prefix + u'ButtonLayout')
+ button_layout = QtGui.QHBoxLayout()
+ button_layout.setObjectName(prefix + u'_button_layout')
addButton = QtGui.QPushButton(importWidget)
- addButton.setIcon(self.openIcon)
+ addButton.setIcon(self.open_icon)
addButton.setObjectName(prefix + u'AddButton')
- buttonLayout.addWidget(addButton)
- buttonLayout.addStretch()
+ button_layout.addWidget(addButton)
+ button_layout.addStretch()
removeButton = QtGui.QPushButton(importWidget)
- removeButton.setIcon(self.deleteIcon)
+ removeButton.setIcon(self.delete_icon)
removeButton.setObjectName(prefix + u'RemoveButton')
- buttonLayout.addWidget(removeButton)
- importLayout.addLayout(buttonLayout)
- self.formatWidgets[this_format][u'fileListWidget'] = fileListWidget
- self.formatWidgets[this_format][u'buttonLayout'] = buttonLayout
- self.formatWidgets[this_format][u'addButton'] = addButton
- self.formatWidgets[this_format][u'removeButton'] = removeButton
- self.formatStack.addWidget(page)
- self.formatWidgets[this_format][u'page'] = page
- self.formatWidgets[this_format][u'importLayout'] = importLayout
- self.formatComboBox.addItem(u'')
+ button_layout.addWidget(removeButton)
+ importLayout.addLayout(button_layout)
+ self.format_widgets[this_format][u'fileListWidget'] = fileListWidget
+ self.format_widgets[this_format][u'button_layout'] = button_layout
+ self.format_widgets[this_format][u'addButton'] = addButton
+ self.format_widgets[this_format][u'removeButton'] = removeButton
+ self.format_stack.addWidget(page)
+ self.format_widgets[this_format][u'page'] = page
+ self.format_widgets[this_format][u'importLayout'] = importLayout
+ self.format_combo_box.addItem(u'')
def disablableWidget(self, page, prefix):
"""
Disable a widget.
"""
- this_format = self.currentFormat
- self.disablableFormats.append(this_format)
+ this_format = self.current_format
+ self.disablable_formats.append(this_format)
layout = QtGui.QVBoxLayout(page)
layout.setMargin(0)
layout.setSpacing(0)
- layout.setObjectName(prefix + u'Layout')
- disabledWidget = QtGui.QWidget(page)
- disabledWidget.setVisible(False)
- disabledWidget.setObjectName(prefix + u'DisabledWidget')
- disabledLayout = QtGui.QVBoxLayout(disabledWidget)
- disabledLayout.setMargin(0)
- disabledLayout.setObjectName(prefix + u'DisabledLayout')
- disabledLabel = QtGui.QLabel(disabledWidget)
- disabledLabel.setWordWrap(True)
- disabledLabel.setObjectName(prefix + u'DisabledLabel')
- disabledLayout.addWidget(disabledLabel)
- disabledLayout.addSpacerItem(self.stackSpacer)
- layout.addWidget(disabledWidget)
- importWidget = QtGui.QWidget(page)
- importWidget.setObjectName(prefix + u'ImportWidget')
- layout.addWidget(importWidget)
- self.formatWidgets[this_format][u'layout'] = layout
- self.formatWidgets[this_format][u'disabledWidget'] = disabledWidget
- self.formatWidgets[this_format][u'disabledLayout'] = disabledLayout
- self.formatWidgets[this_format][u'disabledLabel'] = disabledLabel
- self.formatWidgets[this_format][u'importWidget'] = importWidget
- return importWidget
+ layout.setObjectName(prefix + u'_layout')
+ disabled_widget = QtGui.QWidget(page)
+ disabled_widget.setVisible(False)
+ disabled_widget.setObjectName(prefix + u'_disabled_widget')
+ disabled_layout = QtGui.QVBoxLayout(disabled_widget)
+ disabled_layout.setMargin(0)
+ disabled_layout.setObjectName(prefix + u'_disabled_layout')
+ disabled_label = QtGui.QLabel(disabled_widget)
+ disabled_label.setWordWrap(True)
+ disabled_label.setObjectName(prefix + u'_disabled_label')
+ disabled_layout.addWidget(disabled_label)
+ disabled_layout.addSpacerItem(self.stack_spacer)
+ layout.addWidget(disabled_widget)
+ import_widget = QtGui.QWidget(page)
+ import_widget.setObjectName(prefix + u'_import_widget')
+ layout.addWidget(import_widget)
+ self.format_widgets[this_format][u'layout'] = layout
+ self.format_widgets[this_format][u'disabled_widget'] = disabled_widget
+ self.format_widgets[this_format][u'disabled_layout'] = disabled_layout
+ self.format_widgets[this_format][u'disabled_label'] = disabled_label
+ self.format_widgets[this_format][u'import_widget'] = import_widget
+ return import_widget
def _get_main_window(self):
"""
@@ -516,14 +508,14 @@
When this method returns True, the wizard's Next button is enabled.
"""
wizard = self.wizard()
- this_format = wizard.currentFormat
+ this_format = wizard.current_format
select_mode, format_available = SongFormat.get(this_format, u'selectMode', u'availability')
if format_available:
if select_mode == SongFormatSelect.MultipleFiles:
- if wizard.formatWidgets[this_format][u'fileListWidget'].count() > 0:
+ if wizard.format_widgets[this_format][u'fileListWidget'].count() > 0:
return True
else:
- filepath = unicode(wizard.formatWidgets[this_format][u'filepathEdit'].text())
+ filepath = unicode(wizard.format_widgets[this_format][u'file_path_edit'].text())
if filepath:
if select_mode == SongFormatSelect.SingleFile and os.path.isfile(filepath):
return True
=== modified file 'openlp/plugins/songs/forms/songmaintenancedialog.py'
--- openlp/plugins/songs/forms/songmaintenancedialog.py 2013-02-05 08:05:28 +0000
+++ openlp/plugins/songs/forms/songmaintenancedialog.py 2013-03-07 18:01:28 +0000
@@ -134,8 +134,7 @@
self.dialogLayout.addWidget(self.button_box, 1, 0, 1, 2)
self.retranslateUi(songMaintenanceDialog)
self.stackedLayout.setCurrentIndex(0)
- QtCore.QObject.connect(self.typeListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'),
- self.stackedLayout.setCurrentIndex)
+ self.typeListWidget.currentRowChanged.connect(self.stackedLayout.setCurrentIndex)
def retranslateUi(self, songMaintenanceDialog):
songMaintenanceDialog.setWindowTitle(SongStrings.SongMaintenance)
=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py 2013-02-07 08:42:17 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py 2013-03-07 18:01:28 +0000
@@ -62,21 +62,18 @@
self.booksDeleteButton.setEnabled(False)
self.booksEditButton.setEnabled(False)
# Signals
- QtCore.QObject.connect(self.authorsAddButton, QtCore.SIGNAL(u'clicked()'), self.onAuthorAddButtonClicked)
- QtCore.QObject.connect(self.topicsAddButton, QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked)
- QtCore.QObject.connect(self.booksAddButton, QtCore.SIGNAL(u'clicked()'), self.onBookAddButtonClicked)
- QtCore.QObject.connect(self.authorsEditButton, QtCore.SIGNAL(u'clicked()'), self.onAuthorEditButtonClicked)
- QtCore.QObject.connect(self.topicsEditButton, QtCore.SIGNAL(u'clicked()'), self.onTopicEditButtonClicked)
- QtCore.QObject.connect(self.booksEditButton, QtCore.SIGNAL(u'clicked()'), self.onBookEditButtonClicked)
- QtCore.QObject.connect(self.authorsDeleteButton, QtCore.SIGNAL(u'clicked()'), self.onAuthorDeleteButtonClicked)
- QtCore.QObject.connect(self.topicsDeleteButton, QtCore.SIGNAL(u'clicked()'), self.onTopicDeleteButtonClicked)
- QtCore.QObject.connect(self.booksDeleteButton, QtCore.SIGNAL(u'clicked()'), self.onBookDeleteButtonClicked)
- QtCore.QObject.connect(self.authorsListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'),
- self.onAuthorsListRowChanged)
- QtCore.QObject.connect(self.topicsListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'),
- self.onTopicsListRowChanged)
- QtCore.QObject.connect(self.booksListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'),
- self.onBooksListRowChanged)
+ self.authorsAddButton.clicked.connect(self.onAuthorAddButtonClicked)
+ self.topicsAddButton.clicked.connect(self.onTopicAddButtonClicked)
+ self.booksAddButton.clicked.connect(self.onBookAddButtonClicked)
+ self.authorsEditButton.clicked.connect(self.onAuthorEditButtonClicked)
+ self.topicsEditButton.clicked.connect(self.onTopicEditButtonClicked)
+ self.booksEditButton.clicked.connect(self.onBookEditButtonClicked)
+ self.authorsDeleteButton.clicked.connect(self.onAuthorDeleteButtonClicked)
+ self.topicsDeleteButton.clicked.connect(self.onTopicDeleteButtonClicked)
+ self.booksDeleteButton.clicked.connect(self.onBookDeleteButtonClicked)
+ self.authorsListWidget.currentRowChanged.connect(self.onAuthorsListRowChanged)
+ self.topicsListWidget.currentRowChanged.connect(self.onTopicsListRowChanged)
+ self.booksListWidget.currentRowChanged.connect(self.onBooksListRowChanged)
def exec_(self, fromSongEdit=False):
"""
=== modified file 'openlp/plugins/songs/lib/cclifileimport.py'
--- openlp/plugins/songs/lib/cclifileimport.py 2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/lib/cclifileimport.py 2013-03-07 18:01:28 +0000
@@ -62,8 +62,8 @@
Import either a ``.usr`` or a ``.txt`` SongSelect file.
"""
log.debug(u'Starting CCLI File Import')
- self.importWizard.progressBar.setMaximum(len(self.importSource))
- for filename in self.importSource:
+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
+ for filename in self.import_source:
filename = unicode(filename)
log.debug(u'Importing CCLI File: %s', filename)
lines = []
=== modified file 'openlp/plugins/songs/lib/dreambeamimport.py'
--- openlp/plugins/songs/lib/dreambeamimport.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/songs/lib/dreambeamimport.py 2013-03-07 18:01:28 +0000
@@ -87,9 +87,9 @@
"""
Receive a single file or a list of files to import.
"""
- if isinstance(self.importSource, list):
- self.importWizard.progressBar.setMaximum(len(self.importSource))
- for file in self.importSource:
+ if isinstance(self.import_source, list):
+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
+ for file in self.import_source:
if self.stop_import_flag:
return
self.setDefaults()
@@ -148,6 +148,6 @@
unicode(SongStrings.CopyrightSymbol)) >= 0:
self.addCopyright(author_copyright)
else:
- self.parseAuthor(author_copyright)
+ self.parse_author(author_copyright)
if not self.finish():
self.logError(file)
=== modified file 'openlp/plugins/songs/lib/easyslidesimport.py'
--- openlp/plugins/songs/lib/easyslidesimport.py 2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/lib/easyslidesimport.py 2013-03-07 18:01:28 +0000
@@ -51,12 +51,12 @@
SongImport.__init__(self, manager, **kwargs)
def doImport(self):
- log.info(u'Importing EasySlides XML file %s', self.importSource)
+ log.info(u'Importing EasySlides XML file %s', self.import_source)
parser = etree.XMLParser(remove_blank_text=True)
- parsed_file = etree.parse(self.importSource, parser)
+ parsed_file = etree.parse(self.import_source, parser)
xml = unicode(etree.tostring(parsed_file))
song_xml = objectify.fromstring(xml)
- self.importWizard.progressBar.setMaximum(len(song_xml.Item))
+ self.import_wizard.progress_bar.setMaximum(len(song_xml.Item))
for song in song_xml.Item:
if self.stop_import_flag:
return
@@ -64,22 +64,22 @@
def _parseSong(self, song):
self._success = True
- self._addUnicodeAttribute(u'title', song.Title1, True)
+ self._add_unicode_attribute(u'title', song.Title1, True)
if hasattr(song, u'Title2'):
- self._addUnicodeAttribute(u'alternateTitle', song.Title2)
+ self._add_unicode_attribute(u'alternateTitle', song.Title2)
if hasattr(song, u'SongNumber'):
- self._addUnicodeAttribute(u'songNumber', song.SongNumber)
+ self._add_unicode_attribute(u'songNumber', song.SongNumber)
if self.songNumber == u'0':
self.songNumber = u''
self._addAuthors(song)
if hasattr(song, u'Copyright'):
- self._addCopyright(song.Copyright)
+ self._add_copyright(song.Copyright)
if hasattr(song, u'LicenceAdmin1'):
- self._addCopyright(song.LicenceAdmin1)
+ self._add_copyright(song.LicenceAdmin1)
if hasattr(song, u'LicenceAdmin2'):
- self._addCopyright(song.LicenceAdmin2)
+ self._add_copyright(song.LicenceAdmin2)
if hasattr(song, u'BookReference'):
- self._addUnicodeAttribute(u'songBookName', song.BookReference)
+ self._add_unicode_attribute(u'songBookName', song.BookReference)
self._parseAndAddLyrics(song)
if self._success:
if not self.finish():
@@ -87,7 +87,7 @@
else:
self.setDefaults()
- def _addUnicodeAttribute(self, self_attribute, import_attribute, mandatory=False):
+ def _add_unicode_attribute(self, self_attribute, import_attribute, mandatory=False):
"""
Add imported values to the song model converting them to unicode at the
same time. If the unicode decode fails or a mandatory attribute is not
@@ -123,7 +123,7 @@
except AttributeError:
pass
- def _addCopyright(self, element):
+ def _add_copyright(self, element):
"""
Add a piece of copyright to the total copyright information for the
song.
=== modified file 'openlp/plugins/songs/lib/ewimport.py'
--- openlp/plugins/songs/lib/ewimport.py 2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/lib/ewimport.py 2013-03-07 18:01:28 +0000
@@ -64,15 +64,15 @@
def doImport(self):
# Open the DB and MB files if they exist
- import_source_mb = self.importSource.replace('.DB', '.MB')
- if not os.path.isfile(self.importSource):
+ import_source_mb = self.import_source.replace('.DB', '.MB')
+ if not os.path.isfile(self.import_source):
return
if not os.path.isfile(import_source_mb):
return
- db_size = os.path.getsize(self.importSource)
+ db_size = os.path.getsize(self.import_source)
if db_size < 0x800:
return
- db_file = open(self.importSource, 'rb')
+ db_file = open(self.import_source, 'rb')
self.memoFile = open(import_source_mb, 'rb')
# Don't accept files that are clearly not paradox files
record_size, header_size, block_size, first_block, num_fields = struct.unpack('<hhxb8xh17xh', db_file.read(35))
@@ -110,7 +110,7 @@
# There does not appear to be a _reliable_ way of getting the number
# of songs/records, so let's use file blocks for measuring progress.
total_blocks = (db_size - header_size) / (block_size * 1024)
- self.importWizard.progressBar.setMaximum(total_blocks)
+ self.import_wizard.progress_bar.setMaximum(total_blocks)
# Read the field description information
db_file.seek(120)
field_info = db_file.read(num_fields * 2)
@@ -216,7 +216,7 @@
if self.stop_import_flag:
break
if not self.finish():
- self.logError(self.importSource)
+ self.logError(self.import_source)
db_file.close()
self.memoFile.close()
=== modified file 'openlp/plugins/songs/lib/foilpresenterimport.py'
--- openlp/plugins/songs/lib/foilpresenterimport.py 2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/lib/foilpresenterimport.py 2013-03-07 18:01:28 +0000
@@ -121,12 +121,12 @@
"""
Imports the songs.
"""
- self.importWizard.progressBar.setMaximum(len(self.importSource))
+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
parser = etree.XMLParser(remove_blank_text=True)
- for file_path in self.importSource:
+ for file_path in self.import_source:
if self.stop_import_flag:
return
- self.importWizard.incrementProgressBar(
+ self.import_wizard.increment_progress_bar(
WizardStrings.ImportingType % os.path.basename(file_path))
try:
parsed_file = etree.parse(file_path, parser)
=== modified file 'openlp/plugins/songs/lib/importer.py'
--- openlp/plugins/songs/lib/importer.py 2013-01-11 00:19:11 +0000
+++ openlp/plugins/songs/lib/importer.py 2013-03-07 18:01:28 +0000
@@ -140,7 +140,7 @@
"""
# Song formats (ordered alphabetically after Generic)
# * Numerical order of song formats is significant as it determines the
- # order used by formatComboBox.
+ # order used by format_combo_box.
Unknown = -1
OpenLyrics = 0
OpenLP2 = 1
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2013-03-07 18:01:28 +0000
@@ -65,9 +65,9 @@
"""
log.info(u'Song Media Item loaded')
- def __init__(self, parent, plugin, icon):
+ def __init__(self, parent, plugin):
self.IconPath = u'songs/song'
- MediaManagerItem.__init__(self, parent, plugin, icon)
+ MediaManagerItem.__init__(self, parent, plugin)
self.editSongForm = EditSongForm(self, self.main_window, self.plugin.manager)
self.openLyrics = OpenLyrics(self.plugin.manager)
self.singleServiceItem = False
@@ -94,7 +94,7 @@
def addEndHeaderBar(self):
self.toolbar.addSeparator()
## Song Maintenance Button ##
- self.maintenanceAction = self.toolbar.addToolbarAction('maintenanceAction',
+ self.maintenanceAction = self.toolbar.add_toolbar_action('maintenanceAction',
icon=':/songs/song_maintenance.png',
triggers=self.onSongMaintenanceClick)
self.addSearchToToolBar()
@@ -128,7 +128,7 @@
'Maintain the lists of authors, topics and books.'))
def initialise(self):
- self.searchTextEdit.setSearchTypes([
+ self.searchTextEdit.set_search_types([
(SongSearch.Entire, u':/songs/song_search_all.png',
translate('SongsPlugin.MediaItem', 'Entire Song'),
translate('SongsPlugin.MediaItem', 'Search Entire Song...')),
@@ -145,16 +145,16 @@
(SongSearch.Themes, u':/slides/slide_theme.png',
UiStrings().Themes, UiStrings().SearchThemes)
])
- self.searchTextEdit.setCurrentSearchType(Settings().value(u'%s/last search type' % self.settingsSection))
+ self.searchTextEdit.set_current_search_type(Settings().value(u'%s/last search type' % self.settingsSection))
self.config_update()
def onSearchTextButtonClicked(self):
# Save the current search type to the configuration.
- Settings().setValue(u'%s/last search type' % self.settingsSection, self.searchTextEdit.currentSearchType())
+ Settings().setValue(u'%s/last search type' % self.settingsSection, self.searchTextEdit.current_search_type())
# Reload the list considering the new search type.
search_keywords = unicode(self.searchTextEdit.displayText())
search_results = []
- search_type = self.searchTextEdit.currentSearchType()
+ search_type = self.searchTextEdit.current_search_type()
if search_type == SongSearch.Entire:
log.debug(u'Entire Song Search')
search_results = self.searchEntire(search_keywords)
@@ -279,9 +279,9 @@
"""
if self.searchAsYouType:
search_length = 1
- if self.searchTextEdit.currentSearchType() == SongSearch.Entire:
+ if self.searchTextEdit.current_search_type() == SongSearch.Entire:
search_length = 4
- elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics:
+ elif self.searchTextEdit.current_search_type() == SongSearch.Lyrics:
search_length = 3
if len(text) > search_length:
self.onSearchTextButtonClicked()
@@ -289,9 +289,9 @@
self.onClearTextButtonClick()
def onImportClick(self):
- if not hasattr(self, u'importWizard'):
- self.importWizard = SongImportForm(self, self.plugin)
- self.importWizard.exec_()
+ if not hasattr(self, u'import_wizard'):
+ self.import_wizard = SongImportForm(self, self.plugin)
+ self.import_wizard.exec_()
# Run song load as list may have been cancelled but some songs loaded
Registry().execute(u'songs_load_list')
@@ -378,7 +378,7 @@
except OSError:
log.exception(u'Could not remove directory: %s', save_path)
self.plugin.manager.delete_object(Song, item_id)
- self.main_window.incrementProgressBar()
+ self.main_window.increment_progress_bar()
self.main_window.finishedProgressBar()
self.application.set_normal_cursor()
self.onSearchTextButtonClicked()
=== modified file 'openlp/plugins/songs/lib/mediashoutimport.py'
--- openlp/plugins/songs/lib/mediashoutimport.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/songs/lib/mediashoutimport.py 2013-03-07 18:01:28 +0000
@@ -54,17 +54,17 @@
"""
try:
conn = pyodbc.connect(u'DRIVER={Microsoft Access Driver (*.mdb)};'
- u'DBQ=%s;PWD=6NOZ4eHK7k' % self.importSource)
+ u'DBQ=%s;PWD=6NOZ4eHK7k' % self.import_source)
except:
# Unfortunately no specific exception type
- self.logError(self.importSource,
+ self.logError(self.import_source,
translate('SongsPlugin.MediaShoutImport', 'Unable to open the MediaShout database.'))
return
cursor = conn.cursor()
cursor.execute(u'SELECT Record, Title, Author, Copyright, '
u'SongID, CCLI, Notes FROM Songs ORDER BY Title')
songs = cursor.fetchall()
- self.importWizard.progressBar.setMaximum(len(songs))
+ self.import_wizard.progress_bar.setMaximum(len(songs))
for song in songs:
if self.stop_import_flag:
break
@@ -90,7 +90,7 @@
"""
self.setDefaults()
self.title = song.Title
- self.parseAuthor(song.Author)
+ self.parse_author(song.Author)
self.addCopyright(song.Copyright)
self.comments = song.Notes
for topic in topics:
=== modified file 'openlp/plugins/songs/lib/olp1import.py'
--- openlp/plugins/songs/lib/olp1import.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/songs/lib/olp1import.py 2013-03-07 18:01:28 +0000
@@ -37,7 +37,7 @@
import sys
import os
-from openlp.core.lib import translate
+from openlp.core.lib import Registry, translate
from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport
@@ -61,21 +61,20 @@
The database providing the data to import.
"""
SongImport.__init__(self, manager, **kwargs)
- self.availableThemes = kwargs[u'plugin'].theme_manager.get_themes()
def doImport(self):
"""
Run the import for an openlp.org 1.x song database.
"""
- if not self.importSource.endswith(u'.olp'):
- self.logError(self.importSource,
+ if not self.import_source.endswith(u'.olp'):
+ self.logError(self.import_source,
translate('SongsPlugin.OpenLP1SongImport', 'Not a valid openlp.org 1.x song database.'))
return
encoding = self.getEncoding()
if not encoding:
return
# Connect to the database.
- connection = sqlite.connect(self.importSource, mode=0444, encoding=(encoding, 'replace'))
+ connection = sqlite.connect(self.import_source, mode=0444, encoding=(encoding, 'replace'))
cursor = connection.cursor()
# Determine if the db supports linking audio to songs.
cursor.execute(u'SELECT name FROM sqlite_master '
@@ -100,14 +99,14 @@
cursor.execute(u'-- types int, unicode')
cursor.execute(u'SELECT settingsid, settingsname FROM settings')
for theme_id, theme_name in cursor.fetchall():
- if theme_name in self.availableThemes:
+ if theme_name in self.theme_manager.get_themes():
themes[theme_id] = theme_name
# Import the songs.
cursor.execute(u'-- types int, unicode, unicode, unicode')
cursor.execute(u'SELECT songid, songtitle, lyrics || \'\' AS ' \
u'lyrics, copyrightinfo FROM songs')
songs = cursor.fetchall()
- self.importWizard.progressBar.setMaximum(len(songs))
+ self.import_wizard.progress_bar.setMaximum(len(songs))
for song in songs:
self.setDefaults()
if self.stop_import_flag:
@@ -135,7 +134,7 @@
break
for author in authors:
if author[0] == author_id[0]:
- self.parseAuthor(author[1])
+ self.parse_author(author[1])
break
if self.stop_import_flag:
break
@@ -156,14 +155,14 @@
if self.stop_import_flag:
break
if not self.finish():
- self.logError(self.importSource)
+ self.logError(self.import_source)
def getEncoding(self):
"""
Detect character encoding of an openlp.org 1.x song database.
"""
# Connect to the database.
- connection = sqlite.connect(self.importSource.encode(
+ connection = sqlite.connect(self.import_source.encode(
sys.getfilesystemencoding()), mode=0444)
cursor = connection.cursor()
@@ -216,3 +215,13 @@
if not common_app_data:
return filename
return os.path.join(common_app_data, u'openlp.org', 'Audio', filename)
+
+ def _get_theme_manager(self):
+ """
+ Adds the theme manager to the class dynamically
+ """
+ if not hasattr(self, u'_theme_manager'):
+ self._theme_manager = Registry().get(u'theme_manager')
+ return self._theme_manager
+
+ theme_manager = property(_get_theme_manager)
=== modified file 'openlp/plugins/songs/lib/olpimport.py'
--- openlp/plugins/songs/lib/olpimport.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/songs/lib/olpimport.py 2013-03-07 18:01:28 +0000
@@ -106,13 +106,13 @@
pass
# Check the file type
- if not self.importSource.endswith(u'.sqlite'):
- self.logError(self.importSource,
+ if not self.import_source.endswith(u'.sqlite'):
+ self.logError(self.import_source,
translate('SongsPlugin.OpenLPSongImport', 'Not a valid OpenLP 2.0 song database.'))
return
- self.importSource = u'sqlite:///%s' % self.importSource
+ self.import_source = u'sqlite:///%s' % self.import_source
# Load the db file
- engine = create_engine(self.importSource)
+ engine = create_engine(self.import_source)
source_meta = MetaData()
source_meta.reflect(engine)
self.sourceSession = scoped_session(sessionmaker(bind=engine))
@@ -169,8 +169,8 @@
mapper(OldTopic, source_topics_table)
source_songs = self.sourceSession.query(OldSong).all()
- if self.importWizard:
- self.importWizard.progressBar.setMaximum(len(source_songs))
+ if self.import_wizard:
+ self.import_wizard.progress_bar.setMaximum(len(source_songs))
for song in source_songs:
new_song = Song()
new_song.title = song.title
@@ -224,7 +224,7 @@
progressDialog.setValue(progressDialog.value() + 1)
progressDialog.setLabelText(WizardStrings.ImportingType % new_song.title)
else:
- self.importWizard.incrementProgressBar(WizardStrings.ImportingType % new_song.title)
+ self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % new_song.title)
if self.stop_import_flag:
break
engine.dispose()
=== modified file 'openlp/plugins/songs/lib/oooimport.py'
--- openlp/plugins/songs/lib/oooimport.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/songs/lib/oooimport.py 2013-03-07 18:01:28 +0000
@@ -65,18 +65,18 @@
self.processStarted = False
def doImport(self):
- if not isinstance(self.importSource, list):
+ if not isinstance(self.import_source, list):
return
try:
self.startOoo()
except NoConnectException as exc:
self.logError(
- self.importSource[0],
+ self.import_source[0],
translate('SongsPlugin.SongImport', 'Cannot access OpenOffice or LibreOffice'))
log.error(exc)
return
- self.importWizard.progressBar.setMaximum(len(self.importSource))
- for filename in self.importSource:
+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
+ for filename in self.import_source:
if self.stop_import_flag:
break
filename = unicode(filename)
@@ -162,7 +162,7 @@
self.document.supportsService("com.sun.star.text.TextDocument"):
self.closeOooFile()
else:
- self.importWizard.incrementProgressBar(u'Processing file ' + filepath, 0)
+ self.import_wizard.increment_progress_bar(u'Processing file ' + filepath, 0)
except AttributeError:
log.exception("openOooFile failed: %s", url)
return
@@ -190,7 +190,7 @@
text = u''
for slide_no in range(slides.getCount()):
if self.stop_import_flag:
- self.importWizard.incrementProgressBar(u'Import cancelled', 0)
+ self.import_wizard.increment_progress_bar(u'Import cancelled', 0)
return
slide = slides.getByIndex(slide_no)
slidetext = u''
=== modified file 'openlp/plugins/songs/lib/openlyricsexport.py'
--- openlp/plugins/songs/lib/openlyricsexport.py 2013-02-03 19:23:12 +0000
+++ openlp/plugins/songs/lib/openlyricsexport.py 2013-03-07 18:01:28 +0000
@@ -62,12 +62,12 @@
"""
log.debug(u'started OpenLyricsExport')
openLyrics = OpenLyrics(self.manager)
- self.parent.progressBar.setMaximum(len(self.songs))
+ self.parent.progress_bar.setMaximum(len(self.songs))
for song in self.songs:
self.application.process_events()
if self.parent.stop_export_flag:
return False
- self.parent.incrementProgressBar(translate('SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') %
+ self.parent.increment_progress_bar(translate('SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') %
song.title)
xml = openLyrics.song_to_xml(song)
tree = etree.ElementTree(etree.fromstring(xml))
=== modified file 'openlp/plugins/songs/lib/openlyricsimport.py'
--- openlp/plugins/songs/lib/openlyricsimport.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/songs/lib/openlyricsimport.py 2013-03-07 18:01:28 +0000
@@ -60,12 +60,12 @@
"""
Imports the songs.
"""
- self.importWizard.progressBar.setMaximum(len(self.importSource))
+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
parser = etree.XMLParser(remove_blank_text=True)
- for file_path in self.importSource:
+ for file_path in self.import_source:
if self.stop_import_flag:
return
- self.importWizard.incrementProgressBar(WizardStrings.ImportingType % os.path.basename(file_path))
+ self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % os.path.basename(file_path))
try:
# Pass a file object, because lxml does not cope with some
# special characters in the path (see lp:757673 and lp:744337).
=== modified file 'openlp/plugins/songs/lib/opensongimport.py'
--- openlp/plugins/songs/lib/opensongimport.py 2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/lib/opensongimport.py 2013-03-07 18:01:28 +0000
@@ -111,8 +111,8 @@
SongImport.__init__(self, manager, **kwargs)
def doImport(self):
- self.importWizard.progressBar.setMaximum(len(self.importSource))
- for filename in self.importSource:
+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
+ for filename in self.import_source:
if self.stop_import_flag:
return
song_file = open(filename)
@@ -139,7 +139,7 @@
decode = {
u'copyright': self.addCopyright,
u'ccli': u'ccli_number',
- u'author': self.parseAuthor,
+ u'author': self.parse_author,
u'title': u'title',
u'aka': u'alternate_title',
u'hymn_number': u'song_number'
=== modified file 'openlp/plugins/songs/lib/powersongimport.py'
--- openlp/plugins/songs/lib/powersongimport.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/songs/lib/powersongimport.py 2013-03-07 18:01:28 +0000
@@ -91,21 +91,21 @@
"""
from importer import SongFormat
PS_string = SongFormat.get(SongFormat.PowerSong, u'name')
- if isinstance(self.importSource, unicode):
- if os.path.isdir(self.importSource):
- dir = self.importSource
- self.importSource = []
+ if isinstance(self.import_source, unicode):
+ if os.path.isdir(self.import_source):
+ dir = self.import_source
+ self.import_source = []
for file in os.listdir(dir):
if fnmatch.fnmatch(file, u'*.song'):
- self.importSource.append(os.path.join(dir, file))
+ self.import_source.append(os.path.join(dir, file))
else:
- self.importSource = u''
- if not self.importSource or not isinstance(self.importSource, list):
+ self.import_source = u''
+ if not self.import_source or not isinstance(self.import_source, list):
self.logError(translate('SongsPlugin.PowerSongImport', 'No songs to import.'),
translate('SongsPlugin.PowerSongImport', 'No %s files found.') % PS_string)
return
- self.importWizard.progressBar.setMaximum(len(self.importSource))
- for file in self.importSource:
+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
+ for file in self.import_source:
if self.stop_import_flag:
return
self.setDefaults()
@@ -127,7 +127,7 @@
if label == u'TITLE':
self.title = field.replace(u'\n', u' ')
elif label == u'AUTHOR':
- self.parseAuthor(field)
+ self.parse_author(field)
elif label == u'COPYRIGHTLINE':
found_copyright = True
self._parseCopyrightCCLI(field)
=== modified file 'openlp/plugins/songs/lib/sofimport.py'
--- openlp/plugins/songs/lib/sofimport.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/songs/lib/sofimport.py 2013-03-07 18:01:28 +0000
@@ -261,7 +261,7 @@
if title.endswith(u','):
title = title[:-1]
self.title = title
- self.importWizard.incrementProgressBar(u'Processing song ' + title, 0)
+ self.import_wizard.increment_progress_bar(u'Processing song ' + title, 0)
def addSofAuthor(self, text):
"""
@@ -271,7 +271,7 @@
"Mr Smith" and "Mrs Smith".
"""
text = text.replace(u' and ', u' & ')
- self.parseAuthor(text)
+ self.parse_author(text)
def addVerseLine(self, text):
"""
=== modified file 'openlp/plugins/songs/lib/songbeamerimport.py'
--- openlp/plugins/songs/lib/songbeamerimport.py 2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/lib/songbeamerimport.py 2013-03-07 18:01:28 +0000
@@ -102,10 +102,10 @@
"""
Receive a single file or a list of files to import.
"""
- self.importWizard.progressBar.setMaximum(len(self.importSource))
- if not isinstance(self.importSource, list):
+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
+ if not isinstance(self.import_source, list):
return
- for file in self.importSource:
+ for file in self.import_source:
# TODO: check that it is a valid SongBeamer file
if self.stop_import_flag:
return
@@ -177,7 +177,7 @@
elif tag_val[0] == u'#AddCopyrightInfo':
pass
elif tag_val[0] == u'#Author':
- self.parseAuthor(tag_val[1])
+ self.parse_author(tag_val[1])
elif tag_val[0] == u'#BackgroundImage':
pass
elif tag_val[0] == u'#Bible':
@@ -217,7 +217,7 @@
elif tag_val[0] == u'#LangCount':
pass
elif tag_val[0] == u'#Melody':
- self.parseAuthor(tag_val[1])
+ self.parse_author(tag_val[1])
elif tag_val[0] == u'#NatCopyright':
pass
elif tag_val[0] == u'#OTitle':
=== modified file 'openlp/plugins/songs/lib/songimport.py'
--- openlp/plugins/songs/lib/songimport.py 2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/lib/songimport.py 2013-03-07 18:01:28 +0000
@@ -71,15 +71,15 @@
self.manager = manager
QtCore.QObject.__init__(self)
if u'filename' in kwargs:
- self.importSource = kwargs[u'filename']
+ self.import_source = kwargs[u'filename']
elif u'filenames' in kwargs:
- self.importSource = kwargs[u'filenames']
+ self.import_source = kwargs[u'filenames']
elif u'folder' in kwargs:
- self.importSource = kwargs[u'folder']
+ self.import_source = kwargs[u'folder']
else:
raise KeyError(u'Keyword arguments "filename[s]" or "folder" not supplied.')
- log.debug(self.importSource)
- self.importWizard = None
+ log.debug(self.import_source)
+ self.import_wizard = None
self.song = None
self.stop_import_flag = False
self.setDefaults()
@@ -92,7 +92,7 @@
"""
self.title = u''
self.songNumber = u''
- self.alternateTitle = u''
+ self.alternate_title = u''
self.copyright = u''
self.comments = u''
self.themeName = u''
@@ -114,7 +114,7 @@
This should be called, when a song could not be imported.
``filepath``
- This should be the file path if ``self.importSource`` is a list
+ This should be the file path if ``self.import_source`` is a list
with different files. If it is not a list, but a single file (for
instance a database), then this should be the song's title.
@@ -123,15 +123,15 @@
informative as possible.
"""
self.setDefaults()
- if self.importWizard is None:
+ if self.import_wizard is None:
return
- if self.importWizard.errorReportTextEdit.isHidden():
- self.importWizard.errorReportTextEdit.setText(translate('SongsPlugin.SongImport',
+ if self.import_wizard.error_report_text_edit.isHidden():
+ self.import_wizard.error_report_text_edit.setText(translate('SongsPlugin.SongImport',
'The following songs could not be imported:'))
- self.importWizard.errorReportTextEdit.setVisible(True)
- self.importWizard.errorCopyToButton.setVisible(True)
- self.importWizard.errorSaveToButton.setVisible(True)
- self.importWizard.errorReportTextEdit.append(u'- %s (%s)' % (filepath, reason))
+ self.import_wizard.error_report_text_edit.setVisible(True)
+ self.import_wizard.error_copy_to_button.setVisible(True)
+ self.import_wizard.error_save_to_button.setVisible(True)
+ self.import_wizard.error_report_text_edit.append(u'- %s (%s)' % (filepath, reason))
def stop_import(self):
"""
@@ -141,7 +141,7 @@
self.stop_import_flag = True
def register(self, import_wizard):
- self.importWizard = import_wizard
+ self.import_wizard = import_wizard
def tidyText(self, text):
"""
@@ -177,10 +177,10 @@
copyright_found = True
self.addCopyright(line)
else:
- self.parseAuthor(line)
+ self.parse_author(line)
return
if len(lines) == 1:
- self.parseAuthor(lines[0])
+ self.parse_author(lines[0])
return
if not self.title:
self.title = lines[0]
@@ -196,7 +196,7 @@
self.copyright += ' '
self.copyright += copyright
- def parseAuthor(self, text):
+ def parse_author(self, text):
"""
Add the author. OpenLP stores them individually so split by 'and', '&'
and comma. However need to check for 'Mr and Mrs Smith' and turn it to
@@ -291,9 +291,9 @@
log.info(u'committing song %s to database', self.title)
song = Song()
song.title = self.title
- if self.importWizard is not None:
- self.importWizard.incrementProgressBar(WizardStrings.ImportingType % song.title)
- song.alternate_title = self.alternateTitle
+ if self.import_wizard is not None:
+ self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % song.title)
+ song.alternate_title = self.alternate_title
# Values will be set when cleaning the song.
song.search_title = u''
song.search_lyrics = u''
@@ -366,7 +366,7 @@
The file to copy.
"""
if not hasattr(self, u'save_path'):
- self.save_path = os.path.join(AppLocation.get_section_data_path(self.importWizard.plugin.name),
+ self.save_path = os.path.join(AppLocation.get_section_data_path(self.import_wizard.plugin.name),
'audio', str(song_id))
check_directory_exists(self.save_path)
if not filename.startswith(self.save_path):
=== modified file 'openlp/plugins/songs/lib/songproimport.py'
--- openlp/plugins/songs/lib/songproimport.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/songs/lib/songproimport.py 2013-03-07 18:01:28 +0000
@@ -78,8 +78,8 @@
Receive a single file or a list of files to import.
"""
self.encoding = None
- with open(self.importSource, 'r') as songs_file:
- self.importWizard.progressBar.setMaximum(0)
+ with open(self.import_source, 'r') as songs_file:
+ self.import_wizard.progress_bar.setMaximum(0)
tag = u''
text = u''
for file_line in songs_file:
@@ -115,7 +115,7 @@
if not text:
return
if tag == u'A':
- self.parseAuthor(text)
+ self.parse_author(text)
elif tag in [u'B', u'C']:
self.addVerse(text, tag)
elif tag == u'D':
=== modified file 'openlp/plugins/songs/lib/songshowplusimport.py'
--- openlp/plugins/songs/lib/songshowplusimport.py 2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/lib/songshowplusimport.py 2013-03-07 18:01:28 +0000
@@ -101,17 +101,17 @@
"""
Receive a single file or a list of files to import.
"""
- if not isinstance(self.importSource, list):
+ if not isinstance(self.import_source, list):
return
- self.importWizard.progressBar.setMaximum(len(self.importSource))
- for file in self.importSource:
+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
+ for file in self.import_source:
if self.stop_import_flag:
return
self.sspVerseOrderList = []
other_count = 0
other_list = {}
file_name = os.path.split(file)[1]
- self.importWizard.incrementProgressBar(WizardStrings.ImportingType % file_name, 0)
+ self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % file_name, 0)
song_data = open(file, 'rb')
while True:
block_key, = struct.unpack("I", song_data.read(4))
@@ -146,7 +146,7 @@
if author.find(",") !=-1:
authorParts = author.split(", ")
author = authorParts[1] + " " + authorParts[0]
- self.parseAuthor(unicode(author, u'cp1252'))
+ self.parse_author(unicode(author, u'cp1252'))
elif block_key == COPYRIGHT:
self.addCopyright(unicode(data, u'cp1252'))
elif block_key == CCLI_NO:
=== modified file 'openlp/plugins/songs/lib/songstab.py'
--- openlp/plugins/songs/lib/songstab.py 2013-01-10 23:07:48 +0000
+++ openlp/plugins/songs/lib/songstab.py 2013-03-07 18:01:28 +0000
@@ -61,14 +61,10 @@
self.leftLayout.addWidget(self.modeGroupBox)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
- QtCore.QObject.connect(self.searchAsTypeCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onSearchAsTypeCheckBoxChanged)
- QtCore.QObject.connect(self.toolBarActiveCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onToolBarActiveCheckBoxChanged)
- QtCore.QObject.connect(self.updateOnEditCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onUpdateOnEditCheckBoxChanged)
- QtCore.QObject.connect(self.addFromServiceCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- self.onAddFromServiceCheckBoxChanged)
+ self.searchAsTypeCheckBox.stateChanged.connect(self.onSearchAsTypeCheckBoxChanged)
+ self.toolBarActiveCheckBox.stateChanged.connect(self.onToolBarActiveCheckBoxChanged)
+ self.updateOnEditCheckBox.stateChanged.connect(self.onUpdateOnEditCheckBoxChanged)
+ self.addFromServiceCheckBox.stateChanged.connect(self.onAddFromServiceCheckBoxChanged)
def retranslateUi(self):
self.modeGroupBox.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))
=== modified file 'openlp/plugins/songs/lib/sundayplusimport.py'
--- openlp/plugins/songs/lib/sundayplusimport.py 2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/lib/sundayplusimport.py 2013-03-07 18:01:28 +0000
@@ -63,8 +63,8 @@
self.encoding = u'us-ascii'
def doImport(self):
- self.importWizard.progressBar.setMaximum(len(self.importSource))
- for filename in self.importSource:
+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
+ for filename in self.import_source:
if self.stop_import_flag:
return
song_file = open(filename)
=== modified file 'openlp/plugins/songs/lib/wowimport.py'
--- openlp/plugins/songs/lib/wowimport.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/songs/lib/wowimport.py 2013-03-07 18:01:28 +0000
@@ -105,9 +105,9 @@
"""
Receive a single file or a list of files to import.
"""
- if isinstance(self.importSource, list):
- self.importWizard.progressBar.setMaximum(len(self.importSource))
- for source in self.importSource:
+ if isinstance(self.import_source, list):
+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
+ for source in self.import_source:
if self.stop_import_flag:
return
self.setDefaults()
@@ -145,7 +145,7 @@
# Now to extract the author
author_length = ord(song_data.read(1))
if author_length:
- self.parseAuthor(unicode(song_data.read(author_length), u'cp1252'))
+ self.parse_author(unicode(song_data.read(author_length), u'cp1252'))
# Finally the copyright
copyright_length = ord(song_data.read(1))
if copyright_length:
=== modified file 'openlp/plugins/songs/lib/zionworximport.py'
--- openlp/plugins/songs/lib/zionworximport.py 2013-02-07 11:33:47 +0000
+++ openlp/plugins/songs/lib/zionworximport.py 2013-03-07 18:01:28 +0000
@@ -82,7 +82,7 @@
"""
Receive a CSV file (from a ZionWorx database dump) to import.
"""
- with open(self.importSource, 'rb') as songs_file:
+ with open(self.import_source, 'rb') as songs_file:
field_names = [u'SongNum', u'Title1', u'Title2', u'Lyrics', u'Writer', u'Copyright', u'Keywords',
u'DefaultStyle']
songs_reader = csv.DictReader(songs_file, field_names)
@@ -94,7 +94,7 @@
return
num_records = len(records)
log.info(u'%s records found in CSV file' % num_records)
- self.importWizard.progressBar.setMaximum(num_records)
+ self.import_wizard.progress_bar.setMaximum(num_records)
for index, record in enumerate(records, 1):
if self.stop_import_flag:
return
@@ -102,8 +102,8 @@
try:
self.title = self._decode(record[u'Title1'])
if record[u'Title2']:
- self.alternateTitle = self._decode(record[u'Title2'])
- self.parseAuthor(self._decode(record[u'Writer']))
+ self.alternate_title = self._decode(record[u'Title2'])
+ self.parse_author(self._decode(record[u'Writer']))
self.addCopyright(self._decode(record[u'Copyright']))
lyrics = self._decode(record[u'Lyrics'])
except UnicodeDecodeError, e:
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2013-02-19 21:23:56 +0000
+++ openlp/plugins/songs/songsplugin.py 2013-03-07 18:01:28 +0000
@@ -204,9 +204,8 @@
def importSongs(self, format, **kwargs):
class_ = SongFormat.get(format, u'class')
- kwargs[u'plugin'] = self
importer = class_(self.manager, **kwargs)
- importer.register(self.mediaItem.importWizard)
+ importer.register(self.mediaItem.import_wizard)
return importer
def set_plugin_text_strings(self):
=== modified file 'tests/functional/openlp_core_lib/test_lib.py'
--- tests/functional/openlp_core_lib/test_lib.py 2013-03-05 14:44:47 +0000
+++ tests/functional/openlp_core_lib/test_lib.py 2013-03-07 18:01:28 +0000
@@ -7,7 +7,7 @@
from mock import MagicMock, patch
from openlp.core.lib import str_to_bool, translate, check_directory_exists, get_text_file_string, build_icon, \
- image_to_byte, check_item_selected, validate_thumb, create_separated_list, expand_tags
+ image_to_byte, check_item_selected, validate_thumb, create_separated_list, clean_tags, expand_tags
class TestLib(TestCase):
@@ -299,6 +299,28 @@
MockedQtGui.QMessageBox.information.assert_called_with(u'parent', u'mocked translate', 'message')
assert not result, u'The result should be False'
+ def clean_tags_test(self):
+ """
+ Test clean_tags() method.
+ """
+ with patch(u'openlp.core.lib.FormattingTags.get_html_tags') as mocked_get_tags:
+ # GIVEN: Mocked get_html_tags() method.
+ mocked_get_tags.return_value = [{
+ u'desc': u'Black',
+ u'start tag': u'{b}',
+ u'start html': u'<span style="-webkit-text-fill-color:black">',
+ u'end tag': u'{/b}', u'end html': u'</span>', u'protected': True,
+ u'temporary': False
+ }]
+ string_to_pass = u'ASDF<br>foo{br}bar {b}black{/b}'
+ wanted_string = u'ASDF\nfoo\nbar black'
+
+ # WHEN: Clean the string.
+ result_string = clean_tags(string_to_pass)
+
+ # THEN: The strings should be identical.
+ assert result_string == wanted_string, u'The strings should be identical.'
+
def expand_tags_test(self):
"""
Test the expand_tags() method.
@@ -411,7 +433,7 @@
mocked_createSeparatedList.return_value = u'Author 1, Author 2, and Author 3'
string_list = [u'Author 1', u'Author 2', u'Author 3']
- # WHEN: We get a string build from the entries it the list and a seperator.
+ # WHEN: We get a string build from the entries it the list and a separator.
string_result = create_separated_list(string_list)
# THEN: We should have "Author 1, Author 2, and Author 3"
@@ -428,7 +450,7 @@
mocked_qt.qVersion.return_value = u'4.7'
string_list = []
- # WHEN: We get a string build from the entries it the list and a seperator.
+ # WHEN: We get a string build from the entries it the list and a separator.
string_result = create_separated_list(string_list)
# THEN: We shoud have an emptry string.
@@ -444,7 +466,7 @@
mocked_qt.qVersion.return_value = u'4.7'
string_list = [u'Author 1']
- # WHEN: We get a string build from the entries it the list and a seperator.
+ # WHEN: We get a string build from the entries it the list and a separator.
string_result = create_separated_list(string_list)
# THEN: We should have "Author 1"
=== modified file 'tests/interfaces/openlp_core_ui/test_filerenamedialog.py'
--- tests/interfaces/openlp_core_ui/test_filerenamedialog.py 2013-02-17 20:11:37 +0000
+++ tests/interfaces/openlp_core_ui/test_filerenamedialog.py 2013-03-07 18:01:28 +0000
@@ -56,28 +56,28 @@
def line_edit_focus_test(self):
"""
Regression test for bug1067251
- Test that the fileNameEdit setFocus has called with True when executed
+ Test that the file_name_edit setFocus has called with True when executed
"""
- # GIVEN: A mocked QDialog.exec_() method and mocked fileNameEdit.setFocus() method.
+ # GIVEN: A mocked QDialog.exec_() method and mocked file_name_edit.setFocus() method.
with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec:
mocked_set_focus = MagicMock()
- self.form.fileNameEdit.setFocus = mocked_set_focus
+ self.form.file_name_edit.setFocus = mocked_set_focus
# WHEN: The form is executed
self.form.exec_()
- # THEN: the setFocus method of the fileNameEdit has been called with True
+ # THEN: the setFocus method of the file_name_edit has been called with True
mocked_set_focus.assert_called_with()
def file_name_validation_test(self):
"""
- Test the fileNameEdit validation
+ Test the file_name_edit validation
"""
# GIVEN: QLineEdit with a validator set with illegal file name characters.
# WHEN: 'Typing' a string containing invalid file characters.
- QtTest.QTest.keyClicks(self.form.fileNameEdit, u'I/n\\v?a*l|i<d> \F[i\l]e" :N+a%me')
+ QtTest.QTest.keyClicks(self.form.file_name_edit, u'I/n\\v?a*l|i<d> \F[i\l]e" :N+a%me')
# THEN: The text in the QLineEdit should be the same as the input string with the invalid characters filtered
# out.
- self.assertEqual(self.form.fileNameEdit.text(), u'Invalid File Name')
+ self.assertEqual(self.form.file_name_edit.text(), u'Invalid File Name')