forked from openlp/openlp
Style cleanups
bzr-revno: 580
This commit is contained in:
commit
268b0e98f3
@ -200,8 +200,7 @@ class Plugin(object):
|
||||
|
||||
def process_add_service_event(self):
|
||||
"""
|
||||
Proxy method as method is not defined early enough
|
||||
in the processing
|
||||
Generic Drag and drop handler triggered from service_manager.
|
||||
"""
|
||||
log.debug(u'process_add_service_event event called for plugin %s' % self.name)
|
||||
self.media_item.onAddClick()
|
||||
|
@ -24,12 +24,16 @@
|
||||
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import buildIcon
|
||||
|
||||
class ServiceType(object):
|
||||
"""
|
||||
Defines the type of service item
|
||||
"""
|
||||
Text = 1
|
||||
Image = 2
|
||||
Command = 3
|
||||
@ -82,7 +86,7 @@ class ServiceItem(object):
|
||||
|
||||
def render(self):
|
||||
"""
|
||||
The render method is what renders the frames for the screen.
|
||||
The render method is what generates the frames for the screen.
|
||||
"""
|
||||
log.debug(u'Render called')
|
||||
self.frames = []
|
||||
@ -93,6 +97,7 @@ class ServiceItem(object):
|
||||
else:
|
||||
self.RenderManager.set_override_theme(self.theme)
|
||||
for slide in self.service_frames:
|
||||
before = time.time()
|
||||
formated = self.RenderManager.format_slide(slide[u'raw_slide'])
|
||||
for format in formated:
|
||||
frame = None
|
||||
@ -102,6 +107,7 @@ class ServiceItem(object):
|
||||
title = lines.split(u'\n')[0]
|
||||
self.frames.append({u'title': title, u'text': lines,
|
||||
u'image': frame})
|
||||
log.info(u'Formatting took %4s' % (time.time() - before))
|
||||
elif self.service_item_type == ServiceType.Command:
|
||||
self.frames = self.service_frames
|
||||
elif self.service_item_type == ServiceType.Image:
|
||||
@ -113,6 +119,11 @@ class ServiceItem(object):
|
||||
log.error(u'Invalid value renderer :%s' % self.service_item_type)
|
||||
|
||||
def render_individual(self, row):
|
||||
"""
|
||||
Takes an array of text and geneates an Image from the
|
||||
theme. It assumes the text will fit on the screen as it
|
||||
has generated by the render method above.
|
||||
"""
|
||||
log.debug(u'render individual')
|
||||
if self.theme is None:
|
||||
self.RenderManager.set_override_theme(None)
|
||||
@ -138,7 +149,8 @@ class ServiceItem(object):
|
||||
"""
|
||||
self.service_item_type = ServiceType.Image
|
||||
self.service_item_path = path
|
||||
self.service_frames.append({u'title': frame_title, u'text':None, u'image': image})
|
||||
self.service_frames.append(
|
||||
{u'title': frame_title, u'text':None, u'image': image})
|
||||
|
||||
def add_from_text(self, frame_title, raw_slide):
|
||||
"""
|
||||
@ -152,8 +164,8 @@ class ServiceItem(object):
|
||||
"""
|
||||
self.service_item_type = ServiceType.Text
|
||||
frame_title = frame_title.split(u'\n')[0]
|
||||
self.service_frames.append({u'title': frame_title,
|
||||
u'raw_slide': raw_slide})
|
||||
self.service_frames.append(
|
||||
{u'title': frame_title, u'raw_slide': raw_slide})
|
||||
|
||||
def add_from_command(self, path, frame_title):
|
||||
"""
|
||||
@ -167,7 +179,8 @@ class ServiceItem(object):
|
||||
"""
|
||||
self.service_item_type = ServiceType.Command
|
||||
self.service_item_path = path
|
||||
self.service_frames.append({u'title': frame_title, u'command': None})
|
||||
self.service_frames.append(
|
||||
{u'title': frame_title, u'command': None})
|
||||
|
||||
def get_service_repr(self):
|
||||
"""
|
||||
|
@ -67,13 +67,13 @@ class SettingsManager(object):
|
||||
def setUIItemVisibility(self, item=u'', isVisible=True):
|
||||
if item != u'':
|
||||
if item == u'ThemeManagerDock':
|
||||
ConfigHelper.set_config('user interface',
|
||||
ConfigHelper.set_config(u'user interface',
|
||||
u'display thememanager', isVisible)
|
||||
elif item == u'ServiceManagerDock':
|
||||
ConfigHelper.set_config('user interface',
|
||||
ConfigHelper.set_config(u'user interface',
|
||||
u'display servicemanager', isVisible)
|
||||
elif item == u'MediaManagerDock':
|
||||
ConfigHelper.set_config('user interface',
|
||||
ConfigHelper.set_config(u'user interface',
|
||||
u'display mediamanager', isVisible)
|
||||
|
||||
def togglePreviewPanel(self, isVisible):
|
||||
|
@ -28,7 +28,7 @@ from types import StringType, NoneType, UnicodeType
|
||||
|
||||
from xml.etree.ElementTree import ElementTree, XML
|
||||
|
||||
sys.path.append(os.path.abspath(os.path.join('.', '..', '..')))
|
||||
sys.path.append(os.path.abspath(os.path.join(u'.', u'..', u'..')))
|
||||
|
||||
class XmlRootClass(object):
|
||||
"""
|
||||
@ -61,7 +61,7 @@ class XmlRootClass(object):
|
||||
val = text
|
||||
elif type(text) is StringType:
|
||||
# Strings need special handling to sort the colours out
|
||||
if text[0] == '$':
|
||||
if text[0] == u'$':
|
||||
# This might be a hex number, let's try to convert it.
|
||||
try:
|
||||
val = int(text[1:], 16)
|
||||
|
@ -162,6 +162,7 @@ class AboutForm(QtGui.QDialog):
|
||||
u' Scott \"sguerrieri\" Guerrieri\n'
|
||||
u' Raoul \"superfly\" Snyman\n'
|
||||
u' Martin \"mijiti\" Thompson\n'
|
||||
u' Jon \"Meths\" Tibble\n'
|
||||
u' Carsten \"catini\" Tingaard'))
|
||||
self.AboutNotebook.setTabText(
|
||||
self.AboutNotebook.indexOf(self.CreditsTab),
|
||||
|
@ -32,7 +32,7 @@ class MainDisplay(QtGui.QWidget):
|
||||
This is the form that is used to display things on the projector.
|
||||
"""
|
||||
global log
|
||||
log=logging.getLogger(u'MainDisplay')
|
||||
log = logging.getLogger(u'MainDisplay')
|
||||
log.info(u'MainDisplay Loaded')
|
||||
|
||||
def __init__(self, parent, screens):
|
||||
|
@ -49,7 +49,7 @@ class AuditPlugin(Plugin):
|
||||
"""
|
||||
Check to see if auditing is required
|
||||
"""
|
||||
log.debug('check_pre_conditions')
|
||||
log.debug(u'check_pre_conditions')
|
||||
#Lets see if audit is required
|
||||
if int(self.config.get_config(u'startup', 0)) == QtCore.Qt.Checked:
|
||||
return True
|
||||
|
@ -33,7 +33,7 @@ class AuditManager():
|
||||
"""
|
||||
|
||||
global log
|
||||
log=logging.getLogger(u'AuditManager')
|
||||
log = logging.getLogger(u'AuditManager')
|
||||
log.info(u'Audit manager loaded')
|
||||
|
||||
def __init__(self, config):
|
||||
|
@ -31,7 +31,7 @@ from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
|
||||
|
||||
class BiblePlugin(Plugin):
|
||||
global log
|
||||
log=logging.getLogger(u'BiblePlugin')
|
||||
log = logging.getLogger(u'BiblePlugin')
|
||||
log.info(u'Bible Plugin loaded')
|
||||
|
||||
def __init__(self, plugin_helpers):
|
||||
|
@ -30,7 +30,7 @@ from openlp.core.lib import Receiver
|
||||
|
||||
class BibleCSVImpl(BibleCommon):
|
||||
global log
|
||||
log=logging.getLogger(u'BibleCSVImpl')
|
||||
log = logging.getLogger(u'BibleCSVImpl')
|
||||
log.info(u'BibleCVSImpl loaded')
|
||||
def __init__(self, bibledb):
|
||||
"""
|
||||
|
@ -28,7 +28,7 @@ from common import BibleCommon, SearchResults
|
||||
|
||||
class BGExtract(BibleCommon):
|
||||
global log
|
||||
log=logging.getLogger(u'BibleHTTPMgr(BG_extract)')
|
||||
log = logging.getLogger(u'BibleHTTPMgr(BG_extract)')
|
||||
log.info(u'BG_extract loaded')
|
||||
|
||||
def __init__(self, proxyurl= None):
|
||||
@ -65,7 +65,7 @@ class BGExtract(BibleCommon):
|
||||
bible = {}
|
||||
while versePos > -1:
|
||||
# clear out string
|
||||
verseText = ''
|
||||
verseText = u''
|
||||
versePos = xml_string.find(u'</span', versePos)
|
||||
i = xml_string.find(VerseSearch, versePos+1)
|
||||
if i == -1:
|
||||
@ -88,7 +88,7 @@ class BGExtract(BibleCommon):
|
||||
|
||||
class CWExtract(BibleCommon):
|
||||
global log
|
||||
log=logging.getLogger(u'BibleHTTPMgr(CWExtract)')
|
||||
log = logging.getLogger(u'BibleHTTPMgr(CWExtract)')
|
||||
log.info(u'CWExtract loaded')
|
||||
|
||||
def __init__(self, proxyurl=None):
|
||||
@ -121,8 +121,8 @@ class CWExtract(BibleCommon):
|
||||
xml_string = self._get_web_text(urlstring, self.proxyurl)
|
||||
## Strip Book Title from Heading to return it to system
|
||||
##
|
||||
i= xml_string.find(u'<title>')
|
||||
j= xml_string.find(u'-', i)
|
||||
i = xml_string.find(u'<title>')
|
||||
j = xml_string.find(u'-', i)
|
||||
book_title = xml_string[i + 7:j]
|
||||
book_title = book_title.rstrip()
|
||||
log.debug(u'Book Title %s', book_title)
|
||||
@ -133,15 +133,15 @@ class CWExtract(BibleCommon):
|
||||
log.debug(u'Book Chapter %s', book_chapter)
|
||||
# Strip Verse Data from Page and build an array
|
||||
|
||||
i= xml_string.find(u'NavCurrentChapter')
|
||||
i = xml_string.find(u'NavCurrentChapter')
|
||||
xml_string = xml_string[i:len(xml_string)]
|
||||
i= xml_string.find(u'<TABLE')
|
||||
i = xml_string.find(u'<TABLE')
|
||||
xml_string = xml_string[i:len(xml_string)]
|
||||
i= xml_string.find(u'<B>')
|
||||
i = xml_string.find(u'<B>')
|
||||
#remove the <B> at the front
|
||||
xml_string = xml_string[i + 3 :len(xml_string)]
|
||||
# Remove the heading for the book
|
||||
i= xml_string.find(u'<B>')
|
||||
i = xml_string.find(u'<B>')
|
||||
#remove the <B> at the front
|
||||
xml_string = xml_string[i + 3 :len(xml_string)]
|
||||
versePos = xml_string.find(u'<BLOCKQUOTE>')
|
||||
@ -151,7 +151,7 @@ class CWExtract(BibleCommon):
|
||||
versePos = xml_string.find(u'<B><I>', versePos) + 6
|
||||
i = xml_string.find(u'</I></B>', versePos)
|
||||
# Got the Chapter
|
||||
verse= xml_string[versePos:i]
|
||||
verse = xml_string[versePos:i]
|
||||
# move the starting position to begining of the text
|
||||
versePos = i + 8
|
||||
# find the start of the next verse
|
||||
@ -168,7 +168,7 @@ class CWExtract(BibleCommon):
|
||||
|
||||
class BibleHTTPImpl():
|
||||
global log
|
||||
log=logging.getLogger(u'BibleHTTPMgr')
|
||||
log = logging.getLogger(u'BibleHTTPMgr')
|
||||
log.info(u'BibleHTTP manager loaded')
|
||||
def __init__(self):
|
||||
"""
|
||||
@ -180,8 +180,7 @@ class BibleHTTPImpl():
|
||||
|
||||
Init confirms the bible exists and stores the database path.
|
||||
"""
|
||||
#bible = {}
|
||||
self.biblesource = ''
|
||||
self.biblesource = u''
|
||||
self.proxyurl = None
|
||||
self.bibleid = None
|
||||
|
||||
|
@ -60,7 +60,7 @@ class BibleOSISImpl():
|
||||
filepath = os.path.split(os.path.abspath(__file__))[0]
|
||||
filepath = os.path.abspath(os.path.join(
|
||||
filepath, u'..', u'resources',u'osisbooks.csv'))
|
||||
fbibles=open(filepath, u'r')
|
||||
fbibles = open(filepath, u'r')
|
||||
for line in fbibles:
|
||||
p = line.split(u',')
|
||||
self.booksOfBible[p[0]] = p[1].replace(u'\n', u'')
|
||||
@ -99,9 +99,11 @@ class BibleOSISImpl():
|
||||
if self.loadbible == False:
|
||||
break
|
||||
pos = file_record.find(verseText)
|
||||
if pos > -1: # we have a verse
|
||||
epos= file_record.find(u'>', pos)
|
||||
ref = file_record[pos+15:epos-1] # Book Reference
|
||||
# we have a verse
|
||||
if pos > -1:
|
||||
epos = file_record.find(u'>', pos)
|
||||
# Book Reference
|
||||
ref = file_record[pos+15:epos-1]
|
||||
#lets find the bible text only
|
||||
# find start of text
|
||||
pos = epos + 1
|
||||
|
@ -104,15 +104,15 @@ class BibleCommon(object):
|
||||
urllib2.install_opener(opener)
|
||||
xml_string = u''
|
||||
req = urllib2.Request(urlstring)
|
||||
req.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')
|
||||
req.add_header(u'User-Agent', u'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')
|
||||
try:
|
||||
handle = urllib2.urlopen(req)
|
||||
html = handle.read()
|
||||
details = chardet.detect(html)
|
||||
xml_string = unicode(html, details['encoding'])
|
||||
xml_string = unicode(html, details[u'encoding'])
|
||||
except IOError, e:
|
||||
if hasattr(e, u'reason'):
|
||||
log.error(u'Reason : %s', e.reason)
|
||||
log.exception(u'Reason for failure: %s', e.reason)
|
||||
return xml_string
|
||||
|
||||
def _clean_text(self, text):
|
||||
|
@ -322,8 +322,7 @@ c
|
||||
Rest can be guessed at !
|
||||
"""
|
||||
text = []
|
||||
self.media.setQuickMsg1(u'')
|
||||
self.media.setQuickMsg2(u'')
|
||||
self.media.setQuickMessage(u'')
|
||||
log.debug(u'get_verse_text %s,%s,%s,%s,%s,%s',
|
||||
bible, bookname, schapter, echapter, sverse, everse)
|
||||
# check to see if book/chapter exists fow HTTP bibles and load cache
|
||||
@ -331,10 +330,10 @@ c
|
||||
if self.bible_http_cache[bible] is not None:
|
||||
book = self.bible_db_cache[bible].get_bible_book(bookname)
|
||||
if book is None:
|
||||
self.media.setQuickMsg1(u'Downloading')
|
||||
log.debug(u'get_verse_text : new book')
|
||||
for chapter in range(schapter, echapter + 1):
|
||||
self.media.setQuickMsg2(u'%s: %s'% (bookname, chapter))
|
||||
self.media.setQuickMessage \
|
||||
(u'Downloading %s: %s'% (bookname, chapter))
|
||||
search_results = \
|
||||
self.bible_http_cache[bible].get_bible_chapter(
|
||||
bible, 0, bookname, chapter)
|
||||
@ -362,8 +361,8 @@ c
|
||||
v = self.bible_db_cache[bible].get_bible_chapter(
|
||||
book.id, chapter)
|
||||
if v is None:
|
||||
self.media.setQuickMsg2(u'%s: %s'% (
|
||||
bookname, chapter))
|
||||
self.media.setQuickMessage \
|
||||
(u'%Downloading %s: %s'% (bookname, chapter))
|
||||
self.bible_db_cache[bible].create_chapter(
|
||||
book.id, chapter,
|
||||
search_results.get_verselist())
|
||||
@ -374,9 +373,8 @@ c
|
||||
book.id, chapter)
|
||||
if v is None:
|
||||
try:
|
||||
self.media.setQuickMsg1(u'Downloading')
|
||||
self.media.setQuickMsg2(u'%s: %s'% \
|
||||
(bookname, chapter))
|
||||
self.media.setQuickMessage \
|
||||
(u'Downloading %s: %s'% (bookname, chapter))
|
||||
search_results = \
|
||||
self.bible_http_cache[bible].get_bible_chapter(
|
||||
bible, book.id, bookname, chapter)
|
||||
|
@ -76,7 +76,9 @@ class BibleMediaItem(MediaManagerItem):
|
||||
# Add the Quick Search tab
|
||||
self.QuickTab = QtGui.QWidget()
|
||||
self.QuickTab.setObjectName(u'QuickTab')
|
||||
self.QuickLayout = QtGui.QGridLayout(self.QuickTab)
|
||||
self.QuickVerticalLayout = QtGui.QVBoxLayout(self.QuickTab)
|
||||
self.QuickVerticalLayout.setObjectName("verticalLayout")
|
||||
self.QuickLayout = QtGui.QGridLayout()
|
||||
self.QuickLayout.setMargin(5)
|
||||
self.QuickLayout.setSpacing(4)
|
||||
self.QuickLayout.setObjectName(u'QuickLayout')
|
||||
@ -107,12 +109,10 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab)
|
||||
self.ClearQuickSearchComboBox.setObjectName(u'ClearQuickSearchComboBox')
|
||||
self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 3, 1, 1, 1)
|
||||
self.QuickMsg1 = QtGui.QLabel(self.QuickTab)
|
||||
self.QuickMsg1.setObjectName(u'QuickSearchLabel')
|
||||
self.QuickLayout.addWidget(self.QuickMsg1, 4, 0, 1, 1)
|
||||
self.QuickMsg2 = QtGui.QLabel(self.QuickTab)
|
||||
self.QuickMsg2.setObjectName(u'QuickSearchLabel')
|
||||
self.QuickLayout.addWidget(self.QuickMsg2, 4, 1, 1, 1)
|
||||
self.QuickVerticalLayout.addLayout(self.QuickLayout)
|
||||
self.QuickMessage = QtGui.QLabel(self.QuickTab)
|
||||
self.QuickMessage.setObjectName(u'QuickMessage')
|
||||
self.QuickVerticalLayout.addWidget(self.QuickMessage)
|
||||
self.SearchTabWidget.addTab(self.QuickTab, 'Quick')
|
||||
QuickSpacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
|
||||
QtGui.QSizePolicy.Expanding)
|
||||
@ -230,14 +230,11 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.loadBibles()
|
||||
self.parent.biblemanager.set_media_manager(self)
|
||||
|
||||
def setQuickMsg1(self, text):
|
||||
self.QuickMsg1.setText(translate(u'BibleMediaItem', unicode(text)))
|
||||
|
||||
def setQuickMsg2(self, text):
|
||||
self.QuickMsg2.setText(translate(u'BibleMediaItem', unicode(text)))
|
||||
def setQuickMessage(self, text):
|
||||
self.QuickMessage.setText(translate(u'BibleMediaItem', unicode(text)))
|
||||
Receiver().send_message(u'process_events')
|
||||
#minor delay to get the events processed
|
||||
time.sleep(0.5)
|
||||
time.sleep(0.1)
|
||||
|
||||
def loadBibles(self):
|
||||
log.debug(u'Loading Bibles')
|
||||
|
@ -40,7 +40,7 @@ class CustomPlugin(Plugin):
|
||||
"""
|
||||
|
||||
global log
|
||||
log=logging.getLogger(u'CustomPlugin')
|
||||
log = logging.getLogger(u'CustomPlugin')
|
||||
log.info(u'Custom Plugin loaded')
|
||||
|
||||
def __init__(self, plugin_helpers):
|
||||
|
@ -38,7 +38,7 @@ class CustomMediaItem(MediaManagerItem):
|
||||
This is the custom media manager item for Custom Slides.
|
||||
"""
|
||||
global log
|
||||
log=logging.getLogger(u'CustomMediaItem')
|
||||
log = logging.getLogger(u'CustomMediaItem')
|
||||
log.info(u'Custom Media Item loaded')
|
||||
|
||||
def __init__(self, parent, icon, title):
|
||||
|
@ -43,7 +43,7 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
It can present files using Openoffice
|
||||
"""
|
||||
global log
|
||||
log=logging.getLogger(u'PresentationsMediaItem')
|
||||
log = logging.getLogger(u'PresentationsMediaItem')
|
||||
log.info(u'Presentations Media Item loaded')
|
||||
|
||||
def __init__(self, parent, icon, title, controllers):
|
||||
|
@ -30,7 +30,7 @@ class MessageListener(object):
|
||||
controller and passes the messages on the the correct presentation handlers
|
||||
"""
|
||||
global log
|
||||
log=logging.getLogger(u'MessageListener')
|
||||
log = logging.getLogger(u'MessageListener')
|
||||
log.info(u'Message Listener loaded')
|
||||
|
||||
def __init__(self, controllers):
|
||||
|
@ -36,7 +36,7 @@ class PresentationPlugin(Plugin):
|
||||
|
||||
def __init__(self, plugin_helpers):
|
||||
# Call the parent constructor
|
||||
log.debug('Initialised')
|
||||
log.debug(u'Initialised')
|
||||
self.controllers = {}
|
||||
Plugin.__init__(self, u'Presentations', u'1.9.0', plugin_helpers)
|
||||
self.weight = -8
|
||||
@ -66,7 +66,7 @@ class PresentationPlugin(Plugin):
|
||||
Check to see if we have any presentation software available
|
||||
If Not do not install the plugin.
|
||||
"""
|
||||
log.debug('check_pre_conditions')
|
||||
log.debug(u'check_pre_conditions')
|
||||
#Lets see if Powerpoint is required (Default is Not wanted)
|
||||
controller = PowerpointController(self)
|
||||
if int(self.config.get_config(
|
||||
|
@ -39,7 +39,7 @@ class RemotesPlugin(Plugin):
|
||||
"""
|
||||
Check to see if remotes is required
|
||||
"""
|
||||
log.debug('check_pre_conditions')
|
||||
log.debug(u'check_pre_conditions')
|
||||
#Lets see if Remote is required
|
||||
if int(self.config.get_config(u'startup', 0)) == QtCore.Qt.Checked:
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user