openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00103
[Merge] lp:~trb143/openlp/servicing into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/servicing into lp:openlp.
Requested reviews:
openlp.org Core (openlp-core)
Add OOS saving and loading
Fixes in the plugins due to strange window events before system fully loaded.
More code cleanups.
--
https://code.launchpad.net/~trb143/openlp/servicing/+merge/7211
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw 2009-05-20 20:17:20 +0000
+++ openlp.pyw 2009-06-07 19:34:24 +0000
@@ -41,7 +41,6 @@
#provide a listener for widgets to reqest a screen update.
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlpprocessevents'), self.processEvents)
-
self.setApplicationName(u'openlp.org')
self.setApplicationVersion(u'1.9.0')
self.splash = SplashScreen(self.applicationVersion())
@@ -66,4 +65,3 @@
if __name__ == u'__main__':
app = OpenLP(sys.argv)
app.run()
-
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2009-06-05 18:53:50 +0000
+++ openlp/core/lib/renderer.py 2009-06-08 04:30:12 +0000
@@ -20,22 +20,14 @@
import logging
import os, os.path
import sys
+#from copy import copy
-from datetime import *
from PyQt4 import QtGui, QtCore, Qt
-from copy import copy
-
class Renderer:
"""
- All the functions for rendering a set of words onto a Device Context
-
- How to use:
- set the words to be displayed with a call to format_slide() - this returns an array of screenfuls of data
- set a theme (if you need) with set_theme
- tell it which DC to render to with set_DC()
- set the borders of where you want the text (if not the whole DC) with set_text_rectangle()
- tell it to render a particular screenfull with render_screen(n)
+ Genarates a pixmap image of a array of text. The Text is formatted to
+ make sure it fits on the screen and if not extra frames a generated.
"""
global log
log = logging.getLogger(u'Renderer')
@@ -98,7 +90,7 @@
"""
if preview == True:
self._bg_frame = None
- log.debug(u'set frame dest (frame) w %d h %d',frame_width, frame_height)
+ log.debug(u'set frame dest (frame) w %d h %d', frame_width, frame_height)
self._frame = QtGui.QPixmap(frame_width, frame_height)
if self._bg_image_filename is not None:
self.scale_bg_image()
@@ -109,10 +101,10 @@
"""
External API to sort out the text to pe placed on the frame
"""
- print "########## Format Slide ##################"
+ #print "########## Format Slide ##################"
log.debug(u'format_slide %s', words)
verses = []
- words = words.replace("\r\n", "\n")
+ words = words.replace(u'\r\n', u'\n')
verses_text = words.split(u'\n\n')
text = []
for verse in verses_text:
@@ -120,8 +112,8 @@
for line in lines:
text.append(line)
split_text = self._split_set_of_lines(text, False)
- print "split text ", split_text
- print "text ", text
+ #print "split text ", split_text
+ #print "text ", text
return split_text
def set_text_rectangle(self, rect_main, rect_footer):
@@ -147,7 +139,6 @@
bbox = self._render_lines_unaligned(lines, False, (x, y))
if footer_lines is not None:
bbox = self._render_lines_unaligned(footer_lines, True, (self._rect_footer.left(), self._rect_footer.top()) )
- log.debug(u'generate_frame_from_lines - Finish')
return self._frame
def _generate_background_frame(self):
@@ -158,7 +149,6 @@
assert(self._theme)
self._bg_frame = QtGui.QPixmap(self._frame.width(), self._frame.height())
log.debug(u'render background %s ', self._theme.background_type)
- bef = datetime.now()
painter = QtGui.QPainter()
painter.begin(self._bg_frame)
if self._theme.background_type == u'solid':
@@ -193,9 +183,6 @@
else:
painter.fillRect(self._frame.rect(), QtGui.QColor(u'#000000'))
painter.end()
- aft = datetime.now()
- print "background time", bef, aft, aft-bef
- log.debug(u'render background finish')
def _split_set_of_lines(self, lines, footer):
"""
@@ -212,16 +199,11 @@
#print "bboxes ", bboxes
numlines = len(lines)
bottom = self._rect.bottom()
- count = 0
for ratio in (numlines, numlines/2, numlines/3, numlines/4):
good = 1
startline = 0
endline = startline + ratio
while (endline <= numlines and endline != 0):
- count += 1
- if count > 100:
- #print "busted"
- break
by = 0
for (x,y) in bboxes[startline:endline]:
#print by, startline, endline, x, y, bottom
@@ -278,7 +260,7 @@
elif int(self._theme.display_verticalAlign) == 1: # centre align
y = rect.top() + (rect.height() - bbox.height()) / 2
else:
- assert(0 , u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign)
+ log.error(u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign)
return x, y
def _render_lines_unaligned(self, lines, footer, tlcorner=(0,0)):
@@ -306,7 +288,6 @@
painter.setPen(QtGui.QPen(QtGui.QColor(0,0,255)))
painter.drawRect(retval)
painter.end()
- log.debug(u'render lines unaligned Finish')
return retval
def _render_and_wrap_single_line(self, line, footer, tlcorner=(0,0)):
@@ -317,7 +298,7 @@
right-aligns the surplus words in the manner of song lyrics
Returns the bottom-right corner (of what was rendered) as a tuple(x, y).
"""
- log.debug(u'Render single line %s @ %s '%( line, tlcorner))
+ #log.debug(u'Render single line %s @ %s '%( line, tlcorner))
x, y = tlcorner
# We draw the text to see how big it is and then iterate to make it fit
# when we line wrap we do in in the "lyrics" style, so the second line is
@@ -342,7 +323,8 @@
startx = x
starty = y
rightextent = None
- if footer: # dont allow alignment messing with footers
+ # dont allow alignment messing with footers
+ if footer:
align = 0
else:
align = int(self._theme .display_horizontalAlign)
@@ -354,42 +336,47 @@
w += self._shadow_offset
h += self._shadow_offset
if self._theme.display_outline:
- w += 2*self._outline_offset # pixels either side
- h += 2*self._outline_offset # pixels top/bottom
+ # pixels either side
+ w += 2 * self._outline_offset
+ # pixels top/bottom
+ h += 2 * self._outline_offset
if align == 0: # left align
rightextent = x + w
- if self._theme.display_wrapStyle == 1 and linenum != 0: # 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:
rightextent = self._first_line_right_extent + self._right_margin
if rightextent > maxx:
rightextent = maxx
x = rightextent - w
- elif align == 1: # right align
+ # right align
+ elif align == 1:
rightextent = maxx
x = maxx - w
- elif align == 2: # centre
+ # centre
+ elif align == 2:
x = (maxx - w) / 2;
rightextent = x + w
# now draw the text, and any outlines/shadows
if self._theme.display_shadow:
- self._get_extent_and_render(line, footer,tlcorner=(x+self._shadow_offset,y+self._shadow_offset),
+ self._get_extent_and_render(line, footer, tlcorner=(x+self._shadow_offset,y+self._shadow_offset),
draw=True, color = self._theme.display_shadow_color)
if self._theme.display_outline:
- self._get_extent_and_render(line, footer,(x+self._outline_offset,y), draw=True,
- color = self._theme.display_outline_color)
- self._get_extent_and_render(line, footer,(x, y+self._outline_offset), draw=True,
- color = self._theme.display_outline_color)
- self._get_extent_and_render(line, footer,(x, y-self._outline_offset), draw=True,
- color = self._theme.display_outline_color)
- self._get_extent_and_render(line, footer,(x-self._outline_offset,y), draw=True,
+ self._get_extent_and_render(line, footer, (x+self._outline_offset,y), draw=True,
+ color = self._theme.display_outline_color)
+ self._get_extent_and_render(line, footer, (x, y+self._outline_offset), draw=True,
+ color = self._theme.display_outline_color)
+ self._get_extent_and_render(line, footer, (x, y-self._outline_offset), draw=True,
+ color = self._theme.display_outline_color)
+ self._get_extent_and_render(line, footer, (x-self._outline_offset,y), draw=True,
color = self._theme.display_outline_color)
if self._outline_offset > 1:
- self._get_extent_and_render(line, footer,(x+self._outline_offset,y+self._outline_offset), draw=True,
- color = self._theme.display_outline_color)
- self._get_extent_and_render(line, footer,(x-self._outline_offset,y+self._outline_offset), draw=True,
- color = self._theme.display_outline_color)
- self._get_extent_and_render(line, footer,(x+self._outline_offset,y-self._outline_offset), draw=True,
- color = self._theme.display_outline_color)
- self._get_extent_and_render(line, footer,(x-self._outline_offset,y-self._outline_offset), draw=True,
+ self._get_extent_and_render(line, footer, (x+self._outline_offset,y+self._outline_offset), draw=True,
+ color = self._theme.display_outline_color)
+ self._get_extent_and_render(line, footer, (x-self._outline_offset,y+self._outline_offset), draw=True,
+ color = self._theme.display_outline_color)
+ self._get_extent_and_render(line, footer, (x+self._outline_offset,y-self._outline_offset), draw=True,
+ color = self._theme.display_outline_color)
+ self._get_extent_and_render(line, footer, (x-self._outline_offset,y-self._outline_offset), draw=True,
color = self._theme.display_outline_color)
self._get_extent_and_render(line, footer,tlcorner=(x, y), draw=True)
y += h
@@ -403,7 +390,6 @@
painter.drawRect(startx , starty , rightextent-startx , y-starty)
painter.end()
brcorner = (rightextent , y)
- log.debug(u'Render single line Finish')
return brcorner
# xxx this is what to override for an SDL version
@@ -454,14 +440,7 @@
Debugging method to allow images to be viewed
"""
im = image.toImage()
- im.save("renderer.png", "png")
+ im.save(u'renderer.png', u'png')
if image2 is not None:
im = image2.toImage()
- im.save("renderer2.png", "png")
-
-# def render_screen(self, screennum):
-# log.debug(u'render screen\n %s %s ', screennum, self.words[screennum])
-# t = 0.0
-# words = self.words[screennum]
-# retval = self._render_lines(words)
-# return retval
+ im.save(u'renderer2.png', u'png')
=== modified file 'openlp/core/lib/rendermanager.py'
--- openlp/core/lib/rendermanager.py 2009-06-05 18:53:50 +0000
+++ openlp/core/lib/rendermanager.py 2009-06-08 05:04:06 +0000
@@ -64,6 +64,7 @@
self.calculate_default(self.screen_list[self.current_display]['size'])
self.theme = u''
self.service_theme = u''
+ self.global_style = u''
def update_display(self, screen_number):
"""
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2009-06-05 19:00:57 +0000
+++ openlp/core/lib/serviceitem.py 2009-06-08 20:36:33 +0000
@@ -32,12 +32,14 @@
log=logging.getLogger(u'ServiceItem')
log.info(u'Service Item created')
- def __init__(self, hostplugin):
+ def __init__(self, hostplugin=None):
"""
Init Method
"""
self.plugin = hostplugin
- self.shortname = hostplugin.name
+ if hostplugin is not None:
+ self.RenderManager = self.plugin.render_manager
+ self.shortname = hostplugin.name
self.title = u''
self.items = []
self.iconic_representation = None
@@ -47,10 +49,11 @@
self.frames = []
self.raw_footer = None
self.theme = None
- log.debug(u'Service item created for %s ', self.shortname)
+ #log.debug(u'Service item created for %s ', self.shortname)
self.service_frames = []
def addIcon(self, icon):
+ self.icon = icon
self.iconic_representation = buildIcon(icon)
def render(self):
@@ -59,15 +62,15 @@
"""
log.debug(u'Render called')
if self.theme == None:
- self.plugin.render_manager.set_override_theme(None)
+ self.RenderManager.set_override_theme(None)
else:
- self.plugin.render_manager.set_override_theme(self.theme)
+ self.RenderManager.set_override_theme(self.theme)
log.debug(u'Formatting slides')
if self.service_item_type == u'text':
for slide in self.service_frames:
- formated = self.plugin.render_manager.format_slide(slide[u'raw_slide'])
+ formated = self.RenderManager.format_slide(slide[u'raw_slide'])
for format in formated:
- frame = self.plugin.render_manager.generate_slide(format, self.raw_footer)
+ frame = self.RenderManager.generate_slide(format, self.raw_footer)
self.frames.append({u'title': slide[u'title'], u'image': frame})
elif self.service_item_type == u'command':
self.frames = self.service_frames
@@ -76,7 +79,7 @@
self.frames = self.service_frames
self.service_frames = []
else:
- assert(0 , u'Invalid value rendere :%s' % self.service_item_type)
+ log.error(u'Invalid value renderer :%s' % self.service_item_type)
def add_from_image(self, frame_title, image):
self.service_item_type = u'image'
@@ -91,24 +94,29 @@
self.service_item_type = u'command'
self.service_frames.append({u'title': frame_title, u'command': command})
-
-
def get_oos_repr(self):
"""
This method returns some text which can be saved into the OOS
file to represent this item
"""
- pass
+ oos_header = {u'plugin': self.shortname,u'theme':self.theme, u'title':self.title,
+ u'icon':self.icon, u'footer':self.raw_footer, u'type':self.service_item_type}
+ oos_data = []
+ if self.service_item_type == u'text':
+ for slide in self.service_frames:
+ oos_data.append(slide[u'raw_slide'])
+ return {u'header': oos_header, u'data': self.service_frames}
- def set_from_oos(self, oostext):
+ def set_from_oos(self, serviceitem):
"""
This method takes some oostext (passed from the ServiceManager)
and parses it into the data actually required
"""
- pass
-
- def set_from_plugin(self):
- """
- Takes data from the plugin media chooser
- """
- pass
+ header = serviceitem[u'serviceitem'][u'header']
+ self.title = header[u'title']
+ self.service_item_type = header[u'type']
+ self.shortname = header[u'plugin']
+ self.theme = header[u'theme']
+ self.addIcon(header[u'icon'])
+ self.raw_footer = header[u'footer']
+ self.service_frames = serviceitem[u'serviceitem'][u'data']
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2009-06-05 18:53:50 +0000
+++ openlp/core/ui/maindisplay.py 2009-06-07 19:34:24 +0000
@@ -60,7 +60,7 @@
if not screen[u'primary']:
self.showFullScreen()
else:
- self.hide()
+ self.showMinimized()
painter = QtGui.QPainter()
self.blankFrame = QtGui.QPixmap(screen[u'size'].width(), screen[u'size'].height())
painter.begin(self.blankFrame)
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2009-06-08 19:03:16 +0000
+++ openlp/core/ui/mainwindow.py 2009-06-08 19:11:55 +0000
@@ -75,12 +75,12 @@
# hook methods have to happen after find_plugins. Find plugins needs the
# controllershence the hooks have moved from setupUI() to here
+ # Find and insert settings tabs
+ log.info(u'hook settings')
+ self.plugin_manager.hook_settings_tabs(self.settingsForm)
# Find and insert media manager items
log.info(u'hook media')
self.plugin_manager.hook_media_manager(self.MediaToolBox)
- # Find and insert settings tabs
- log.info(u'hook settings')
- self.plugin_manager.hook_settings_tabs(self.settingsForm)
# Call the hook method to pull in import menus.
log.info(u'hook menus')
self.plugin_manager.hook_import_menu(self.FileImportMenu)
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2009-06-08 19:03:16 +0000
+++ openlp/core/ui/servicemanager.py 2009-06-08 20:36:33 +0000
@@ -19,6 +19,7 @@
"""
import os
import logging
+import cPickle
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, Event, \
@@ -134,7 +135,8 @@
"""
Clear the list to create a new service
"""
- self.service_data.clearItems()
+ self.ServiceManagerList.clear()
+ self.serviceItems = []
def onDeleteFromService(self):
"""
@@ -146,13 +148,34 @@
"""
Save the current service
"""
- pass
+ filename = QtGui.QFileDialog.getSaveFileName(self, u'Save Order of Service',self.config.get_last_dir() )
+ if filename != u'':
+ self.config.set_last_dir(filename)
+ print filename
+ service = []
+ for item in self.serviceItems:
+ service.append({u'serviceitem':item[u'data'].get_oos_repr()})
+ file = open(filename+u'.oos', u'wb')
+ cPickle.dump(service, file)
+ file.close()
def onLoadService(self):
"""
Load an existing service from disk
"""
- pass
+ filename = QtGui.QFileDialog.getOpenFileName(self, u'Open Order of Service',self.config.get_last_dir(),
+ u'Services (*.oos)')
+ if filename != u'':
+ self.config.set_last_dir(filename)
+ file = open(filename, u'r')
+ items = cPickle.load(file)
+ file.close()
+ self.onNewService()
+ for item in items:
+ serviceitem = ServiceItem()
+ serviceitem.RenderManager = self.parent.RenderManager
+ serviceitem.set_from_oos(item)
+ self.addServiceItem(serviceitem)
def onThemeComboBoxSelected(self, currentIndex):
"""
@@ -162,16 +185,16 @@
self.parent.RenderManager.set_service_theme(self.service_theme)
self.config.set_config(u'theme service theme', self.service_theme)
- def addServiceItem(self, item):
+ def addServiceItem(self, item, expand=True):
"""
Add an item to the list
"""
self.serviceItems.append({u'data': item, u'order': len(self.serviceItems)+1})
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
- treewidgetitem.setText(0,item.title) # + u':' + item.shortname)
+ treewidgetitem.setText(0,item.title)
treewidgetitem.setIcon(0,item.iconic_representation)
treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(len(self.serviceItems)))
- treewidgetitem.setExpanded(True)
+ treewidgetitem.setExpanded(expand)
item.render()
count = 0
for frame in item.frames:
@@ -204,13 +227,14 @@
count = 0
for item in items:
childCount = item.childCount()
- if childCount >= 1: # is the parent
+ if childCount >= 1:
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
else:
parentitem = item.parent()
pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
count = item.data(0, QtCore.Qt.UserRole).toInt()[0]
- pos = pos - 1 #adjust for zeor indexing
+ #adjuest for zero based arrays
+ pos = pos - 1
return pos, count
def dragEnterEvent(self, event):
@@ -229,26 +253,6 @@
plugin = event.mimeData().text()
self.parent.EventManager.post_event(Event(EventType.LoadServiceItem, plugin))
- def oos_as_text(self):
- text=[]
- log.info( "oos as text")
- log.info("Data:"+str(self.service_data))
- for i in self.service_data:
- text.append("# " + str(i))
- text.append(i.get_oos_text())
- return '\n'.join(text)
-
- def write_oos(self, filename):
- """
- Write a full OOS file out - iterate over plugins and call their respective methods
- This format is totally arbitrary testing purposes - something sensible needs to go in here!
- """
- oosfile=open(filename, "w")
- oosfile.write("# BEGIN OOS\n")
- oosfile.write(self.oos_as_text)
- oosfile.write("# END OOS\n")
- oosfile.close()
-
def updateThemeList(self, theme_list):
"""
Called from ThemeManager when the Themes have changed
@@ -264,4 +268,3 @@
self.service_theme = u''
self.ThemeComboBox.setCurrentIndex(id)
self.parent.RenderManager.set_service_theme(self.service_theme)
-
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-06-05 19:00:57 +0000
+++ openlp/core/ui/slidecontroller.py 2009-06-07 19:34:24 +0000
@@ -135,11 +135,10 @@
self.PreviewListView = QtGui.QListView(self.Controller)
self.PreviewListData = SlideData()
self.PreviewListView.isLive = self.isLive
- self.PreviewListView.setFlow(1)
- self.PreviewListView.setViewMode(1)
+ #self.PreviewListView.setFlow(1)
+ #self.PreviewListView.setViewMode(1)
self.PreviewListView.setWrapping(False)
self.PreviewListView.setModel(self.PreviewListData)
- #self.PreviewListView.setSelectionRectVisible(True)
self.PreviewListView.setSpacing(0)
self.PreviewListView.setObjectName(u'PreviewListView')
self.ControllerLayout.addWidget(self.PreviewListView)
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py 2009-06-07 16:33:33 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py 2009-06-08 05:04:06 +0000
@@ -33,9 +33,9 @@
global log
log=logging.getLogger(u'BibleImportForm')
log.info(u'BibleImportForm loaded')
- '''
+ """
Class documentation goes here.
- '''
+ """
def __init__(self, config, biblemanager , bibleplugin, parent = None):
'''
Constructor
@@ -124,7 +124,7 @@
# Was OSIS and is not any more stops lostFocus running mad
if self.bible_type == u'OSIS':
self.bible_type = None
- self.freeAll()
+ self.resetScreenFieldStates()
def onBooksLocationEditLostFocus(self):
self.checkOsis()
@@ -209,9 +209,9 @@
str(self.PermisionEdit.displayText()))
self.bible_type = None
# free the screen state restrictions
- self.freeAll()
+ self.resetScreenFieldStates()
# reset all the screen fields
- self.resetAll()
+ self.resetEntryFields()
def checkOsis(self):
if len(self.BooksLocationEdit.displayText()) > 0 or len(self.VerseLocationEdit.displayText()) > 0:
@@ -220,7 +220,7 @@
# Was CSV and is not any more stops lostFocus running mad
if self.bible_type == u'CSV':
self.bible_type = None
- self.freeAll()
+ self.resetScreenFieldStates()
def checkHttp(self):
if self.BibleComboBox.currentIndex() != 0 : # First slot is blank so no bible
@@ -229,7 +229,7 @@
# Was HTTP and is not any more stops lostFocus running mad
if self.bible_type == u'HTTP':
self.bible_type = None
- self.freeAll()
+ self.resetScreenFieldStates()
def blockCsv(self):
self.BooksLocationEdit.setReadOnly(True)
@@ -247,7 +247,7 @@
self.blockHttp()
def setOsis(self):
- self.bible_type = 'OSIS'
+ self.bible_type = u'OSIS'
self.OSISLocationEdit.setReadOnly(False)
self.OsisFileButton.setEnabled(True)
self.blockCsv()
@@ -268,8 +268,9 @@
self.LocationComboBox.setEnabled(False)
self.BibleComboBox.setEnabled(False)
- def freeAll(self):
- if self.bible_type == None: # only reset if no bible type set.
+ def resetScreenFieldStates(self):
+ # only reset if no bible type set.
+ if self.bible_type == None:
self.BooksLocationEdit.setReadOnly(False)
self.VerseLocationEdit.setReadOnly(False)
self.BooksFileButton.setEnabled(True)
@@ -279,7 +280,7 @@
self.LocationComboBox.setEnabled(True)
self.BibleComboBox.setEnabled(True)
- def resetAll(self):
+ def resetEntryFields(self):
self.BooksLocationEdit.setText(u'')
self.VerseLocationEdit.setText(u'')
self.OSISLocationEdit.setText(u'')
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2009-06-05 18:53:50 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2009-06-08 05:04:06 +0000
@@ -17,6 +17,7 @@
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
+import logging
from PyQt4 import Qt, QtCore, QtGui
@@ -27,6 +28,10 @@
"""
BiblesTab is the Bibles settings tab in the settings dialog.
"""
+ global log
+ log = logging.getLogger(u'BibleTab')
+ log.info(u'Bible Tab loaded')
+
def __init__(self):
self.paragraph_style = True
self.show_new_chapters = False
@@ -67,14 +72,12 @@
self.NewChaptersCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
self.NewChaptersCheckBox.setObjectName("NewChaptersCheckBox")
self.VerseDisplayLayout.addWidget(self.NewChaptersCheckBox, 1, 0, 1, 1)
-
self.DisplayStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.DisplayStyleWidget.setObjectName(u'DisplayStyleWidget')
self.DisplayStyleLayout = QtGui.QHBoxLayout(self.DisplayStyleWidget)
self.DisplayStyleLayout.setSpacing(8)
self.DisplayStyleLayout.setMargin(0)
self.DisplayStyleLayout.setObjectName(u'DisplayStyleLayout')
-
self.DisplayStyleLabel = QtGui.QLabel(self.DisplayStyleWidget)
self.DisplayStyleLabel.setObjectName(u'DisplayStyleLabel')
self.DisplayStyleLayout.addWidget(self.DisplayStyleLabel)
@@ -86,14 +89,12 @@
self.DisplayStyleComboBox.addItem(QtCore.QString())
self.DisplayStyleLayout.addWidget(self.DisplayStyleComboBox)
self.VerseDisplayLayout.addWidget(self.DisplayStyleWidget, 2, 0, 1, 1)
-
self.BibleThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.BibleThemeWidget.setObjectName(u'BibleThemeWidget')
self.BibleThemeLayout = QtGui.QHBoxLayout(self.BibleThemeWidget)
self.BibleThemeLayout.setSpacing(8)
self.BibleThemeLayout.setMargin(0)
self.BibleThemeLayout.setObjectName(u'BibleThemeLayout')
-
self.BibleThemeLabel = QtGui.QLabel(self.BibleThemeWidget)
self.BibleThemeLabel.setObjectName(u'BibleThemeLabel')
self.BibleThemeLayout.addWidget(self.BibleThemeLabel)
@@ -102,7 +103,6 @@
self.BibleThemeComboBox.addItem(QtCore.QString())
self.BibleThemeLayout.addWidget(self.BibleThemeComboBox)
self.VerseDisplayLayout.addWidget(self.BibleThemeWidget, 3, 0, 1, 1)
-
self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel')
self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 4, 0, 1, 1)
@@ -111,7 +111,6 @@
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.BibleLeftLayout.addItem(self.BibleLeftSpacer)
self.BibleLayout.addWidget(self.BibleLeftWidget)
-
self.BibleRightWidget = QtGui.QWidget(self)
self.BibleRightWidget.setObjectName(u'BibleRightWidget')
self.BibleRightLayout = QtGui.QVBoxLayout(self.BibleRightWidget)
@@ -176,13 +175,15 @@
def onNewChaptersCheckBoxChanged(self):
check_state = self.NewChaptersCheckBox.checkState()
self.show_new_chapters = False
- if check_state == 2: # we have a set value convert to True/False
+ # we have a set value convert to True/False
+ if check_state == 2:
self.show_new_chapters = True
def onBibleSearchCheckBoxChanged(self):
check_state = self.BibleSearchCheckBox.checkState()
self.bible_search = False
- if check_state == 2: # we have a set value convert to True/False
+ # we have a set value convert to True/False
+ if check_state == 2:
self.bible_search = True
def load(self):
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2009-06-07 18:39:31 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2009-06-08 05:04:06 +0000
@@ -42,9 +42,7 @@
mimeData = QtCore.QMimeData()
drag.setMimeData(mimeData)
mimeData.setText(u'Bibles')
-
dropAction = drag.start(QtCore.Qt.CopyAction)
-
if dropAction == QtCore.Qt.CopyAction:
self.close()
@@ -90,7 +88,6 @@
translate(u'BibleMediaItem',u'Add the selected Bible(s) to the service'),
u':/system/system_add.png',
self.onBibleAddClick, u'BibleAddItem')
-
# Create the tab widget
self.SearchTabWidget = QtGui.QTabWidget(self)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
@@ -99,7 +96,6 @@
sizePolicy.setHeightForWidth(self.SearchTabWidget.sizePolicy().hasHeightForWidth())
self.SearchTabWidget.setSizePolicy(sizePolicy)
self.SearchTabWidget.setObjectName(u'SearchTabWidget')
-
# Add the Quick Search tab
self.QuickTab = QtGui.QWidget()
self.QuickTab.setObjectName(u'QuickTab')
@@ -138,7 +134,6 @@
QuickSpacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.QuickLayout.addItem(QuickSpacerItem, 4, 2, 1, 1)
-
# Add the Advanced Search tab
self.AdvancedTab = QtGui.QWidget()
self.AdvancedTab.setObjectName(u'AdvancedTab')
@@ -170,45 +165,37 @@
self.AdvancedToLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedToLabel.setObjectName(u'AdvancedToLabel')
self.AdvancedLayout.addWidget(self.AdvancedToLabel, 4, 0, 1, 1)
-
self.AdvancedFromChapter = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedFromChapter.setObjectName(u'AdvancedFromChapter')
self.AdvancedLayout.addWidget(self.AdvancedFromChapter, 3, 2, 1, 1)
self.AdvancedFromVerse = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedFromVerse.setObjectName(u'AdvancedFromVerse')
self.AdvancedLayout.addWidget(self.AdvancedFromVerse, 3, 3, 1, 1)
-
self.AdvancedToChapter = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedToChapter.setObjectName(u'AdvancedToChapter')
self.AdvancedLayout.addWidget(self.AdvancedToChapter, 4, 2, 1, 1)
self.AdvancedToVerse = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedToVerse.setObjectName(u'AdvancedToVerse')
self.AdvancedLayout.addWidget(self.AdvancedToVerse, 4, 3, 1, 1)
-
self.AdvancedClearLabel = QtGui.QLabel(self.QuickTab)
self.AdvancedClearLabel.setObjectName(u'QuickSearchLabel')
self.AdvancedLayout.addWidget(self.AdvancedClearLabel, 5, 0, 1, 1)
self.ClearAdvancedSearchComboBox = QtGui.QComboBox(self.QuickTab)
self.ClearAdvancedSearchComboBox.setObjectName(u'ClearAdvancedSearchComboBox')
self.AdvancedLayout.addWidget(self.ClearAdvancedSearchComboBox, 5, 2, 1, 1)
-
self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab)
self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton')
self.AdvancedLayout.addWidget(self.AdvancedSearchButton, 5, 3, 1, 1)
self.SearchTabWidget.addTab(self.AdvancedTab, u'Advanced')
-
# Add the search tab widget to the page layout
self.PageLayout.addWidget(self.SearchTabWidget)
-
self.BibleListView = BibleList()
self.BibleListView.setAlternatingRowColors(True)
self.BibleListData = TextListData()
self.BibleListView.setModel(self.BibleListData)
self.BibleListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.BibleListView.setDragEnabled(True)
-
self.PageLayout.addWidget(self.BibleListView)
-
# Combo Boxes
QtCore.QObject.connect(self.AdvancedVersionComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox)
@@ -226,7 +213,7 @@
QtCore.QObject.connect(self.QuickSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton)
QtCore.QObject.connect(self.BibleListView,
- QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onRowSelected)
+ QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onBiblePreviewClick)
# Context Menus
self.BibleListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.BibleListView.addAction(self.contextMenuAction(
@@ -239,7 +226,6 @@
self.BibleListView, u':/system/system_add.png',
translate(u'BibleMediaItem',u'&Add to Service'), self.onBibleAddClick))
-
def retranslateUi(self):
log.debug(u'retranslateUi')
self.QuickVersionLabel.setText(translate(u'BibleMediaItem', u'Version:'))
@@ -262,9 +248,6 @@
self.ClearAdvancedSearchComboBox.addItem(translate(u'BibleMediaItem', u'Clear'))
self.ClearAdvancedSearchComboBox.addItem(translate(u'BibleMediaItem', u'Keep'))
- def onRowSelected(self, row):
- self.onBiblePreviewClick()
-
def initialise(self):
log.debug(u'initialise')
self.loadBibles()
@@ -277,7 +260,8 @@
# load bibles into the combo boxes
for bible in bibles:
self.QuickVersionComboBox.addItem(bible)
- bibles = self.parent.biblemanager.get_bibles(u'partial') # Without HTTP
+ # Without HTT
+ bibles = self.parent.biblemanager.get_bibles(u'partial')
first = True
# load bibles into the combo boxes
for bible in bibles:
@@ -367,7 +351,7 @@
self.parent.preview_controller.addServiceItem(service_item)
def generateSlideData(self, service_item):
- log.debug(u'Bible Preview Button pressed')
+ log.debug(u'generating slide data')
items = self.BibleListView.selectedIndexes()
old_chapter = u''
raw_slides=[]
@@ -459,7 +443,7 @@
end_chapter = ''
start_verse = ''
end_verse = ''
- search = search.replace(u' ', ' ').strip()
+ search = search.replace(u' ', u' ').strip()
original = search
message = None
# Remove book beware 0 index arrays
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2009-06-05 19:00:57 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2009-06-07 19:34:24 +0000
@@ -41,9 +41,7 @@
mimeData = QtCore.QMimeData()
drag.setMimeData(mimeData)
mimeData.setText(u'Custom')
-
dropAction = drag.start(QtCore.Qt.CopyAction)
-
if dropAction == QtCore.Qt.CopyAction:
self.close()
@@ -65,36 +63,36 @@
# Create buttons for the toolbar
## New Custom Button ##
self.addToolbarButton(
- translate('CustomMediaItem',u'New Custom Item'),
- translate('CustomMediaItem',u'Add a new Custom Item'),
- ':/custom/custom_new.png', self.onCustomNewClick, 'CustomNewItem')
+ translate(u'CustomMediaItem',u'New Custom Item'),
+ translate(u'CustomMediaItem',u'Add a new Custom Item'),
+ u':/custom/custom_new.png', self.onCustomNewClick, u'CustomNewItem')
## Edit Custom Button ##
self.addToolbarButton(
- translate('CustomMediaItem',u'Edit Custom Item'),
- translate('CustomMediaItem',u'Edit the selected Custom Item'),
- ':/custom/custom_edit.png', self.onCustomEditClick, 'CustomEditItem')
+ translate(u'CustomMediaItem',u'Edit Custom Item'),
+ translate(u'CustomMediaItem',u'Edit the selected Custom Item'),
+ u':/custom/custom_edit.png', self.onCustomEditClick, u'CustomEditItem')
## Delete Custom Button ##
self.addToolbarButton(
- translate('CustomMediaItem',u'Delete Custom Item'),
- translate('CustomMediaItem',u'Delete the selected Custom Item'),
- ':/custom/custom_delete.png', self.onCustomDeleteClick, 'CustomDeleteItem')
+ translate(u'CustomMediaItem',u'Delete Custom Item'),
+ translate(u'CustomMediaItem',u'Delete the selected Custom Item'),
+ u':/custom/custom_delete.png', self.onCustomDeleteClick, u'CustomDeleteItem')
## Separator Line ##
self.addToolbarSeparator()
## Preview Custom Button ##
self.addToolbarButton(
- translate('CustomMediaItem',u'Preview Custom Item'),
- translate('CustomMediaItem',u'Preview the selected Custom Item'),
- ':/system/system_preview.png', self.onCustomPreviewClick, 'CustomPreviewItem')
+ translate(u'CustomMediaItem',u'Preview Custom Item'),
+ translate(u'CustomMediaItem',u'Preview the selected Custom Item'),
+ u':/system/system_preview.png', self.onCustomPreviewClick, u'CustomPreviewItem')
## Live Custom Button ##
self.addToolbarButton(
- translate('CustomMediaItem',u'Go Live'),
- translate('CustomMediaItem', u'Send the selected Custom live'),
- ':/system/system_live.png', self.onCustomLiveClick, 'CustomLiveItem')
+ translate(u'CustomMediaItem',u'Go Live'),
+ translate(u'CustomMediaItem', u'Send the selected Custom live'),
+ u':/system/system_live.png', self.onCustomLiveClick, u'CustomLiveItem')
## Add Custom Button ##
self.addToolbarButton(
- translate('CustomMediaItem',u'Add Custom To Service'),
- translate('CustomMediaItem',u'Add the selected Custom(s) to the service'),
- ':/system/system_add.png', self.onCustomAddClick, 'CustomAddItem')
+ translate(u'CustomMediaItem',u'Add Custom To Service'),
+ translate(u'CustomMediaItem',u'Add the selected Custom(s) to the service'),
+ u':/system/system_add.png', self.onCustomAddClick, u'CustomAddItem')
# Add the Customlist widget
self.CustomWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
@@ -103,64 +101,36 @@
sizePolicy.setHeightForWidth(self.CustomWidget.sizePolicy().hasHeightForWidth())
self.CustomWidget.setSizePolicy(sizePolicy)
self.CustomWidget.setObjectName(u'CustomWidget')
-
-# self.SearchLayout = QtGui.QGridLayout(self.CustomWidget)
-# self.SearchLayout.setObjectName('SearchLayout')
-# self.SearchTextLabel = QtGui.QLabel(self.CustomWidget)
-# self.SearchTextLabel.setObjectName('SearchTextLabel')
-# self.SearchTextLabel.setText('Search Text:')
-# self.SearchLayout.addWidget(self.SearchTextLabel, 2, 0, 1, 1)
-# self.SearchTextEdit = QtGui.QLineEdit(self.CustomWidget)
-# self.SearchTextEdit.setObjectName('SearchTextEdit')
-# self.SearchLayout.addWidget(self.SearchTextEdit, 2, 1, 1, 2)
-#
-# self.ClearTextButton = QtGui.QPushButton(self.CustomWidget)
-# self.ClearTextButton.setObjectName('ClearTextButton')
-#
-# self.SearchLayout.addWidget(self.ClearTextButton, 3, 1, 1, 1)
-# self.SearchTextButton = QtGui.QPushButton(self.CustomWidget)
-# self.SearchTextButton.setObjectName('SearchTextButton')
-# self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1)
# Add the Custom widget to the page layout
self.PageLayout.addWidget(self.CustomWidget)
-
self.CustomListView = CustomList()
self.CustomListView.setAlternatingRowColors(True)
self.CustomListData = TextListData()
self.CustomListView.setModel(self.CustomListData)
self.CustomListView.setDragEnabled(True)
-
self.PageLayout.addWidget(self.CustomListView)
-
# Signals
-# QtCore.QObject.connect(self.SearchTextButton,
-# QtCore.SIGNAL("pressed()"), self.onSearchTextButtonClick)
-# QtCore.QObject.connect(self.ClearTextButton,
-# QtCore.SIGNAL("pressed()"), self.onClearTextButtonClick)
-# QtCore.QObject.connect(self.SearchTextEdit,
-# QtCore.SIGNAL("textChanged(const QString&)"), self.onSearchTextEditChanged)
-# QtCore.QObject.connect(self.CustomListView,
-# QtCore.SIGNAL("itemPressed(QTableWidgetItem * item)"), self.onCustomSelected)
-
+ QtCore.QObject.connect(self.CustomListView,
+ QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onCustomPreviewClick)
#define and add the context menu
self.CustomListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.CustomListView.addAction(self.contextMenuAction(self.CustomListView,
- ':/custom/custom_edit.png', translate('CustomMediaItem', u'&Edit Custom'),
+ ':/custom/custom_edit.png', translate(u'CustomMediaItem', u'&Edit Custom'),
self.onCustomEditClick))
self.CustomListView.addAction(self.contextMenuSeparator(self.CustomListView))
self.CustomListView.addAction(self.contextMenuAction(
self.CustomListView, ':/system/system_preview.png',
- translate('CustomMediaItem',u'&Preview Custom'), self.onCustomPreviewClick))
+ translate(u'CustomMediaItem',u'&Preview Custom'), self.onCustomPreviewClick))
self.CustomListView.addAction(self.contextMenuAction(
self.CustomListView, ':/system/system_live.png',
- translate('CustomMediaItem',u'&Show Live'), self.onCustomLiveClick))
+ translate(u'CustomMediaItem',u'&Show Live'), self.onCustomLiveClick))
self.CustomListView.addAction(self.contextMenuAction(
self.CustomListView, ':/system/system_add.png',
- translate('CustomMediaItem',u'&Add to Service'), self.onCustomAddClick))
+ translate(u'CustomMediaItem',u'&Add to Service'), self.onCustomAddClick))
# def retranslateUi(self):
-# self.ClearTextButton.setText(translate('CustomMediaItem', u'Clear'))
-# self.SearchTextButton.setText(translate('CustomMediaItem', u'Search'))
+# self.ClearTextButton.setText(translate(u'CustomMediaItem', u'Clear'))
+# self.SearchTextButton.setText(translate(u'CustomMediaItem', u'Search'))
def initialise(self):
self.loadCustomList(self.parent.custommanager.get_all_slides())
@@ -177,7 +147,8 @@
self.SearchTextEdit.clear()
def onSearchTextEditChanged(self, text):
- if len(text) > 3: # only search if > 3 characters
+ # only search if > 3 characters
+ if len(text) > 3:
self.onSearchTextButtonClick()
def onSearchTextButtonClick(self):
@@ -209,21 +180,21 @@
def onCustomPreviewClick(self):
log.debug(u'Custom Preview Requested')
service_item = ServiceItem(self.parent)
- service_item.addIcon( ":/media/media_song.png")
+ service_item.addIcon(u':/media/media_song.png')
self.generateSlideData(service_item)
self.parent.preview_controller.addServiceItem(service_item)
def onCustomLiveClick(self):
log.debug(u'Custom Live Requested')
service_item = ServiceItem(self.parent)
- service_item.addIcon( ":/media/media_song.png")
+ service_item.addIcon(u':/media/media_song.png')
self.generateSlideData(service_item)
self.parent.live_controller.addServiceItem(service_item)
def onCustomAddClick(self):
log.debug(u'Custom Add Requested')
service_item = ServiceItem(self.parent)
- service_item.addIcon( ":/media/media_song.png")
+ service_item.addIcon(u':/media/media_song.png')
self.generateSlideData(service_item)
self.parent.service_manager.addServiceItem(service_item)
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2009-06-05 19:00:57 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2009-06-07 19:34:24 +0000
@@ -42,9 +42,7 @@
mimeData = QtCore.QMimeData()
drag.setMimeData(mimeData)
mimeData.setText(u'Image')
-
dropAction = drag.start(QtCore.Qt.CopyAction)
-
if dropAction == QtCore.Qt.CopyAction:
self.close()
@@ -65,32 +63,31 @@
# Create buttons for the toolbar
## New Song Button ##
self.addToolbarButton(
- translate('ImageMediaItem', u'Load Image'),
- translate('ImageMediaItem', u'Load images into openlp.org'),
- ':/images/image_load.png', self.onImagesNewClick, 'ImageNewItem')
+ translate(u'ImageMediaItem', u'Load Image'),
+ translate(u'ImageMediaItem', u'Load images into openlp.org'),
+ u':/images/image_load.png', self.onImagesNewClick, u'ImageNewItem')
## Delete Song Button ##
self.addToolbarButton(
- translate('ImageMediaItem', u'Delete Image'),
- translate('ImageMediaItem', u'Delete the selected image'),
- ':/images/image_delete.png', self.onImageDeleteClick, 'ImageDeleteItem')
+ translate(u'ImageMediaItem', u'Delete Image'),
+ translate(u'ImageMediaItem', u'Delete the selected image'),
+ u':/images/image_delete.png', self.onImageDeleteClick, u'ImageDeleteItem')
## Separator Line ##
self.addToolbarSeparator()
## Preview Song Button ##
self.addToolbarButton(
- translate('ImageMediaItem', u'Preview Song'),
- translate('ImageMediaItem', u'Preview the selected image'),
- ':/system/system_preview.png', self.onImagePreviewClick, 'ImagePreviewItem')
+ translate(u'ImageMediaItem', u'Preview Song'),
+ translate(u'ImageMediaItem', u'Preview the selected image'),
+ u':/system/system_preview.png', self.onImagePreviewClick, u'ImagePreviewItem')
## Live Song Button ##
self.addToolbarButton(
- translate('ImageMediaItem', u'Go Live'),
- translate('ImageMediaItem', u'Send the selected image live'),
- ':/system/system_live.png', self.onImageLiveClick, 'ImageLiveItem')
+ translate(u'ImageMediaItem', u'Go Live'),
+ translate(u'ImageMediaItem', u'Send the selected image live'),
+ u':/system/system_live.png', self.onImageLiveClick, u'ImageLiveItem')
## Add Song Button ##
self.addToolbarButton(
- translate('ImageMediaItem', u'Add Image To Service'),
- translate('ImageMediaItem', u'Add the selected image(s) to the service'),
- ':/system/system_add.png', self.onImageAddClick, 'ImageAddItem')
-
+ translate(u'ImageMediaItem', u'Add Image To Service'),
+ translate(u'ImageMediaItem', u'Add the selected image(s) to the service'),
+ u':/system/system_add.png', self.onImageAddClick, u'ImageAddItem')
#Add the Image List widget
self.ImageListView = ImageList()
self.ImageListView.uniformItemSizes = True
@@ -101,33 +98,29 @@
self.ImageListView.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
self.ImageListView.setAlternatingRowColors(True)
self.ImageListView.setDragEnabled(True)
- self.ImageListView.setObjectName('ImageListView')
-
+ self.ImageListView.setObjectName(u'ImageListView')
self.PageLayout.addWidget(self.ImageListView)
-
#define and add the context menu
self.ImageListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
-
self.ImageListView.addAction(self.contextMenuAction(
self.ImageListView, ':/system/system_preview.png',
- translate('ImageMediaItem', u'&Preview Image'),
+ translate(u'ImageMediaItem', u'&Preview Image'),
self.onImagePreviewClick))
self.ImageListView.addAction(self.contextMenuAction(
self.ImageListView, ':/system/system_live.png',
- translate('ImageMediaItem', u'&Show Live'),
+ translate(u'ImageMediaItem', u'&Show Live'),
self.onImageLiveClick))
self.ImageListView.addAction(self.contextMenuAction(
self.ImageListView, ':/system/system_add.png',
- translate('ImageMediaItem', u'&Add to Service'),
+ translate(u'ImageMediaItem', u'&Add to Service'),
self.onImageAddClick))
-
def initialise(self):
self.loadImageList(self.parent.config.load_list(u'images'))
def onImagesNewClick(self):
files = QtGui.QFileDialog.getOpenFileNames(None,
- translate('ImageMediaItem', u'Select Image(s)'),
+ translate(u'ImageMediaItem', u'Select Image(s)'),
self.parent.config.get_last_dir(),
u'Images (*.jpg *.gif *.png *.bmp)')
log.info(u'New image(s)', str(files))
@@ -160,20 +153,20 @@
def onImagePreviewClick(self):
log.debug(u'Image Preview Requested')
service_item = ServiceItem(self.parent)
- service_item.addIcon( ":/media/media_image.png")
+ service_item.addIcon(u':/media/media_image.png')
self.generateSlideData(service_item)
self.parent.preview_controller.addServiceItem(service_item)
def onImageLiveClick(self):
log.debug(u'Image Live Requested')
service_item = ServiceItem(self.parent)
- service_item.addIcon( ":/media/media_image.png")
+ service_item.addIcon(u':/media/media_image.png')
self.generateSlideData(service_item)
self.parent.live_controller.addServiceItem(service_item)
def onImageAddClick(self):
log.debug(u'Image Add Requested')
service_item = ServiceItem(self.parent)
- service_item.addIcon( ":/media/media_image.png")
+ service_item.addIcon(u':/media/media_image.png')
self.generateSlideData(service_item)
self.parent.service_manager.addServiceItem(service_item)
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2009-06-05 19:00:57 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2009-06-08 05:04:06 +0000
@@ -43,9 +43,7 @@
mimeData = QtCore.QMimeData()
drag.setMimeData(mimeData)
mimeData.setText(u'Song')
-
dropAction = drag.start(QtCore.Qt.CopyAction)
-
if dropAction == QtCore.Qt.CopyAction:
self.close()
@@ -54,8 +52,8 @@
This is the custom media manager item for Songs.
"""
global log
- log = logging.getLogger("SongMediaItem")
- log.info("Song Media Item loaded")
+ log = logging.getLogger(u'SongMediaItem')
+ log.info(u'Song Media Item loaded')
def __init__(self, parent, icon, title):
MediaManagerItem.__init__(self, parent, icon, title)
@@ -66,30 +64,30 @@
self.addToolbar()
# Create buttons for the toolbar
## New Song Button ##
- self.addToolbarButton(translate('SongMediaItem', u'New Song'),
- translate('SongMediaItem', u'Add a new song'),
+ self.addToolbarButton(translate(u'SongMediaItem', u'New Song'),
+ translate(u'SongMediaItem', u'Add a new song'),
':/songs/song_new.png', self.onSongNewClick, 'SongNewItem')
## Edit Song Button ##
- self.addToolbarButton(translate('SongMediaItem', u'Edit Song'),
- translate('SongMediaItem', u'Edit the selected song'),
+ self.addToolbarButton(translate(u'SongMediaItem', u'Edit Song'),
+ translate(u'SongMediaItem', u'Edit the selected song'),
':/songs/song_edit.png', self.onSongEditClick, 'SongEditItem')
## Delete Song Button ##
- self.addToolbarButton(translate('SongMediaItem', u'Delete Song'),
- translate('SongMediaItem', u'Delete the selected song'),
+ self.addToolbarButton(translate(u'SongMediaItem', u'Delete Song'),
+ translate(u'SongMediaItem', u'Delete the selected song'),
':/songs/song_delete.png', self.onSongDeleteClick, 'SongDeleteItem')
## Separator Line ##
self.addToolbarSeparator()
## Preview Song Button ##
- self.addToolbarButton(translate('SongMediaItem', u'Preview Song'),
- translate('SongMediaItem', u'Preview the selected song'),
+ self.addToolbarButton(translate(u'SongMediaItem', u'Preview Song'),
+ translate(u'SongMediaItem', u'Preview the selected song'),
':/system/system_preview.png', self.onSongPreviewClick, 'SongPreviewItem')
## Live Song Button ##
- self.addToolbarButton(translate('SongMediaItem', u'Go Live'),
- translate('SongMediaItem', u'Send the selected song live'),
+ self.addToolbarButton(translate(u'SongMediaItem', u'Go Live'),
+ translate(u'SongMediaItem', u'Send the selected song live'),
':/system/system_live.png', self.onSongLiveClick, 'SongLiveItem')
## Add Song Button ##
- self.addToolbarButton(translate('SongMediaItem', u'Add Song To Service'),
- translate('SongMediaItem', u'Add the selected song(s) to the service'),
+ self.addToolbarButton(translate(u'SongMediaItem', u'Add Song To Service'),
+ translate(u'SongMediaItem', u'Add the selected song(s) to the service'),
':/system/system_add.png', self.onSongAddClick, 'SongAddItem')
## Add the songlist widget ##
# Create the tab widget
@@ -99,92 +97,77 @@
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.SongWidget.sizePolicy().hasHeightForWidth())
self.SongWidget.setSizePolicy(sizePolicy)
- self.SongWidget.setObjectName('SongWidget')
+ self.SongWidget.setObjectName(u'SongWidget')
self.SearchLayout = QtGui.QGridLayout(self.SongWidget)
- self.SearchLayout.setObjectName('SearchLayout')
+ self.SearchLayout.setObjectName(u'SearchLayout')
self.SearchTypeComboBox = QtGui.QComboBox(self.SongWidget)
- self.SearchTypeComboBox.setObjectName('SearchTypeComboBox')
+ self.SearchTypeComboBox.setObjectName(u'SearchTypeComboBox')
self.SearchLayout.addWidget(self.SearchTypeComboBox, 0, 1, 1, 2)
self.SearchTypeLabel = QtGui.QLabel(self.SongWidget)
- self.SearchTypeLabel.setObjectName('SearchTypeLabel')
+ self.SearchTypeLabel.setObjectName(u'SearchTypeLabel')
self.SearchLayout.addWidget(self.SearchTypeLabel, 0, 0, 1, 1)
self.SearchTextLabel = QtGui.QLabel(self.SongWidget)
- self.SearchTextLabel.setObjectName('SearchTextLabel')
+ self.SearchTextLabel.setObjectName(u'SearchTextLabel')
self.SearchLayout.addWidget(self.SearchTextLabel, 2, 0, 1, 1)
self.SearchTextEdit = QtGui.QLineEdit(self.SongWidget)
- self.SearchTextEdit.setObjectName('SearchTextEdit')
+ self.SearchTextEdit.setObjectName(u'SearchTextEdit')
self.SearchLayout.addWidget(self.SearchTextEdit, 2, 1, 1, 2)
self.ClearTextButton = QtGui.QPushButton(self.SongWidget)
- self.ClearTextButton.setObjectName('ClearTextButton')
+ self.ClearTextButton.setObjectName(u'ClearTextButton')
self.SearchLayout.addWidget(self.ClearTextButton, 3, 1, 1, 1)
self.SearchTextButton = QtGui.QPushButton(self.SongWidget)
- self.SearchTextButton.setObjectName('SearchTextButton')
+ self.SearchTextButton.setObjectName(u'SearchTextButton')
self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1)
# Add the song widget to the page layout
self.PageLayout.addWidget(self.SongWidget)
-
self.SongListView = SongList()
self.SongListView.setAlternatingRowColors(True)
self.SongListData = TextListData()
self.SongListView.setModel(self.SongListData)
self.SongListView.setDragEnabled(True)
-
-# self.SongListView = QtGui.QTableWidget()
-# self.SongListView.setColumnCount(2)
-# self.SongListView.setColumnHidden(0, True)
-# self.SongListView.setColumnWidth(1, 240)
-# self.SongListView.setShowGrid(False)
-# self.SongListView.setSortingEnabled(False)
-# self.SongListView.setAlternatingRowColors(True)
-# self.SongListView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
-# self.SongListView.horizontalHeader().setVisible(False)
-# self.SongListView.verticalHeader().setVisible(False)
-# self.SongListView.setGeometry(QtCore.QRect(10, 100, 256, 591))
- self.SongListView.setObjectName('SongListView')
-
+ self.SongListView.setObjectName(u'SongListView')
self.PageLayout.addWidget(self.SongListView)
self.SongListView.setDragEnabled(True)
-
# Signals and slots
QtCore.QObject.connect(self.SearchTextButton,
- QtCore.SIGNAL('pressed()'), self.onSearchTextButtonClick)
+ QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick)
QtCore.QObject.connect(self.ClearTextButton,
- QtCore.SIGNAL('pressed()'), self.onClearTextButtonClick)
+ QtCore.SIGNAL(u'pressed()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit,
- QtCore.SIGNAL('textChanged(const QString&)'), self.onSearchTextEditChanged)
-# QtCore.QObject.connect(self.SongListView,
-# QtCore.SIGNAL('itemPressed(QTableWidgetItem * item)'), self.onSongSelected)
+ QtCore.SIGNAL(u'textChanged(const QString&)'), self.onSearchTextEditChanged)
+ QtCore.QObject.connect(self.SongListView,
+ QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onSongPreviewClick)
#define and add the context menu
self.SongListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.SongListView.addAction(self.contextMenuAction(self.SongListView,
- ':/songs/song_new.png', translate('SongMediaItem', u'&Edit Song'),
+ ':/songs/song_new.png', translate(u'SongMediaItem', u'&Edit Song'),
self.onSongEditClick))
self.SongListView.addAction(self.contextMenuSeparator(self.SongListView))
self.SongListView.addAction(self.contextMenuAction(self.SongListView,
- ':/system/system_preview.png', translate('SongMediaItem', u'&Preview Song'),
+ ':/system/system_preview.png', translate(u'SongMediaItem', u'&Preview Song'),
self.onSongPreviewClick))
self.SongListView.addAction(self.contextMenuAction(self.SongListView,
- ':/system/system_live.png', translate('SongMediaItem', u'&Show Live'),
+ ':/system/system_live.png', translate(u'SongMediaItem', u'&Show Live'),
self.onSongLiveClick))
self.SongListView.addAction(self.contextMenuAction(self.SongListView,
- ':/system/system_add.png', translate('SongMediaItem', u'&Add to Service'),
+ ':/system/system_add.png', translate(u'SongMediaItem', u'&Add to Service'),
self.onSongAddClick))
def retranslateUi(self):
- self.SearchTypeLabel.setText(translate('SongMediaItem', u'Search Type:'))
- self.SearchTextLabel.setText(translate('SongMediaItem', u'Search Text:'))
- self.ClearTextButton.setText(translate('SongMediaItem', u'Clear'))
- self.SearchTextButton.setText(translate('SongMediaItem', u'Search'))
+ self.SearchTypeLabel.setText(translate(u'SongMediaItem', u'Search Type:'))
+ self.SearchTextLabel.setText(translate(u'SongMediaItem', u'Search Text:'))
+ self.ClearTextButton.setText(translate(u'SongMediaItem', u'Clear'))
+ self.SearchTextButton.setText(translate(u'SongMediaItem', u'Search'))
def initialise(self):
- self.SearchTypeComboBox.addItem(translate('SongMediaItem', u'Titles'))
- self.SearchTypeComboBox.addItem(translate('SongMediaItem', u'Lyrics'))
- self.SearchTypeComboBox.addItem(translate('SongMediaItem', u'Authors'))
+ self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Titles'))
+ self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Lyrics'))
+ self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Authors'))
def displayResults(self, searchresults):
- log.debug("display results")
+ log.debug(u'display results')
self.SongListData.resetStore()
- #log.debug("Records returned from search %s", len(searchresults))
+ #log.debug(u'Records returned from search %s", len(searchresults))
for song in searchresults:
author_list = u''
for author in song.authors:
@@ -192,7 +175,6 @@
author_list = author_list + u', '
author_list = author_list + author.display_name
song_detail = str(u'%s (%s)' % (str(song.title), str(author_list)))
-
self.SongListData.addRow(song.id,song_detail)
def onClearTextButtonClick(self):
@@ -205,7 +187,7 @@
search_length = 3
if self.SearchTypeComboBox.currentIndex() == 1:
search_length = 7
- if len(text) > search_length: # only search if > 3 characters
+ if len(text) > search_length:
self.onSearchTextButtonClick()
def onSearchTextButtonClick(self):
@@ -213,13 +195,13 @@
search_results = []
search_type = self.SearchTypeComboBox.currentIndex()
if search_type == 0:
- log.debug("Titles Search")
+ log.debug(u'Titles Search')
search_results = self.parent.songmanager.search_song_title(search_keywords)
elif search_type == 1:
- log.debug("Lyrics Search")
+ log.debug(u'Lyrics Search')
search_results = self.parent.songmanager.search_song_lyrics(search_keywords)
elif search_type == 2:
- log.debug("Authors Search")
+ log.debug(u'Authors Search')
#searchresults = self.songmanager.get_song_from_author(searchtext)
self.displayResults(search_results)
@@ -242,7 +224,7 @@
def onSongPreviewClick(self):
service_item = ServiceItem(self.parent)
- service_item.addIcon( ":/media/media_song.png")
+ service_item.addIcon(u':/media/media_song.png')
self.generateSlideData(service_item)
self.parent.preview_controller.addServiceItem(service_item)
@@ -267,12 +249,12 @@
def onSongLiveClick(self):
service_item = ServiceItem(self.parent)
- service_item.addIcon( ":/media/media_song.png")
+ service_item.addIcon(u':/media/media_song.png')
self.generateSlideData(service_item)
self.parent.live_controller.addServiceItem(service_item)
def onSongAddClick(self):
service_item = ServiceItem(self.parent)
- service_item.addIcon( ":/media/media_song.png")
+ service_item.addIcon( u':/media/media_song.png')
self.generateSlideData(service_item)
self.parent.service_manager.addServiceItem(service_item)
Follow ups