This commit is contained in:
Jonathan Corwin 2010-03-22 23:02:02 +00:00
commit 4e8b3e29bc
192 changed files with 2118 additions and 1518 deletions

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -7,8 +7,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -1 +1 @@
1.9.0-bzr722 1.9.0-bzr743

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -43,7 +43,6 @@ class Renderer(object):
""" """
self._rect = None self._rect = None
self._debug = False self._debug = False
self._right_margin = 64 # the amount of right indent
self._display_shadow_size_footer = 0 self._display_shadow_size_footer = 0
self._display_outline_size_footer = 0 self._display_outline_size_footer = 0
self.theme_name = None self.theme_name = None
@ -149,7 +148,7 @@ class Renderer(object):
def pre_render_text(self, text): def pre_render_text(self, text):
metrics = QtGui.QFontMetrics(self.mainFont) metrics = QtGui.QFontMetrics(self.mainFont)
#work out line width #work out line width
line_width = self._rect.width() - self._right_margin line_width = self._rect.width()
#number of lines on a page - adjust for rounding up. #number of lines on a page - adjust for rounding up.
line_height = metrics.height() line_height = metrics.height()
if self._theme.display_shadow: if self._theme.display_shadow:
@ -224,6 +223,7 @@ class Renderer(object):
``rect_footer`` ``rect_footer``
The footer text block. The footer text block.
""" """
log.debug(u'set_text_rectangle %s , %s' %(rect_main, rect_footer) )
self._rect = rect_main self._rect = rect_main
self._rect_footer = rect_footer self._rect_footer = rect_footer
@ -447,8 +447,7 @@ class Renderer(object):
rightextent = x + w rightextent = x + w
# shift right from last line's rh edge # shift right from last line's rh edge
if self._theme.display_wrapStyle == 1 and linenum != 0: if self._theme.display_wrapStyle == 1 and linenum != 0:
rightextent = self._first_line_right_extent + \ rightextent = self._first_line_right_extent
self._right_margin
if rightextent > maxx: if rightextent > maxx:
rightextent = maxx rightextent = maxx
x = rightextent - w x = rightextent - w

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -146,13 +146,13 @@ class RenderManager(object):
footer_rect = None footer_rect = None
if not theme.font_main_override: if not theme.font_main_override:
main_rect = QtCore.QRect(10, 0, main_rect = QtCore.QRect(10, 0,
self.width - 1, self.footer_start) self.width - 20, self.footer_start)
else: else:
main_rect = QtCore.QRect(theme.font_main_x, theme.font_main_y, main_rect = QtCore.QRect(theme.font_main_x, theme.font_main_y,
theme.font_main_width - 1, theme.font_main_height - 1) theme.font_main_width - 1, theme.font_main_height - 1)
if not theme.font_footer_override: if not theme.font_footer_override:
footer_rect = QtCore.QRect(10, self.footer_start, footer_rect = QtCore.QRect(10, self.footer_start,
self.width - 1, self.height - self.footer_start) self.width - 20, self.height - self.footer_start)
else: else:
footer_rect = QtCore.QRect(theme.font_footer_x, footer_rect = QtCore.QRect(theme.font_footer_x,
theme.font_footer_y, theme.font_footer_width - 1, theme.font_footer_y, theme.font_footer_width - 1,

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -148,6 +148,8 @@ class SongXMLParser(object):
verse_list = [] verse_list = []
for element in iter: for element in iter:
if element.tag == u'verse': if element.tag == u'verse':
if element.text is None:
element.text = u''
verse_list.append([element.attrib, verse_list.append([element.attrib,
unicode(element.text).decode('unicode-escape')]) unicode(element.text).decode('unicode-escape')])
return verse_list return verse_list

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -53,7 +53,7 @@ blankthemexml=\
<weight>Normal</weight> <weight>Normal</weight>
<italics>False</italics> <italics>False</italics>
<indentation>0</indentation> <indentation>0</indentation>
<location override="False" x="10" y="10" width="1024" height="730"/> <location override="False" x="10" y="10" width="1004" height="730"/>
</font> </font>
<font type="footer"> <font type="footer">
<name>Arial</name> <name>Arial</name>
@ -62,7 +62,7 @@ blankthemexml=\
<weight>Normal</weight> <weight>Normal</weight>
<italics>False</italics> <italics>False</italics>
<indentation>0</indentation> <indentation>0</indentation>
<location override="False" x="10" y="730" width="1024" height="38"/> <location override="False" x="10" y="730" width="1004" height="38"/>
</font> </font>
<display> <display>
<shadow color="#000000" size="5">True</shadow> <shadow color="#000000" size="5">True</shadow>

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -1,3 +1,28 @@
# -*- 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 #
###############################################################################
import logging import logging
import os import os
import sys import sys

View File

@ -1,3 +1,28 @@
# -*- 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 #
###############################################################################
import logging import logging
import os import os
import sys import sys
@ -46,4 +71,4 @@ if __name__ == "__main__":
log.debug(u'List of plugins found:') log.debug(u'List of plugins found:')
for plugin in t.p.plugins: for plugin in t.p.plugins:
log.debug(u'Plugin %s, name=%s (version=%d)' %(unicode(plugin), log.debug(u'Plugin %s, name=%s (version=%d)' %(unicode(plugin),
plugin.name, plugin.version)) plugin.name, plugin.version))

View File

@ -1,20 +1,27 @@
""" # -*- coding: utf-8 -*-
OpenLP - Open Source Lyrics Projection # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
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 # OpenLP - Open Source Lyrics Projection #
Foundation; version 2 of the License. # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
This program is distributed in the hope that it will be useful, but WITHOUT ANY # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
PARTICULAR PURPOSE. See the GNU General Public License for more details. # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
You should have received a copy of the GNU General Public License along with # This program is free software; you can redistribute it and/or modify it #
this program; if not, write to the Free Software Foundation, Inc., 59 Temple # under the terms of the GNU General Public License as published by the Free #
Place, Suite 330, Boston, MA 02111-1307 USA # 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 sys import sys
import os import os
@ -135,13 +142,13 @@ class TestRender(TestRender_base):
def test_longer(self): def test_longer(self):
answer = self.renderer._render_single_line( answer = self.renderer._render_single_line(
u'Test line with more words than fit on one line', u'Test line with more words than fit on one line',
tlcorner = (10,10)) tlcorner = (10,10))
assert(answer == (753,136)) assert(answer == (753,136))
def test_even_longer(self): def test_even_longer(self):
answer = self.renderer._render_single_line( answer = self.renderer._render_single_line(
u'Test line with more words than fit on either one or two lines', u'Test line with more words than fit on either one or two lines',
tlcorner = (10,10)) tlcorner = (10,10))
assert(answer == (753,199)) assert(answer == (753,199))
def test_lines(self): def test_lines(self):

View File

@ -1,20 +1,27 @@
""" # -*- coding: utf-8 -*-
OpenLP - Open Source Lyrics Projection # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
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 # OpenLP - Open Source Lyrics Projection #
Foundation; version 2 of the License. # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
This program is distributed in the hope that it will be useful, but WITHOUT ANY # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
PARTICULAR PURPOSE. See the GNU General Public License for more details. # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
You should have received a copy of the GNU General Public License along with # This program is free software; you can redistribute it and/or modify it #
this program; if not, write to the Free Software Foundation, Inc., 59 Temple # under the terms of the GNU General Public License as published by the Free #
Place, Suite 330, Boston, MA 02111-1307 USA # 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 sys import sys
import os import os
@ -163,7 +170,7 @@ And drives away his fear.
t = Theme(u'blank_theme.xml') t = Theme(u'blank_theme.xml')
t.BackgroundType = 2 t.BackgroundType = 2
t.BackgroundParameter1 = os.path.join(u'data_for_tests', t.BackgroundParameter1 = os.path.join(u'data_for_tests',
'treessmall.jpg') 'treessmall.jpg')
t.BackgroundParameter2 = QtGui.QColor(0,0,64) t.BackgroundParameter2 = QtGui.QColor(0,0,64)
t.BackgroundParameter3 = 0 t.BackgroundParameter3 = 0
t.VerticalAlign = 2 t.VerticalAlign = 2

View File

@ -5,8 +5,9 @@
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Martin Thompson, Tim Bentley, Carsten # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -1,3 +1,28 @@
# -*- 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 #
###############################################################################
import os import os
import os.path import os.path
import sys import sys

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -142,13 +142,17 @@ class Ui_AboutDialog(object):
' Michael "cocooncrash" Gorven\n' ' Michael "cocooncrash" Gorven\n'
' Scott "sguerrieri" Guerrieri\n' ' Scott "sguerrieri" Guerrieri\n'
' Raoul "superfly" Snyman\n' ' Raoul "superfly" Snyman\n'
' Maikel Stuivenberg\n'
' Martin "mijiti" Thompson\n' ' Martin "mijiti" Thompson\n'
' Jon "Meths" Tibble\n' ' Jon "Meths" Tibble\n'
'\n'
'Contributors\n'
' Christian "crichter" Richter\n'
' Maikel Stuivenberg\n'
' Carsten "catini" Tingaard\n' ' Carsten "catini" Tingaard\n'
'\n' '\n'
'Testers\n' 'Testers\n'
' Wesley "wrst" Stout' ' Wesley "wrst" Stout\n'
' Philip "Phill" Ridout'
)) ))
self.AboutNotebook.setTabText( self.AboutNotebook.setTabText(
self.AboutNotebook.indexOf(self.CreditsTab), self.AboutNotebook.indexOf(self.CreditsTab),
@ -158,8 +162,8 @@ class Ui_AboutDialog(object):
'Snyman\n' 'Snyman\n'
'Portions copyright ' + u'\u00a9'.encode('utf8') + ' 2004-2009 ' 'Portions copyright ' + u'\u00a9'.encode('utf8') + ' 2004-2009 '
'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri, ' 'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri, '
'Maikel Stuivenberg, Martin Thompson, Jon Tibble, Carsten ' 'Christian Richter, Maikel Stuivenberg, Martin Thompson, Jon '
'Tinggaard\n' 'Tibble, Carsten Tinggaard\n'
'\n' '\n'
'This program is free software; you can redistribute it and/or ' 'This program is free software; you can redistribute it and/or '
'modify it under the terms of the GNU General Public License as ' 'modify it under the terms of the GNU General Public License as '

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -168,8 +168,7 @@ class MainDisplay(DisplayWidget):
self.screen[u'size'].height(), self.screen[u'size'].height(),
QtGui.QImage.Format_ARGB32_Premultiplied) QtGui.QImage.Format_ARGB32_Premultiplied)
painter.begin(self.blankFrame) painter.begin(self.blankFrame)
#TODO make black when testing finished painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black)
painter.fillRect(self.blankFrame.rect(), QtCore.Qt.red)
#build a blank transparent image #build a blank transparent image
self.transparent = QtGui.QPixmap(self.screen[u'size'].width(), self.transparent = QtGui.QPixmap(self.screen[u'size'].width(),
self.screen[u'size'].height()) self.screen[u'size'].height())
@ -227,6 +226,7 @@ class MainDisplay(DisplayWidget):
``frame`` ``frame``
Image frame to be rendered Image frame to be rendered
""" """
log.debug(u'frameView %d' % (self.displayBlank))
if not self.displayBlank: if not self.displayBlank:
if transition: if transition:
if self.frame is not None: if self.frame is not None:
@ -249,14 +249,22 @@ class MainDisplay(DisplayWidget):
if not self.isVisible(): if not self.isVisible():
self.setVisible(True) self.setVisible(True)
self.showFullScreen() self.showFullScreen()
else:
self.waitingFrame = frame
self.waitingFrameTrans = transition
def blankDisplay(self, blanked=True): def blankDisplay(self, blanked=True):
log.debug(u'Blank main Display %d' % blanked)
if blanked: if blanked:
self.displayBlank = True self.displayBlank = True
self.display_text.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) self.display_text.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
self.waitingFrame = None
self.waitingFrameTrans = False
else: else:
self.displayBlank = False self.displayBlank = False
if self.display_frame: if self.waitingFrame:
self.frameView(self.waitingFrame, self.waitingFrameTrans)
elif self.display_frame:
self.frameView(self.display_frame) self.frameView(self.display_frame)
def onMediaQueue(self, message): def onMediaQueue(self, message):

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -23,7 +23,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import os
import logging import logging
import time import time
@ -68,7 +67,8 @@ class VersionThread(QtCore.QThread):
""" """
Run the thread. Run the thread.
""" """
time.sleep(2) time.sleep(1)
Receiver.send_message(u'blank_check')
version = check_latest_version(self.generalConfig, self.app_version) version = check_latest_version(self.generalConfig, self.app_version)
#new version has arrived #new version has arrived
if version != self.app_version: if version != self.app_version:
@ -419,7 +419,7 @@ class Ui_MainWindow(object):
self.LanguageEnglishItem.setText(self.trUtf8('English')) self.LanguageEnglishItem.setText(self.trUtf8('English'))
self.LanguageEnglishItem.setStatusTip( self.LanguageEnglishItem.setStatusTip(
self.trUtf8('Set the interface language to English')) self.trUtf8('Set the interface language to English'))
self.ToolsAddToolItem.setText(self.trUtf8('&Add Tool...')) self.ToolsAddToolItem.setText(self.trUtf8('Add &Tool...'))
self.ToolsAddToolItem.setStatusTip( self.ToolsAddToolItem.setStatusTip(
self.trUtf8('Add an application to the list of tools')) self.trUtf8('Add an application to the list of tools'))
self.action_Preview_Panel.setText(self.trUtf8('&Preview Pane')) self.action_Preview_Panel.setText(self.trUtf8('&Preview Pane'))
@ -494,6 +494,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'update_global_theme'), self.defaultThemeChanged) QtCore.SIGNAL(u'update_global_theme'), self.defaultThemeChanged)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'version_check'), self.versionCheck) QtCore.SIGNAL(u'version_check'), self.versionCheck)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'blank_check'), self.blankCheck)
QtCore.QObject.connect(self.FileNewItem, QtCore.QObject.connect(self.FileNewItem,
QtCore.SIGNAL(u'triggered()'), QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onNewService) self.ServiceManagerContents.onNewService)
@ -583,6 +585,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.activateWindow() self.activateWindow()
if str_to_bool(self.generalConfig.get_config(u'auto open', False)): if str_to_bool(self.generalConfig.get_config(u'auto open', False)):
self.ServiceManagerContents.onLoadService(True) self.ServiceManagerContents.onLoadService(True)
def blankCheck(self):
if str_to_bool(self.generalConfig.get_config(u'screen blank', False)) \ if str_to_bool(self.generalConfig.get_config(u'screen blank', False)) \
and str_to_bool(self.generalConfig.get_config(u'blank warning', False)): and str_to_bool(self.generalConfig.get_config(u'blank warning', False)):
self.LiveController.onBlankDisplay(True) self.LiveController.onBlankDisplay(True)
@ -621,6 +625,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.screens.set_current_display(updated_display) self.screens.set_current_display(updated_display)
self.RenderManager.update_display(updated_display) self.RenderManager.update_display(updated_display)
self.mainDisplay.setup(updated_display) self.mainDisplay.setup(updated_display)
#Trigger after changes have been made
Receiver.send_message(u'config_updated')
self.activateWindow() self.activateWindow()
def closeEvent(self, event): def closeEvent(self, event):

View File

@ -6,15 +6,15 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. # # Software Foundation; version 2 of the License. #
# # # #
# This program is distributed in the hope that it will be useful, but WITHOUT # # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANdockILITY or # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. # # more details. #
# # # #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -22,6 +22,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -100,6 +100,7 @@ class ServiceManager(QtGui.QWidget):
self.parent = parent self.parent = parent
self.serviceItems = [] self.serviceItems = []
self.serviceName = u'' self.serviceName = u''
self.droppos = 0
#is a new service and has not been saved #is a new service and has not been saved
self.isNew = True self.isNew = True
#Indicates if remoteTriggering is active. If it is the next addServiceItem call #Indicates if remoteTriggering is active. If it is the next addServiceItem call
@ -190,6 +191,8 @@ class ServiceManager(QtGui.QWidget):
QtCore.SIGNAL(u'presentation types'), self.onPresentationTypes) QtCore.SIGNAL(u'presentation types'), self.onPresentationTypes)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'servicemanager_next_item'), self.nextItem) QtCore.SIGNAL(u'servicemanager_next_item'), self.nextItem)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.regenerateServiceItems)
# Last little bits of setting up # Last little bits of setting up
self.config = PluginConfig(u'ServiceManager') self.config = PluginConfig(u'ServiceManager')
self.servicePath = self.config.get_data_path() self.servicePath = self.config.get_data_path()
@ -474,7 +477,8 @@ class ServiceManager(QtGui.QWidget):
log.debug(u'onSaveService') log.debug(u'onSaveService')
if not quick or self.isNew: if not quick or self.isNew:
filename = QtGui.QFileDialog.getSaveFileName(self, filename = QtGui.QFileDialog.getSaveFileName(self,
u'Save Service', self.config.get_last_dir()) self.trUtf8(u'Save Service'), self.config.get_last_dir(),
self.trUtf8(u'OpenLP Service Files (*.osz)'))
else: else:
filename = self.config.get_last_dir() filename = self.config.get_last_dir()
if filename: if filename:
@ -513,9 +517,9 @@ class ServiceManager(QtGui.QWidget):
os.remove(servicefile) os.remove(servicefile)
except: except:
pass #if not present do not worry pass #if not present do not worry
name = filename.split(os.path.sep) name = filename.split(os.path.sep)
self.serviceName = name[-1] self.serviceName = name[-1]
self.parent.serviceChanged(True, self.serviceName) self.parent.serviceChanged(True, self.serviceName)
def onQuickSaveService(self): def onQuickSaveService(self):
self.onSaveService(True) self.onSaveService(True)
@ -617,7 +621,7 @@ class ServiceManager(QtGui.QWidget):
for item in tempServiceItems: for item in tempServiceItems:
self.addServiceItem(item[u'service_item'], False, item[u'expanded']) self.addServiceItem(item[u'service_item'], False, item[u'expanded'])
#Set to False as items may have changed rendering #Set to False as items may have changed rendering
#does not impact the saved song so True may aslo be valid #does not impact the saved song so True may also be valid
self.parent.serviceChanged(False, self.serviceName) self.parent.serviceChanged(False, self.serviceName)
def addServiceItem(self, item, rebuild=False, expand=True): def addServiceItem(self, item, rebuild=False, expand=True):
@ -637,19 +641,21 @@ class ServiceManager(QtGui.QWidget):
self.repaintServiceList(sitem + 1, 0) self.repaintServiceList(sitem + 1, 0)
self.parent.LiveController.replaceServiceManagerItem(item) self.parent.LiveController.replaceServiceManagerItem(item)
else: else:
if sitem == -1: #nothing selected or dnd
if self.droppos == 0:
self.serviceItems.append({u'service_item': item, self.serviceItems.append({u'service_item': item,
u'order': len(self.serviceItems) + 1, u'order': len(self.serviceItems) + 1,
u'expanded':expand}) u'expanded':expand})
self.repaintServiceList(len(self.serviceItems) + 1, 0) self.repaintServiceList(len(self.serviceItems) + 1, 0)
else: else:
self.serviceItems.insert(sitem + 1, {u'service_item': item, self.serviceItems.insert(self.droppos, {u'service_item': item,
u'order': len(self.serviceItems)+1, u'order': self.droppos,
u'expanded':expand}) u'expanded':expand})
self.repaintServiceList(sitem + 1, 0) self.repaintServiceList(self.droppos, 0)
#if rebuilding list make sure live is fixed. #if rebuilding list make sure live is fixed.
if rebuild: if rebuild:
self.parent.LiveController.replaceServiceManagerItem(item) self.parent.LiveController.replaceServiceManagerItem(item)
self.droppos = 0
self.parent.serviceChanged(False, self.serviceName) self.parent.serviceChanged(False, self.serviceName)
def makePreview(self): def makePreview(self):
@ -730,18 +736,13 @@ class ServiceManager(QtGui.QWidget):
link = event.mimeData() link = event.mimeData()
if link.hasText(): if link.hasText():
plugin = event.mimeData().text() plugin = event.mimeData().text()
item = self.ServiceManagerList.itemAt(event.pos())
if plugin == u'ServiceManager': if plugin == u'ServiceManager':
startpos, startCount = self.findServiceItem() startpos, startCount = self.findServiceItem()
item = self.ServiceManagerList.itemAt(event.pos())
if item is None: if item is None:
endpos = len(self.serviceItems) endpos = len(self.serviceItems)
else: else:
parentitem = item.parent() endpos = self._getParentItemData(item) - 1
if parentitem is None:
endpos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
else:
endpos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
endpos -= 1
if endpos < startpos: if endpos < startpos:
newpos = endpos newpos = endpos
else: else:
@ -751,6 +752,10 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems.insert(newpos, serviceItem) self.serviceItems.insert(newpos, serviceItem)
self.repaintServiceList(endpos, startCount) self.repaintServiceList(endpos, startCount)
else: else:
if item == None:
self.droppos = len(self.serviceItems)
else:
self.droppos = self._getParentItemData(item)
Receiver.send_message(u'%s_add_service_item' % plugin) Receiver.send_message(u'%s_add_service_item' % plugin)
def updateThemeList(self, theme_list): def updateThemeList(self, theme_list):
@ -785,3 +790,10 @@ class ServiceManager(QtGui.QWidget):
item, count = self.findServiceItem() item, count = self.findServiceItem()
self.serviceItems[item][u'service_item'].theme = theme self.serviceItems[item][u'service_item'].theme = theme
self.regenerateServiceItems() self.regenerateServiceItems()
def _getParentItemData(self, item):
parentitem = item.parent()
if parentitem is None:
return item.data(0, QtCore.Qt.UserRole).toInt()[0]
else:
return parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -28,7 +28,6 @@ import logging
from PyQt4 import QtGui from PyQt4 import QtGui
from openlp.core.ui import GeneralTab, ThemesTab from openlp.core.ui import GeneralTab, ThemesTab
from openlp.core.lib import Receiver
from settingsdialog import Ui_SettingsDialog from settingsdialog import Ui_SettingsDialog
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -45,7 +44,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
self.ThemesTab = ThemesTab(mainWindow) self.ThemesTab = ThemesTab(mainWindow)
self.addTab(u'Themes', self.ThemesTab) self.addTab(u'Themes', self.ThemesTab)
def addTab(self, name, tab): def addTab(self, name, tab):
log.info(u'Adding %s tab' % tab.tabTitle) log.info(u'Adding %s tab' % tab.tabTitle)
self.SettingsTabWidget.addTab(tab, tab.tabTitleVisible) self.SettingsTabWidget.addTab(tab, tab.tabTitleVisible)
@ -65,7 +64,6 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
def accept(self): def accept(self):
for tab_index in range(0, self.SettingsTabWidget.count()): for tab_index in range(0, self.SettingsTabWidget.count()):
self.SettingsTabWidget.widget(tab_index).save() self.SettingsTabWidget.widget(tab_index).save()
Receiver.send_message(u'config_updated')
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)
def postSetUp(self): def postSetUp(self):

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -299,6 +299,8 @@ class SlideController(QtGui.QWidget):
QtCore.SIGNAL(u'%s_change' % prefix), self.onSlideChange) QtCore.SIGNAL(u'%s_change' % prefix), self.onSlideChange)
QtCore.QObject.connect(self.Splitter, QtCore.QObject.connect(self.Splitter,
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter) QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem)
def widthChanged(self): def widthChanged(self):
""" """
@ -377,6 +379,17 @@ class SlideController(QtGui.QWidget):
self.Mediabar.setVisible(True) self.Mediabar.setVisible(True)
self.volumeSlider.setAudioOutput(self.audio) self.volumeSlider.setAudioOutput(self.audio)
def refreshServiceItem(self):
"""
Method to update the service item if the screen has changed
"""
log.debug(u'refreshServiceItem')
if self.serviceItem:
if self.serviceItem.is_text() or self.serviceItem.is_image():
item = self.serviceItem
item.render()
self.addServiceManagerItem(item, self.selectedRow)
def addServiceItem(self, item): def addServiceItem(self, item):
""" """
Method to install the service item into the controller Method to install the service item into the controller
@ -390,14 +403,14 @@ class SlideController(QtGui.QWidget):
if self.songEdit: if self.songEdit:
slideno = self.selectedRow slideno = self.selectedRow
self.songEdit = False self.songEdit = False
self.addServiceManagerItem(item, slideno) self._processItem(item, slideno)
def replaceServiceManagerItem(self, item): def replaceServiceManagerItem(self, item):
""" """
Replacement item following a remote edit Replacement item following a remote edit
""" """
if item.__eq__(self.serviceItem): if item.__eq__(self.serviceItem):
self.addServiceManagerItem(item, self.PreviewListWidget.currentRow()) self._processItem(item, self.PreviewListWidget.currentRow())
def addServiceManagerItem(self, item, slideno): def addServiceManagerItem(self, item, slideno):
""" """
@ -406,27 +419,32 @@ class SlideController(QtGui.QWidget):
Called by ServiceManager Called by ServiceManager
""" """
log.debug(u'addServiceManagerItem') log.debug(u'addServiceManagerItem')
#If old item was a command tell it to stop #If service item is the same as the current on only change slide
if self.serviceItem and self.serviceItem.is_command(): if item.__eq__(self.serviceItem):
self.onMediaStop() self.PreviewListWidget.selectRow(slideno)
if item.is_media(): self.onSlideSelected()
self.onMediaStart(item) return
elif item.is_command(): self._processItem(item, slideno)
if self.isLive:
blanked = self.blankButton.isChecked()
else:
blanked = False
Receiver.send_message(u'%s_start' % item.name.lower(), \
[item.title, item.service_item_path,
item.get_frame_title(), slideno, self.isLive, blanked])
self.displayServiceManagerItems(item, slideno)
def displayServiceManagerItems(self, serviceItem, slideno): def _processItem(self, serviceItem, slideno):
""" """
Loads a ServiceItem into the system from ServiceManager Loads a ServiceItem into the system from ServiceManager
Display the slide number passed Display the slide number passed
""" """
log.debug(u'displayServiceManagerItems Start') log.debug(u'processsManagerItem')
#If old item was a command tell it to stop
if self.serviceItem and self.serviceItem.is_command():
self.onMediaStop()
if serviceItem.is_media():
self.onMediaStart(serviceItem)
elif serviceItem.is_command():
if self.isLive:
blanked = self.blankButton.isChecked()
else:
blanked = False
Receiver.send_message(u'%s_start' % serviceItem.name.lower(), \
[serviceItem.title, serviceItem.service_item_path,
serviceItem.get_frame_title(), slideno, self.isLive, blanked])
self.slideList = {} self.slideList = {}
width = self.parent.ControlSplitter.sizes()[self.split] width = self.parent.ControlSplitter.sizes()[self.split]
#Set pointing cursor when we have somthing to point at #Set pointing cursor when we have somthing to point at
@ -490,7 +508,6 @@ class SlideController(QtGui.QWidget):
log.log(15, u'Display Rendering took %4s' % (time.time() - before)) log.log(15, u'Display Rendering took %4s' % (time.time() - before))
if self.isLive: if self.isLive:
self.serviceItem.request_audit() self.serviceItem.request_audit()
log.debug(u'displayServiceManagerItems End')
#Screen event methods #Screen event methods
def onSlideSelectedFirst(self): def onSlideSelectedFirst(self):
@ -511,6 +528,7 @@ class SlideController(QtGui.QWidget):
""" """
Handle the blank screen button Handle the blank screen button
""" """
log.debug(u'onBlankDisplay %d' % force)
if force: if force:
self.blankButton.setChecked(True) self.blankButton.setChecked(True)
self.blankScreen(self.blankButton.isChecked()) self.blankScreen(self.blankButton.isChecked())
@ -527,6 +545,8 @@ class SlideController(QtGui.QWidget):
Receiver.send_message(u'%s_blank'% self.serviceItem.name.lower()) Receiver.send_message(u'%s_blank'% self.serviceItem.name.lower())
else: else:
Receiver.send_message(u'%s_unblank'% self.serviceItem.name.lower()) Receiver.send_message(u'%s_unblank'% self.serviceItem.name.lower())
else:
self.parent.mainDisplay.blankDisplay(blanked)
else: else:
self.parent.mainDisplay.blankDisplay(blanked) self.parent.mainDisplay.blankDisplay(blanked)

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -1,20 +1,27 @@
""" # -*- coding: utf-8 -*-
OpenLP - Open Source Lyrics Projection # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
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 # OpenLP - Open Source Lyrics Projection #
Foundation; version 2 of the License. # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
This program is distributed in the hope that it will be useful, but WITHOUT ANY # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
PARTICULAR PURPOSE. See the GNU General Public License for more details. # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
You should have received a copy of the GNU General Public License along with # This program is free software; you can redistribute it and/or modify it #
this program; if not, write to the Free Software Foundation, Inc., 59 Temple # under the terms of the GNU General Public License as published by the Free #
Place, Suite 330, Boston, MA 02111-1307 USA # 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 sys import sys
import os import os

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -29,6 +29,8 @@ import logging
import urllib2 import urllib2
from datetime import datetime from datetime import datetime
import openlp
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class AppLocation(object): class AppLocation(object):
@ -42,8 +44,14 @@ class AppLocation(object):
@staticmethod @staticmethod
def get_directory(dir_type): def get_directory(dir_type):
"""
Return the appropriate directory according to the directory type.
``dir_type``
The directory type you want, for instance the data directory.
"""
if dir_type == AppLocation.AppDir: if dir_type == AppLocation.AppDir:
return os.path.abspath(os.path.split(sys.argv[0])[0]) return os.path.abspath(os.path.split(sys.argv[0])[0])
elif dir_type == AppLocation.ConfigDir: elif dir_type == AppLocation.ConfigDir:
if sys.platform == u'win32': if sys.platform == u'win32':
path = os.path.join(os.getenv(u'APPDATA'), u'openlp') path = os.path.join(os.getenv(u'APPDATA'), u'openlp')
@ -71,14 +79,32 @@ class AppLocation(object):
path = os.path.join(os.getenv(u'HOME'), u'.openlp', u'data') path = os.path.join(os.getenv(u'HOME'), u'.openlp', u'data')
return path return path
elif dir_type == AppLocation.PluginsDir: elif dir_type == AppLocation.PluginsDir:
plugin_path = None
app_path = os.path.abspath(os.path.split(sys.argv[0])[0]) app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
if hasattr(sys, u'frozen') and sys.frozen == 1: if sys.platform == u'win32':
return os.path.join(app_path, u'plugins') if hasattr(sys, u'frozen') and sys.frozen == 1:
plugin_path = os.path.join(app_path, u'plugins')
else:
plugin_path = os.path.join(app_path, u'openlp', u'plugins')
elif sys.platform == u'darwin':
plugin_path = os.path.join(app_path, u'plugins')
else: else:
return os.path.join(app_path, u'openlp', u'plugins') plugin_path = os.path.join(
os.path.split(openlp.__file__)[0], u'plugins')
return plugin_path
def check_latest_version(config, current_version): def check_latest_version(config, current_version):
"""
Check the latest version of OpenLP against the version file on the OpenLP
site.
``config``
The OpenLP config object.
``current_version``
The current version of OpenLP.
"""
version_string = current_version version_string = current_version
#set to prod in the distribution confif file. #set to prod in the distribution confif file.
last_test = config.get_config(u'last version test', datetime.now().date()) last_test = config.get_config(u'last version test', datetime.now().date())
@ -97,6 +123,18 @@ def check_latest_version(config, current_version):
log.exception(u'Reason for failure: %s', e.reason) log.exception(u'Reason for failure: %s', e.reason)
return version_string return version_string
def variant_to_unicode(variant):
"""
Converts a QVariant to a unicode string.
``variant``
The QVariant instance to convert to unicode.
"""
string = variant.toString()
if not isinstance(string, unicode):
string = unicode(string, u'utf8')
return string
from registry import Registry from registry import Registry
from confighelper import ConfigHelper from confighelper import ConfigHelper

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -1,11 +1,27 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
# Form implementation generated from reading ui file 'alertform.ui' ###############################################################################
# # OpenLP - Open Source Lyrics Projection #
# Created: Sat Feb 13 08:19:51 2010 # --------------------------------------------------------------------------- #
# by: PyQt4 UI code generator 4.6.2 # Copyright (c) 2008-2010 Raoul Snyman #
# # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# WARNING! All changes made in this file will be lost! # 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 #
###############################################################################
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui

View File

@ -1,11 +1,27 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
# Form implementation generated from reading ui file 'alerteditdialog.ui' ###############################################################################
# # OpenLP - Open Source Lyrics Projection #
# Created: Sun Feb 14 16:45:10 2010 # --------------------------------------------------------------------------- #
# by: PyQt4 UI code generator 4.6.2 # Copyright (c) 2008-2010 Raoul Snyman #
# # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# WARNING! All changes made in this file will be lost! # 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 #
###############################################################################
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -22,5 +22,6 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from alertsmanager import AlertsManager from alertsmanager import AlertsManager
from manager import DBManager from manager import DBManager

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -93,7 +93,6 @@ class BiblePlugin(Plugin):
'displayed on the screen during the service.') 'displayed on the screen during the service.')
return about_text return about_text
def can_delete_theme(self, theme): def can_delete_theme(self, theme):
if self.settings_tab.bible_theme == theme: if self.settings_tab.bible_theme == theme:
return False return False

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -32,7 +32,7 @@ from PyQt4 import QtCore, QtGui
from bibleimportwizard import Ui_BibleImportWizard from bibleimportwizard import Ui_BibleImportWizard
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation, variant_to_unicode
from openlp.plugins.bibles.lib.manager import BibleFormat from openlp.plugins.bibles.lib.manager import BibleFormat
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -60,9 +60,21 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
log.info(u'BibleImportForm loaded') log.info(u'BibleImportForm loaded')
def __init__(self, parent, config, manager, bibleplugin): def __init__(self, parent, config, manager, bibleplugin):
''' """
Constructor Instantiate the wizard, and run any extra setup we need to.
'''
``parent``
The QWidget-derived parent of the wizard.
``config``
The configuration object for storing and retrieving settings.
``manager``
The Bible manager.
``bibleplugin``
The Bible plugin.
"""
QtGui.QWizard.__init__(self, parent) QtGui.QWizard.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
self.registerFields() self.registerFields()
@ -97,10 +109,16 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.onCurrentIdChanged) self.onCurrentIdChanged)
def exec_(self): def exec_(self):
"""
Run the wizard.
"""
self.setDefaults() self.setDefaults()
return QtGui.QWizard.exec_(self) return QtGui.QWizard.exec_(self)
def validateCurrentPage(self): def validateCurrentPage(self):
"""
Validate the current page before moving on to the next page.
"""
if self.currentId() == 0: if self.currentId() == 0:
# Welcome page # Welcome page
return True return True
@ -144,7 +162,9 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
return True return True
elif self.currentId() == 2: elif self.currentId() == 2:
# License details # License details
if self.field(u'license_version').toString() == u'': license_version = variant_to_unicode(self.field(u'license_version'))
license_copyright = variant_to_unicode(self.field(u'license_copyright'))
if license_version == u'':
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
self.trUtf8('Empty Version Name'), self.trUtf8('Empty Version Name'),
self.trUtf8('You need to specify a version name for your ' self.trUtf8('You need to specify a version name for your '
@ -152,7 +172,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.VersionNameEdit.setFocus() self.VersionNameEdit.setFocus()
return False return False
elif self.field(u'license_copyright').toString() == u'': elif license_copyright == u'':
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
self.trUtf8('Empty Copyright'), self.trUtf8('Empty Copyright'),
self.trUtf8('You need to set a copyright for your Bible! ' self.trUtf8('You need to set a copyright for your Bible! '
@ -161,8 +181,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CopyrightEdit.setFocus() self.CopyrightEdit.setFocus()
return False return False
elif self.manager.exists( elif self.manager.exists(license_version):
self.field(u'license_version').toString()):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
self.trUtf8('Bible Exists'), self.trUtf8('Bible Exists'),
self.trUtf8('This Bible already exists! Please import ' self.trUtf8('This Bible already exists! Please import '
@ -176,27 +195,49 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
return True return True
def onLocationComboBoxChanged(self, index): def onLocationComboBoxChanged(self, index):
"""
Setup the list of Bibles when you select a different source on the web
download page.
``index``
The index of the combo box.
"""
self.BibleComboBox.clear() self.BibleComboBox.clear()
for bible, abbreviation in self.web_bible_list[index].iteritems(): for bible in self.web_bible_list[index].keys():
self.BibleComboBox.addItem(unicode(self.trUtf8(bible))) self.BibleComboBox.addItem(unicode(self.trUtf8(bible)))
def onOsisFileButtonClicked(self): def onOsisFileButtonClicked(self):
self.getFileName(self.trUtf8('Open OSIS file'), """
Show the file open dialog for the OSIS file.
"""
self.getFileName(self.trUtf8('Open OSIS File'),
self.OSISLocationEdit) self.OSISLocationEdit)
def onBooksFileButtonClicked(self): def onBooksFileButtonClicked(self):
self.getFileName(self.trUtf8('Open Books CSV file'), """
Show the file open dialog for the books CSV file.
"""
self.getFileName(self.trUtf8('Open Books CSV File'),
self.BooksLocationEdit) self.BooksLocationEdit)
def onCsvVersesFileButtonClicked(self): def onCsvVersesFileButtonClicked(self):
self.getFileName(self.trUtf8('Open Verses CSV file'), """
Show the file open dialog for the verses CSV file.
"""
self.getFileName(self.trUtf8('Open Verses CSV File'),
self.CsvVerseLocationEdit) self.CsvVerseLocationEdit)
def onOpenSongBrowseButtonClicked(self): def onOpenSongBrowseButtonClicked(self):
"""
Show the file open dialog for the OpenSong file.
"""
self.getFileName(self.trUtf8('Open OpenSong Bible'), self.getFileName(self.trUtf8('Open OpenSong Bible'),
self.OpenSongFileEdit) self.OpenSongFileEdit)
def onCancelButtonClicked(self, checked): def onCancelButtonClicked(self, checked):
"""
Stop the import on pressing the cancel button.
"""
log.debug('Cancel button pressed!') log.debug('Cancel button pressed!')
if self.currentId() == 3: if self.currentId() == 3:
Receiver.send_message(u'openlpstopimport') Receiver.send_message(u'openlpstopimport')
@ -270,7 +311,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
books_reader = csv.reader(books_file, dialect) books_reader = csv.reader(books_file, dialect)
for line in books_reader: for line in books_reader:
self.web_bible_list[DownloadLocation.Crosswalk][line[0]] = \ self.web_bible_list[DownloadLocation.Crosswalk][line[0]] = \
unicode(line[1], u'utf-8').strip() unicode(line[1], u'utf8').strip()
except: except:
log.exception(u'Crosswalk resources missing') log.exception(u'Crosswalk resources missing')
finally: finally:
@ -315,25 +356,28 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
def performImport(self): def performImport(self):
bible_type = self.field(u'source_format').toInt()[0] bible_type = self.field(u'source_format').toInt()[0]
success = False license_version = variant_to_unicode(self.field(u'license_version'))
license_copyright = variant_to_unicode(self.field(u'license_copyright'))
license_permission = variant_to_unicode(self.field(u'license_permission'))
importer = None
if bible_type == BibleFormat.OSIS: if bible_type == BibleFormat.OSIS:
# Import an OSIS bible # Import an OSIS bible
success = self.manager.import_bible(BibleFormat.OSIS, importer = self.manager.import_bible(BibleFormat.OSIS,
name=unicode(self.field(u'license_version').toString()), name=license_version,
filename=unicode(self.field(u'osis_location').toString()) filename=variant_to_unicode(self.field(u'osis_location'))
) )
elif bible_type == BibleFormat.CSV: elif bible_type == BibleFormat.CSV:
# Import a CSV bible # Import a CSV bible
success = self.manager.import_bible(BibleFormat.CSV, importer = self.manager.import_bible(BibleFormat.CSV,
name=unicode(self.field(u'license_version').toString()), name=license_version,
booksfile=self.field(u'csv_booksfile').toString(), booksfile=variant_to_unicode(self.field(u'csv_booksfile')),
versefile=self.field(u'csv_versefile').toString() versefile=variant_to_unicode(self.field(u'csv_versefile'))
) )
elif bible_type == BibleFormat.OpenSong: elif bible_type == BibleFormat.OpenSong:
# Import an OpenSong bible # Import an OpenSong bible
success = self.manager.import_bible(BibleFormat.OpenSong, importer = self.manager.import_bible(BibleFormat.OpenSong,
name=unicode(self.field(u'license_version').toString()), name=license_version,
filename=self.field(u'opensong_file').toString() filename=variant_to_unicode(self.field(u'opensong_file'))
) )
elif bible_type == BibleFormat.WebDownload: elif bible_type == BibleFormat.WebDownload:
# Import a bible from the web # Import a bible from the web
@ -341,30 +385,29 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
download_location = self.field(u'web_location').toInt()[0] download_location = self.field(u'web_location').toInt()[0]
if download_location == DownloadLocation.Crosswalk: if download_location == DownloadLocation.Crosswalk:
bible = self.web_bible_list[DownloadLocation.Crosswalk][ bible = self.web_bible_list[DownloadLocation.Crosswalk][
unicode(self.BibleComboBox.currentText())] unicode(self.BibleComboBox.currentText(), u'utf8')]
elif download_location == DownloadLocation.BibleGateway: elif download_location == DownloadLocation.BibleGateway:
bible = self.web_bible_list[DownloadLocation.BibleGateway][ bible = self.web_bible_list[DownloadLocation.BibleGateway][
unicode(self.BibleComboBox.currentText())] unicode(self.BibleComboBox.currentText(), u'utf8')]
success = self.manager.import_bible(BibleFormat.WebDownload, importer = self.manager.import_bible(
name=unicode(self.field(u'license_version').toString()), BibleFormat.WebDownload,
download_source=unicode(DownloadLocation.get_name(download_location)), name=license_version,
download_name=unicode(bible), download_source=DownloadLocation.get_name(download_location),
proxy_server=unicode(self.field(u'proxy_server').toString()), download_name=bible,
proxy_username=unicode(self.field(u'proxy_username').toString()), proxy_server=variant_to_unicode(self.field(u'proxy_server')),
proxy_password=unicode(self.field(u'proxy_password').toString()) proxy_username=variant_to_unicode(self.field(u'proxy_username')),
proxy_password=variant_to_unicode(self.field(u'proxy_password'))
) )
success = importer.do_import()
if success: if success:
self.manager.save_meta_data( self.manager.save_meta_data(license_version, license_version,
unicode(self.field(u'license_version').toString()), license_copyright, license_permission)
unicode(self.field(u'license_version').toString()),
unicode(self.field(u'license_copyright').toString()),
unicode(self.field(u'license_permission').toString())
)
self.manager.reload_bibles() self.manager.reload_bibles()
self.ImportProgressLabel.setText(self.trUtf8('Finished import.')) self.ImportProgressLabel.setText(self.trUtf8('Finished import.'))
else: else:
self.ImportProgressLabel.setText( self.ImportProgressLabel.setText(
self.trUtf8('Your Bible import failed.')) self.trUtf8('Your Bible import failed.'))
importer.delete()
def postImport(self): def postImport(self):
self.ImportProgressBar.setValue(self.ImportProgressBar.maximum()) self.ImportProgressBar.setValue(self.ImportProgressBar.maximum())

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -27,6 +27,7 @@ import urllib2
import logging import logging
import re import re
import chardet import chardet
import htmlentitydefs
only_verses = re.compile(r'([\w .]+)[ ]+([0-9]+)[ ]*[:|v|V][ ]*([0-9]+)' only_verses = re.compile(r'([\w .]+)[ ]+([0-9]+)[ ]*[:|v|V][ ]*([0-9]+)'
r'(?:[ ]*-[ ]*([0-9]+|end))?(?:[ ]*,[ ]*([0-9]+)(?:[ ]*-[ ]*([0-9]+|end))?)?', r'(?:[ ]*-[ ]*([0-9]+|end))?(?:[ ]*,[ ]*([0-9]+)(?:[ ]*-[ ]*([0-9]+|end))?)?',
@ -115,7 +116,6 @@ def parse_reference(reference):
log.debug(reference_list) log.debug(reference_list)
return reference_list return reference_list
class SearchResults(object): class SearchResults(object):
""" """
Encapsulate a set of search results. This is Bible-type independant. Encapsulate a set of search results. This is Bible-type independant.
@ -247,3 +247,33 @@ class BibleCommon(object):
start_tag = text.find(u'<') start_tag = text.find(u'<')
text = text.replace(u'>', u'') text = text.replace(u'>', u'')
return text.rstrip().lstrip() return text.rstrip().lstrip()
def unescape(text):
"""
Removes HTML or XML character references and entities from a text string.
Courtesy of Fredrik Lundh, http://effbot.org/zone/re-sub.htm#unescape-html
@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)
if text[:2] == u'&#':
# character reference
try:
if text[:3] == u'&#x':
return unichr(int(text[3:-1], 16))
else:
return unichr(int(text[2:-1]))
except ValueError:
pass
else:
# named entity
try:
text = unichr(htmlentitydefs.name2codepoint[text[1:-1]])
except KeyError:
pass
return text # leave as is
return re.sub(u'&#?\w+;', fixup, text)

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -26,6 +26,7 @@
import os import os
import logging import logging
import chardet import chardet
import re
from sqlalchemy import or_ from sqlalchemy import or_
from PyQt4 import QtCore from PyQt4 import QtCore
@ -63,16 +64,21 @@ class BibleDB(QtCore.QObject):
QtCore.QObject.__init__(self) QtCore.QObject.__init__(self)
if u'path' not in kwargs: if u'path' not in kwargs:
raise KeyError(u'Missing keyword argument "path".') raise KeyError(u'Missing keyword argument "path".')
if u'name' not in kwargs:
raise KeyError(u'Missing keyword argument "name".')
if u'config' not in kwargs: if u'config' not in kwargs:
raise KeyError(u'Missing keyword argument "config".') raise KeyError(u'Missing keyword argument "config".')
if u'name' not in kwargs and u'file' not in kwargs:
raise KeyError(u'Missing keyword argument "name" or "file".')
self.stop_import_flag = False self.stop_import_flag = False
self.name = kwargs[u'name']
self.config = kwargs[u'config'] self.config = kwargs[u'config']
self.db_file = os.path.join(kwargs[u'path'], if u'name' in kwargs:
u'%s.sqlite' % kwargs[u'name']) self.name = kwargs[u'name']
log.debug(u'Load bible %s on path %s', kwargs[u'name'], self.db_file) if not isinstance(self.name, unicode):
self.name = unicode(self.name, u'utf-8')
self.file = self.clean_filename(self.name)
if u'file' in kwargs:
self.file = kwargs[u'file']
self.db_file = os.path.join(kwargs[u'path'], self.file)
log.debug(u'Load bible %s on path %s', self.file, self.db_file)
db_type = self.config.get_config(u'db type', u'sqlite') db_type = self.config.get_config(u'db type', u'sqlite')
db_url = u'' db_url = u''
if db_type == u'sqlite': if db_type == u'sqlite':
@ -85,12 +91,35 @@ class BibleDB(QtCore.QObject):
self.config.get_config(u'db database')) self.config.get_config(u'db database'))
self.metadata, self.session = init_models(db_url) self.metadata, self.session = init_models(db_url)
self.metadata.create_all(checkfirst=True) self.metadata.create_all(checkfirst=True)
if u'file' in kwargs:
self.get_name()
def get_name(self):
version_name = self.get_meta(u'Version')
if version_name:
self.name = version_name.value
else:
self.name = None
return self.name
def clean_filename(self, old_filename):
if not isinstance(old_filename, unicode):
old_filename = unicode(old_filename, u'utf-8')
old_filename = re.sub(r'[^\w]+', u'_', old_filename).strip(u'_')
return old_filename + u'.sqlite'
def delete(self):
try:
os.remove(self.db_file)
return True
except:
return False
def register(self, wizard): def register(self, wizard):
""" """
This method basically just initialialises the database. It is called This method basically just initialialises the database. It is called
from the Bible Manager when a Bible is imported. Descendant classes from the Bible Manager when a Bible is imported. Descendant classes
may want to override this method to supply their own custom may want to override this method to suVersionpply their own custom
initialisation as well. initialisation as well.
""" """
self.wizard = wizard self.wizard = wizard
@ -241,8 +270,6 @@ class BibleDB(QtCore.QObject):
count = self.session.query(Verse.chapter).join(Book)\ count = self.session.query(Verse.chapter).join(Book)\
.filter(Book.name==book)\ .filter(Book.name==book)\
.distinct().count() .distinct().count()
#verse = self.session.query(Verse).join(Book).filter(
# Book.name == bookname).order_by(Verse.chapter.desc()).first()
if not count: if not count:
return 0 return 0
else: else:
@ -254,9 +281,6 @@ class BibleDB(QtCore.QObject):
.filter(Book.name==book)\ .filter(Book.name==book)\
.filter(Verse.chapter==chapter)\ .filter(Verse.chapter==chapter)\
.count() .count()
#verse = self.session.query(Verse).join(Book).filter(
# Book.name == bookname).filter(
# Verse.chapter == chapter).order_by(Verse.verse.desc()).first()
if not count: if not count:
return 0 return 0
else: else:

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -28,21 +28,30 @@ import urllib2
import os import os
import sqlite3 import sqlite3
from BeautifulSoup import BeautifulSoup from BeautifulSoup import BeautifulSoup, Tag, NavigableString
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
from common import BibleCommon, SearchResults from common import BibleCommon, SearchResults, unescape
from db import BibleDB from db import BibleDB
from openlp.plugins.bibles.lib.models import Book from openlp.plugins.bibles.lib.models import Book
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class HTTPBooks(object): class HTTPBooks(object):
"""
A wrapper class around a small SQLite database which contains the books,
chapter counts and verse counts for the web download Bibles. This class
contains a singleton "cursor" so that only one connection to the SQLite
database is ever used.
"""
cursor = None cursor = None
@staticmethod @staticmethod
def get_cursor(): def get_cursor():
"""
Return the cursor object. Instantiate one if it doesn't exist yet.
"""
if HTTPBooks.cursor is None: if HTTPBooks.cursor is None:
filepath = os.path.join( filepath = os.path.join(
AppLocation.get_directory(AppLocation.PluginsDir), u'bibles', AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
@ -53,12 +62,24 @@ class HTTPBooks(object):
@staticmethod @staticmethod
def run_sql(query, parameters=()): def run_sql(query, parameters=()):
"""
Run an SQL query on the database, returning the results.
``query``
The actual SQL query to run.
``parameters``
Any variable parameters to add to the query.
"""
cursor = HTTPBooks.get_cursor() cursor = HTTPBooks.get_cursor()
cursor.execute(query, parameters) cursor.execute(query, parameters)
return cursor.fetchall() return cursor.fetchall()
@staticmethod @staticmethod
def get_books(): def get_books():
"""
Return a list of all the books of the Bible.
"""
books = HTTPBooks.run_sql(u'SELECT id, testament_id, name, ' books = HTTPBooks.run_sql(u'SELECT id, testament_id, name, '
u'abbreviation, chapters FROM books ORDER BY id') u'abbreviation, chapters FROM books ORDER BY id')
book_list = [] book_list = []
@ -74,6 +95,12 @@ class HTTPBooks(object):
@staticmethod @staticmethod
def get_book(name): def get_book(name):
"""
Return a book by name or abbreviation.
``name``
The name or abbreviation of the book.
"""
if not isinstance(name, unicode): if not isinstance(name, unicode):
name = unicode(name) name = unicode(name)
books = HTTPBooks.run_sql(u'SELECT id, testament_id, name, ' books = HTTPBooks.run_sql(u'SELECT id, testament_id, name, '
@ -92,6 +119,15 @@ class HTTPBooks(object):
@staticmethod @staticmethod
def get_chapter(name, chapter): def get_chapter(name, chapter):
"""
Return the chapter details for a specific chapter of a book.
``name``
The name or abbreviation of a book.
``chapter``
The chapter number.
"""
if not isinstance(name, int): if not isinstance(name, int):
chapter = int(chapter) chapter = int(chapter)
book = HTTPBooks.get_book(name) book = HTTPBooks.get_book(name)
@ -109,6 +145,12 @@ class HTTPBooks(object):
@staticmethod @staticmethod
def get_chapter_count(book): def get_chapter_count(book):
"""
Return the number of chapters in a book.
``book``
The name or abbreviation of the book.
"""
details = HTTPBooks.get_book(book) details = HTTPBooks.get_book(book)
if details: if details:
return details[u'chapters'] return details[u'chapters']
@ -116,6 +158,15 @@ class HTTPBooks(object):
@staticmethod @staticmethod
def get_verse_count(book, chapter): def get_verse_count(book, chapter):
"""
Return the number of verses in a chapter.
``book``
The name or abbreviation of the book.
``chapter``
The number of the chapter.
"""
details = HTTPBooks.get_chapter(book, chapter) details = HTTPBooks.get_chapter(book, chapter)
if details: if details:
return details[u'verses'] return details[u'verses']
@ -123,7 +174,9 @@ class HTTPBooks(object):
class BGExtract(BibleCommon): class BGExtract(BibleCommon):
log.info(u'%s BGExtract loaded', __name__) """
Extract verses from BibleGateway
"""
def __init__(self, proxyurl=None): def __init__(self, proxyurl=None):
log.debug(u'init %s', proxyurl) log.debug(u'init %s', proxyurl)
@ -133,7 +186,7 @@ class BGExtract(BibleCommon):
""" """
Access and decode bibles via the BibleGateway website Access and decode bibles via the BibleGateway website
``Version`` ``version``
The version of the bible like 31 for New International version The version of the bible like 31 for New International version
``bookname`` ``bookname``
@ -146,54 +199,76 @@ class BGExtract(BibleCommon):
urlstring = u'http://www.biblegateway.com/passage/?search=%s+%s' \ urlstring = u'http://www.biblegateway.com/passage/?search=%s+%s' \
u'&version=%s' % (bookname, chapter, version) u'&version=%s' % (bookname, chapter, version)
log.debug(u'BibleGateway url = %s' % urlstring) log.debug(u'BibleGateway url = %s' % urlstring)
xml_string = self._get_web_text(urlstring, self.proxyurl) # Let's get the page, and then open it in BeautifulSoup, so as to
verseSearch = u'<sup class=\"versenum' # attempt to make "easy" work of bad HTML.
verseFootnote = u'<sup class=\'footnote' page = urllib2.urlopen(urlstring)
verse = 1 soup = BeautifulSoup(page)
i = xml_string.find(u'result-text-style-normal') + 26 verses = soup.find(u'div', u'result-text-style-normal')
xml_string = xml_string[i:len(xml_string)] verse_number = 0
versePos = xml_string.find(verseSearch) verse_list = {0: u''}
bible = {} # http://www.codinghorror.com/blog/2009/11/parsing-html-the-cthulhu-way.html
while versePos > -1: # This is a PERFECT example of opening the Cthulu tag!
# clear out string # O Bible Gateway, why doth ye such horrific HTML produce?
verseText = u'' for verse in verses:
versePos = xml_string.find(u'</sup>', versePos) + 6 if isinstance(verse, Tag) and verse.name == u'div' and filter(lambda a: a[0] == u'class', verse.attrs)[0][1] == u'footnotes':
i = xml_string.find(verseSearch, versePos + 1) break
# Not sure if this is needed now if isinstance(verse, Tag) and verse.name == u'sup' and filter(lambda a: a[0] == u'class', verse.attrs)[0][1] != u'versenum':
if i == -1: continue
i = xml_string.find(u'</div', versePos + 1) if isinstance(verse, Tag) and verse.name == u'p' and not verse.contents:
j = xml_string.find(u'<strong', versePos + 1) continue
if j > 0 and j < i: if isinstance(verse, Tag) and (verse.name == u'p' or verse.name == u'font') and verse.contents:
i = j for item in verse.contents:
verseText = xml_string[versePos + 7 : i ] if isinstance(item, Tag) and (item.name == u'h4' or item.name == u'h5'):
# store the verse continue
bible[verse] = self._clean_text(verseText) if isinstance(item, Tag) and item.name == u'sup' and filter(lambda a: a[0] == u'class', item.attrs)[0][1] != u'versenum':
versePos = -1 continue
else: if isinstance(item, Tag) and item.name == u'p' and not item.contents:
verseText = xml_string[versePos: i] continue
start_tag = verseText.find(verseFootnote) if isinstance(item, Tag) and item.name == u'sup':
while start_tag > -1: verse_number = int(str(item.contents[0]))
end_tag = verseText.find(u'</sup>') verse_list[verse_number] = u''
verseText = verseText[:start_tag] + verseText[end_tag + 6:len(verseText)] continue
start_tag = verseText.find(verseFootnote) if isinstance(item, Tag) and item.name == u'font':
# Chop off verse and start again for subitem in item.contents:
xml_string = xml_string[i:] if isinstance(subitem, Tag) and subitem.name == u'sup' and filter(lambda a: a[0] == u'class', subitem.attrs)[0][1] != u'versenum':
#look for the next verse continue
versePos = xml_string.find(verseSearch) if isinstance(subitem, Tag) and subitem.name == u'p' and not subitem.contents:
# store the verse continue
bible[verse] = self._clean_text(verseText) if isinstance(subitem, Tag) and subitem.name == u'sup':
verse += 1 verse_number = int(str(subitem.contents[0]))
return SearchResults(bookname, chapter, bible) verse_list[verse_number] = u''
continue
if isinstance(subitem, NavigableString):
verse_list[verse_number] = verse_list[verse_number] + subitem.replace(u'&nbsp;', u' ')
continue
if isinstance(item, NavigableString):
verse_list[verse_number] = verse_list[verse_number] + item.replace(u'&nbsp;', u' ')
continue
if isinstance(verse, Tag) and verse.name == u'sup':
verse_number = int(str(verse.contents[0]))
verse_list[verse_number] = u''
continue
if isinstance(verse, NavigableString):
if not isinstance(verse, unicode):
verse = unicode(verse, u'utf8')
verse_list[verse_number] = verse_list[verse_number] + \
unescape(verse.replace(u'&nbsp;', u' '))
# Delete the "0" element, since we don't need it, it's just there for
# some stupid initial whitespace, courtesy of Bible Gateway.
del verse_list[0]
# Finally, return the list of verses in a "SearchResults" object.
return SearchResults(bookname, chapter, verse_list)
class CWExtract(BibleCommon): class CWExtract(BibleCommon):
log.info(u'%s CWExtract loaded', __name__) """
Extract verses from CrossWalk/BibleStudyTools
"""
def __init__(self, proxyurl=None): def __init__(self, proxyurl=None):
log.debug(u'init %s', proxyurl) log.debug(u'init %s', proxyurl)
self.proxyurl = proxyurl self.proxyurl = proxyurl
def get_bible_chapter(self, version, bookname, chapter): def get_bible_chapter(self, version, bookname, chapter):
log.debug(u'%s %s, %s, %s', __name__, version, bookname, chapter)
""" """
Access and decode bibles via the Crosswalk website Access and decode bibles via the Crosswalk website
@ -208,9 +283,9 @@ class CWExtract(BibleCommon):
""" """
log.debug(u'get_bible_chapter %s,%s,%s', log.debug(u'get_bible_chapter %s,%s,%s',
version, bookname, chapter) version, bookname, chapter)
bookname = bookname.replace(u' ', u'') urlbookname = bookname.replace(u' ', u'-')
chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % \ chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % \
(version, bookname.lower(), chapter) (version, urlbookname.lower(), chapter)
log.debug(u'URL: %s', chapter_url) log.debug(u'URL: %s', chapter_url)
page = urllib2.urlopen(chapter_url) page = urllib2.urlopen(chapter_url)
if not page: if not page:
@ -268,6 +343,10 @@ class HTTPBible(BibleDB):
self.proxy_password = None self.proxy_password = None
def do_import(self): def do_import(self):
"""
Run the import. This method overrides the parent class method. Returns
``True`` on success, ``False`` on failure.
"""
self.wizard.ImportProgressBar.setMaximum(2) self.wizard.ImportProgressBar.setMaximum(2)
self.wizard.incrementProgressBar('Registering bible...') self.wizard.incrementProgressBar('Registering bible...')
self.create_meta(u'download source', self.download_source) self.create_meta(u'download source', self.download_source)
@ -351,17 +430,43 @@ class HTTPBible(BibleDB):
return None return None
def get_books(self): def get_books(self):
"""
Return the list of books.
"""
return [Book.populate(name=book['name']) for book in HTTPBooks.get_books()] return [Book.populate(name=book['name']) for book in HTTPBooks.get_books()]
def lookup_book(self, book): def lookup_book(self, book):
"""
Look up the name of a book.
"""
return HTTPBooks.get_book(book) return HTTPBooks.get_book(book)
def get_chapter_count(self, book): def get_chapter_count(self, book):
"""
Return the number of chapters in a particular book.
"""
return HTTPBooks.get_chapter_count(book) return HTTPBooks.get_chapter_count(book)
def get_verse_count(self, book, chapter): def get_verse_count(self, book, chapter):
"""
Return the number of verses for the specified chapter and book.
``book``
The name of the book.
``chapter``
The chapter whose verses are being counted.
"""
return HTTPBooks.get_verse_count(book, chapter) return HTTPBooks.get_verse_count(book, chapter)
def set_proxy_server(self, server): def set_proxy_server(self, server):
"""
Sets the proxy server.
**Note: This is not actually used.**
``server``
The hostname or IP address of the proxy server.
"""
self.proxy_server = server self.proxy_server = server

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -24,7 +24,6 @@
############################################################################### ###############################################################################
import logging import logging
import os
from common import parse_reference from common import parse_reference
from opensong import OpenSongBible from opensong import OpenSongBible
@ -61,6 +60,9 @@ class BibleFormat(object):
def get_class(id): def get_class(id):
""" """
Return the appropriate imeplementation class. Return the appropriate imeplementation class.
``id``
The Bible format.
""" """
if id == BibleFormat.OSIS: if id == BibleFormat.OSIS:
return OSISBible return OSISBible
@ -75,6 +77,9 @@ class BibleFormat(object):
@staticmethod @staticmethod
def list(): def list():
"""
Return a list of the supported Bible formats.
"""
return [ return [
BibleFormat.OSIS, BibleFormat.OSIS,
BibleFormat.CSV, BibleFormat.CSV,
@ -123,19 +128,21 @@ class BibleManager(object):
log.debug(u'Bible Files %s', files) log.debug(u'Bible Files %s', files)
self.db_cache = {} self.db_cache = {}
for filename in files: for filename in files:
name, extension = os.path.splitext(filename) bible = BibleDB(self.parent, path=self.path, file=filename,
self.db_cache[name] = BibleDB(self.parent, path=self.path, name=name, config=self.config) config=self.config)
name = bible.get_name()
log.debug(u'Bible Name: "%s"', name)
self.db_cache[name] = bible
# look to see if lazy load bible exists and get create getter. # look to see if lazy load bible exists and get create getter.
source = self.db_cache[name].get_meta(u'download source') source = self.db_cache[name].get_meta(u'download source')
if source: if source:
download_name = self.db_cache[name].get_meta(u'download name').value download_name = self.db_cache[name].get_meta(u'download name').value
meta_proxy = self.db_cache[name].get_meta(u'proxy url') meta_proxy = self.db_cache[name].get_meta(u'proxy url')
web_bible = HTTPBible(self.parent, path=self.path, name=name, web_bible = HTTPBible(self.parent, path=self.path,
config=self.config, download_source=source.value, file=filename, config=self.config,
download_name=download_name) download_source=source.value, download_name=download_name)
if meta_proxy: if meta_proxy:
web_bible.set_proxy_server(meta_proxy.value) web_bible.set_proxy_server(meta_proxy.value)
#del self.db_cache[name]
self.db_cache[name] = web_bible self.db_cache[name] = web_bible
log.debug(u'Bibles reloaded') log.debug(u'Bibles reloaded')
@ -164,7 +171,7 @@ class BibleManager(object):
importer = class_(self.parent, **kwargs) importer = class_(self.parent, **kwargs)
name = importer.register(self.import_wizard) name = importer.register(self.import_wizard)
self.db_cache[name] = importer self.db_cache[name] = importer
return importer.do_import() return importer
def get_bibles(self): def get_bibles(self):
""" """
@ -246,7 +253,7 @@ class BibleManager(object):
""" """
if not isinstance(name, unicode): if not isinstance(name, unicode):
name = unicode(name) name = unicode(name)
for bible, db_object in self.db_cache.iteritems(): for bible in self.db_cache.keys():
log.debug(u'Bible from cache in is_new_bible %s', bible) log.debug(u'Bible from cache in is_new_bible %s', bible)
if not isinstance(bible, unicode): if not isinstance(bible, unicode):
bible = unicode(bible) bible = unicode(bible)

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -45,6 +45,7 @@ class BibleListView(BaseListWithDnD):
def resizeEvent(self, event): def resizeEvent(self, event):
self.parent.onListViewResize(event.size().width(), event.size().width()) self.parent.onListViewResize(event.size().width(), event.size().width())
class BibleMediaItem(MediaManagerItem): class BibleMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for Bibles. This is the custom media manager item for Bibles.
@ -64,6 +65,12 @@ class BibleMediaItem(MediaManagerItem):
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlpreloadbibles'), self.reloadBibles) QtCore.SIGNAL(u'openlpreloadbibles'), self.reloadBibles)
def _decodeQtObject(self, listobj, key):
obj = listobj[QtCore.QString(key)]
if isinstance(obj, QtCore.QVariant):
obj = obj.toPyObject()
return unicode(obj)
def initPluginNameVisible(self): def initPluginNameVisible(self):
self.PluginNameVisible = self.trUtf8('Bible') self.PluginNameVisible = self.trUtf8('Bible')
@ -451,15 +458,17 @@ class BibleMediaItem(MediaManagerItem):
# Let's loop through the main lot, and assemble our verses # Let's loop through the main lot, and assemble our verses
for item in items: for item in items:
bitem = self.ListView.item(item.row()) bitem = self.ListView.item(item.row())
reference = bitem.data(QtCore.Qt.UserRole).toPyObject() reference = bitem.data(QtCore.Qt.UserRole)
bible = unicode(reference[QtCore.QString('bible')]) if isinstance(reference, QtCore.QVariant):
book = unicode(reference[QtCore.QString('book')]) reference = reference.toPyObject()
chapter = unicode(reference[QtCore.QString('chapter')]) bible = self._decodeQtObject(reference, 'bible')
verse = unicode(reference[QtCore.QString('verse')]) book = self._decodeQtObject(reference, 'book')
text = unicode(reference[QtCore.QString('text')]) chapter = self._decodeQtObject(reference, 'chapter')
version = unicode(reference[QtCore.QString('version')]) verse = self._decodeQtObject(reference, 'verse')
copyright = unicode(reference[QtCore.QString('copyright')]) text = self._decodeQtObject(reference, 'text')
permission = unicode(reference[QtCore.QString('permission')]) version = self._decodeQtObject(reference, 'version')
copyright = self._decodeQtObject(reference, 'copyright')
permission = self._decodeQtObject(reference, 'permission')
if self.parent.settings_tab.display_style == 1: if self.parent.settings_tab.display_style == 1:
verse_text = self.formatVerse(old_chapter, chapter, verse, u'(u', u')') verse_text = self.formatVerse(old_chapter, chapter, verse, u'(u', u')')
elif self.parent.settings_tab.display_style == 2: elif self.parent.settings_tab.display_style == 2:
@ -563,7 +572,7 @@ class BibleMediaItem(MediaManagerItem):
permission = u'' permission = u''
else: else:
permission = permission.value permission = permission.value
for count, verse in enumerate(self.search_results): for count, verse in enumerate(self.search_results):
bible_text = u' %s %d:%d (%s)' % \ bible_text = u' %s %d:%d (%s)' % \
(verse.book.name, verse.chapter, verse.verse, bible) (verse.book.name, verse.chapter, verse.verse, bible)
bible_verse = QtGui.QListWidgetItem(bible_text) bible_verse = QtGui.QListWidgetItem(bible_text)

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -102,7 +102,7 @@ class OpenSongBible(BibleDB):
finally: finally:
if file: if file:
file.close() file.close()
if self.stop_import: if self.stop_import_flag:
self.wizard.incrementProgressBar(u'Import canceled!') self.wizard.incrementProgressBar(u'Import canceled!')
return False return False
else: else:

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -65,6 +65,7 @@ class OSISBible(BibleDB):
self.l_regex = re.compile(r'<l (.*?)>') self.l_regex = re.compile(r'<l (.*?)>')
self.w_regex = re.compile(r'<w (.*?)>') self.w_regex = re.compile(r'<w (.*?)>')
self.q_regex = re.compile(r'<q (.*?)>') self.q_regex = re.compile(r'<q (.*?)>')
self.trans_regex = re.compile(r'<transChange(.*?)>(.*?)</transChange>')
self.spaces_regex = re.compile(r'([ ]{2,})') self.spaces_regex = re.compile(r'([ ]{2,})')
self.books = {} self.books = {}
filepath = os.path.join( filepath = os.path.join(
@ -114,12 +115,14 @@ class OSISBible(BibleDB):
osis = codecs.open(self.filename, u'r', details['encoding']) osis = codecs.open(self.filename, u'r', details['encoding'])
last_chapter = 0 last_chapter = 0
testament = 1 testament = 1
match_count = 0
db_book = None db_book = None
for file_record in osis: for file_record in osis:
if self.stop_import_flag: if self.stop_import_flag:
break break
match = self.verse_regex.search(file_record) match = self.verse_regex.search(file_record)
if match: if match:
match_count += 1
book = match.group(1) book = match.group(1)
chapter = int(match.group(2)) chapter = int(match.group(2))
verse = int(match.group(3)) verse = int(match.group(3))
@ -157,15 +160,18 @@ class OSISBible(BibleDB):
verse_text = self.l_regex.sub(u'', verse_text) verse_text = self.l_regex.sub(u'', verse_text)
verse_text = self.w_regex.sub(u'', verse_text) verse_text = self.w_regex.sub(u'', verse_text)
verse_text = self.q_regex.sub(u'', verse_text) verse_text = self.q_regex.sub(u'', verse_text)
verse_text = self.trans_regex.sub(u'', verse_text)
verse_text = verse_text.replace(u'</lb>', u'')\ verse_text = verse_text.replace(u'</lb>', u'')\
.replace(u'</l>', u'').replace(u'<lg>', u'')\ .replace(u'</l>', u'').replace(u'<lg>', u'')\
.replace(u'</lg>', u'').replace(u'</q>', u'')\ .replace(u'</lg>', u'').replace(u'</q>', u'')\
.replace(u'</div>', u'') .replace(u'</div>', u'').replace(u'</w>', u'')
verse_text = self.spaces_regex.sub(u' ', verse_text) verse_text = self.spaces_regex.sub(u' ', verse_text)
self.create_verse(db_book.id, chapter, verse, verse_text) self.create_verse(db_book.id, chapter, verse, verse_text)
Receiver.send_message(u'process_events') Receiver.send_message(u'process_events')
self.commit() self.commit()
self.wizard.incrementProgressBar(u'Finishing import...') self.wizard.incrementProgressBar(u'Finishing import...')
if match_count == 0:
success = False
except: except:
log.exception(u'Loading bible from OSIS file failed') log.exception(u'Loading bible from OSIS file failed')
success = False success = False

View File

@ -0,0 +1,24 @@
# -*- 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 #
###############################################################################

View File

@ -1,20 +1,27 @@
""" # -*- coding: utf-8 -*-
OpenLP - Open Source Lyrics Projection # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
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 # OpenLP - Open Source Lyrics Projection #
Foundation; version 2 of the License. # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
This program is distributed in the hope that it will be useful, but WITHOUT ANY # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
PARTICULAR PURPOSE. See the GNU General Public License for more details. # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
You should have received a copy of the GNU General Public License along with # This program is free software; you can redistribute it and/or modify it #
this program; if not, write to the Free Software Foundation, Inc., 59 Temple # under the terms of the GNU General Public License as published by the Free #
Place, Suite 330, Boston, MA 02111-1307 USA # 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 logging import logging
import os import os
@ -64,7 +71,7 @@ class TestBibleManager:
self.bm.registerHTTPBible(u'asv', u'Crosswalk', u'', u'', u'') self.bm.registerHTTPBible(u'asv', u'Crosswalk', u'', u'', u'')
self.bm.registerHTTPBible(u'nasb', u'Biblegateway', u'', u'', u'') self.bm.registerHTTPBible(u'nasb', u'Biblegateway', u'', u'', u'')
self.bm.registerHTTPBible(u'nkj', u'Biblegateway', self.bm.registerHTTPBible(u'nkj', u'Biblegateway',
u'http://tigger2:3128/', u'', u'') u'http://tigger2:3128/', u'', u'')
b = self.bm.get_bibles() b = self.bm.get_bibles()
for b1 in b: for b1 in b:
log.debug( b1) log.debug( b1)

View File

@ -1,20 +1,27 @@
""" # -*- coding: utf-8 -*-
OpenLP - Open Source Lyrics Projection # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
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 # OpenLP - Open Source Lyrics Projection #
Foundation; version 2 of the License. # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
This program is distributed in the hope that it will be useful, but WITHOUT ANY # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
PARTICULAR PURPOSE. See the GNU General Public License for more details. # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
You should have received a copy of the GNU General Public License along with # This program is free software; you can redistribute it and/or modify it #
this program; if not, write to the Free Software Foundation, Inc., 59 Temple # under the terms of the GNU General Public License as published by the Free #
Place, Suite 330, Boston, MA 02111-1307 USA # 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 logging import logging
import os import os
@ -73,7 +80,7 @@ class TestBibleManager:
assert(self.bm.getBookVerseCount(u'TheMessage', u'Genesis', 2)[0] == 25) assert(self.bm.getBookVerseCount(u'TheMessage', u'Genesis', 2)[0] == 25)
assert(self.bm.getBookVerseCount(u'asv', u'Matthew', 1)[0] == 25) assert(self.bm.getBookVerseCount(u'asv', u'Matthew', 1)[0] == 25)
assert(self.bm.getBookVerseCount(u'TheMessage', u'Revelation', assert(self.bm.getBookVerseCount(u'TheMessage', u'Revelation',
1)[0] == 20) 1)[0] == 20)
def testGetVerseText(self): def testGetVerseText(self):
log.debug(u'\n.......testGetVerseText') log.debug(u'\n.......testGetVerseText')

View File

@ -1,20 +1,27 @@
""" # -*- coding: utf-8 -*-
OpenLP - Open Source Lyrics Projection # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
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 # OpenLP - Open Source Lyrics Projection #
Foundation; version 2 of the License. # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
This program is distributed in the hope that it will be useful, but WITHOUT ANY # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
PARTICULAR PURPOSE. See the GNU General Public License for more details. # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
You should have received a copy of the GNU General Public License along with # This program is free software; you can redistribute it and/or modify it #
this program; if not, write to the Free Software Foundation, Inc., 59 Temple # under the terms of the GNU General Public License as published by the Free #
Place, Suite 330, Boston, MA 02111-1307 USA # 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 logging import logging
import os import os
@ -52,9 +59,9 @@ class TestBibleManager:
# Register a bible from files # Register a bible from files
log.debug(u'\n.......testRegisterBibleFiles') log.debug(u'\n.......testRegisterBibleFiles')
self.bm.registerCSVFileBible(u'TheMessage', self.bm.registerCSVFileBible(u'TheMessage',
u'biblebooks_msg_short.csv', u'bibleverses_msg_short.csv') u'biblebooks_msg_short.csv', u'bibleverses_msg_short.csv')
self.bm.registerCSVFileBible(u'NIV', u'biblebooks_niv_short.csv', self.bm.registerCSVFileBible(u'NIV', u'biblebooks_niv_short.csv',
u'bibleverses_niv_short.csv') u'bibleverses_niv_short.csv')
b = self.bm.get_bibles() b = self.bm.get_bibles()
for b1 in b: for b1 in b:
log.debug( b1) log.debug( b1)

View File

@ -1,20 +1,27 @@
""" # -*- coding: utf-8 -*-
OpenLP - Open Source Lyrics Projection # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
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 # OpenLP - Open Source Lyrics Projection #
Foundation; version 2 of the License. # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
This program is distributed in the hope that it will be useful, but WITHOUT ANY # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
PARTICULAR PURPOSE. See the GNU General Public License for more details. # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
You should have received a copy of the GNU General Public License along with # This program is free software; you can redistribute it and/or modify it #
this program; if not, write to the Free Software Foundation, Inc., 59 Temple # under the terms of the GNU General Public License as published by the Free #
Place, Suite 330, Boston, MA 02111-1307 USA # 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 logging import logging
import os import os

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,8 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Carsten Tinggaard # # Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # 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 # # under the terms of the GNU General Public License as published by the Free #

Some files were not shown because too many files have changed in this diff Show More