This commit is contained in:
rimach 2010-05-31 22:31:41 +02:00
commit 0efffda562
54 changed files with 3656 additions and 429 deletions

View File

@ -15,3 +15,4 @@ OpenLP.egg-info
build
resources/innosetup/Output
_eric4project
.pylint.d

View File

@ -48,8 +48,7 @@ def translate(context, text, comment=None):
``text``
The text to put into the translation tables for translation.
"""
return QtCore.QCoreApplication.translate(context, text,
comment)
return QtCore.QCoreApplication.translate(context, text, comment)
def get_text_file_string(text_file):
"""
@ -68,7 +67,7 @@ def get_text_file_string(text_file):
file_handle = open(text_file, u'r')
content_string = file_handle.read()
except IOError:
log.error(u'Failed to open text file %s' % text_file)
log.exception(u'Failed to open text file %s' % text_file)
finally:
if file_handle:
file_handle.close()
@ -132,6 +131,9 @@ def contextMenu(base, icon, text):
return action
def contextMenuSeparator(base):
"""
Add a separator to a context menu
"""
action = QtGui.QAction(u'', base)
action.setSeparator(True)
return action
@ -150,7 +152,8 @@ def resize_image(image, width, height):
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)
newImage = QtGui.QImage(width, height,
QtGui.QImage.Format_ARGB32_Premultiplied)
newImage.fill(QtCore.Qt.black)
painter = QtGui.QPainter(newImage)
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
@ -158,6 +161,9 @@ def resize_image(image, width, height):
class ThemeLevel(object):
"""
Provides an enumeration for the level a theme applies to
"""
Global = 1
Service = 2
Song = 3
@ -178,5 +184,5 @@ from songxmlhandler import SongXMLBuilder, SongXMLParser
from themexmlhandler import ThemeXML
from renderer import Renderer
from rendermanager import RenderManager
from mediamanageritem import MediaManagerItem
from basemodel import BaseModel
from baselistwithdnd import BaseListWithDnD

View File

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# 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 #
###############################################################################
class BaseModel(object):
"""
BaseModel provides a base object with a set of generic functions
"""
@classmethod
def populate(cls, **kwargs):
"""
Creates an instance of a class and populates it, returning the instance
"""
me = cls()
for key in kwargs:
me.__setattr__(key, kwargs[key])
return me

View File

@ -230,7 +230,7 @@ class EventReceiver(QtCore.QObject):
self.emit(QtCore.SIGNAL(event), msg)
class Receiver():
class Receiver(object):
"""
Class to allow events to be passed from different parts of the system. This
is a static wrapper around the ``EventReceiver`` class. As there is only

View File

@ -367,7 +367,7 @@ class MediaManagerItem(QtGui.QWidget):
def IconFromFile(self, file, thumb):
icon = build_icon(unicode(file))
pixmap = icon.pixmap(QtCore.QSize(88,50))
pixmap = icon.pixmap(QtCore.QSize(88, 50))
ext = os.path.splitext(thumb)[1].lower()
pixmap.save(thumb, ext[1:])
return icon

View File

@ -474,7 +474,7 @@ class Renderer(object):
# draw a box around the text - debug only
if self._debug:
self.painter.setPen(QtGui.QPen(QtGui.QColor(0,255,0)))
self.painter.setPen(QtGui.QPen(QtGui.QColor(0, 255, 0)))
self.painter.drawRect(startx, starty, rightextent-startx, y-starty)
brcorner = (rightextent, y)
self.painter.end()

View File

@ -43,12 +43,12 @@ class ServiceItemType(object):
Command = 3
class ItemCapabilities(object):
AllowsPreview = 1
AllowsEdit = 2
AllowsMaintain = 3
RequiresMedia = 4
AllowsLoop = 5
AllowsAdditions = 6
AllowsPreview = 1
AllowsEdit = 2
AllowsMaintain = 3
RequiresMedia = 4
AllowsLoop = 5
AllowsAdditions = 6
class ServiceItem(object):
"""
@ -125,8 +125,9 @@ class ServiceItem(object):
if title == u'':
title = line
lines += line + u'\n'
self._display_frames.append({u'title': title, \
u'text': lines.rstrip(), u'verseTag': slide[u'verseTag'] })
self._display_frames.append({u'title': title,
u'text': lines.rstrip(),
u'verseTag': slide[u'verseTag'] })
self.cache.insert(len(self._display_frames), None)
log.log(15, u'Formatting took %4s' % (time.time() - before))
elif self.service_item_type == ServiceItemType.Image:
@ -159,7 +160,7 @@ class ServiceItem(object):
frame = self.RenderManager.generate_slide(format,
self.raw_footer)
else:
frame = self.RenderManager.generate_slide(format,u'')
frame = self.RenderManager.generate_slide(format, u'')
self.cache[row] = frame
return frame
@ -239,7 +240,8 @@ class ServiceItem(object):
service_data.append(slide[u'title'])
elif self.service_item_type == ServiceItemType.Command:
for slide in self._raw_frames:
service_data.append({u'title':slide[u'title'], u'image':slide[u'image']})
service_data.append(
{u'title':slide[u'title'], u'image':slide[u'image']})
return {u'header': service_header, u'data': service_data}
def set_from_service(self, serviceitem, path=None):
@ -276,7 +278,8 @@ class ServiceItem(object):
elif self.service_item_type == ServiceItemType.Command:
for text_image in serviceitem[u'serviceitem'][u'data']:
filename = os.path.join(path, text_image[u'title'])
self.add_from_command(path, text_image[u'title'], text_image[u'image'] )
self.add_from_command(
path, text_image[u'title'], text_image[u'image'] )
def merge(self, other):
"""
@ -343,3 +346,4 @@ class ServiceItem(object):
Returns the title of the raw frame
"""
return self._raw_frames[row][u'path']

View File

@ -30,7 +30,7 @@ from xml.etree.ElementTree import ElementTree, XML
from openlp.core.lib import str_to_bool
blankthemexml=\
blankthemexml = \
'''<?xml version="1.0" encoding="utf-8"?>
<theme version="1.0">
<name>BlankStyle</name>
@ -215,7 +215,7 @@ class ThemeXML(object):
The height of the text block.
"""
background = self.theme_xml.createElement(u'font')
background.setAttribute(u'type',fonttype)
background.setAttribute(u'type', fonttype)
self.theme.appendChild(background)
#Create Font name element
self.child_element(background, u'name', name)
@ -230,11 +230,12 @@ class ThemeXML(object):
#Create indentation name element
self.child_element(background, u'indentation', unicode(indentation))
#Create indentation name element
self.child_element(background, u'line_adjustment', unicode(line_adjustment))
self.child_element(
background, u'line_adjustment', unicode(line_adjustment))
#Create Location element
element = self.theme_xml.createElement(u'location')
element.setAttribute(u'override',override)
element.setAttribute(u'override', override)
if override == u'True':
element.setAttribute(u'x', xpos)
element.setAttribute(u'y', ypos)

View File

@ -102,3 +102,4 @@ class XmlRootClass(object):
if not attrib.startswith(u'_'):
result += u'_%s_' % getattr(self, attrib)
return result

View File

@ -23,4 +23,4 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from theme import Theme
from openlp.core.theme.theme import Theme

View File

@ -28,13 +28,13 @@ import types
from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import QtGui
DelphiColors={"clRed":0xFF0000,
DelphiColors = {"clRed":0xFF0000,
"clBlue":0x0000FF,
"clYellow":0xFFFF00,
"clBlack":0x000000,
"clWhite":0xFFFFFF}
"clBlack":0x000000,
"clWhite":0xFFFFFF}
blankstylexml=\
blankstylexml = \
'''<?xml version="1.0" encoding="iso-8859-1"?>
<Theme>
<Name>BlankStyle</Name>
@ -136,12 +136,15 @@ class Theme(object):
except ValueError:
val = t
if (element.tag.find(u'Color') > 0 or
(element.tag.find(u'BackgroundParameter') == 0 and type(val) == type(0))):
(element.tag.find(u'BackgroundParameter') == 0 and
type(val) == type(0))):
# convert to a wx.Colour
if not delphiColorChange:
val = QtGui.QColor(val&0xFF, (val>>8)&0xFF, (val>>16)&0xFF)
else:
val = QtGui.QColor((val>>16)&0xFF, (val>>8)&0xFF, val&0xFF)
if not delphiColorChange:
val = QtGui.QColor(
val&0xFF, (val>>8)&0xFF, (val>>16)&0xFF)
else:
val = QtGui.QColor(
(val>>16)&0xFF, (val>>8)&0xFF, val&0xFF)
setattr(self, element.tag, val)
def __str__(self):

View File

@ -222,8 +222,8 @@ class DisplayTab(SettingsTab):
self.postSetUp()
def postSetUp(self):
self.screens.override[u'size'] = QtCore.QRect(int(self.XposEdit.text()),\
int(self.YposEdit.text()), int(self.WidthEdit.text()),\
self.screens.override[u'size'] = QtCore.QRect(int(self.XposEdit.text()),
int(self.YposEdit.text()), int(self.WidthEdit.text()),
int(self.HeightEdit.text()))
if self.amend_display:
self.screens.set_override_display()
@ -233,3 +233,4 @@ class DisplayTab(SettingsTab):
if self.amend_display_start != self.amend_display:
self.amend_display_start = self.amend_display
Receiver.send_message(u'config_screen_changed')

View File

@ -375,11 +375,13 @@ class Ui_MainWindow(object):
translate('MainWindow', 'Theme Manager'))
self.FileNewItem.setText(translate('MainWindow', '&New'))
self.FileNewItem.setToolTip(translate('MainWindow', 'New Service'))
self.FileNewItem.setStatusTip(translate('MainWindow', 'Create a new Service'))
self.FileNewItem.setStatusTip(
translate('MainWindow', 'Create a new Service'))
self.FileNewItem.setShortcut(translate('MainWindow', 'Ctrl+N'))
self.FileOpenItem.setText(translate('MainWindow', '&Open'))
self.FileOpenItem.setToolTip(translate('MainWindow', 'Open Service'))
self.FileOpenItem.setStatusTip(translate('MainWindow', 'Open an existing service'))
self.FileOpenItem.setStatusTip(
translate('MainWindow', 'Open an existing service'))
self.FileOpenItem.setShortcut(translate('MainWindow', 'Ctrl+O'))
self.FileSaveItem.setText(translate('MainWindow', '&Save'))
self.FileSaveItem.setToolTip(translate('MainWindow', 'Save Service'))
@ -387,9 +389,10 @@ class Ui_MainWindow(object):
translate('MainWindow', 'Save the current service to disk'))
self.FileSaveItem.setShortcut(translate('MainWindow', 'Ctrl+S'))
self.FileSaveAsItem.setText(translate('MainWindow', 'Save &As...'))
self.FileSaveAsItem.setToolTip(translate('MainWindow', 'Save Service As'))
self.FileSaveAsItem.setStatusTip(
translate('MainWindow', 'Save the current service under a new name'))
self.FileSaveAsItem.setToolTip(
translate('MainWindow', 'Save Service As'))
self.FileSaveAsItem.setStatusTip(translate('MainWindow',
'Save the current service under a new name'))
self.FileSaveAsItem.setShortcut(translate('MainWindow', 'F12'))
self.FileExitItem.setText(translate('MainWindow', 'E&xit'))
self.FileExitItem.setStatusTip(translate('MainWindow', 'Quit OpenLP'))
@ -400,34 +403,40 @@ class Ui_MainWindow(object):
self.ExportLanguageItem.setText(translate('MainWindow', '&Language'))
self.actionLook_Feel.setText(translate('MainWindow', 'Look && &Feel'))
self.OptionsSettingsItem.setText(translate('MainWindow', '&Settings'))
self.ViewMediaManagerItem.setText(translate('MainWindow', '&Media Manager'))
self.ViewMediaManagerItem.setText(
translate('MainWindow', '&Media Manager'))
self.ViewMediaManagerItem.setToolTip(
translate('MainWindow', 'Toggle Media Manager'))
self.ViewMediaManagerItem.setStatusTip(
translate('MainWindow', 'Toggle the visibility of the Media Manager'))
self.ViewMediaManagerItem.setStatusTip(translate('MainWindow',
'Toggle the visibility of the Media Manager'))
self.ViewMediaManagerItem.setShortcut(translate('MainWindow', 'F8'))
self.ViewThemeManagerItem.setText(translate('MainWindow', '&Theme Manager'))
self.ViewThemeManagerItem.setText(
translate('MainWindow', '&Theme Manager'))
self.ViewThemeManagerItem.setToolTip(
translate('MainWindow', 'Toggle Theme Manager'))
self.ViewThemeManagerItem.setStatusTip(
translate('MainWindow', 'Toggle the visibility of the Theme Manager'))
self.ViewThemeManagerItem.setStatusTip(translate('MainWindow',
'Toggle the visibility of the Theme Manager'))
self.ViewThemeManagerItem.setShortcut(translate('MainWindow', 'F10'))
self.ViewServiceManagerItem.setText(translate('MainWindow', '&Service Manager'))
self.ViewServiceManagerItem.setText(
translate('MainWindow', '&Service Manager'))
self.ViewServiceManagerItem.setToolTip(
translate('MainWindow', 'Toggle Service Manager'))
self.ViewServiceManagerItem.setStatusTip(
translate('MainWindow', 'Toggle the visibility of the Service Manager'))
self.ViewServiceManagerItem.setStatusTip(translate('MainWindow',
'Toggle the visibility of the Service Manager'))
self.ViewServiceManagerItem.setShortcut(translate('MainWindow', 'F9'))
self.action_Preview_Panel.setText(translate('MainWindow', '&Preview Panel'))
self.action_Preview_Panel.setText(
translate('MainWindow', '&Preview Panel'))
self.action_Preview_Panel.setToolTip(
translate('MainWindow', 'Toggle Preview Panel'))
self.action_Preview_Panel.setStatusTip(
translate('MainWindow', 'Toggle the visibility of the Preview Panel'))
self.action_Preview_Panel.setStatusTip(translate('MainWindow',
'Toggle the visibility of the Preview Panel'))
self.action_Preview_Panel.setShortcut(translate('MainWindow', 'F11'))
self.PluginItem.setText(translate('MainWindow', '&Plugin List'))
self.PluginItem.setStatusTip(translate('MainWindow', 'List the Plugins'))
self.PluginItem.setStatusTip(
translate('MainWindow', 'List the Plugins'))
self.PluginItem.setShortcut(translate('MainWindow', 'Alt+F7'))
self.HelpDocumentationItem.setText(translate('MainWindow', '&User Guide'))
self.HelpDocumentationItem.setText(
translate('MainWindow', '&User Guide'))
self.HelpAboutItem.setText(translate('MainWindow', '&About'))
self.HelpAboutItem.setStatusTip(
translate('MainWindow', 'More information about OpenLP'))
@ -440,12 +449,13 @@ class Ui_MainWindow(object):
translate('MainWindow', 'Choose System language, if available'))
for item in self.LanguageGroup.actions():
item.setText(item.objectName())
item.setStatusTip(
translate('MainWindow', 'Set the interface language to %1').arg(item.objectName()))
item.setStatusTip(translate('MainWindow',
'Set the interface language to %1').arg(item.objectName()))
self.ToolsAddToolItem.setText(translate('MainWindow', 'Add &Tool...'))
self.ToolsAddToolItem.setStatusTip(
translate('MainWindow', 'Add an application to the list of tools'))
self.action_Preview_Panel.setText(translate('MainWindow', '&Preview Pane'))
self.action_Preview_Panel.setText(
translate('MainWindow', '&Preview Pane'))
self.ModeLiveItem.setText(translate('MainWindow', '&Live'))

View File

@ -810,8 +810,8 @@ class ServiceManager(QtGui.QWidget):
if self.serviceItems and item < len(self.serviceItems) and \
self.serviceItems[item][u'service_item'].is_capable(
ItemCapabilities.AllowsPreview):
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], 0)
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], 0)
else:
QtGui.QMessageBox.critical(self,
self.trUtf8('Missing Display Handler'),
@ -897,17 +897,18 @@ class ServiceManager(QtGui.QWidget):
#we are over somthing so lets investigate
pos = self._getParentItemData(item) - 1
serviceItem = self.serviceItems[pos]
if plugin == serviceItem[u'service_item'].name \
and serviceItem[u'service_item'].is_capable(ItemCapabilities.AllowsAdditions):
action = self.dndMenu.exec_(QtGui.QCursor.pos())
#New action required
if action == self.newAction:
self.droppos = self._getParentItemData(item)
#Append to existing action
if action == self.addToAction:
self.droppos = self._getParentItemData(item)
item.setSelected(True)
replace = True
if (plugin == serviceItem[u'service_item'].name and
serviceItem[u'service_item'].is_capable(
ItemCapabilities.AllowsAdditions)):
action = self.dndMenu.exec_(QtGui.QCursor.pos())
#New action required
if action == self.newAction:
self.droppos = self._getParentItemData(item)
#Append to existing action
if action == self.addToAction:
self.droppos = self._getParentItemData(item)
item.setSelected(True)
replace = True
else:
self.droppos = self._getParentItemData(item)
Receiver.send_message(u'%s_add_service_item' % plugin, replace)

View File

@ -426,11 +426,12 @@ class SlideController(QtGui.QWidget):
self.Toolbar.makeWidgetsVisible([u'Song Menu'])
if item.is_capable(ItemCapabilities.AllowsLoop) and \
len(item.get_frames()) > 1:
self.Toolbar.makeWidgetsVisible(self.loopList)
self.Toolbar.makeWidgetsVisible(self.loopList)
if item.is_media():
self.Toolbar.setVisible(False)
self.Mediabar.setVisible(True)
#self.volumeSlider.setAudioOutput(self.mainDisplay.videoDisplay.audio)
#self.volumeSlider.setAudioOutput(
# self.mainDisplay.videoDisplay.audio)
def enablePreviewToolBar(self, item):
"""

View File

@ -73,7 +73,7 @@ class ThemeManager(QtGui.QWidget):
self.Layout.addWidget(self.Toolbar)
self.ThemeListWidget = QtGui.QListWidget(self)
self.ThemeListWidget.setAlternatingRowColors(True)
self.ThemeListWidget.setIconSize(QtCore.QSize(88,50))
self.ThemeListWidget.setIconSize(QtCore.QSize(88, 50))
self.Layout.addWidget(self.ThemeListWidget)
self.ThemeListWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.ThemeListWidget.addAction(
@ -285,7 +285,7 @@ class ThemeManager(QtGui.QWidget):
icon = build_icon(thumb)
else:
icon = build_icon(theme)
pixmap = icon.pixmap(QtCore.QSize(88,50))
pixmap = icon.pixmap(QtCore.QSize(88, 50))
pixmap.save(thumb, u'png')
item_name.setIcon(icon)
item_name.setData(QtCore.Qt.UserRole,
@ -450,8 +450,6 @@ class ThemeManager(QtGui.QWidget):
'would you like to overwrite it?'),
(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
else:
result == QtGui.QMessageBox.Yes
if result == QtGui.QMessageBox.Yes:
# Save the theme, overwriting the existing theme if necessary.
outfile = None
@ -485,7 +483,7 @@ class ThemeManager(QtGui.QWidget):
frame.save(samplepathname, u'png')
thumb = os.path.join(self.thumbPath, u'%s.png' % name)
icon = build_icon(frame)
pixmap = icon.pixmap(QtCore.QSize(88,50))
pixmap = icon.pixmap(QtCore.QSize(88, 50))
pixmap.save(thumb, u'png')
log.debug(u'Theme image written to %s', samplepathname)

View File

@ -192,4 +192,5 @@ def add_actions(target, actions):
from languagemanager import LanguageManager
__all__ = [u'AppLocation', u'check_latest_version', u'add_actions', u'LanguageManager']
__all__ = [u'AppLocation', u'check_latest_version', u'add_actions',
u'LanguageManager']

View File

@ -27,7 +27,7 @@ import logging
log = logging.getLogger(__name__)
class Display():
class Display(object):
log.info(u'Display Class loaded')
@staticmethod

View File

@ -27,30 +27,13 @@ import os
import sys
import sqlite3
from sqlalchemy import *
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker, mapper
from openlp.core.lib import SettingsManager
from openlp.core.lib import BaseModel, SettingsManager
from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib.models import *
class BaseModel(object):
"""
BaseModel provides a base object with a set of generic functions
"""
@classmethod
def populate(cls, **kwargs):
"""
Creates an instance of a class and populates it, returning the instance
"""
me = cls()
keys = kwargs.keys()
for key in keys:
me.__setattr__(key, kwargs[key])
return me
class TBibleMeta(BaseModel):
"""
Bible Meta Data
@ -109,7 +92,7 @@ def init_models(url):
autocommit=False, bind=engine))
return session
class MigrateBibles():
class MigrateBibles(object):
def __init__(self, display):
self.display = display
self.data_path = AppLocation.get_section_data_path(u'bibles')

View File

@ -25,7 +25,7 @@
from openlp.core.utils import AppLocation
class MigrateFiles():
class MigrateFiles(object):
def __init__(self, display):
self.display = display

View File

@ -31,7 +31,7 @@ from sqlalchemy import *
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker, mapper, relation
from openlp.core.lib import SettingsManager
from openlp.core.lib import BaseModel, SettingsManager
from openlp.core.utils import AppLocation
from openlp.plugins.songs.lib.models import metadata, songs_table, Song, \
Author, Topic, Book
@ -75,21 +75,6 @@ temp_authors_songs_table = Table(u'songauthors_temp', metadata,
Column(u'authorid', types.Integer, primary_key=True),
Column(u'songid', types.Integer)
)
class BaseModel(object):
"""
BaseModel provides a base object with a set of generic functions
"""
@classmethod
def populate(cls, **kwargs):
"""
Creates an instance of a class and populates it, returning the instance
"""
me = cls()
keys = kwargs.keys()
for key in keys:
me.__setattr__(key, kwargs[key])
return me
class TAuthor(BaseModel):
"""
@ -109,7 +94,7 @@ class TSongAuthor(BaseModel):
"""
pass
class MigrateSongs():
class MigrateSongs(object):
def __init__(self, display):
self.display = display
self.data_path = AppLocation.get_section_data_path(u'songs')

View File

@ -67,7 +67,7 @@ class AlertsManager(QtCore.QObject):
- self.alertHeight
self.alertHeight = self.screen[u'size'].height() \
- self.alertScreenPosition
self.parent.maindisplay.setAlertSize(self.alertScreenPosition,\
self.parent.maindisplay.setAlertSize(self.alertScreenPosition,
self.alertHeight)
def onAlertText(self, message):

View File

@ -23,21 +23,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
class BaseModel(object):
"""
BaseModel provides a base object with a set of generic functions
"""
@classmethod
def populate(cls, **kwargs):
"""
Creates an instance of a class and populates it, returning the instance
"""
me = cls()
keys = kwargs.keys()
for key in keys:
me.__setattr__(key, kwargs[key])
return me
from openlp.core.lib import BaseModel
class AlertItem(BaseModel):
"""

View File

@ -32,7 +32,7 @@ from openlp.plugins.alerts.lib.models import init_models, metadata, AlertItem
log = logging.getLogger(__name__)
class DBManager():
class DBManager(object):
"""
The Song Manager provides a central location for all database code. This
class takes care of connecting to the database and running all the queries.
@ -70,13 +70,13 @@ class DBManager():
"""
return self.session.query(AlertItem).order_by(AlertItem.text).all()
def save_alert(self, AlertItem):
def save_alert(self, alert_item):
"""
Saves a Alert show to the database
"""
log.debug(u'Alert added')
try:
self.session.add(AlertItem)
self.session.add(alert_item)
self.session.commit()
log.debug(u'Alert saved')
return True
@ -99,9 +99,9 @@ class DBManager():
Delete a Alert show
"""
if id != 0:
AlertItem = self.get_alert(id)
alert_item = self.get_alert(id)
try:
self.session.delete(AlertItem)
self.session.delete(alert_item)
self.session.commit()
return True
except:
@ -110,3 +110,4 @@ class DBManager():
return False
else:
return True

View File

@ -277,7 +277,7 @@ class Ui_BibleImportWizard(object):
self.CopyrightEdit)
self.PermissionLabel = QtGui.QLabel(self.LicenseDetailsPage)
self.PermissionLabel.setObjectName(u'PermissionLabel')
self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,\
self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.PermissionLabel)
self.PermissionEdit = QtGui.QLineEdit(self.LicenseDetailsPage)
self.PermissionEdit.setObjectName(u'PermissionEdit')

View File

@ -257,8 +257,8 @@ def unescape(text):
@param text The HTML (or XML) source text.
@return The plain text, as a Unicode string, if necessary.
"""
def fixup(m):
text = m.group(0)
def fixup(markup):
text = markup.group(0)
if text[:2] == u'&#':
# character reference
try:

View File

@ -27,6 +27,8 @@ import logging
import chardet
import csv
from PyQt4 import QtCore
from openlp.core.lib import Receiver
from db import BibleDB
@ -89,7 +91,7 @@ class CSVBible(BibleDB):
verse_file = None
try:
book_ptr = None
verse_file = open(versesfile, 'r')
verse_file = open(self.versesfile, 'r')
dialect = csv.Sniffer().sniff(verse_file.read(1024))
verse_file.seek(0)
verse_reader = csv.reader(verse_file, dialect)

View File

@ -418,12 +418,13 @@ class HTTPBible(BibleDB):
Receiver.send_message(u'bibles_nobook')
return []
db_book = self.create_book(book_details[u'name'],
book_details[u'abbreviation'], book_details[u'testament_id'])
book_details[u'abbreviation'],
book_details[u'testament_id'])
book = db_book.name
if BibleDB.get_verse_count(self, book, reference[1]) == 0:
Receiver.send_message(u'bibles_showprogress')
Receiver.send_message(u'openlp_process_events')
search_results = self.get_chapter(self.name, book, reference[1])
search_results = self.get_chapter(book, reference[1])
if search_results and search_results.has_verselist():
## We have found a book of the bible lets check to see
## if it was there. By reusing the returned book name
@ -433,18 +434,19 @@ class HTTPBible(BibleDB):
Receiver.send_message(u'openlp_process_events')
# check to see if book/chapter exists
db_book = self.get_book(bookname)
self.create_chapter(db_book.id, search_results.get_chapter(),
self.create_chapter(db_book.id,
search_results.get_chapter(),
search_results.get_verselist())
Receiver.send_message(u'openlp_process_events')
Receiver.send_message(u'bibles_hideprogress')
Receiver.send_message(u'openlp_process_events')
return BibleDB.get_verses(self, reference_list)
def get_chapter(self, version, book, chapter):
def get_chapter(self, book, chapter):
"""
Receive the request and call the relevant handler methods
"""
log.debug(u'get_chapter %s, %s, %s', version, book, chapter)
log.debug(u'get_chapter %s, %s', book, chapter)
log.debug(u'source = %s', self.download_source)
try:
if self.download_source.lower() == u'crosswalk':

View File

@ -463,7 +463,19 @@ class BibleMediaItem(MediaManagerItem):
bible2_verses.extend(self.parent.manager.get_verses(bible2, scripture))
bible2_version = self.parent.manager.get_meta_data(bible2, u'Version')
bible2_copyright = self.parent.manager.get_meta_data(bible2, u'Copyright')
bible2_permission = self.parent.manager.get_meta_data(bible2, u'Permission')
bible2_permission = self.parent.manager.get_meta_data(bible2, u'Permissions')
if bible2_version:
bible2_version = bible2_version.value
else:
bible2_version = u''
if bible2_copyright:
bible2_copyright = bible2_copyright.value
else:
bible2_copyright = u''
if bible2_permission:
bible2_permission = bible2_permission.value
else:
bible2_permission = u''
# Let's loop through the main lot, and assemble our verses
for item in items:
bitem = self.ListView.item(item.row())
@ -492,8 +504,8 @@ class BibleMediaItem(MediaManagerItem):
if footer not in raw_footer:
raw_footer.append(footer)
if bible2:
footer = u'%s (%s %s)' % (book, version, copyright)
#If not found add to footer
footer = u'%s (%s %s)' % (book, bible2_version, bible2_copyright)
#If not found add second version and copyright to footer
if footer not in raw_footer:
raw_footer.append(footer)
bible_text = u'%s %s \n\n %s %s' % \
@ -580,7 +592,7 @@ class BibleMediaItem(MediaManagerItem):
def displayResults(self, bible):
version = self.parent.manager.get_meta_data(bible, u'Version')
copyright = self.parent.manager.get_meta_data(bible, u'Copyright')
permission = self.parent.manager.get_meta_data(bible, u'Permission')
permission = self.parent.manager.get_meta_data(bible, u'Permissions')
if not permission:
permission = u''
else:

View File

@ -27,20 +27,7 @@ from sqlalchemy import Column, Table, MetaData, ForeignKey, types, \
create_engine
from sqlalchemy.orm import mapper, relation, sessionmaker, scoped_session
class BaseModel(object):
"""
BaseModel provides a base object with a set of generic functions
"""
@classmethod
def populate(cls, **kwargs):
"""
Creates an instance of a class and populates it, returning the instance
"""
me = cls()
keys = kwargs.keys()
for key in keys:
me.__setattr__(key, kwargs[key])
return me
from openlp.core.lib import BaseModel
class BibleMeta(BaseModel):

View File

@ -211,8 +211,8 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
for row in range(0, self.VerseListView.count()):
item = self.VerseListView.item(row)
verse_list += item.text()
if row != self.VerseListView.count() - 1:
verse_list += u'\n[---]\n'
if row != self.VerseListView.count() - 1:
verse_list += u'\n[---]\n'
self.editText(verse_list)
def editText(self, text):

View File

@ -23,21 +23,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
class BaseModel(object):
"""
BaseModel provides a base object with a set of generic functions
"""
@classmethod
def populate(cls, **kwargs):
"""
Creates an instance of a class and populates it, returning the instance
"""
me = cls()
keys = kwargs.keys()
for key in keys:
me.__setattr__(key, kwargs[key])
return me
from openlp.core.lib import BaseModel
class CustomSlide(BaseModel):
"""

View File

@ -32,7 +32,7 @@ from openlp.plugins.custom.lib.models import init_models, metadata, CustomSlide
log = logging.getLogger(__name__)
class CustomManager():
class CustomManager(object):
"""
The Song Manager provides a central location for all database code. This
class takes care of connecting to the database and running all the queries.

View File

@ -75,7 +75,7 @@ class ImageMediaItem(MediaManagerItem):
self.ListView.clear()
self.ListView.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection)
self.ListView.setIconSize(QtCore.QSize(88,50))
self.ListView.setIconSize(QtCore.QSize(88, 50))
self.servicePath = os.path.join(
AppLocation.get_section_data_path(self.settingsSection),
u'thumbnails')

View File

@ -129,7 +129,7 @@ class MediaMediaItem(MediaManagerItem):
def initialise(self):
self.ListView.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection)
self.ListView.setIconSize(QtCore.QSize(88,50))
self.ListView.setIconSize(QtCore.QSize(88, 50))
self.loadList(SettingsManager.load_list(
self.settingsSection, self.settingsSection))

View File

@ -354,10 +354,10 @@ class ImpressDocument(PresentationDocument):
self.control.gotoSlideIndex(slideno-1)
def next_step(self):
"""
Triggers the next effect of slide on the running presentation
"""
self.control.gotoNextEffect()
"""
Triggers the next effect of slide on the running presentation
"""
self.control.gotoNextEffect()
def previous_step(self):
"""

View File

@ -109,7 +109,7 @@ class PresentationMediaItem(MediaManagerItem):
self.servicePath = os.path.join(
AppLocation.get_section_data_path(self.settingsSection),
u'thumbnails')
self.ListView.setIconSize(QtCore.QSize(88,50))
self.ListView.setIconSize(QtCore.QSize(88, 50))
if not os.path.exists(self.servicePath):
os.mkdir(self.servicePath)
list = SettingsManager.load_list(

View File

@ -73,7 +73,7 @@ class PptviewController(PresentationController):
self.start_process()
return self.process.CheckInstalled()
except:
return False
return False
def start_process(self):
"""

View File

@ -151,7 +151,7 @@ class PresentationController(object):
if doc is None:
return
if doc in self.docs:
self.docs.remove(doc)
self.docs.remove(doc)
def close_presentation(self):
pass

View File

@ -95,10 +95,9 @@ class PresentationPlugin(Plugin):
log.debug(u'Importing controller %s', modulename)
try:
__import__(modulename, globals(), locals(), [])
except ImportError, e:
log.error(
u'Failed to import %s on path %s for reason %s',
modulename, path, e.args[0])
except ImportError:
log.exception(u'Failed to import %s on path %s',
modulename, path)
controller_classes = PresentationController.__subclasses__()
for controller_class in controller_classes:
controller = controller_class(self)
@ -114,3 +113,4 @@ class PresentationPlugin(Plugin):
'programs. The choice of available presentation programs is '
'available to the user in a drop down box.')
return about_text

View File

@ -206,14 +206,17 @@ class HttpConnection(object):
mimetype = u'image/png'
else:
return (None, None)
file_handle = None
try:
f = open(path, u'rb')
except:
file_handle = open(path, u'rb')
log.debug(u'Opened %s' % path)
html = file_handle.read()
except IOError:
log.exception(u'Failed to open %s' % path)
return None
log.debug(u'Opened %s' % path)
html = f.read()
f.close()
finally:
if file_handle:
file_handle.close()
return (mimetype, html)
def load_params(self, query):

View File

@ -127,8 +127,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
authorsCompleter = QtGui.QCompleter(
[author.display_name for author in authors],
self.AuthorsSelectionComboItem)
authorsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive);
self.AuthorsSelectionComboItem.setCompleter(authorsCompleter);
authorsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.AuthorsSelectionComboItem.setCompleter(authorsCompleter)
self.AuthorsSelectionComboItem.clear()
for author in authors:
row = self.AuthorsSelectionComboItem.count()
@ -139,10 +139,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def loadTopics(self):
topics = self.songmanager.get_topics()
topicsCompleter = QtGui.QCompleter(
[topic.name for topic in topics],
self.SongTopicCombo)
topicsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive);
self.SongTopicCombo.setCompleter(topicsCompleter);
[topic.name for topic in topics], self.SongTopicCombo)
topicsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.SongTopicCombo.setCompleter(topicsCompleter)
self.SongTopicCombo.clear()
for topic in topics:
row = self.SongTopicCombo.count()
@ -153,8 +152,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
books = self.songmanager.get_books()
booksCompleter = QtGui.QCompleter(
[book.name for book in books], self.SongbookCombo)
booksCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive);
self.SongbookCombo.setCompleter(booksCompleter);
booksCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.SongbookCombo.setCompleter(booksCompleter)
self.SongbookCombo.clear()
self.SongbookCombo.addItem(u' ')
for book in books:
@ -166,8 +165,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
themesCompleter = QtGui.QCompleter(
[theme for theme in theme_list],
self.ThemeSelectionComboItem)
themesCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive);
self.ThemeSelectionComboItem.setCompleter(themesCompleter);
themesCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.ThemeSelectionComboItem.setCompleter(themesCompleter)
self.ThemeSelectionComboItem.clear()
self.ThemeSelectionComboItem.addItem(u' ')
for theme in theme_list:

View File

@ -81,7 +81,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
return -1
def _deleteItem(self, list_widget, get_func, del_func, reset_func,
dlg_title, del_text, err_text, sel_text):
dlg_title, del_text, err_text, sel_text):
item_id = self._getCurrentItemId(list_widget)
if item_id != -1:
item = get_func(item_id)
@ -93,11 +93,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
del_func(item.id)
reset_func()
else:
QtGui.QMessageBox.critical(self, dlg_title, err_text,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtGui.QMessageBox.critical(self, dlg_title, err_text)
else:
QtGui.QMessageBox.critical(self, dlg_title, sel_text,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtGui.QMessageBox.critical(self, dlg_title, sel_text)
def resetAuthors(self):
self.AuthorsListWidget.clear()
@ -131,39 +129,41 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.setAutoDisplayName(True)
if self.authorform.exec_():
author = Author.populate(
first_name=unicode(self.authorform.FirstNameEdit.text(), u'utf-8'),
last_name=unicode(self.authorform.LastNameEdit.text(), u'utf-8'),
display_name=unicode(self.authorform.DisplayEdit.text(), u'utf-8'))
first_name=unicode(
self.authorform.FirstNameEdit.text(), u'utf-8'),
last_name=unicode(
self.authorform.LastNameEdit.text(), u'utf-8'),
display_name=unicode(
self.authorform.DisplayEdit.text(), u'utf-8'))
if self.songmanager.save_author(author):
self.resetAuthors()
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t add your author.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t add your author.'))
def onTopicAddButtonClick(self):
if self.topicform.exec_():
topic = Topic.populate(name=unicode(self.topicform.NameEdit.text(), u'utf-8'))
topic = Topic.populate(
name=unicode(self.topicform.NameEdit.text(), u'utf-8'))
if self.songmanager.save_topic(topic):
self.resetTopics()
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t add your topic.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t add your topic.'))
def onBookAddButtonClick(self):
if self.bookform.exec_():
book = Book.populate(name=unicode(self.bookform.NameEdit.text(), u'utf-8'),
book = Book.populate(
name=unicode(self.bookform.NameEdit.text(), u'utf-8'),
publisher=unicode(self.bookform.PublisherEdit.text(), u'utf-8'))
if self.songmanager.save_book(book):
self.resetBooks()
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t add your book.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t add your book.'))
def onAuthorEditButtonClick(self):
author_id = self._getCurrentItemId(self.AuthorsListWidget)
@ -174,16 +174,18 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.LastNameEdit.setText(author.last_name)
self.authorform.DisplayEdit.setText(author.display_name)
if self.authorform.exec_(False):
author.first_name = unicode(self.authorform.FirstNameEdit.text(), u'utf-8')
author.last_name = unicode(self.authorform.LastNameEdit.text(), u'utf-8')
author.display_name = unicode(self.authorform.DisplayEdit.text(), u'utf-8')
author.first_name = unicode(
self.authorform.FirstNameEdit.text(), u'utf-8')
author.last_name = unicode(
self.authorform.LastNameEdit.text(), u'utf-8')
author.display_name = unicode(
self.authorform.DisplayEdit.text(), u'utf-8')
if self.songmanager.save_author(author):
self.resetAuthors()
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t save your author.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t save your author.'))
def onTopicEditButtonClick(self):
topic_id = self._getCurrentItemId(self.TopicsListWidget)
@ -197,8 +199,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t save your topic.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t save your topic.'))
def onBookEditButtonClick(self):
book_id = self._getCurrentItemId(self.BooksListWidget)
@ -208,14 +209,14 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.bookform.PublisherEdit.setText(book.publisher)
if self.bookform.exec_(False):
book.name = unicode(self.bookform.NameEdit.text(), u'utf-8')
book.publisher = unicode(self.bookform.PublisherEdit.text(), u'utf-8')
book.publisher = unicode(
self.bookform.PublisherEdit.text(), u'utf-8')
if self.songmanager.save_book(book):
self.resetBooks()
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t save your book.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t save your book.'))
def onAuthorDeleteButtonClick(self):
"""

View File

@ -23,21 +23,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
class BaseModel(object):
"""
BaseModel provides a base object with a set of generic functions
"""
@classmethod
def populate(cls, **kwargs):
"""
Creates an instance of a class and populates it, returning the instance
"""
me = cls()
keys = kwargs.keys()
for key in keys:
me.__setattr__(key, kwargs[key])
return me
from openlp.core.lib import BaseModel
class Author(BaseModel):
"""
@ -50,7 +36,8 @@ class Book(BaseModel):
Book model
"""
def __repr__(self):
return u'<Book id="%s" name="%s" publisher="%s" />' % (str(self.id), self.name, self.publisher)
return u'<Book id="%s" name="%s" publisher="%s" />' % (
str(self.id), self.name, self.publisher)
class Song(BaseModel):
"""

View File

@ -270,7 +270,7 @@ class SongMediaItem(MediaManagerItem):
self.edit_song_form.loadSong(fields[1], (fields[0] == u'P'))
self.edit_song_form.exec_()
def onEditClick(self, preview=False):
def onEditClick(self):
item = self.ListView.currentItem()
if item:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
@ -283,7 +283,8 @@ class SongMediaItem(MediaManagerItem):
if len(items) == 1:
del_message = self.trUtf8('Delete song?')
else:
del_message = unicode(self.trUtf8('Delete %d songs?')) % len(items)
del_message = unicode(
self.trUtf8('Delete %d songs?')) % len(items)
ans = QtGui.QMessageBox.question(self,
self.trUtf8('Delete Confirmation'), del_message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok|
@ -323,7 +324,8 @@ class SongMediaItem(MediaManagerItem):
#no verse list or only 1 space (in error)
if not song.verse_order or not song.verse_order.strip():
for verse in verseList:
verseTag = u'%s:%s' % (verse[0][u'type'], verse[0][u'label'])
verseTag = u'%s:%s' % (
verse[0][u'type'], verse[0][u'label'])
service_item.add_from_text(\
verse[1][:30], unicode(verse[1]), verseTag)
else:
@ -372,4 +374,3 @@ class SongMediaItem(MediaManagerItem):
]
return True

View File

@ -67,7 +67,7 @@ class SofImport(OooImport):
Initialise the class. Requires a songmanager class which is passed
to SongImport for writing song to disk
"""
OooImport.__init__(self,songmanager)
OooImport.__init__(self, songmanager)
def import_sof(self, filename):
self.start_ooo()
@ -332,105 +332,205 @@ class SofImport(OooImport):
Because someone at Kingsway forgot to check the 1+2 RTF file,
some verses were not formatted correctly.
"""
if song_number == 11: return 8
if song_number == 18: return 5
if song_number == 21: return 6
if song_number == 23: return 4
if song_number == 24: return 7
if song_number == 27: return 4
if song_number == 31: return 6
if song_number == 49: return 4
if song_number == 50: return 8
if song_number == 70: return 4
if song_number == 75: return 8
if song_number == 79: return 6
if song_number == 97: return 7
if song_number == 107: return 4
if song_number == 109: return 4
if song_number == 133: return 4
if song_number == 155: return 10
if song_number == 156: return 8
if song_number == 171: return 4
if song_number == 188: return 7
if song_number == 192: return 4
if song_number == 208: return 8
if song_number == 215: return 8
if song_number == 220: return 4
if song_number == 247: return 6
if song_number == 248: return 6
if song_number == 251: return 8
if song_number == 295: return 8
if song_number == 307: return 5
if song_number == 314: return 6
if song_number == 325: return 8
if song_number == 386: return 6
if song_number == 415: return 4
if song_number == 426: return 4
if song_number == 434: return 5
if song_number == 437: return 4
if song_number == 438: return 6
if song_number == 456: return 8
if song_number == 461: return 4
if song_number == 469: return 4
if song_number == 470: return 5
if song_number == 476: return 6
if song_number == 477: return 7
if song_number == 480: return 8
if song_number == 482: return 4
if song_number == 512: return 4
if song_number == 513: return 8
if song_number == 518: return 5
if song_number == 520: return 4
if song_number == 523: return 6
if song_number == 526: return 8
if song_number == 527: return 4
if song_number == 529: return 4
if song_number == 537: return 4
if song_number == 555: return 6
if song_number == 581: return 4
if song_number == 589: return 6
if song_number == 590: return 4
if song_number == 593: return 8
if song_number == 596: return 4
if song_number == 610: return 6
if song_number == 611: return 6
if song_number == 619: return 8
if song_number == 645: return 5
if song_number == 653: return 6
if song_number == 683: return 7
if song_number == 686: return 4
if song_number == 697: return 8
if song_number == 698: return 4
if song_number == 704: return 6
if song_number == 716: return 4
if song_number == 717: return 6
if song_number == 730: return 4
if song_number == 731: return 8
if song_number == 732: return 8
if song_number == 738: return 4
if song_number == 756: return 9
if song_number == 815: return 6
if song_number == 830: return 8
if song_number == 831: return 4
if song_number == 876: return 6
if song_number == 877: return 6
if song_number == 892: return 4
if song_number == 894: return 6
if song_number == 902: return 8
if song_number == 905: return 8
if song_number == 921: return 6
if song_number == 940: return 7
if song_number == 955: return 9
if song_number == 968: return 8
if song_number == 972: return 7
if song_number == 974: return 4
if song_number == 988: return 6
if song_number == 991: return 5
if song_number == 1002: return 8
if song_number == 1024: return 8
if song_number == 1044: return 9
if song_number == 1088: return 6
if song_number == 1117: return 6
if song_number == 1119: return 7
if song_number == 11:
return 8
if song_number == 18:
return 5
if song_number == 21:
return 6
if song_number == 23:
return 4
if song_number == 24:
return 7
if song_number == 27:
return 4
if song_number == 31:
return 6
if song_number == 49:
return 4
if song_number == 50:
return 8
if song_number == 70:
return 4
if song_number == 75:
return 8
if song_number == 79:
return 6
if song_number == 97:
return 7
if song_number == 107:
return 4
if song_number == 109:
return 4
if song_number == 133:
return 4
if song_number == 155:
return 10
if song_number == 156:
return 8
if song_number == 171:
return 4
if song_number == 188:
return 7
if song_number == 192:
return 4
if song_number == 208:
return 8
if song_number == 215:
return 8
if song_number == 220:
return 4
if song_number == 247:
return 6
if song_number == 248:
return 6
if song_number == 251:
return 8
if song_number == 295:
return 8
if song_number == 307:
return 5
if song_number == 314:
return 6
if song_number == 325:
return 8
if song_number == 386:
return 6
if song_number == 415:
return 4
if song_number == 426:
return 4
if song_number == 434:
return 5
if song_number == 437:
return 4
if song_number == 438:
return 6
if song_number == 456:
return 8
if song_number == 461:
return 4
if song_number == 469:
return 4
if song_number == 470:
return 5
if song_number == 476:
return 6
if song_number == 477:
return 7
if song_number == 480:
return 8
if song_number == 482:
return 4
if song_number == 512:
return 4
if song_number == 513:
return 8
if song_number == 518:
return 5
if song_number == 520:
return 4
if song_number == 523:
return 6
if song_number == 526:
return 8
if song_number == 527:
return 4
if song_number == 529:
return 4
if song_number == 537:
return 4
if song_number == 555:
return 6
if song_number == 581:
return 4
if song_number == 589:
return 6
if song_number == 590:
return 4
if song_number == 593:
return 8
if song_number == 596:
return 4
if song_number == 610:
return 6
if song_number == 611:
return 6
if song_number == 619:
return 8
if song_number == 645:
return 5
if song_number == 653:
return 6
if song_number == 683:
return 7
if song_number == 686:
return 4
if song_number == 697:
return 8
if song_number == 698:
return 4
if song_number == 704:
return 6
if song_number == 716:
return 4
if song_number == 717:
return 6
if song_number == 730:
return 4
if song_number == 731:
return 8
if song_number == 732:
return 8
if song_number == 738:
return 4
if song_number == 756:
return 9
if song_number == 815:
return 6
if song_number == 830:
return 8
if song_number == 831:
return 4
if song_number == 876:
return 6
if song_number == 877:
return 6
if song_number == 892:
return 4
if song_number == 894:
return 6
if song_number == 902:
return 8
if song_number == 905:
return 8
if song_number == 921:
return 6
if song_number == 940:
return 7
if song_number == 955:
return 9
if song_number == 968:
return 8
if song_number == 972:
return 7
if song_number == 974:
return 4
if song_number == 988:
return 6
if song_number == 991:
return 5
if song_number == 1002:
return 8
if song_number == 1024:
return 8
if song_number == 1044:
return 9
if song_number == 1088:
return 6
if song_number == 1117:
return 6
if song_number == 1119:
return 7
return None

View File

@ -122,8 +122,9 @@ class SongImport(object):
or text.lower().find(self.copyright_symbol) >= 0:
copyright_found = False
for line in lines:
if copyright_found or line.lower().find(self.copyright_string) >= 0\
or line.lower().find(self.copyright_symbol) >= 0:
if (copyright_found or
line.lower().find(self.copyright_string) >= 0 or
line.lower().find(self.copyright_symbol) >= 0):
copyright_found = True
self.add_copyright(line)
else:
@ -264,8 +265,8 @@ class SongImport(object):
"""
Remove punctuation from the string for searchable fields
"""
for c in string.punctuation:
text = text.replace(c, u'')
for character in string.punctuation:
text = text.replace(character, u'')
return text
def finish(self):

View File

@ -23,6 +23,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import logging
import sys
import os
@ -32,6 +33,9 @@ sys.path.append(os.path.abspath(u'./../../../..'))
from openlp.core.lib import XmlRootClass
log = logging.getLogger(__name__)
class SongException(Exception):
pass
@ -71,7 +75,7 @@ _blankOpenSongXml = \
'''
class _OpenSong(XmlRootClass):
"""Class for import of OpenSogn"""
"""Class for import of OpenSong"""
def __init__(self, xmlContent = None):
"""Initialize from given xml content"""
@ -80,7 +84,6 @@ class _OpenSong(XmlRootClass):
def _reset(self):
"""Reset all song attributes"""
global _blankOpenSongXml
self._setFromXml(_blankOpenSongXml, 'song')
def from_buffer(self, xmlContent):
@ -110,8 +113,7 @@ class _OpenSong(XmlRootClass):
res.append(self.theme)
if self.alttheme:
res.append(self.alttheme)
s = u', u'.join(res)
return s
return u', u'.join(res)
def _reorder_verse(self, tag, tmpVerse):
"""
@ -120,28 +122,28 @@ class _OpenSong(XmlRootClass):
tmpVerse -- list of strings
"""
res = []
for c in '1234567890 ':
for digit in '1234567890 ':
tagPending = True
for l in tmpVerse:
if l.startswith(c):
for line in tmpVerse:
if line.startswith(digit):
if tagPending:
tagPending = False
t = tag.strip(u'[]').lower()
if 'v' == t:
tagChar = tag.strip(u'[]').lower()
if 'v' == tagChar:
newtag = "Verse"
elif 'c' == t:
elif 'c' == tagChar:
newtag = "Chorus"
elif 'b' == t:
elif 'b' == tagChar:
newtag = "Bridge"
elif 'p' == t:
elif 'p' == tagChar:
newtag = "Pre-chorus"
else:
newtag = t
s = (u'# %s %s' % (newtag, c)).rstrip()
res.append(s)
res.append(l[1:])
if (len(l) == 0) and (not tagPending):
res.append(l)
newtag = tagChar
tagString = (u'# %s %s' % (newtag, digit)).rstrip()
res.append(tagString)
res.append(line[1:])
if (len(line) == 0) and (not tagPending):
res.append(line)
return res
def get_lyrics(self):
@ -162,13 +164,13 @@ class _OpenSong(XmlRootClass):
if line.startswith(u'['):
tag = line
else:
r = self._reorder_verse(tag, tmpVerse)
finalLyrics.extend(r)
reorderedVerse = self._reorder_verse(tag, tmpVerse)
finalLyrics.extend(reorderedVerse)
tag = ""
tmpVerse = []
# catch up final verse
r = self._reorder_verse(tag, tmpVerse)
finalLyrics.extend(r)
reorderedVerse = self._reorder_verse(tag, tmpVerse)
finalLyrics.extend(reorderedVerse)
return finalLyrics
@ -301,7 +303,7 @@ class Song(object):
string = title
for char in punctuation:
string = string.replace(char, '')
return s
return string
def set_title(self, title):
"""Set the song title
@ -341,36 +343,36 @@ class Song(object):
sCopyright = ""
sCcli = ""
lastpart = 0
n = 0
lineCount = 0
metMisc = False
lyrics = []
for l in textList:
n += 1
for line in textList:
lineCount += 1
if lastpart > 0:
lastpart += 1
if lastpart == 2:
sCopyright = l[1:].strip()
sCopyright = line[1:].strip()
if lastpart == 3:
sAuthor = l
elif l.startswith(u'CCLI Song'):
sCcli = l[13:].strip()
sAuthor = line
elif line.startswith(u'CCLI Song'):
sCcli = line[13:].strip()
lastpart = 1
else:
if metMisc:
metMisc = False
if l.upper().startswith(u'(BRIDGE)'):
if line.upper().startswith(u'(BRIDGE)'):
lyrics.append(u'# Bridge')
# otherwise unknown misc keyword
elif l.startswith(u'Misc'):
elif line.startswith(u'Misc'):
metMisc = True
elif l.startswith(u'Verse') or l.startswith(u'Chorus'):
lyrics.append(u'# %s'%l)
elif line.startswith(u'Verse') or line.startswith(u'Chorus'):
lyrics.append(u'# %s' % line)
else:
# should we remove multiple blank lines?
if n == 1:
sName = l
if lineCount == 1:
sName = line
else:
lyrics.append(l)
lyrics.append(line)
# split on known separators
lst = sAuthor.split(u'/')
if len(lst) < 2:
@ -403,7 +405,7 @@ class Song(object):
if string_in is None:
string_out = ""
else:
string_out = unicode(s)
string_out = unicode(string_in)
return string_out
def _split_to_list(self, aString):

View File

@ -35,10 +35,11 @@ from songusagedetaildialog import Ui_SongUsageDetailDialog
log = logging.getLogger(__name__)
class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
log.info(u'SongUsage Detail Form loaded')
"""
Class documentation goes here.
"""
log.info(u'SongUsage Detail Form Loaded')
def __init__(self, parent=None):
"""
Constructor

View File

@ -23,21 +23,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
class BaseModel(object):
"""
BaseModel provides a base object with a set of generic functions
"""
@classmethod
def populate(cls, **kwargs):
"""
Creates an instance of a class and populates it, returning the instance
"""
me = cls()
keys = kwargs.keys()
for key in keys:
me.__setattr__(key, kwargs[key])
return me
from openlp.core.lib import BaseModel
class SongUsageItem(BaseModel):
"""

View File

@ -33,7 +33,7 @@ from openlp.plugins.songusage.lib.models import init_models, metadata, \
log = logging.getLogger(__name__)
class SongUsageManager():
class SongUsageManager(object):
"""
The Song Manager provides a central location for all database code. This
class takes care of connecting to the database and running all the queries.

3098
resources/i18n/openlp_et.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
hiddenimports = ['lxml.etree']

View File

@ -28,11 +28,48 @@ Windows Build Script
--------------------
This script is used to build the Windows binary and the accompanying installer.
For this script to work out of the box, it depends on a number of things:
Inno Setup 5
Inno Setup should be installed into "C:\%PROGRAMFILES%\Inno Setup 5"
UPX
This is used to compress DLLs and EXEs so that they take up less space, but
still function exactly the same. To install UPS, download it from
http://upx.sourceforge.net/, extract it into C:\%PROGRAMFILES%\UPX, and then
add that directory to your PATH environment variable.
PyInstaller
PyInstaller should be a checkout of trunk, and in a directory called,
"pyinstaller" on the same level as OpenLP's Bazaar shared repository
directory.
To install PyInstaller, first checkout trunk from Subversion. The easiest
way is to install TortoiseSVN and then checkout the following URL to a
directory called "pyinstaller"::
http://svn.pyinstaller.org/trunk
Then you need to copy the two hook-*.py files from the "pyinstaller"
subdirectory in OpenLP's "resources" directory into PyInstaller's "hooks"
directory.
Once you've done that, open a command prompt (DOS shell), navigate to the
PyInstaller directory and run::
C:\Projects\pyinstaller>python Configure.py
Bazaar
You need the command line "bzr" client installed.
OpenLP
A checkout of the latest code, in a branch directory, which is in a Bazaar
shared repository directory. This means your code should be in a directory
structure like this: "openlp\branch-name".
windows-builder.py
This script, of course. It should be in the "scripts" directory of OpenLP.
For this script to work out of the box, it depends on being inside the
"resources/pyinstaller" directory in the OpenLP source tree, it depends on
OpenLP having it's own project directory which all the branches live in, and it
depends on PyInstaller being
"""
import os
@ -40,12 +77,12 @@ from shutil import copy
from subprocess import Popen, PIPE
script_path = os.path.split(os.path.abspath(__file__))[0]
pyinstaller_path = os.path.abspath(os.path.join(script_path, u'..', u'..', u'..', u'..', u'pyinstaller'))
innosetup_path = os.path.join(os.getenv(u'PROGRAMFILES'), 'Inno Setup 5')
iss_path = os.path.abspath(os.path.join(script_path, u'..', u'innosetup'))
branch_path = os.path.abspath(os.path.join(script_path, u'..', u'..'))
branch_path = os.path.abspath(os.path.join(script_path, u'..'))
source_path = os.path.join(branch_path, u'openlp')
dist_path = os.path.join(branch_path, u'dist', u'OpenLP')
pyinstaller_path = os.path.abspath(os.path.join(branch_path, u'..', u'..', u'pyinstaller'))
innosetup_path = os.path.join(os.getenv(u'PROGRAMFILES'), 'Inno Setup 5')
iss_path = os.path.join(branch_path, u'resources', u'innosetup')
def run_pyinstaller():
@ -113,12 +150,12 @@ def run_innosetup():
def main():
print "Script path:", script_path
print "PyInstaller path:", pyinstaller_path
print "Inno Setup path:", innosetup_path
print "ISS file path:", iss_path
print "Branch path:", branch_path
print "Source path:", source_path
print "\"dist\" path:", dist_path
print "PyInstaller path:", pyinstaller_path
print "Inno Setup path:", innosetup_path
print "ISS file path:", iss_path
run_pyinstaller()
write_version_file()
copy_plugins()