openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #01133
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Truth test and C style cleanups
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/21003
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2010-01-22 18:59:36 +0000
+++ openlp/core/lib/__init__.py 2010-03-09 21:54:17 +0000
@@ -146,7 +146,7 @@
preview = QtGui.QImage(image)
preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation)
- realw = preview.width();
+ realw = preview.width()
realh = preview.height()
# and move it to the centre of the preview space
newImage = QtGui.QImage(width, height, QtGui.QImage.Format_ARGB32_Premultiplied)
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2010-02-27 15:31:23 +0000
+++ openlp/core/lib/mediamanageritem.py 2010-03-09 21:54:17 +0000
@@ -314,7 +314,7 @@
self, self.OnNewPrompt,
self.parent.config.get_last_dir(), self.OnNewFileMasks)
log.info(u'New files(s)%s', unicode(files))
- if len(files) > 0:
+ if files:
self.loadList(files)
dir, filename = os.path.split(unicode(files[0]))
self.parent.config.set_last_dir(dir)
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2010-02-27 15:31:23 +0000
+++ openlp/core/lib/renderer.py 2010-03-09 21:54:17 +0000
@@ -174,7 +174,7 @@
#Must be a blank line so keep it.
if len(line) == 0:
line = u' '
- while len(line) > 0:
+ while line:
pos = char_per_line
split_text = line[:pos]
#line needs splitting
@@ -199,7 +199,7 @@
split_lines.append(split_text)
line = line[pos:].lstrip()
#if we have more text add up to 10 spaces on the front.
- if len(line) > 0 and self._theme.font_main_indentation > 0:
+ if line and self._theme.font_main_indentation > 0:
line = u'%s%s' % \
(u' '[:int(self._theme.font_main_indentation)], line)
#Text fits in a line now
@@ -210,7 +210,7 @@
len(page) == page_length:
split_pages.append(page)
page = []
- if len(page) > 0 and page != u' ':
+ if page and page != u' ':
split_pages.append(page)
return split_pages
@@ -406,8 +406,8 @@
Defaults to *False*. Whether or not this is a live screen.
"""
x, y = tlcorner
- maxx = self._rect.width();
- maxy = self._rect.height();
+ maxx = self._rect.width()
+ maxy = self._rect.height()
lines = []
lines.append(line)
startx = x
@@ -415,11 +415,11 @@
rightextent = None
self.painter = QtGui.QPainter()
self.painter.begin(self._frame)
- self.painter.setRenderHint(QtGui.QPainter.Antialiasing);
+ self.painter.setRenderHint(QtGui.QPainter.Antialiasing)
if self._theme.display_slideTransition:
self.painter2 = QtGui.QPainter()
self.painter2.begin(self._frameOp)
- self.painter2.setRenderHint(QtGui.QPainter.Antialiasing);
+ self.painter2.setRenderHint(QtGui.QPainter.Antialiasing)
self.painter2.setOpacity(0.7)
# dont allow alignment messing with footers
if footer:
@@ -458,7 +458,7 @@
x = maxx - w
# centre
elif align == 2:
- x = (maxx - w) / 2;
+ x = (maxx - w) / 2
rightextent = x + w
if live:
# now draw the text, and any outlines/shadows
=== modified file 'openlp/core/lib/themexmlhandler.py'
--- openlp/core/lib/themexmlhandler.py 2009-12-31 12:52:01 +0000
+++ openlp/core/lib/themexmlhandler.py 2010-03-09 21:54:17 +0000
@@ -171,7 +171,8 @@
self.child_element(background, u'filename', filename)
def add_font(self, name, color, proportion, override, fonttype=u'main',
- weight=u'Normal', italics=u'False', indentation=0, xpos=0, ypos=0, width=0, height=0):
+ weight=u'Normal', italics=u'False', indentation=0, xpos=0, ypos=0,
+ width=0, height=0):
"""
Add a Font.
@@ -363,14 +364,14 @@
master = u''
for element in iter:
element.text = unicode(element.text).decode('unicode-escape')
- if len(element.getchildren()) > 0:
+ if element.getchildren():
master = element.tag + u'_'
else:
#background transparent tags have no children so special case
if element.tag == u'background':
for e in element.attrib.iteritems():
setattr(self, element.tag + u'_' + e[0], e[1])
- if len(element.attrib) > 0:
+ if element.attrib:
for e in element.attrib.iteritems():
if master == u'font_' and e[0] == u'type':
master += e[1] + u'_'
@@ -402,4 +403,4 @@
for key in dir(self):
if key[0:1] != u'_':
theme_strings.append(u'%30s: %s' % (key, getattr(self, key)))
- return u'\n'.join(theme_strings)
\ No newline at end of file
+ return u'\n'.join(theme_strings)
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2010-03-02 19:44:55 +0000
+++ openlp/core/ui/maindisplay.py 2010-03-09 21:54:17 +0000
@@ -65,7 +65,7 @@
Receiver.send_message(u'live_slidecontroller_last')
event.accept()
elif event.key() in self.hotkey_map:
- Receiver.send_message(self.hotkey_map[event.key()]);
+ Receiver.send_message(self.hotkey_map[event.key()])
event.accept()
elif event.key() == QtCore.Qt.Key_Escape:
self.resetDisplay()
=== modified file 'openlp/core/ui/screen.py'
--- openlp/core/ui/screen.py 2010-02-27 15:31:23 +0000
+++ openlp/core/ui/screen.py 2010-03-09 21:54:17 +0000
@@ -40,7 +40,7 @@
self.current_display = 0
def add_screen(self, screen):
- if screen[u'primary'] == True:
+ if screen[u'primary']:
self.current = screen
self.screen_list.append(screen)
self.count += 1
@@ -70,4 +70,3 @@
# if scrn[u'number'] == screenNumber:
# self.screen = scrn
# break
-
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2010-03-08 19:55:13 +0000
+++ openlp/core/ui/servicemanager.py 2010-03-09 21:54:17 +0000
@@ -33,8 +33,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
- contextMenuAction, contextMenuSeparator, contextMenu, Receiver, \
- contextMenu, str_to_bool, build_icon
+ contextMenuAction, Receiver, str_to_bool, build_icon
from openlp.core.ui import ServiceItemNoteForm
class ServiceManagerList(QtGui.QTreeWidget):
@@ -433,7 +432,7 @@
for itemcount, item in enumerate(self.serviceItems):
serviceitem = item[u'service_item']
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
- if len(serviceitem.notes) > 0:
+ if serviceitem.notes:
icon = QtGui.QImage(serviceitem.icon)
icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation)
@@ -608,7 +607,7 @@
def regenerateServiceItems(self):
#force reset of renderer as theme data has changed
self.parent.RenderManager.themedata = None
- if len(self.serviceItems) > 0:
+ if self.serviceItems:
tempServiceItems = self.serviceItems
self.ServiceManagerList.clear()
self.serviceItems = []
@@ -670,7 +669,7 @@
if str_to_bool(PluginConfig(u'General').
get_config(u'auto preview', u'False')):
item += 1
- if len(self.serviceItems) > 0 and item < len(self.serviceItems) and \
+ if self.serviceItems and item < len(self.serviceItems) and \
self.serviceItems[item][u'service_item'].autoPreviewAllowed:
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], 0)
@@ -732,7 +731,7 @@
if plugin == u'ServiceManager':
startpos, startCount = self.findServiceItem()
item = self.ServiceManagerList.itemAt(event.pos())
- if item == None:
+ if item is None:
endpos = len(self.serviceItems)
else:
parentitem = item.parent()
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2010-03-03 17:48:37 +0000
+++ openlp/core/ui/slidecontroller.py 2010-03-09 21:54:17 +0000
@@ -31,7 +31,7 @@
from PyQt4.phonon import Phonon
from openlp.core.lib import OpenLPToolbar, Receiver, str_to_bool, \
-PluginConfig, resize_image
+ PluginConfig, resize_image
log = logging.getLogger(__name__)
@@ -65,7 +65,7 @@
self.parent.onSlideSelectedLast()
event.accept()
elif event.key() in self.hotkey_map and self.parent.isLive:
- Receiver.send_message(self.hotkey_map[event.key()]);
+ Receiver.send_message(self.hotkey_map[event.key()])
event.accept()
event.ignore()
else:
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2010-03-04 19:03:09 +0000
+++ openlp/core/ui/thememanager.py 2010-03-09 21:54:17 +0000
@@ -246,7 +246,7 @@
self, self.trUtf8('Select Theme Import File'),
self.config.get_last_dir(), u'Theme (*.*)')
log.info(u'New Themes %s', unicode(files))
- if len(files) > 0:
+ if files:
for file in files:
self.config.set_last_dir(unicode(file))
self.unzipTheme(file, self.path)
=== modified file 'openlp/migration/display.py'
--- openlp/migration/display.py 2010-02-27 15:31:23 +0000
+++ openlp/migration/display.py 2010-03-09 21:54:17 +0000
@@ -32,11 +32,11 @@
@staticmethod
def output(string):
- log.debug(string);
- print (string)
+ log.debug(string)
+ #print (string)
@staticmethod
def sub_output(string):
if not string is None:
- log.debug(u' '+string);
- print (u' '+string)
+ log.debug(u' '+string)
+ #print (u' '+string)
=== modified file 'openlp/migration/migratebibles.py'
--- openlp/migration/migratebibles.py 2009-12-31 12:52:01 +0000
+++ openlp/migration/migratebibles.py 2010-03-09 21:54:17 +0000
@@ -28,5 +28,5 @@
self.display = display
def process(self):
- self.display.output(u'Bible process started');
- self.display.output(u'Bible process finished');
\ No newline at end of file
+ self.display.output(u'Bible process started')
+ self.display.output(u'Bible process finished')
\ No newline at end of file
=== modified file 'openlp/migration/migratefiles.py'
--- openlp/migration/migratefiles.py 2009-12-31 12:52:01 +0000
+++ openlp/migration/migratefiles.py 2010-03-09 21:54:17 +0000
@@ -30,20 +30,20 @@
self.display = display
def process(self):
- self.display.output(u'Files process started');
+ self.display.output(u'Files process started')
self._initial_setup()
- self.display.output(u'Files process finished');
+ self.display.output(u'Files process finished')
def _initial_setup(self):
- self.display.output(u'Initial Setup started');
+ self.display.output(u'Initial Setup started')
ConfigHelper.get_data_path()
- self.display.sub_output(u'Config created');
+ self.display.sub_output(u'Config created')
ConfigHelper.get_config(u'bible', u'data path')
- self.display.sub_output(u'Config created');
+ self.display.sub_output(u'Config created')
ConfigHelper.get_config(u'videos', u'data path')
- self.display.sub_output(u'videos created');
+ self.display.sub_output(u'videos created')
ConfigHelper.get_config(u'images', u'data path')
- self.display.sub_output(u'images created');
+ self.display.sub_output(u'images created')
ConfigHelper.get_config(u'presentations', u'data path')
- self.display.sub_output(u'presentations created');
- self.display.output(u'Initial Setup finished');
\ No newline at end of file
+ self.display.sub_output(u'presentations created')
+ self.display.output(u'Initial Setup finished')
\ No newline at end of file
=== modified file 'openlp/plugins/alerts/forms/alerteditform.py'
--- openlp/plugins/alerts/forms/alerteditform.py 2010-02-17 19:13:04 +0000
+++ openlp/plugins/alerts/forms/alerteditform.py 2010-03-09 21:54:17 +0000
@@ -82,7 +82,7 @@
self.DeleteButton.setEnabled(False)
def onItemSelected(self):
- if len(self.AlertLineEdit.text()) > 0:
+ if self.AlertLineEdit.text():
QtGui.QMessageBox.information(self,
self.trUtf8('Item selected to Edit'),
self.trUtf8('Please Save or Clear seletced item'))
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py 2010-02-27 09:18:26 +0000
+++ openlp/plugins/bibles/lib/http.py 2010-03-09 21:54:17 +0000
@@ -77,7 +77,7 @@
books = HTTPBooks.run_sql(u'SELECT id, testament_id, name, '
u'abbreviation, chapters FROM books WHERE name = ? OR '
u'abbreviation = ?', (name, name))
- if len(books) > 0:
+ if books:
return {
u'id': books[0][0],
u'testament_id': books[0][1],
@@ -95,7 +95,7 @@
book = HTTPBooks.get_book(name)
chapters = HTTPBooks.run_sql(u'SELECT id, book_id, chapter, '
u'verses FROM chapters WHERE book_id = ?', (book[u'id'],))
- if len(chapters) > 0:
+ if chapters:
return {
u'id': chapters[0][0],
u'book_id': chapters[0][1],
=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py 2010-02-27 15:31:23 +0000
+++ openlp/plugins/custom/forms/editcustomform.py 2010-03-09 21:54:17 +0000
@@ -254,7 +254,7 @@
if self.VerseListView.count() == 0:
self.VerseTextEdit.setFocus()
return False, self.trUtf8('You need to enter a slide')
- if len(self.VerseTextEdit.toPlainText()) > 0:
+ if self.VerseTextEdit.toPlainText():
self.VerseTextEdit.setFocus()
return False, self.trUtf8('You have unsaved data')
return True, u''
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2010-02-27 15:31:23 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2010-03-09 21:54:17 +0000
@@ -151,7 +151,7 @@
service_item.edit_enabled = True
service_item.editId = item_id
theme = customSlide.theme_name
- if len(theme) is not 0 :
+ if theme:
service_item.theme = theme
songXML = SongXMLParser(customSlide.text)
verseList = songXML.get_verses()
@@ -160,9 +160,9 @@
service_item.title = title
for slide in raw_slides:
service_item.add_from_text(slide[:30], slide)
- if str_to_bool(self.parent.config.get_config(u'display footer', True)) or \
- len(credit) > 0:
- raw_footer.append(title + u' '+ credit)
+ if str_to_bool(self.parent.config.get_config(u'display footer', True)) \
+ or credit:
+ raw_footer.append(title + u' ' + credit)
else:
raw_footer.append(u'')
service_item.raw_footer = raw_footer
=== modified file 'openlp/plugins/presentations/lib/powerpointcontroller.py'
--- openlp/plugins/presentations/lib/powerpointcontroller.py 2010-03-05 19:39:30 +0000
+++ openlp/plugins/presentations/lib/powerpointcontroller.py 2010-03-09 21:54:17 +0000
@@ -167,7 +167,7 @@
Triggerent by new object being added to SlideController orOpenLP
being shut down
"""
- if self.presentation == None:
+ if self.presentation is None:
return
try:
self.presentation.Close()
@@ -183,9 +183,9 @@
if not self.controller.is_loaded():
return False
try:
- if self.presentation.SlideShowWindow == None:
+ if self.presentation.SlideShowWindow is None:
return False
- if self.presentation.SlideShowWindow.View == None:
+ if self.presentation.SlideShowWindow.View is None:
return False
except:
return False
=== modified file 'openlp/plugins/presentations/lib/pptviewcontroller.py'
--- openlp/plugins/presentations/lib/pptviewcontroller.py 2010-03-05 19:39:30 +0000
+++ openlp/plugins/presentations/lib/pptviewcontroller.py 2010-03-09 21:54:17 +0000
@@ -30,7 +30,7 @@
from ctypes import *
from ctypes.wintypes import RECT
-from presentationcontroller import PresentationController, PresentationDocument
+from presentationcontroller import PresentationController, PresentationDocument
log = logging.getLogger(__name__)
@@ -122,7 +122,7 @@
rendermanager = self.controller.plugin.render_manager
rect = rendermanager.screens.current[u'size']
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
- filepath = str(self.filepath.replace(u'/', u'\\'));
+ filepath = str(self.filepath.replace(u'/', u'\\'))
try:
self.pptid = self.controller.process.OpenPPT(filepath, None, rect,
str(os.path.join(self.thumbnailpath, self.controller.thumbnailprefix)))
=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py 2010-03-05 19:50:51 +0000
+++ openlp/plugins/presentations/presentationplugin.py 2010-03-09 21:54:17 +0000
@@ -103,7 +103,7 @@
self.registerControllers(controller)
if controller.enabled:
controller.start_process()
- if len(self.controllers) > 0:
+ if self.controllers:
return True
else:
return False
=== modified file 'openlp/plugins/remotes/remoteclient.py'
--- openlp/plugins/remotes/remoteclient.py 2010-02-03 18:53:31 +0000
+++ openlp/plugins/remotes/remoteclient.py 2010-03-09 21:54:17 +0000
@@ -54,7 +54,7 @@
help="Message to be passed for the action")
(options, args) = parser.parse_args()
- if len(args) > 0:
+ if args:
parser.print_help()
parser.error("incorrect number of arguments")
elif options.address is None:
=== modified file 'openlp/plugins/songs/forms/songmaintenancedialog.py'
--- openlp/plugins/songs/forms/songmaintenancedialog.py 2009-12-31 12:52:01 +0000
+++ openlp/plugins/songs/forms/songmaintenancedialog.py 2010-03-09 21:54:17 +0000
@@ -51,10 +51,10 @@
self.TypeListWidget.sizePolicy().hasHeightForWidth())
self.TypeListWidget.setSizePolicy(sizePolicy)
self.TypeListWidget.setViewMode(QtGui.QListView.IconMode)
- self.TypeListWidget.setIconSize(QtCore.QSize(112, 100));
- self.TypeListWidget.setMovement(QtGui.QListView.Static);
- self.TypeListWidget.setMaximumWidth(118);
- self.TypeListWidget.setSpacing(0);
+ self.TypeListWidget.setIconSize(QtCore.QSize(112, 100))
+ self.TypeListWidget.setMovement(QtGui.QListView.Static)
+ self.TypeListWidget.setMaximumWidth(118)
+ self.TypeListWidget.setSpacing(0)
self.TypeListWidget.setSortingEnabled(False)
self.TypeListWidget.setUniformItemSizes(True)
self.TypeListWidget.setObjectName(u'TypeListWidget')
=== modified file 'openlp/plugins/songs/lib/songxml.py'
--- openlp/plugins/songs/lib/songxml.py 2009-12-31 12:52:01 +0000
+++ openlp/plugins/songs/lib/songxml.py 2010-03-09 21:54:17 +0000
@@ -153,12 +153,12 @@
tmpVerse = []
finalLyrics = []
tag = ""
- for l in lyrics:
- line = l.rstrip()
+ for lyric in lyrics:
+ line = lyric.rstrip()
if not line.startswith(u'.'):
# drop all chords
tmpVerse.append(line)
- if len(line) > 0:
+ if line:
if line.startswith(u'['):
tag = line
else:
@@ -298,9 +298,9 @@
chars are: .,:;!?&%#/\@`$'|"^~*-
"""
punctuation = ".,:;!?&%#'\"/\\@`$|^~*-"
- s = title
- for c in punctuation:
- s = s.replace(c, '')
+ string = title
+ for char in punctuation:
+ string = string.replace(char, '')
return s
def set_title(self, title):
@@ -582,17 +582,16 @@
self.slideList = []
tmpSlide = []
metContent = False
- for l in self.lyrics:
- if len(l) > 0:
+ for lyric in self.lyrics:
+ if lyric:
metContent = True
- tmpSlide.append(l)
+ tmpSlide.append(lyric)
else:
if metContent:
metContent = False
self.slideList.append(tmpSlide)
tmpSlide = []
- #
- if len(tmpSlide) > 0:
+ if tmpSlide:
self.slideList.append(tmpSlide)
def get_number_of_slides(self):
=== modified file 'setup.py'
--- setup.py 2010-02-23 15:52:38 +0000
+++ setup.py 2010-03-09 21:54:17 +0000
@@ -1,7 +1,6 @@
#!/usr/bin/env python
from setuptools import setup, find_packages
-import sys, os
VERSION_FILE = 'openlp/.version'
Follow ups