openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00113
[Merge] lp:~trb143/openlp/servicing2 into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/servicing2 into lp:openlp.
Requested reviews:
openlp.org Core (openlp-core)
Correct oos to become a zip file
bug fixes and code corrections
--
https://code.launchpad.net/~trb143/openlp/servicing2/+merge/7691
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2009-06-16 18:21:24 +0000
+++ openlp/core/lib/renderer.py 2009-06-19 18:41:38 +0000
@@ -20,9 +20,8 @@
import logging
import os, os.path
import sys
-#from copy import copy
-from PyQt4 import QtGui, QtCore, Qt
+from PyQt4 import QtGui, QtCore
class Renderer:
"""
@@ -36,7 +35,6 @@
def __init__(self):
self._rect = None
self._debug = 0
- #self.words = None
self._right_margin = 64 # the amount of right indent
self._shadow_offset = 5
self._outline_offset = 2
@@ -140,7 +138,7 @@
# reset the frame. first time do not worry about what you paint on.
#self._frame = QtGui.QPixmap(self._frame.width(), self._frame.height()) #(self._bg_frame)
#self._frame.fill(QtCore.Qt.transparent)
- # reset the frame. first time do not worrk about what you paint on.
+ # reset the frame. first time do not worry about what you paint on.
self._frame = QtGui.QImage(self._bg_frame)
x, y = self._correctAlignment(self._rect, bbox)
bbox = self._render_lines_unaligned(lines, False, (x, y), True)
=== modified file 'openlp/core/lib/rendermanager.py'
--- openlp/core/lib/rendermanager.py 2009-06-17 05:11:16 +0000
+++ openlp/core/lib/rendermanager.py 2009-06-19 18:41:38 +0000
@@ -21,9 +21,8 @@
import os, os.path
import sys
-from datetime import *
-from PyQt4 import QtGui, QtCore, Qt
-from renderer import Renderer
+from PyQt4 import QtGui, QtCore
+from renderer import Renderer
import sys
import linecache
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2009-06-16 18:21:24 +0000
+++ openlp/core/ui/servicemanager.py 2009-06-19 18:41:38 +0000
@@ -113,25 +113,47 @@
"""
Move the current ServiceItem to the top of the list
"""
- pass
+ item, count = self.findServiceItem()
+ if item < len(self.serviceItems) and item is not -1:
+ temp = self.serviceItems[item]
+ self.serviceItems.remove(self.serviceItems[item])
+ self.serviceItems.insert(0, temp)
+ self.repaintServiceList()
def onServiceUp(self):
"""
Move the current ServiceItem up in the list
+ Note move up means move to top of area ie 0.
"""
- pass
+ item, count = self.findServiceItem()
+ if item > 0:
+ temp = self.serviceItems[item]
+ self.serviceItems.remove(self.serviceItems[item])
+ self.serviceItems.insert(item - 1, temp)
+ self.repaintServiceList()
def onServiceDown(self):
"""
Move the current ServiceItem down in the list
+ Note move down means move to bottom of area i.e len().
"""
- pass
+ item, count = self.findServiceItem()
+ if item < len(self.serviceItems) and item is not -1:
+ temp = self.serviceItems[item]
+ self.serviceItems.remove(self.serviceItems[item])
+ self.serviceItems.insert(item + 1, temp)
+ self.repaintServiceList()
def onServiceEnd(self):
"""
Move the current ServiceItem to the bottom of the list
"""
- pass
+ item, count = self.findServiceItem()
+ if item < len(self.serviceItems) and item is not -1:
+ temp = self.serviceItems[item]
+ self.serviceItems.remove(self.serviceItems[item])
+ self.serviceItems.insert(len(self.serviceItems), temp)
+ self.repaintServiceList()
def onNewService(self):
"""
@@ -144,7 +166,32 @@
"""
Remove the current ServiceItem from the list
"""
- pass
+ item, count = self.findServiceItem()
+ if item is not -1:
+ self.serviceItems.remove(self.serviceItems[item])
+ self.repaintServiceList()
+
+ def repaintServiceList(self):
+ #Correct order of idems in array
+ count = 1
+ for item in self.serviceItems:
+ item[u'order'] = count
+ count += 1
+ #Repaint the screen
+ self.ServiceManagerList.clear()
+ for item in self.serviceItems:
+ serviceitem = item[u'data']
+ treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
+ treewidgetitem.setText(0,serviceitem.title)
+ treewidgetitem.setIcon(0,serviceitem.iconic_representation)
+ treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(item[u'order']))
+ count = 0
+ for frame in serviceitem.frames:
+ treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem)
+ text = frame[u'title']
+ treewidgetitem1.setText(0,text[:40])
+ treewidgetitem1.setData(0, QtCore.Qt.UserRole,QtCore.QVariant(count))
+ count = count + 1
def onSaveService(self):
"""
@@ -233,11 +280,10 @@
pos = 0
count = 0
for item in items:
- childCount = item.childCount()
- if childCount >= 1:
+ parentitem = item.parent()
+ if parentitem is None:
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]
#adjuest for zero based arrays
@@ -274,4 +320,4 @@
id = 0
self.service_theme = u''
self.ThemeComboBox.setCurrentIndex(id)
- self.parent.RenderManager.set_service_theme(self.service_theme)
\ No newline at end of file
+ self.parent.RenderManager.set_service_theme(self.service_theme)
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2009-06-17 05:11:16 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2009-06-19 18:41:38 +0000
@@ -142,17 +142,20 @@
def onCustomEditClick(self):
item = self.CustomListWidget.currentItem()
- item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
- self.parent.edit_custom_form.loadCustom(item_id)
- self.parent.edit_custom_form.exec_()
- self.initialise()
+ item = self.CustomListWidget.currentItem()
+ if item is not None:
+ item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ self.parent.edit_custom_form.loadCustom(item_id)
+ self.parent.edit_custom_form.exec_()
+ self.initialise()
def onCustomDeleteClick(self):
item = self.CustomListWidget.currentItem()
- item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
- self.parent.custommanager.delete_custom(item_id)
- row = self.CustomListWidget.row(item)
- self.CustomListWidget.takeItem(row)
+ if item is not None:
+ item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ self.parent.custommanager.delete_custom(item_id)
+ row = self.CustomListWidget.row(item)
+ self.CustomListWidget.takeItem(row)
def onCustomPreviewClick(self):
log.debug(u'Custom Preview Requested')
=== removed file 'openlp/plugins/images/lib/imageserviceitem.py'
--- openlp/plugins/images/lib/imageserviceitem.py 2009-06-16 18:21:24 +0000
+++ openlp/plugins/images/lib/imageserviceitem.py 1970-01-01 00:00:00 +0000
@@ -1,113 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-"""
-OpenLP - Open Source Lyrics Projection
-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
-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
-from PyQt4 import QtCore, QtGui
-from openlp.core.lib import ServiceItem
-from listwithpreviews import ListWithPreviews
-
-class ImageServiceItem(ServiceItem):
- """
- The service item is a base class for the plugins to use to interact with
- * the service manager (and hence the OOS disk files),
- * the slide controller(s - both preview and live)
- * and the renderer - which produces the
- main screen
- the preview preview and
- the live preview
-
- The image plugin passes one of these to the preview/live when requested
- The preview/live controllers keep hold of it
- The service manager has one in its service structure for each Image item in the OOS
- When something goes live/previews -
- it simply tells the slide controller to use it???
-
- It contains 1 or more images
-
- """
- global log
- log=logging.getLogger(u'ImageServiceItem')
- log.info(u'ImageServiceItem loaded')
- def __init__(self, controller):
- """
- Init Method
- """
- log.info(u'init')
- self.imgs=ListWithPreviews()
-# self.slide_controller=controller
-# self.slide_controller.ControllerContents=QtGui.QListView()
-# c=self.slide_controller.ControllerContents
-# c.uniformItemSizes=True
-# c.setModel(self.imgs)
-# c.setGeometry(0,0,200,200)
-
- def render(self):
- """
- The render method is what the plugin uses to render its meda to the
- screen.
- """
- # render the "image chooser first"
-# for f in self.imgs:
-# fl , nm = os.path.split(unicode(f))
-# c = self.slide_controller.rowCount()
-# self.slide_controller.setRowCount(c+1)
-# twi = QtGui.QTableWidgetItem(unicode(f))
-# self.slide_controller.setItem(c , 0, twi)
-# twi = QtGui.QTableWidgetItem(unicode(nm))
-# self.slide_controller.setItem(c , 1, twi)
-# self.slide_controller.setRowHeight(c, 80)
-
- # render the preview screen here
-
- def get_parent_node(self):
- """
- This method returns a parent node to be inserted into the Service
- Manager.
- """
- pass
- def add(self, data):
- """
- append an image to the list
- """
- if type(data)==type(u'string'):
- log.info(u'add filename:'+data)
- self.imgs.addRow(data)
- else: # it's another service item to be merged in
- log.info(u'add Item...'+unicode(data))
- for filename in data.get_file_list():
- self.add(filename)
-
-
- def get_oos_text(self):
- """
- Turn the image list into a set of filenames for storage in the oos file
- """
- log.info(u'Get oos text')
- log.info(unicode(self.imgs))
-# log.info(unicode(self.imgs.get_file_list()))
- return '\n'.join(self.imgs.get_file_list())
-
- def set_from_oos(self, text):
- """
- get text from the OOS file and setup the internal structure
- """
- log.info(u'Set from OOS:'+text)
- files=text.split(u'\n')
- for f in files:
- self.imgs.addRow(f)
=== modified file 'openlp/plugins/images/lib/listwithpreviews.py'
--- openlp/plugins/images/lib/listwithpreviews.py 2009-06-16 18:21:24 +0000
+++ openlp/plugins/images/lib/listwithpreviews.py 2009-06-19 18:41:38 +0000
@@ -5,11 +5,11 @@
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
-This program is free software; you can redistribute it and/or modify it under
+This program is free software; you can rediunicodeibute 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
+This program is diunicodeibuted 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.
@@ -21,10 +21,9 @@
import logging
from PyQt4 import QtCore, QtGui
-
class ListWithPreviews(QtCore.QAbstractListModel):
"""
- An abstract list of strings and the preview icon to go with them
+ An abstract list of unicodeings and the preview icon to go with them
"""
global log
log = logging.getLogger(u'ListWithPreviews')
@@ -32,7 +31,8 @@
def __init__(self):
QtCore.QAbstractListModel.__init__(self)
- self.items = [] # will be a list of (full filename, QPixmap, shortname) tuples
+ # will be a list of (full filename, QPixmap, shortname) tuples
+ self.items = []
self.rowheight = 50
self.maximagewidth = self.rowheight*16/9.0;
@@ -41,10 +41,10 @@
def insertRow(self, row, filename):
self.beginInsertRows(QtCore.QModelIndex(),row,row)
- log.info(u'insert row %d:%s'% (row,filename))
+ #log.info(u'insert row %d:%s' % (row,filename))
# get short filename to display next to image
(prefix, shortfilename) = os.path.split(unicode(filename))
- log.info(u'shortfilename=%s'% (shortfilename))
+ #log.info(u'shortfilename=%s' % (shortfilename))
# create a preview image
if os.path.exists(filename):
preview = QtGui.QPixmap(unicode(filename))
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2009-06-16 18:21:24 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2009-06-19 18:41:38 +0000
@@ -122,7 +122,7 @@
files = QtGui.QFileDialog.getOpenFileNames(None,
translate(u'ImageMediaItem', u'Select Image(s)'),
self.parent.config.get_last_dir(),
- u'Images (*.jpg *.gif *.png *.bmp)')
+ u'Images (*.jpg *jpeg *.gif *.png *.bmp)')
log.info(u'New image(s)', unicode(files))
if len(files) > 0:
self.loadImageList(files)
@@ -169,4 +169,4 @@
service_item = ServiceItem(self.parent)
service_item.addIcon(u':/media/media_image.png')
self.generateSlideData(service_item)
- self.parent.service_manager.addServiceItem(service_item)
\ No newline at end of file
+ self.parent.service_manager.addServiceItem(service_item)
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2009-06-16 18:21:24 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2009-06-19 18:41:38 +0000
@@ -209,16 +209,18 @@
def onSongEditClick(self):
item = self.SongListWidget.currentItem()
- item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
- self.edit_song_form.loadSong(item_id)
- self.edit_song_form.exec_()
+ if item is not None:
+ item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ self.edit_song_form.loadSong(item_id)
+ self.edit_song_form.exec_()
def onSongDeleteClick(self):
item = self.SongListWidget.currentItem()
- item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
- self.parent.songmanager.delete_song(item_id)
- row = self.SongListWidget.row(item)
- self.SongListWidget.takeItem(row)
+ if item is not None:
+ item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ self.parent.songmanager.delete_song(item_id)
+ row = self.SongListWidget.row(item)
+ self.SongListWidget.takeItem(row)
def onSongPreviewClick(self):
service_item = ServiceItem(self.parent)
Follow ups