Fix up maintenance dialog

This commit is contained in:
Tim Bentley 2010-03-18 21:50:20 +00:00
parent ff8145cef1
commit 44224b0c73
5 changed files with 116 additions and 17 deletions

View File

@ -66,7 +66,6 @@ class ServiceItem(object):
self.iconic_representation = None
self.raw_footer = None
self.theme = None
self.service_item_path = None
self.service_item_type = None
self.edit_enabled = False
self.maintain_allowed = False
@ -157,9 +156,8 @@ class ServiceItem(object):
The actual image file name.
"""
self.service_item_type = ServiceItemType.Image
self.service_item_path = path
self._raw_frames.append(
{u'title': title, u'image': image})
{u'title': title, u'image': image, u'path': path})
def add_from_text(self, title, raw_slide, verseTag=None):
"""
@ -190,9 +188,8 @@ class ServiceItem(object):
The command of/for the slide.
"""
self.service_item_type = ServiceItemType.Command
self.service_item_path = path
self._raw_frames.append(
{u'title': file_name, u'image': image})
{u'title': file_name, u'image': image, u'path': path})
def get_service_repr(self):
"""
@ -209,7 +206,9 @@ class ServiceItem(object):
u'type':self.service_item_type,
u'audit':self.audit,
u'notes':self.notes,
u'preview':self.autoPreviewAllowed
u'preview':self.autoPreviewAllowed,
u'edit':self.edit_enabled,
u'maintain':self.maintain_allowed
}
service_data = []
if self.service_item_type == ServiceItemType.Text:
@ -245,6 +244,8 @@ class ServiceItem(object):
self.audit = header[u'audit']
self.autoPreviewAllowed = header[u'preview']
self.notes = header[u'notes']
self.edit_enabled = header[u'edit']
self.maintain_allowed = header[u'maintain']
if self.service_item_type == ServiceItemType.Text:
for slide in serviceitem[u'serviceitem'][u'data']:
self._raw_frames.append(slide)

View File

@ -1,11 +1,27 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
# Form implementation generated from reading ui file 'serviceitemeditdialog.ui'
#
# Created: Wed Mar 17 20:55:46 2010
# by: PyQt4 UI code generator 4.7
#
# WARNING! All changes made in this file will be lost!
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, 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

View File

@ -36,9 +36,85 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.itemList = []
# enable drop
QtCore.QObject.connect(self.upButton,
QtCore.SIGNAL(u'clicked()'),
self.onItemUp)
QtCore.QObject.connect(self.downButton,
QtCore.SIGNAL(u'clicked()'),
self.onItemDown)
QtCore.QObject.connect(self.deleteButton,
QtCore.SIGNAL(u'clicked()'),
self.onItemDelete)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'),
self.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'),
self.reject)
def setServiceItem(self, item):
self.item = item
self.itemList = []
if self.item.is_image():
self.data = True
for frame in self.item._raw_frames:
self.itemList.append(frame)
self.loadData()
def getServiceItem(self):
if self.data:
self.item._raw_frames = []
if self.item.is_image():
for item in self.itemList:
self.item.add_from_image(item[u'path'],
item[u'title'], item[u'image'])
self.item.render()
return self.item
def loadData(self):
self.listWidget.clear()
for frame in self.itemList:
item_name = QtGui.QListWidgetItem(frame[u'title'])
self.listWidget.addItem(item_name)
def onItemDelete(self):
"""
Move the current ServiceItem up in the list
Note move up means move to top of area ie 0.
"""
items = self.listWidget.selectedItems()
for item in items:
row = self.listWidget.row(item)
if row > 0:
self.itemList.remove(self.itemList[row])
self.loadData()
def onItemUp(self):
"""
Move the current ServiceItem up in the list
Note move up means move to top of area ie 0.
"""
items = self.listWidget.selectedItems()
for item in items:
row = self.listWidget.row(item)
if row > 0:
temp = self.itemList[row]
self.itemList.remove(self.itemList[row])
self.itemList.insert(row - 1, temp)
self.loadData()
def onItemDown(self):
"""
Move the current ServiceItem down in the list
Note move down means move to bottom of area i.e len().
"""
items = self.listWidget.selectedItems()
for item in items:
row = self.listWidget.row(item)
if row < len(self.itemList) and row is not -1:
temp = self.itemList[row]
self.itemList.remove(self.itemList[row])
self.itemList.insert(row + 1, temp)
self.loadData()

View File

@ -269,9 +269,12 @@ class ServiceManager(QtGui.QWidget):
def onServiceItemEditForm(self):
item, count = self.findServiceItem()
self.serviceItemEditForm.setServiceItem(
self.serviceItems[item][u'service_item'])
if self.serviceItemEditForm.exec_():
pass
self.serviceItems[item][u'service_item'] = \
self.serviceItemEditForm.getServiceItem()
self.repaintServiceList(item, 0)
def nextItem(self):
"""
@ -513,7 +516,7 @@ class ServiceManager(QtGui.QWidget):
if item[u'service_item'].uses_file():
for frame in item[u'service_item'].get_frames():
path_from = unicode(os.path.join(
item[u'service_item'].service_item_path,
frame[u'path'],
frame[u'title']))
zip.write(path_from)
file = open(servicefile, u'wb')

View File

@ -492,7 +492,10 @@ class BibleMediaItem(MediaManagerItem):
if self.parent.settings_tab.layout_style == 0:
raw_slides.append(bible_text)
bible_text = u''
if not service_item.title:
service_item.title = u'%s %s' % (book, verse_text)
elif service_item.title.find(self.trUtf8(u'etc')) == -1:
service_item.title = u'%s, %s' % (service_item.title, self.trUtf8(u'etc'))
if len(self.parent.settings_tab.bible_theme) == 0:
service_item.theme = None
else: