openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #19059
[Merge] lp:~googol/openlp/clean-up into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/clean-up into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
Tim Bentley (trb143)
For more details, see:
https://code.launchpad.net/~googol/openlp/clean-up/+merge/145963
Hello,
- removed not needed imports
- added missing lines
- use 'isinstance' instead of 'type'
- removed old openlp-remoteclient.py
--
https://code.launchpad.net/~googol/openlp/clean-up/+merge/145963
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2013-01-24 20:08:52 +0000
+++ openlp/core/lib/__init__.py 2013-01-31 20:01:25 +0000
@@ -35,8 +35,10 @@
from PyQt4 import QtCore, QtGui, Qt
+
log = logging.getLogger(__name__)
+
class ServiceItemContext(object):
"""
The context in which a Service Item is being generated
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2013-01-27 20:36:18 +0000
+++ openlp/core/lib/mediamanageritem.py 2013-01-31 20:01:25 +0000
@@ -43,6 +43,7 @@
log = logging.getLogger(__name__)
+
class MediaManagerItem(QtGui.QWidget):
"""
MediaManagerItem is a helper widget for plugins.
=== modified file 'openlp/core/lib/registry.py'
--- openlp/core/lib/registry.py 2013-01-27 20:59:02 +0000
+++ openlp/core/lib/registry.py 2013-01-31 20:01:25 +0000
@@ -87,7 +87,7 @@
Removes the registry value from the list based on the key passed in
(Only valid and active for testing framework)
"""
- if self.running_under_test == False:
+ if not self.running_under_test:
log.error(u'Invalid Method call for key %s' % key)
raise KeyError(u'Invalid Method call for key %s' % key)
return
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2013-01-23 20:29:43 +0000
+++ openlp/core/lib/renderer.py 2013-01-31 20:01:25 +0000
@@ -36,8 +36,10 @@
from openlp.core.lib.theme import ThemeLevel
from openlp.core.ui import MainDisplay
+
log = logging.getLogger(__name__)
+
VERSE = u'The Lord said to {r}Noah{/r}: \n' \
'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n' \
'The Lord said to {g}Noah{/g}:\n' \
@@ -136,8 +138,8 @@
theme_data, main_rect, footer_rect = self._theme_dimensions[theme_name]
# if No file do not update cache
if theme_data.background_filename:
- self.image_manager.addImage(theme_data.background_filename,
- ImageSource.Theme, QtGui.QColor(theme_data.background_border_color))
+ self.image_manager.addImage(
+ theme_data.background_filename, ImageSource.Theme, QtGui.QColor(theme_data.background_border_color))
def pre_render(self, override_theme_data=None):
"""
@@ -238,9 +240,8 @@
serviceItem.raw_footer = FOOTER
# if No file do not update cache
if theme_data.background_filename:
- self.image_manager.addImage(theme_data.background_filename,
- ImageSource.Theme,
- QtGui.QColor(theme_data.background_border_color))
+ self.image_manager.addImage(
+ 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
@@ -343,8 +344,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,11 +369,9 @@
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,
+ 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)
def _set_text_rectangle(self, theme_data, rect_main, rect_footer):
@@ -410,16 +408,14 @@
function show_text(newtext) {
var main = document.getElementById('main');
main.innerHTML = newtext;
- // We need to be sure that the page is loaded, that is why we
- // return the element's height (even though we do not use the
- // returned value).
+ // We need to be sure that the page is loaded, that is why we return the element's height (even though
+ // we do not use the returned value).
return main.offsetHeight;
}
</script><style>*{margin: 0; padding: 0; border: 0;}
#main {position: absolute; top: 0px; %s %s}</style></head><body>
- <div id="main"></div></body></html>""" % \
- (build_lyrics_format_css(theme_data, self.page_width,
- self.page_height), build_lyrics_outline_css(theme_data))
+ <div id="main"></div></body></html>""" % (build_lyrics_format_css(
+ theme_data, self.page_width, self.page_height), build_lyrics_outline_css(theme_data))
self.web.setHtml(html)
self.empty_height = self.web_frame.contentsSize().height()
@@ -444,8 +440,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)
@@ -583,10 +579,8 @@
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:
@@ -661,4 +655,4 @@
self._theme_manager = Registry().get(u'theme_manager')
return self._theme_manager
- theme_manager = property(_get_theme_manager)
\ No newline at end of file
+ theme_manager = property(_get_theme_manager)
=== modified file 'openlp/core/lib/screen.py'
--- openlp/core/lib/screen.py 2013-01-20 11:46:19 +0000
+++ openlp/core/lib/screen.py 2013-01-31 20:01:25 +0000
@@ -235,8 +235,7 @@
y = window.y() + (window.height() / 2)
for screen in self.screen_list:
size = screen[u'size']
- if x >= size.x() and x <= (size.x() + size.width()) and \
- y >= size.y() and y <= (size.y() + size.height()):
+ if x >= size.x() and x <= (size.x() + size.width()) and y >= size.y() and y <= (size.y() + size.height()):
return screen[u'number']
def load_screen_settings(self):
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2013-01-24 20:08:52 +0000
+++ openlp/core/lib/serviceitem.py 2013-01-31 20:01:25 +0000
@@ -41,8 +41,10 @@
from openlp.core.lib import build_icon, clean_tags, expand_tags, translate, ImageSource, Settings, Registry
+
log = logging.getLogger(__name__)
+
class ServiceItemType(object):
"""
Defines the type of service item
@@ -607,7 +609,7 @@
``theme``
The new theme to be replaced in the service item
"""
- self.theme_overwritten = (theme == None)
+ self.theme_overwritten = (theme is None)
self.theme = theme
self._new_item()
self.render()
=== modified file 'openlp/core/lib/settingsmanager.py'
--- openlp/core/lib/settingsmanager.py 2013-01-18 18:50:46 +0000
+++ openlp/core/lib/settingsmanager.py 2013-01-31 20:01:25 +0000
@@ -33,9 +33,6 @@
"""
import os
-from PyQt4 import QtCore
-
-from openlp.core.lib import Settings
from openlp.core.utils import AppLocation
=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py 2013-01-11 19:36:28 +0000
+++ openlp/core/lib/ui.py 2013-01-31 20:01:25 +0000
@@ -67,7 +67,7 @@
parent.addPage(parent.welcomePage)
-def create_button_box(dialog, name, standard_buttons, custom_buttons=[]):
+def create_button_box(dialog, name, standard_buttons, custom_buttons=None):
"""
Creates a QDialogButtonBox with the given buttons. The ``accepted()`` and
``rejected()`` signals of the button box are connected with the dialogs
@@ -88,6 +88,8 @@
QtGui.QAbstractButton it is added with QDialogButtonBox.ActionRole.
Otherwhise the item has to be a tuple of a button and a ButtonRole.
"""
+ if custom_buttons is None:
+ custom_buttons = []
buttons = QtGui.QDialogButtonBox.NoButton
if u'ok' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.Ok
=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py 2013-01-20 12:23:22 +0000
+++ openlp/core/ui/__init__.py 2013-01-31 20:01:25 +0000
@@ -31,7 +31,6 @@
"""
-
class HideMode(object):
"""
This is an enumeration class which specifies the different modes of hiding the display.
=== modified file 'openlp/core/ui/aboutdialog.py'
--- openlp/core/ui/aboutdialog.py 2013-01-27 20:36:18 +0000
+++ openlp/core/ui/aboutdialog.py 2013-01-31 20:01:25 +0000
@@ -260,7 +260,7 @@
u'\n '.join(documentors)))
self.aboutNotebook.setTabText(self.aboutNotebook.indexOf(self.creditsTab),
translate('OpenLP.AboutForm', 'Credits'))
- copyright = translate('OpenLP.AboutForm',
+ openlp_copyright = translate('OpenLP.AboutForm',
'Copyright \xa9 2004-2013 %s\n'
'Portions copyright \xa9 2004-2013 %s') % (u'Raoul Snyman',
u'Tim Bentley, Gerald Britton, Jonathan Corwin, Samuel Findlay, '
@@ -652,7 +652,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, licence, disclaimer, gpltext))
+ self.licenseTextEdit.setPlainText(u'%s\n\n%s\n\n%s\n\n\n%s' % (openlp_copyright, licence, disclaimer, gpltext))
self.aboutNotebook.setTabText(self.aboutNotebook.indexOf(self.licenseTab),
translate('OpenLP.AboutForm', 'License'))
self.volunteerButton.setText(translate('OpenLP.AboutForm', 'Volunteer'))
=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py 2013-01-17 22:14:06 +0000
+++ openlp/core/ui/exceptionform.py 2013-01-31 20:01:25 +0000
@@ -128,9 +128,9 @@
u'pyUNO bridge: %s\n' % UNO_VERSION
if platform.system() == u'Linux':
if os.environ.get(u'KDE_FULL_SESSION') == u'true':
- system = system + u'Desktop: KDE SC\n'
+ system += u'Desktop: KDE SC\n'
elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'):
- system = system + u'Desktop: GNOME\n'
+ system += u'Desktop: GNOME\n'
return (openlp_version, description, traceback, system, libraries)
def onSaveReportButtonClicked(self):
=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py 2013-01-10 23:07:48 +0000
+++ openlp/core/ui/firsttimeform.py 2013-01-31 20:01:25 +0000
@@ -357,7 +357,7 @@
self.max_progress += size
if self.max_progress:
# Add on 2 for plugins status setting plus a "finished" point.
- self.max_progress = self.max_progress + 2
+ self.max_progress += 2
self.progressBar.setValue(0)
self.progressBar.setMinimum(0)
self.progressBar.setMaximum(self.max_progress)
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2013-01-23 21:05:25 +0000
+++ openlp/core/ui/maindisplay.py 2013-01-31 20:01:25 +0000
@@ -32,7 +32,6 @@
"""
import cgi
import logging
-import os
import sys
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
@@ -50,6 +49,7 @@
#http://www.steveheffernan.com/html5-video-player/demo-video-player.html
#http://html5demos.com/two-videos
+
class Display(QtGui.QGraphicsView):
"""
This is a general display screen class. Here the general display settings
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2013-01-30 22:01:52 +0000
+++ openlp/core/ui/mainwindow.py 2013-01-31 20:01:25 +0000
@@ -880,7 +880,7 @@
return
# Make sure it's a .conf file.
if not export_file_name.endswith(u'conf'):
- export_file_name = export_file_name + u'.conf'
+ export_file_name += u'.conf'
temp_file = os.path.join(unicode(gettempdir(),
get_filesystem_encoding()), u'openlp', u'exportConf.tmp')
self.saveSettings()
=== modified file 'openlp/core/ui/media/webkitplayer.py'
--- openlp/core/ui/media/webkitplayer.py 2013-01-23 19:53:02 +0000
+++ openlp/core/ui/media/webkitplayer.py 2013-01-31 20:01:25 +0000
@@ -27,7 +27,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
import logging
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2013-01-30 22:01:52 +0000
+++ openlp/core/ui/servicemanager.py 2013-01-31 20:01:25 +0000
@@ -35,8 +35,6 @@
from tempfile import mkstemp
from datetime import datetime, timedelta
-log = logging.getLogger(__name__)
-
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, ItemCapabilities, SettingsManager, \
@@ -48,6 +46,10 @@
from openlp.core.utils import AppLocation, delete_file, split_filename, format_time
from openlp.core.utils.actions import ActionList, CategoryOrder
+
+log = logging.getLogger(__name__)
+
+
class ServiceManagerList(QtGui.QTreeWidget):
"""
Set up key bindings and mouse behaviour for the service list
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2013-01-31 19:06:53 +0000
+++ openlp/core/ui/slidecontroller.py 2013-01-31 20:01:25 +0000
@@ -332,21 +332,16 @@
self.shortcutTimer = QtCore.QTimer()
self.shortcutTimer.setObjectName(u'shortcutTimer')
self.shortcutTimer.setSingleShot(True)
- shortcuts = [{u'key': u'V', u'configurable': True,
- u'text': translate('OpenLP.SlideController', 'Go to "Verse"')},
- {u'key': u'C', u'configurable': True,
- u'text': translate('OpenLP.SlideController', 'Go to "Chorus"')},
- {u'key': u'B', u'configurable': True,
- u'text': translate('OpenLP.SlideController', 'Go to "Bridge"')},
- {u'key': u'P', u'configurable': True,
- u'text': translate('OpenLP.SlideController',
- 'Go to "Pre-Chorus"')},
- {u'key': u'I', u'configurable': True,
- u'text': translate('OpenLP.SlideController', 'Go to "Intro"')},
- {u'key': u'E', u'configurable': True,
- u'text': translate('OpenLP.SlideController', 'Go to "Ending"')},
- {u'key': u'O', u'configurable': True,
- u'text': translate('OpenLP.SlideController', 'Go to "Other"')}]
+ shortcuts = [
+ {u'key': u'V', u'configurable': True, u'text': translate('OpenLP.SlideController', 'Go to "Verse"')},
+ {u'key': u'C', u'configurable': True, u'text': translate('OpenLP.SlideController', 'Go to "Chorus"')},
+ {u'key': u'B', u'configurable': True, u'text': translate('OpenLP.SlideController', 'Go to "Bridge"')},
+ {u'key': u'P', u'configurable': True, u'text': translate('OpenLP.SlideController',
+ 'Go to "Pre-Chorus"')},
+ {u'key': u'I', u'configurable': True, u'text': translate('OpenLP.SlideController', 'Go to "Intro"')},
+ {u'key': u'E', u'configurable': True, u'text': translate('OpenLP.SlideController', 'Go to "Ending"')},
+ {u'key': u'O', u'configurable': True, u'text': translate('OpenLP.SlideController', 'Go to "Other"')}
+ ]
shortcuts += [{u'key': unicode(number)} for number in range(10)]
self.previewListWidget.addActions([create_action(self,
u'shortcutAction_%s' % s[u'key'], text=s.get(u'text'),
@@ -354,9 +349,7 @@
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)
+ QtCore.QObject.connect(self.shortcutTimer, QtCore.SIGNAL(u'timeout()'), self._slideShortcutActivated)
# Signals
QtCore.QObject.connect(self.previewListWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
if self.isLive:
@@ -787,8 +780,7 @@
if verse_def not in self.slideList:
self.slideList[verse_def] = framenumber
if self.isLive:
- self.songMenu.menu().addAction(verse_def,
- self.onSongBarHandler)
+ self.songMenu.menu().addAction(verse_def, self.onSongBarHandler)
else:
row += 1
self.slideList[unicode(row)] = row - 1
@@ -849,8 +841,7 @@
Utility method to update the selected slide in the list.
"""
if slideno > self.previewListWidget.rowCount():
- self.previewListWidget.selectRow(
- self.previewListWidget.rowCount() - 1)
+ self.previewListWidget.selectRow(self.previewListWidget.rowCount() - 1)
else:
self.__checkUpdateSelectedSlide(slideno)
@@ -1363,4 +1354,4 @@
self._live_controller = Registry().get(u'live_controller')
return self._live_controller
- live_controller = property(_get_live_controller)
\ No newline at end of file
+ live_controller = property(_get_live_controller)
=== modified file 'openlp/core/ui/themelayoutform.py'
--- openlp/core/ui/themelayoutform.py 2012-12-29 20:56:56 +0000
+++ openlp/core/ui/themelayoutform.py 2013-01-31 20:01:25 +0000
@@ -27,7 +27,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtGui, QtCore
+from PyQt4 import QtGui
from themelayoutdialog import Ui_ThemeLayoutDialog
@@ -43,7 +43,6 @@
"""
Run the Dialog with correct heading.
"""
- pixmap = image.scaledToHeight(400, QtCore.Qt.SmoothTransformation)
self.themeDisplayLabel.setPixmap(image)
displayAspectRatio = float(image.width()) / image.height()
self.themeDisplayLabel.setFixedSize(400, 400 / displayAspectRatio )
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2013-01-24 20:08:52 +0000
+++ openlp/core/ui/thememanager.py 2013-01-31 20:01:25 +0000
@@ -45,8 +45,10 @@
from openlp.core.ui import FileRenameForm, ThemeForm
from openlp.core.utils import AppLocation, delete_file, locale_compare, get_filesystem_encoding
+
log = logging.getLogger(__name__)
+
class ThemeManager(QtGui.QWidget):
"""
Manages the orders of Theme.
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py 2013-01-23 21:01:45 +0000
+++ openlp/core/utils/__init__.py 2013-01-31 20:01:25 +0000
@@ -29,7 +29,7 @@
"""
The :mod:`openlp.core.utils` module provides the utility libraries for OpenLP.
"""
-from datetime import datetime, timedelta
+from datetime import datetime
from distutils.version import LooseVersion
import logging
import locale
@@ -53,7 +53,10 @@
import openlp
from openlp.core.lib import Receiver, translate, check_directory_exists
+
log = logging.getLogger(__name__)
+
+
APPLICATION_VERSION = {}
IMAGES_FILTER = None
UNO_CONNECTION_TYPE = u'pipe'
@@ -61,6 +64,7 @@
CONTROL_CHARS = re.compile(r'[\x00-\x1F\x7F-\x9F]', re.UNICODE)
INVALID_FILE_CHARS = re.compile(r'[\\/:\*\?"<>\|\+\[\]%]', re.UNICODE)
+
class VersionThread(QtCore.QThread):
"""
A special Qt thread class to fetch the version of OpenLP from the website.
=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py 2013-01-23 21:05:25 +0000
+++ openlp/plugins/alerts/alertsplugin.py 2013-01-31 20:01:25 +0000
@@ -29,7 +29,7 @@
import logging
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings
from openlp.core.lib.db import Manager
=== modified file 'openlp/plugins/alerts/lib/alertstab.py'
--- openlp/plugins/alerts/lib/alertstab.py 2013-01-11 00:19:11 +0000
+++ openlp/plugins/alerts/lib/alertstab.py 2013-01-31 20:01:25 +0000
@@ -30,7 +30,6 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate, Receiver, Settings, UiStrings
-from openlp.core.ui import AlertLocation
from openlp.core.lib.ui import create_valign_selection_widgets
class AlertsTab(SettingsTab):
=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py 2013-01-23 21:05:25 +0000
+++ openlp/plugins/bibles/bibleplugin.py 2013-01-31 20:01:25 +0000
@@ -31,7 +31,7 @@
from PyQt4 import QtGui
-from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings
+from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.ui import create_action, UiStrings
from openlp.core.utils.actions import ActionList
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem, LayoutStyle, DisplayStyle, \
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py 2013-01-11 00:35:00 +0000
+++ openlp/plugins/bibles/lib/http.py 2013-01-31 20:01:25 +0000
@@ -418,20 +418,18 @@
for part in verse.contents:
Receiver.send_message(u'openlp_process_events')
if isinstance(part, NavigableString):
- verse_text = verse_text + part
- elif part and part.attrMap and \
- (part.attrMap[u'class'] == u'WordsOfChrist' or \
- part.attrMap[u'class'] == u'strongs'):
+ verse_text += part
+ elif part and part.attrMap and (part.attrMap[u'class'] == u'WordsOfChrist' or
+ part.attrMap[u'class'] == u'strongs'):
for subpart in part.contents:
Receiver.send_message(u'openlp_process_events')
if isinstance(subpart, NavigableString):
- verse_text = verse_text + subpart
- elif subpart and subpart.attrMap and \
- subpart.attrMap[u'class'] == u'strongs':
+ verse_text += subpart
+ elif subpart and subpart.attrMap and subpart.attrMap[u'class'] == u'strongs':
for subsub in subpart.contents:
Receiver.send_message(u'openlp_process_events')
if isinstance(subsub, NavigableString):
- verse_text = verse_text + subsub
+ verse_text += subsub
Receiver.send_message(u'openlp_process_events')
# Fix up leading and trailing spaces, multiple spaces, and spaces
# between text and , and .
=== modified file 'openlp/plugins/bibles/lib/upgrade.py'
--- openlp/plugins/bibles/lib/upgrade.py 2013-01-01 16:33:41 +0000
+++ openlp/plugins/bibles/lib/upgrade.py 2013-01-31 20:01:25 +0000
@@ -62,11 +62,7 @@
# Copy "Version" to "name" ("version" used by upgrade system)
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
session.execute(insert(metadata_table).values(
- key=u'name',
- value=select(
- [metadata_table.c.value],
- metadata_table.c.key == u'Version'
- ).as_scalar()
+ key=u'name', value=select([metadata_table.c.value], metadata_table.c.key == u'Version').as_scalar()
))
# Copy "Copyright" to "copyright"
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
=== modified file 'openlp/plugins/bibles/lib/versereferencelist.py'
--- openlp/plugins/bibles/lib/versereferencelist.py 2013-01-01 16:33:41 +0000
+++ openlp/plugins/bibles/lib/versereferencelist.py 2013-01-31 20:01:25 +0000
@@ -72,12 +72,12 @@
prev = index - 1
if self.verse_list[prev][u'version'] != verse[u'version']:
result = u'%s (%s)' % (result, self.verse_list[prev][u'version'])
- result = result + u', '
+ result += u', '
if self.verse_list[prev][u'book'] != verse[u'book']:
result = u'%s%s %s:' % (result, verse[u'book'], verse[u'chapter'])
elif self.verse_list[prev][u'chapter'] != verse[u'chapter']:
result = u'%s%s:' % (result, verse[u'chapter'])
- result = result + str(verse[u'start'])
+ result += str(verse[u'start'])
if verse[u'start'] != verse[u'end']:
result = u'%s-%s' % (result, verse[u'end'])
if len(self.version_list) > 1:
@@ -89,8 +89,8 @@
for index, version in enumerate(self.version_list):
if index > 0:
if result[-1] not in [u';', u',', u'.']:
- result = result + u';'
- result = result + u' '
+ result += u';'
+ result += u' '
result = u'%s%s, %s' % (result, version[u'version'], version[u'copyright'])
if version[u'permission'].strip():
result = result + u', ' + version[u'permission']
=== modified file 'openlp/plugins/custom/forms/editcustomslidedialog.py'
--- openlp/plugins/custom/forms/editcustomslidedialog.py 2013-01-27 20:36:18 +0000
+++ openlp/plugins/custom/forms/editcustomslidedialog.py 2013-01-31 20:01:25 +0000
@@ -29,7 +29,7 @@
from PyQt4 import QtGui
-from openlp.core.lib import translate, SpellTextEdit, build_icon, UiStrings
+from openlp.core.lib import translate, SpellTextEdit, UiStrings
from openlp.core.lib.ui import create_button, create_button_box
class Ui_CustomSlideEditDialog(object):
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2013-01-25 20:50:18 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2013-01-31 20:01:25 +0000
@@ -32,7 +32,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, SettingsManager, translate, \
+from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, translate, \
check_item_selected, Receiver, MediaType, ServiceItem, ServiceItemContext, Settings, UiStrings, \
check_directory_exists
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
=== modified file 'openlp/plugins/media/lib/mediatab.py'
--- openlp/plugins/media/lib/mediatab.py 2013-01-27 07:36:04 +0000
+++ openlp/plugins/media/lib/mediatab.py 2013-01-31 20:01:25 +0000
@@ -27,11 +27,9 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import Receiver, Settings, SettingsTab, translate, UiStrings
-from openlp.core.lib.ui import create_button
-from openlp.core.ui.media import get_media_players, set_media_players
class MediaQCheckBox(QtGui.QCheckBox):
"""
=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
--- openlp/plugins/presentations/lib/impresscontroller.py 2013-01-05 22:17:30 +0000
+++ openlp/plugins/presentations/lib/impresscontroller.py 2013-01-31 20:01:25 +0000
@@ -189,7 +189,7 @@
while list.hasMoreElements():
doc = list.nextElement()
if doc.getImplementationName() != u'com.sun.star.comp.framework.BackingComp':
- cnt = cnt + 1
+ cnt += 1
if cnt > 0:
log.debug(u'OpenOffice not terminated as docs are still open')
else:
@@ -399,7 +399,7 @@
i = 1
while not self.control and i < 150:
time.sleep(0.1)
- i = i + 1
+ i += 1
self.control = self.presentation.getController()
else:
self.control.activate()
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2013-01-27 07:36:04 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2013-01-31 20:01:25 +0000
@@ -32,7 +32,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, translate, check_item_selected, Receiver, \
+from openlp.core.lib import MediaManagerItem, build_icon, translate, check_item_selected, Receiver, \
ItemCapabilities, create_thumb, validate_thumb, ServiceItemContext, Settings, UiStrings
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
from openlp.core.utils import locale_compare
@@ -271,7 +271,7 @@
if img:
while img:
service_item.add_from_command(path, name, img)
- i = i + 1
+ i += 1
img = doc.get_thumbnail_path(i, True)
doc.close_presentation()
return True
=== modified file 'openlp/plugins/presentations/lib/messagelistener.py'
--- openlp/plugins/presentations/lib/messagelistener.py 2013-01-18 23:31:02 +0000
+++ openlp/plugins/presentations/lib/messagelistener.py 2013-01-31 20:01:25 +0000
@@ -177,7 +177,7 @@
if not self.doc.is_active():
return
if self.doc.slidenumber < self.doc.get_slide_count():
- self.doc.slidenumber = self.doc.slidenumber + 1
+ self.doc.slidenumber += 1
self.poll()
return
if not self.activate():
@@ -203,7 +203,7 @@
if not self.doc.is_active():
return
if self.doc.slidenumber > 1:
- self.doc.slidenumber = self.doc.slidenumber - 1
+ self.doc.slidenumber -= 1
self.poll()
return
if not self.activate():
=== modified file 'openlp/plugins/presentations/lib/pptviewlib/ppttest.py'
--- openlp/plugins/presentations/lib/pptviewlib/ppttest.py 2012-12-29 20:56:56 +0000
+++ openlp/plugins/presentations/lib/pptviewlib/ppttest.py 2013-01-31 20:01:25 +0000
@@ -71,35 +71,35 @@
row = 0
grid.addWidget(folder_label, 0, 0)
grid.addWidget(self.folderEdit, 0, 1)
- row = row + 1
+ row += 1
grid.addWidget(x_label, row, 0)
grid.addWidget(self.xEdit, row, 1)
grid.addWidget(y_label, row, 2)
grid.addWidget(self.yEdit, row, 3)
- row = row + 1
+ row += 1
grid.addWidget(width_label, row, 0)
grid.addWidget(self.widthEdit, row, 1)
grid.addWidget(height_label, row, 2)
grid.addWidget(self.heightEdit, row, 3)
- row = row + 1
+ row += 1
grid.addWidget(ppt_label, row, 0)
grid.addWidget(self.pptEdit, row, 1)
grid.addWidget(ppt_dlg_btn, row, 2)
grid.addWidget(ppt_btn, row, 3)
- row = row + 1
+ row += 1
grid.addWidget(slide_label, row, 0)
grid.addWidget(self.slideEdit, row, 1)
grid.addWidget(slide_btn, row, 2)
- row = row + 1
+ row += 1
grid.addWidget(prev, row, 0)
grid.addWidget(next, row, 1)
- row = row + 1
+ row += 1
grid.addWidget(blank, row, 0)
grid.addWidget(unblank, row, 1)
- row = row + 1
+ row += 1
grid.addWidget(restart, row, 0)
grid.addWidget(close, row, 1)
- row = row + 1
+ row += 1
grid.addWidget(stop, row, 0)
grid.addWidget(resume, row, 1)
self.connect(ppt_btn, QtCore.SIGNAL(u'clicked()'), self.openClick)
=== modified file 'openlp/plugins/presentations/lib/presentationtab.py'
--- openlp/plugins/presentations/lib/presentationtab.py 2013-01-27 07:36:04 +0000
+++ openlp/plugins/presentations/lib/presentationtab.py 2013-01-31 20:01:25 +0000
@@ -27,7 +27,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import Receiver, Settings, SettingsTab, translate, UiStrings
=== modified file 'openlp/plugins/remotes/lib/httpserver.py'
--- openlp/plugins/remotes/lib/httpserver.py 2013-01-23 19:53:02 +0000
+++ openlp/plugins/remotes/lib/httpserver.py 2013-01-31 20:01:25 +0000
@@ -138,7 +138,9 @@
'Content-Type': 'text/html; charset="utf-8"\r\n'
}
- def __init__(self, content='', headers={}, code=None):
+ def __init__(self, content='', headers=None, code=None):
+ if headers is None:
+ headers = {}
self.content = content
for key, value in headers.iteritems():
self.headers[key] = value
=== modified file 'openlp/plugins/remotes/lib/remotetab.py'
--- openlp/plugins/remotes/lib/remotetab.py 2013-01-21 23:42:35 +0000
+++ openlp/plugins/remotes/lib/remotetab.py 2013-01-31 20:01:25 +0000
@@ -133,7 +133,7 @@
ipAddress = self.addressEdit.text()
url = u'http://%s:%s/' % (ipAddress, self.portSpinBox.value())
self.remoteUrl.setText(u'<a href="%s">%s</a>' % (url, url))
- url = url + u'stage'
+ url += u'stage'
self.stageUrl.setText(u'<a href="%s">%s</a>' % (url, url))
def load(self):
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2013-01-27 20:36:18 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2013-01-31 20:01:25 +0000
@@ -40,7 +40,7 @@
from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, create_separated_list, \
check_directory_exists, Registry, UiStrings
-from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, critical_error_message_box, \
+from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, \
find_and_set_in_combo_box
from openlp.core.utils import AppLocation
from openlp.plugins.songs.forms import EditVerseForm, MediaFilesForm
=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py 2013-01-05 22:17:30 +0000
+++ openlp/plugins/songs/forms/editverseform.py 2013-01-31 20:01:25 +0000
@@ -32,8 +32,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib.ui import critical_error_message_box
-from openlp.plugins.songs.lib import VerseType, translate
+from openlp.plugins.songs.lib import VerseType
from editversedialog import Ui_EditVerseDialog
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py 2013-01-23 20:29:43 +0000
+++ openlp/plugins/songs/forms/songimportform.py 2013-01-31 20:01:25 +0000
@@ -35,7 +35,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Receiver, Settings, SettingsManager, translate, UiStrings
+from openlp.core.lib import Receiver, Settings, translate, UiStrings
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.plugins.songs.lib.importer import SongFormat, SongFormatSelect
=== modified file 'openlp/plugins/songs/lib/easyslidesimport.py'
--- openlp/plugins/songs/lib/easyslidesimport.py 2013-01-06 17:25:49 +0000
+++ openlp/plugins/songs/lib/easyslidesimport.py 2013-01-31 20:01:25 +0000
@@ -162,7 +162,7 @@
region = self._extractRegion(line)
regionlines[region] = 1 + regionlines.get(region, 0)
elif line[0] == u'[':
- separatorlines = separatorlines + 1
+ separatorlines += 1
# if the song has separators
separators = (separatorlines > 0)
# the number of different regions in song - 1
@@ -200,7 +200,7 @@
# separators are used, so empty line means slide break
# inside verse
if self._listHas(verses, [reg, vt, vn, inst]):
- inst = inst + 1
+ inst += 1
else:
# separators are not used, so empty line starts a new verse
vt = u'V'
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2013-01-27 20:36:18 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2013-01-31 20:01:25 +0000
@@ -439,7 +439,7 @@
if not order:
break
for verse in verse_list:
- if verse[0][u'type'][0].lower() == order[0] and (verse[0][u'label'].lower() == order[1:] or \
+ if verse[0][u'type'][0].lower() == order[0] and (verse[0][u'label'].lower() == order[1:] or
not order[1:]):
if verse_tags_translated:
verse_index = VerseType.from_translated_tag(verse[0][u'type'])
=== modified file 'openlp/plugins/songs/lib/olp1import.py'
--- openlp/plugins/songs/lib/olp1import.py 2013-01-06 17:25:49 +0000
+++ openlp/plugins/songs/lib/olp1import.py 2013-01-31 20:01:25 +0000
@@ -95,9 +95,9 @@
cursor.execute(u'-- types int, unicode')
cursor.execute(u'SELECT trackid, fulltrackname FROM tracks')
tracks = cursor.fetchall()
+ themes = {}
if db_has_themes:
# "cache" our list of themes.
- themes = {}
cursor.execute(u'-- types int, unicode')
cursor.execute(u'SELECT settingsid, settingsname FROM settings')
for theme_id, theme_name in cursor.fetchall():
@@ -105,8 +105,7 @@
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')
+ cursor.execute(u'SELECT songid, songtitle, lyrics || \'\' AS lyrics, copyrightinfo FROM songs')
songs = cursor.fetchall()
self.importWizard.progressBar.setMaximum(len(songs))
for song in songs:
@@ -119,8 +118,7 @@
self.addCopyright(song[3])
if db_has_themes:
cursor.execute(u'-- types int')
- cursor.execute(
- u'SELECT settingsid FROM songs WHERE songid = %s' % song_id)
+ cursor.execute(u'SELECT settingsid FROM songs WHERE songid = %s' % song_id)
theme_id = cursor.fetchone()[0]
self.themeName = themes.get(theme_id, u'')
verses = lyrics.split(u'\n\n')
@@ -128,8 +126,7 @@
if verse.strip():
self.addVerse(verse.strip())
cursor.execute(u'-- types int')
- cursor.execute(u'SELECT authorid FROM songauthors '
- u'WHERE songid = %s' % song_id)
+ cursor.execute(u'SELECT authorid FROM songauthors WHERE songid = %s' % song_id)
author_ids = cursor.fetchall()
for author_id in author_ids:
if self.stopImportFlag:
=== modified file 'openlp/plugins/songs/lib/songshowplusimport.py'
--- openlp/plugins/songs/lib/songshowplusimport.py 2013-01-06 17:25:49 +0000
+++ openlp/plugins/songs/lib/songshowplusimport.py 2013-01-31 20:01:25 +0000
@@ -109,7 +109,6 @@
return
self.sspVerseOrderList = []
other_count = 0
- other_list = {}
file_name = os.path.split(file)[1]
self.importWizard.incrementProgressBar(WizardStrings.ImportingType % file_name, 0)
song_data = open(file, 'rb')
@@ -203,7 +202,7 @@
if verse_name not in self.otherList:
if ignore_unique:
return None
- self.otherCount = self.otherCount + 1
+ self.otherCount += 1
self.otherList[verse_name] = str(self.otherCount)
verse_tag = VerseType.Tags[VerseType.Other]
verse_number = self.otherList[verse_name]
=== modified file 'openlp/plugins/songs/lib/sundayplusimport.py'
--- openlp/plugins/songs/lib/sundayplusimport.py 2013-01-06 17:25:49 +0000
+++ openlp/plugins/songs/lib/sundayplusimport.py 2013-01-31 20:01:25 +0000
@@ -121,7 +121,7 @@
end = data.find(')', i) + 1
value = data[i:end]
# If we are in the main group.
- if cell == False:
+ if not cell:
if name == 'title':
self.title = self.decode(self.unescape(value))
elif name == 'Author':
=== modified file 'openlp/plugins/songs/lib/test/test_import_file.py'
--- openlp/plugins/songs/lib/test/test_import_file.py 2012-12-29 20:56:56 +0000
+++ openlp/plugins/songs/lib/test/test_import_file.py 2013-01-31 20:01:25 +0000
@@ -36,7 +36,7 @@
LOG_FILENAME = 'test_import_file.log'
logging.basicConfig(filename=LOG_FILENAME,level=logging.INFO)
-from test_opensongimport import wizard_stub, progbar_stub
+from test_opensongimport import wizard_stub
def test(filenames):
manager = Manager(u'songs', init_schema)
=== modified file 'openlp/plugins/songs/lib/test/test_importing_lots.py'
--- openlp/plugins/songs/lib/test/test_importing_lots.py 2012-12-29 20:56:56 +0000
+++ openlp/plugins/songs/lib/test/test_importing_lots.py 2013-01-31 20:01:25 +0000
@@ -30,18 +30,14 @@
from openlp.plugins.songs.lib.opensongimport import OpenSongImport
from openlp.plugins.songs.lib.db import init_schema
from openlp.core.lib.db import Manager
-from glob import glob
-from zipfile import ZipFile
import os
-from traceback import print_exc
-import sys
import codecs
import logging
LOG_FILENAME = 'import.log'
logging.basicConfig(filename=LOG_FILENAME,level=logging.INFO)
-from test_opensongimport import wizard_stub, progbar_stub
+from test_opensongimport import wizard_stub
# Useful test function for importing a variety of different files
# Uncomment below depending on what problem trying to make occur!
=== modified file 'scripts/check_dependencies.py'
--- scripts/check_dependencies.py 2013-01-07 09:18:29 +0000
+++ scripts/check_dependencies.py 2013-01-31 20:01:25 +0000
@@ -89,10 +89,11 @@
w = sys.stdout.write
+
def check_vers(version, required, text):
- if type(version) is not str:
+ if not isinstance(version, str):
version = '.'.join(map(str, version))
- if type(required) is not str:
+ if not isinstance(required, str):
required = '.'.join(map(str, required))
w(' %s >= %s ... ' % (text, required))
if LooseVersion(version) >= LooseVersion(required):
@@ -102,13 +103,16 @@
w('FAIL' + os.linesep)
return False
+
def print_vers_fail(required, text):
print(' %s >= %s ... FAIL' % (text, required))
+
def verify_python():
if not check_vers(list(sys.version_info), VERS['Python'], text='Python'):
exit(1)
+
def verify_versions():
print('Verifying version of modules...')
try:
@@ -129,6 +133,7 @@
except ImportError:
print_vers_fail(VERS['enchant'], 'enchant')
+
def check_module(mod, text='', indent=' '):
space = (30 - len(mod) - len(text)) * ' '
w(indent + '%s%s... ' % (mod, text) + space)
@@ -139,6 +144,7 @@
w('FAIL')
w(os.linesep)
+
def verify_pyenchant():
w('Enchant (spell checker)... ')
try:
@@ -151,20 +157,20 @@
except ImportError:
w('FAIL' + os.linesep)
+
def verify_pyqt():
w('Qt4 image formats... ')
try:
from PyQt4 import QtGui
- read_f = ', '.join([unicode(format).lower()
- for format in QtGui.QImageReader.supportedImageFormats()])
- write_f = ', '.join([unicode(format).lower()
- for format in QtGui.QImageWriter.supportedImageFormats()])
+ read_f = ', '.join([unicode(format).lower() for format in QtGui.QImageReader.supportedImageFormats()])
+ write_f = ', '.join([unicode(format).lower() for format in QtGui.QImageWriter.supportedImageFormats()])
w(os.linesep)
print(' read: %s' % read_f)
print(' write: %s' % write_f)
except ImportError:
w('FAIL' + os.linesep)
+
def main():
verify_python()
=== removed file 'scripts/openlp-remoteclient.py'
--- scripts/openlp-remoteclient.py 2012-12-29 20:56:56 +0000
+++ scripts/openlp-remoteclient.py 1970-01-01 00:00:00 +0000
@@ -1,70 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2013 Raoul Snyman #
-# Portions copyright (c) 2008-2013 Tim Bentley, Gerald Britton, Jonathan #
-# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
-# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
-# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
-# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
-# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
-# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-import urllib
-import sys
-from optparse import OptionParser
-
-def sendData(options):
- addr = 'http://%s:%s/send/%s?q=%s' % (options.address, options.port,
- options.event, options.message)
- try:
- urllib.urlopen(addr)
- print u'Message sent ', addr
- except:
- print u'Error thrown ', sys.exc_info()[1]
-
-def main():
- usage = "usage: %prog [-a address] [-p port] [-e event] [-m message]"
- parser = OptionParser(usage=usage)
- parser.add_option("-p", "--port", default=4316,
- help="IP Port number %default ")
- parser.add_option("-a", "--address",
- help="Recipient address ",
- default="localhost")
- parser.add_option("-e", "--event",
- help="Action to be performed",
- default="alerts_text")
- parser.add_option("-m", "--message",
- help="Message to be passed for the action",
- default="")
-
- (options, args) = parser.parse_args()
- if args:
- parser.print_help()
- parser.error("incorrect number of arguments")
- elif options.address is None:
- parser.print_help()
- parser.error("IP address missing")
- else:
- sendData(options)
-
-if __name__ == u'__main__':
- main()
=== modified file 'scripts/translation_utils.py'
--- scripts/translation_utils.py 2012-12-29 20:56:56 +0000
+++ scripts/translation_utils.py 2013-01-31 20:01:25 +0000
@@ -53,8 +53,6 @@
"""
import os
import urllib2
-import re
-from shutil import copy
from getpass import getpass
import base64
import json
@@ -62,7 +60,6 @@
from optparse import OptionParser
from PyQt4 import QtCore
-from BeautifulSoup import BeautifulSoup
SERVER_URL = u'http://www.transifex.net/api/2/project/openlp/'
IGNORED_PATHS = [u'scripts']
@@ -73,6 +70,7 @@
username = ''
password = ''
+
class Command(object):
"""
Provide an enumeration of commands.
@@ -83,6 +81,7 @@
Update = 4
Generate = 5
+
class CommandStack(object):
"""
This class provides an iterable stack.
@@ -137,6 +136,7 @@
results.append(str((item[u'command'], )))
return u'[%s]' % u', '.join(results)
+
def print_quiet(text, linefeed=True):
"""
This method checks to see if we are in quiet mode, and if not prints
@@ -152,6 +152,7 @@
else:
print text,
+
def print_verbose(text):
"""
This method checks to see if we are in verbose mode, and if so prints
@@ -164,6 +165,7 @@
if not quiet_mode and verbose_mode:
print u' %s' % text
+
def run(command):
"""
This method runs an external application.
@@ -179,6 +181,7 @@
print_verbose(u'Error(s):\n%s' % process.readAllStandardError())
print_verbose(u'Output:\n%s' % process.readAllStandardOutput())
+
def download_translations():
"""
This method downloads the translation files from the Pootle server.
@@ -220,6 +223,7 @@
print_quiet(u' Done.')
return True
+
def prepare_project():
"""
This method creates the project file needed to update the translation files
@@ -261,11 +265,12 @@
print_verbose(u'Parsing "%s"' % line)
lines.append(u'TRANSLATIONS += %s' % line)
lines.sort()
- file = open(os.path.join(start_dir, u'openlp.pro'), u'w')
- file.write(u'\n'.join(lines).encode('utf8'))
- file.close()
+ pro_file = open(os.path.join(start_dir, u'openlp.pro'), u'w')
+ pro_file.write(u'\n'.join(lines).encode('utf8'))
+ pro_file.close()
print_quiet(u' Done.')
+
def update_translations():
print_quiet(u'Update the translation files')
if not os.path.exists(os.path.join(os.path.abspath(u'..'), u'openlp.pro')):
@@ -277,6 +282,7 @@
run(u'pylupdate4 -verbose -noobsolete openlp.pro')
os.chdir(os.path.abspath(u'scripts'))
+
def generate_binaries():
print_quiet(u'Generate the related *.qm files')
if not os.path.exists(os.path.join(os.path.abspath(u'..'), u'openlp.pro')):
@@ -302,6 +308,7 @@
'resource/ents/')
print_quiet(u'Opening browser to OpenLP project...')
+
def process_stack(command_stack):
"""
This method looks at the commands in the command stack, and processes them
@@ -329,6 +336,7 @@
else:
print_quiet(u'No commands to process.')
+
def main():
global verbose_mode, quiet_mode, username, password
# Set up command line options.
=== modified file 'tests/functional/openlp_core_ui/test_starttimedialog.py'
--- tests/functional/openlp_core_ui/test_starttimedialog.py 2013-01-30 18:55:46 +0000
+++ tests/functional/openlp_core_ui/test_starttimedialog.py 2013-01-31 20:01:25 +0000
@@ -1,7 +1,6 @@
"""
Package to test the openlp.core.ui package.
"""
-import sys
from unittest import TestCase
from mock import MagicMock, patch
=== removed file 'tests/test_app.py'
--- tests/test_app.py 2012-12-08 08:40:41 +0000
+++ tests/test_app.py 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2011 Raoul Snyman #
-# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan #
-# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
-# Meinert Jordan, Armin Köhler, Edwin Lunando, Joshua Miller, Stevan Pettit, #
-# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, #
-# Simon Scudder, Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon #
-# Tibble, Dave Warnock, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-from openlp.core import OpenLP
-from openlp.core.ui.mainwindow import MainWindow
-
-
-def test_start_app(openlpapp):
- assert type(openlpapp) == OpenLP
- assert type(openlpapp.mainWindow) == MainWindow
- assert unicode(openlpapp.mainWindow.windowTitle()) == u'OpenLP 2.1'
Follow ups