forked from openlp/openlp
r1258
This commit is contained in:
commit
4f3e71e268
@ -319,6 +319,20 @@ def check_directory_exists(dir):
|
||||
if not os.path.exists(dir):
|
||||
os.makedirs(dir)
|
||||
|
||||
def save_cancel_button_box(parent):
|
||||
"""
|
||||
Return a standard dialog button box with save and cancel buttons.
|
||||
"""
|
||||
button_box = QtGui.QDialogButtonBox(parent)
|
||||
button_box.setStandardButtons(QtGui.QDialogButtonBox.Save |
|
||||
QtGui.QDialogButtonBox.Cancel)
|
||||
button_box.setObjectName(u'%sButtonBox' % parent)
|
||||
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'),
|
||||
parent.accept)
|
||||
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'),
|
||||
parent.reject)
|
||||
return button_box
|
||||
|
||||
from theme import ThemeLevel, ThemeXML, BackgroundGradientType, \
|
||||
BackgroundType, HorizontalType, VerticalType
|
||||
from displaytags import DisplayTags
|
||||
|
@ -103,7 +103,6 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.icon = build_icon(icon)
|
||||
self.toolbar = None
|
||||
self.remoteTriggered = None
|
||||
self.serviceItemIconName = None
|
||||
self.singleServiceItem = True
|
||||
self.pageLayout = QtGui.QVBoxLayout(self)
|
||||
self.pageLayout.setSpacing(0)
|
||||
@ -525,10 +524,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
Common method for generating a service item
|
||||
"""
|
||||
serviceItem = ServiceItem(self.parent)
|
||||
if self.serviceItemIconName:
|
||||
serviceItem.add_icon(self.serviceItemIconName)
|
||||
else:
|
||||
serviceItem.add_icon(self.parent.icon_path)
|
||||
serviceItem.add_icon(self.parent.icon_path)
|
||||
if self.generateSlideData(serviceItem, item, xmlVersion):
|
||||
return serviceItem
|
||||
else:
|
||||
@ -540,3 +536,25 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
individual service items need to be processed by the plugins
|
||||
"""
|
||||
pass
|
||||
|
||||
def _getIdOfItemToGenerate(self, item, remoteItem):
|
||||
"""
|
||||
Utility method to check items being submitted for slide generation.
|
||||
|
||||
``item``
|
||||
The item to check.
|
||||
|
||||
``remoteItem``
|
||||
The id to assign if the slide generation was remotely triggered.
|
||||
"""
|
||||
if item is None:
|
||||
if self.remoteTriggered is None:
|
||||
item = self.listView.currentItem()
|
||||
if item is None:
|
||||
return False
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
else:
|
||||
item_id = remoteItem
|
||||
else:
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
return item_id
|
||||
|
@ -73,13 +73,13 @@ class OpenLPToolbar(QtGui.QToolBar):
|
||||
``checkable``
|
||||
If *True* the button has two, *off* and *on*, states. Default is
|
||||
*False*, which means the buttons has only one state.
|
||||
|
||||
|
||||
``shortcut``
|
||||
The primary shortcut for this action
|
||||
|
||||
|
||||
``alternate``
|
||||
The alternate shortcut for this action
|
||||
|
||||
|
||||
``context``
|
||||
Specify the context in which this shortcut is valid
|
||||
"""
|
||||
|
@ -80,6 +80,16 @@ class AdvancedTab(SettingsTab):
|
||||
self.hideMouseCheckBox.setObjectName(u'hideMouseCheckBox')
|
||||
self.hideMouseLayout.addWidget(self.hideMouseCheckBox)
|
||||
self.leftLayout.addWidget(self.hideMouseGroupBox)
|
||||
self.serviceOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||
self.serviceOrderGroupBox.setObjectName(u'serviceOrderGroupBox')
|
||||
self.serviceOrderLayout = QtGui.QVBoxLayout(self.serviceOrderGroupBox)
|
||||
self.serviceOrderLayout.setObjectName(u'serviceOrderLayout')
|
||||
self.detailedServicePrintCheckBox = QtGui.QCheckBox(
|
||||
self.serviceOrderGroupBox)
|
||||
self.detailedServicePrintCheckBox.setObjectName(
|
||||
u'detailedServicePrintCheckBox')
|
||||
self.serviceOrderLayout.addWidget(self.detailedServicePrintCheckBox)
|
||||
self.leftLayout.addWidget(self.serviceOrderGroupBox)
|
||||
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||
# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
|
||||
# self.sharedDirLayout = QtGui.QFormLayout(self.sharedDirGroupBox)
|
||||
@ -129,6 +139,10 @@ class AdvancedTab(SettingsTab):
|
||||
'Mouse Cursor'))
|
||||
self.hideMouseCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
'Hide the mouse cursor when moved over the display window'))
|
||||
self.serviceOrderGroupBox.setTitle(translate('OpenLP.AdvancedTab',
|
||||
'Service Order Print'))
|
||||
self.detailedServicePrintCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
'Print slide texts and service item notes as well'))
|
||||
# self.sharedDirGroupBox.setTitle(
|
||||
# translate('AdvancedTab', 'Central Data Store'))
|
||||
# self.sharedCheckBox.setText(
|
||||
@ -164,6 +178,8 @@ class AdvancedTab(SettingsTab):
|
||||
QtCore.QVariant(True)).toBool())
|
||||
self.hideMouseCheckBox.setChecked(
|
||||
settings.value(u'hide mouse', QtCore.QVariant(False)).toBool())
|
||||
self.detailedServicePrintCheckBox.setChecked(settings.value(
|
||||
u'detailed service print', QtCore.QVariant(False)).toBool())
|
||||
settings.endGroup()
|
||||
|
||||
def save(self):
|
||||
@ -184,6 +200,8 @@ class AdvancedTab(SettingsTab):
|
||||
QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked()))
|
||||
settings.setValue(u'hide mouse',
|
||||
QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
|
||||
settings.setValue(u'detailed service print',
|
||||
QtCore.QVariant(self.detailedServicePrintCheckBox.isChecked()))
|
||||
settings.endGroup()
|
||||
|
||||
# def onSharedCheckBoxChanged(self, checked):
|
||||
|
@ -51,6 +51,7 @@ class ValidEdit(QtGui.QLineEdit):
|
||||
else:
|
||||
return self.text()
|
||||
|
||||
|
||||
class GeneralTab(SettingsTab):
|
||||
"""
|
||||
GeneralTab is the general settings tab in the settings dialog.
|
||||
|
@ -175,6 +175,10 @@ class Ui_MainWindow(object):
|
||||
self.FileSaveAsItem = QtGui.QAction(mainWindow)
|
||||
self.FileSaveAsItem.setObjectName(u'FileSaveAsItem')
|
||||
mainWindow.actionList.add_action(self.FileSaveAsItem, u'File')
|
||||
self.printServiceOrderItem = QtGui.QAction(mainWindow)
|
||||
self.printServiceOrderItem.setObjectName(u'printServiceItem')
|
||||
mainWindow.actionList.add_action(
|
||||
self.printServiceOrderItem, u'Print Service Order')
|
||||
self.FileExitItem = QtGui.QAction(mainWindow)
|
||||
self.FileExitItem.setIcon(build_icon(u':/system/system_exit.png'))
|
||||
self.FileExitItem.setObjectName(u'FileExitItem')
|
||||
@ -302,8 +306,8 @@ class Ui_MainWindow(object):
|
||||
(self.ExportThemeItem, self.ExportLanguageItem))
|
||||
self.FileMenuActions = (self.FileNewItem, self.FileOpenItem,
|
||||
self.FileSaveItem, self.FileSaveAsItem, None,
|
||||
self.FileImportMenu.menuAction(), self.FileExportMenu.menuAction(),
|
||||
self.FileExitItem)
|
||||
self.printServiceOrderItem, None, self.FileImportMenu.menuAction(),
|
||||
self.FileExportMenu.menuAction(), self.FileExitItem)
|
||||
add_actions(self.ViewModeMenu, (self.ModeDefaultItem,
|
||||
self.ModeSetupItem, self.ModeLiveItem))
|
||||
add_actions(self.ViewMenu, (self.ViewModeMenu.menuAction(),
|
||||
@ -381,6 +385,12 @@ class Ui_MainWindow(object):
|
||||
'Save the current service under a new name.'))
|
||||
self.FileSaveAsItem.setShortcut(
|
||||
translate('OpenLP.MainWindow', 'Ctrl+Shift+S'))
|
||||
self.printServiceOrderItem.setText(
|
||||
translate('OpenLP.MainWindow', 'Print Service Order'))
|
||||
self.printServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow',
|
||||
'Print the current Service Order.'))
|
||||
self.printServiceOrderItem.setShortcut(
|
||||
translate('OpenLP.MainWindow', 'Ctrl+P'))
|
||||
self.FileExitItem.setText(
|
||||
translate('OpenLP.MainWindow', 'E&xit'))
|
||||
self.FileExitItem.setStatusTip(
|
||||
@ -567,6 +577,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
QtCore.QObject.connect(self.FileSaveAsItem,
|
||||
QtCore.SIGNAL(u'triggered()'),
|
||||
self.ServiceManagerContents.saveFileAs)
|
||||
QtCore.QObject.connect(self.printServiceOrderItem,
|
||||
QtCore.SIGNAL(u'triggered()'),
|
||||
self.ServiceManagerContents.printServiceOrder)
|
||||
# i18n set signals for languages
|
||||
QtCore.QObject.connect(self.AutoLanguageItem,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, build_icon
|
||||
from openlp.core.lib import translate, build_icon, save_cancel_button_box
|
||||
|
||||
class Ui_ServiceItemEditDialog(object):
|
||||
def setupUi(self, serviceItemEditDialog):
|
||||
@ -52,12 +52,8 @@ class Ui_ServiceItemEditDialog(object):
|
||||
self.downButton.setObjectName(u'downButton')
|
||||
self.buttonLayout.addWidget(self.downButton)
|
||||
self.dialogLayout.addLayout(self.buttonLayout, 0, 1)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(serviceItemEditDialog)
|
||||
self.buttonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
|
||||
|
||||
self.dialogLayout.addWidget(
|
||||
save_cancel_button_box(serviceItemEditDialog), 1, 0, 1, 2)
|
||||
self.retranslateUi(serviceItemEditDialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog)
|
||||
|
||||
|
@ -46,10 +46,6 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
|
||||
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)
|
||||
QtCore.QObject.connect(self.listWidget,
|
||||
QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged)
|
||||
|
||||
@ -100,27 +96,30 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
|
||||
"""
|
||||
Move the current row up in the list.
|
||||
"""
|
||||
item = self.listWidget.currentItem()
|
||||
if not item:
|
||||
return
|
||||
row = self.listWidget.row(item)
|
||||
temp = self.itemList[row]
|
||||
self.itemList.remove(self.itemList[row])
|
||||
self.itemList.insert(row - 1, temp)
|
||||
self.loadData()
|
||||
self.listWidget.setCurrentRow(row - 1)
|
||||
self.__moveItem(u'up')
|
||||
|
||||
def onItemDown(self):
|
||||
"""
|
||||
Move the current row down in the list
|
||||
"""
|
||||
self.__moveItem(u'down')
|
||||
|
||||
def __moveItem(self, direction=u''):
|
||||
"""
|
||||
Move the current item.
|
||||
"""
|
||||
if not direction:
|
||||
return
|
||||
item = self.listWidget.currentItem()
|
||||
if not item:
|
||||
return
|
||||
row = self.listWidget.row(item)
|
||||
temp = self.itemList[row]
|
||||
self.itemList.remove(self.itemList[row])
|
||||
self.itemList.insert(row + 1, temp)
|
||||
if direction == u'up':
|
||||
self.itemList.insert(row - 1, temp)
|
||||
else:
|
||||
self.itemList.insert(row + 1, temp)
|
||||
self.loadData()
|
||||
self.listWidget.setCurrentRow(row + 1)
|
||||
|
||||
|
@ -856,7 +856,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
one it allows the item to be displayed.
|
||||
"""
|
||||
if serviceItem.is_command():
|
||||
type = serviceItem._raw_frames[0][u'title'].split(u'.')[1]
|
||||
type = serviceItem._raw_frames[0][u'title'].split(u'.')[-1]
|
||||
if type not in self.suffixes:
|
||||
serviceItem.is_valid = False
|
||||
|
||||
@ -1182,3 +1182,46 @@ class ServiceManager(QtGui.QWidget):
|
||||
data_item[u'selected'] = (item == curitem)
|
||||
data.append(data_item)
|
||||
Receiver.send_message(u'servicemanager_list_response', data)
|
||||
|
||||
def printServiceOrder(self):
|
||||
"""
|
||||
Print a Service Order Sheet.
|
||||
"""
|
||||
if not self.serviceItems:
|
||||
criticalErrorMessageBox(
|
||||
message=translate('OpenLP.ServiceManager',
|
||||
'There is no service item in this service.'))
|
||||
return
|
||||
printDialog = QtGui.QPrintDialog()
|
||||
if not printDialog.exec_():
|
||||
return
|
||||
text = u'<h2>%s</h2>' % translate('OpenLP.ServiceManager',
|
||||
'Service Order Sheet')
|
||||
for item in self.serviceItems:
|
||||
item = item[u'service_item']
|
||||
# add the title
|
||||
text += u'<h4><img src="%s" /> %s</h4>' % (item.icon,
|
||||
item.get_display_title())
|
||||
if not QtCore.QSettings().value(u'advanced' +
|
||||
u'/detailed service print', QtCore.QVariant(True)).toBool():
|
||||
continue
|
||||
if item.is_text():
|
||||
# Add the text of the service item.
|
||||
for slide in item.get_frames():
|
||||
text += u'<p>' + slide[u'text'] + u'</p>'
|
||||
elif item.is_image():
|
||||
# Add the image names of the service item.
|
||||
text += u'<ol>'
|
||||
for slide in range(len(item.get_frames())):
|
||||
text += u'<li><p>%s</p></li>' % item.get_frame_title(slide)
|
||||
text += u'</ol>'
|
||||
if item.foot_text:
|
||||
# add footer
|
||||
text += u'<p>%s</p>' % item.foot_text
|
||||
if item.notes:
|
||||
# add notes
|
||||
text += u'<p><b>%s</b> %s</p>' % (translate(
|
||||
'OpenLP.ServiceManager', 'Notes:'), item.notes)
|
||||
serviceDocument = QtGui.QTextDocument()
|
||||
serviceDocument.setHtml(text)
|
||||
serviceDocument.print_(printDialog.printer())
|
||||
|
@ -1,48 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import translate
|
||||
|
||||
class Ui_ServiceNoteEdit(object):
|
||||
def setupUi(self, serviceNoteEdit):
|
||||
serviceNoteEdit.setObjectName(u'serviceNoteEdit')
|
||||
self.dialogLayout = QtGui.QVBoxLayout(serviceNoteEdit)
|
||||
self.dialogLayout.setObjectName(u'verticalLayout')
|
||||
self.textEdit = QtGui.QTextEdit(serviceNoteEdit)
|
||||
self.textEdit.setObjectName(u'textEdit')
|
||||
self.dialogLayout.addWidget(self.textEdit)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(serviceNoteEdit)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
|
||||
QtGui.QDialogButtonBox.Save)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
self.retranslateUi(serviceNoteEdit)
|
||||
QtCore.QMetaObject.connectSlotsByName(serviceNoteEdit)
|
||||
|
||||
def retranslateUi(self, serviceNoteEdit):
|
||||
serviceNoteEdit.setWindowTitle(
|
||||
translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
|
@ -26,6 +26,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import save_cancel_button_box, translate
|
||||
from servicenotedialog import Ui_ServiceNoteEdit
|
||||
|
||||
class ServiceNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit):
|
||||
@ -37,8 +38,19 @@ class ServiceNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit):
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
|
||||
self.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
|
||||
self.reject)
|
||||
self.setupUi()
|
||||
self.retranslateUi()
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'serviceNoteEdit')
|
||||
self.dialogLayout = QtGui.QVBoxLayout(self)
|
||||
self.dialogLayout.setObjectName(u'verticalLayout')
|
||||
self.textEdit = QtGui.QTextEdit(self)
|
||||
self.textEdit.setObjectName(u'textEdit')
|
||||
self.dialogLayout.addWidget(self.textEdit)
|
||||
self.dialogLayout.addWidget(save_cancel_button_box(self))
|
||||
QtCore.QMetaObject.connectSlotsByName(self)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.setWindowTitle(
|
||||
translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
|
||||
|
@ -482,14 +482,7 @@ class SlideController(QtGui.QWidget):
|
||||
def onSongBarHandler(self):
|
||||
request = unicode(self.sender().text())
|
||||
slideno = self.slideList[request]
|
||||
if slideno > self.previewListWidget.rowCount():
|
||||
self.previewListWidget.selectRow(
|
||||
self.previewListWidget.rowCount() - 1)
|
||||
else:
|
||||
if slideno + 1 < self.previewListWidget.rowCount():
|
||||
self.previewListWidget.scrollToItem(
|
||||
self.previewListWidget.item(slideno + 1, 0))
|
||||
self.previewListWidget.selectRow(slideno)
|
||||
self.__updatePreviewSelection(slideno)
|
||||
self.onSlideSelected()
|
||||
|
||||
def receiveSpinDelay(self, value):
|
||||
@ -665,14 +658,7 @@ class SlideController(QtGui.QWidget):
|
||||
self.previewListWidget.resizeRowsToContents()
|
||||
self.previewListWidget.setColumnWidth(0,
|
||||
self.previewListWidget.viewport().size().width())
|
||||
if slideno > self.previewListWidget.rowCount():
|
||||
self.previewListWidget.selectRow(
|
||||
self.previewListWidget.rowCount() - 1)
|
||||
else:
|
||||
if slideno + 1 < self.previewListWidget.rowCount():
|
||||
self.previewListWidget.scrollToItem(
|
||||
self.previewListWidget.item(slideno + 1, 0))
|
||||
self.previewListWidget.selectRow(slideno)
|
||||
self.__updatePreviewSelection(slideno)
|
||||
self.enableToolBar(serviceItem)
|
||||
# Pass to display for viewing
|
||||
self.display.buildHtml(self.serviceItem)
|
||||
@ -683,6 +669,19 @@ class SlideController(QtGui.QWidget):
|
||||
Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix,
|
||||
[serviceItem])
|
||||
|
||||
def __updatePreviewSelection(self, slideno):
|
||||
"""
|
||||
Utility method to update the selected slide in the list.
|
||||
"""
|
||||
if slideno > self.previewListWidget.rowCount():
|
||||
self.previewListWidget.selectRow(
|
||||
self.previewListWidget.rowCount() - 1)
|
||||
else:
|
||||
if slideno + 1 < self.previewListWidget.rowCount():
|
||||
self.previewListWidget.scrollToItem(
|
||||
self.previewListWidget.item(slideno + 1, 0))
|
||||
self.previewListWidget.selectRow(slideno)
|
||||
|
||||
def onTextRequest(self):
|
||||
"""
|
||||
Return the text for the current item in controller
|
||||
|
@ -165,13 +165,7 @@ class ThemesTab(SettingsTab):
|
||||
self.global_theme = unicode(self.DefaultComboBox.currentText())
|
||||
self.parent.renderManager.set_global_theme(
|
||||
self.global_theme, self.theme_level)
|
||||
image = self.parent.ThemeManagerContents.getPreviewImage(
|
||||
self.global_theme)
|
||||
preview = QtGui.QPixmap(unicode(image))
|
||||
if not preview.isNull():
|
||||
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
|
||||
QtCore.Qt.SmoothTransformation)
|
||||
self.DefaultListView.setPixmap(preview)
|
||||
self.__previewGlobalTheme()
|
||||
|
||||
def updateThemeList(self, theme_list):
|
||||
"""
|
||||
@ -198,10 +192,16 @@ class ThemesTab(SettingsTab):
|
||||
self.parent.renderManager.set_global_theme(
|
||||
self.global_theme, self.theme_level)
|
||||
if self.global_theme is not u'':
|
||||
image = self.parent.ThemeManagerContents.getPreviewImage(
|
||||
self.global_theme)
|
||||
preview = QtGui.QPixmap(unicode(image))
|
||||
if not preview.isNull():
|
||||
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
|
||||
QtCore.Qt.SmoothTransformation)
|
||||
self.DefaultListView.setPixmap(preview)
|
||||
self.__previewGlobalTheme()
|
||||
|
||||
def __previewGlobalTheme(self):
|
||||
"""
|
||||
Utility method to update the global theme preview image.
|
||||
"""
|
||||
image = self.parent.ThemeManagerContents.getPreviewImage(
|
||||
self.global_theme)
|
||||
preview = QtGui.QPixmap(unicode(image))
|
||||
if not preview.isNull():
|
||||
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
|
||||
QtCore.Qt.SmoothTransformation)
|
||||
self.DefaultListView.setPixmap(preview)
|
||||
|
@ -525,19 +525,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
if self.advancedClearComboBox.currentIndex() == 0:
|
||||
self.listView.clear()
|
||||
if self.listView.count() != 0:
|
||||
# Check if the first item is a second bible item or not.
|
||||
bitem = self.listView.item(0)
|
||||
item_second_bible = self._decodeQtObject(bitem, 'second_bible')
|
||||
if item_second_bible and second_bible or not item_second_bible and \
|
||||
not second_bible:
|
||||
self.displayResults(bible, second_bible)
|
||||
elif criticalErrorMessageBox(
|
||||
message=translate('BiblePlugin.MediaItem',
|
||||
'You cannot combine single and second bible verses. Do you '
|
||||
'want to delete your search results and start a new search?'),
|
||||
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||
self.listView.clear()
|
||||
self.displayResults(bible, second_bible)
|
||||
self.__checkSecondBible()
|
||||
else:
|
||||
self.displayResults(bible, second_bible)
|
||||
Receiver.send_message(u'cursor_normal')
|
||||
@ -577,24 +565,29 @@ class BibleMediaItem(MediaManagerItem):
|
||||
if self.quickClearComboBox.currentIndex() == 0:
|
||||
self.listView.clear()
|
||||
if self.listView.count() != 0 and self.search_results:
|
||||
bitem = self.listView.item(0)
|
||||
item_second_bible = self._decodeQtObject(bitem, 'second_bible')
|
||||
if item_second_bible and second_bible or not item_second_bible and \
|
||||
not second_bible:
|
||||
self.displayResults(bible, second_bible)
|
||||
elif criticalErrorMessageBox(
|
||||
message=translate('BiblePlugin.MediaItem',
|
||||
'You cannot combine single and second bible verses. Do you '
|
||||
'want to delete your search results and start a new search?'),
|
||||
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||
self.listView.clear()
|
||||
self.displayResults(bible, second_bible)
|
||||
self.__checkSecondBible()
|
||||
elif self.search_results:
|
||||
self.displayResults(bible, second_bible)
|
||||
self.quickSearchButton.setEnabled(True)
|
||||
Receiver.send_message(u'cursor_normal')
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
|
||||
def __checkSecondBible(self):
|
||||
"""
|
||||
Check if the first item is a second bible item or not.
|
||||
"""
|
||||
bitem = self.listView.item(0)
|
||||
item_second_bible = self._decodeQtObject(bitem, 'second_bible')
|
||||
if item_second_bible and second_bible or not item_second_bible and \
|
||||
not second_bible:
|
||||
self.displayResults(bible, second_bible)
|
||||
elif criticalErrorMessageBox(message=translate('BiblePlugin.MediaItem',
|
||||
'You cannot combine single and second bible verses. Do you '
|
||||
'want to delete your search results and start a new search?'),
|
||||
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||
self.listView.clear()
|
||||
self.displayResults(bible, second_bible)
|
||||
|
||||
def displayResults(self, bible, second_bible=u''):
|
||||
"""
|
||||
Displays the search results in the media manager. All data needed for
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
from openlp.core.lib import build_icon, translate, save_cancel_button_box
|
||||
|
||||
class Ui_CustomEditDialog(object):
|
||||
def setupUi(self, customEditDialog):
|
||||
@ -93,16 +93,9 @@ class Ui_CustomEditDialog(object):
|
||||
self.creditLabel.setBuddy(self.creditEdit)
|
||||
self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit)
|
||||
self.dialogLayout.addLayout(self.bottomFormLayout)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
|
||||
QtGui.QDialogButtonBox.Save)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.buttonBox = save_cancel_button_box(customEditDialog)
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
self.retranslateUi(customEditDialog)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
|
||||
customEditDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
|
||||
customEditDialog.closePressed)
|
||||
QtCore.QMetaObject.connectSlotsByName(customEditDialog)
|
||||
|
||||
def retranslateUi(self, customEditDialog):
|
||||
|
@ -136,7 +136,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
||||
if preview:
|
||||
self.previewButton.setVisible(True)
|
||||
|
||||
def closePressed(self):
|
||||
def reject(self):
|
||||
Receiver.send_message(u'custom_edit_clear')
|
||||
self.close()
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, SpellTextEdit
|
||||
from openlp.core.lib import translate, SpellTextEdit, save_cancel_button_box
|
||||
|
||||
class Ui_CustomSlideEditDialog(object):
|
||||
def setupUi(self, customSlideEditDialog):
|
||||
@ -36,20 +36,13 @@ class Ui_CustomSlideEditDialog(object):
|
||||
self.slideTextEdit = SpellTextEdit(self)
|
||||
self.slideTextEdit.setObjectName(u'slideTextEdit')
|
||||
self.dialogLayout.addWidget(self.slideTextEdit)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(customSlideEditDialog)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
|
||||
QtGui.QDialogButtonBox.Save)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.buttonBox = save_cancel_button_box(customSlideEditDialog)
|
||||
self.splitButton = QtGui.QPushButton(customSlideEditDialog)
|
||||
self.splitButton.setObjectName(u'splitButton')
|
||||
self.buttonBox.addButton(self.splitButton,
|
||||
QtGui.QDialogButtonBox.ActionRole)
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
self.retranslateUi(customSlideEditDialog)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
|
||||
customSlideEditDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
|
||||
customSlideEditDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(customSlideEditDialog)
|
||||
|
||||
def retranslateUi(self, customSlideEditDialog):
|
||||
|
@ -146,16 +146,7 @@ class CustomMediaItem(MediaManagerItem):
|
||||
raw_footer = []
|
||||
slide = None
|
||||
theme = None
|
||||
if item is None:
|
||||
if self.remoteTriggered is None:
|
||||
item = self.listView.currentItem()
|
||||
if item is None:
|
||||
return False
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
else:
|
||||
item_id = self.remoteCustom
|
||||
else:
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
item_id = self._getIdOfItemToGenerate(item, self.remoteCustom)
|
||||
service_item.add_capability(ItemCapabilities.AllowsEdit)
|
||||
service_item.add_capability(ItemCapabilities.AllowsPreview)
|
||||
service_item.add_capability(ItemCapabilities.AllowsLoop)
|
||||
|
@ -57,7 +57,6 @@ class MediaMediaItem(MediaManagerItem):
|
||||
u':/media/media_video.png').toImage()
|
||||
MediaManagerItem.__init__(self, parent, self, icon)
|
||||
self.singleServiceItem = False
|
||||
self.serviceItemIconName = u':/media/image_clapperboard.png'
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'video_background_replaced'),
|
||||
self.videobackgroundReplaced)
|
||||
|
@ -116,7 +116,7 @@ class Controller(object):
|
||||
|
||||
def last(self):
|
||||
"""
|
||||
Based on the handler passed at startup triggers the first slide
|
||||
Based on the handler passed at startup triggers the last slide
|
||||
"""
|
||||
log.debug(u'Live = %s, last' % self.is_live)
|
||||
if not self.is_live:
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import translate, save_cancel_button_box
|
||||
|
||||
class Ui_AuthorsDialog(object):
|
||||
def setupUi(self, authorsDialog):
|
||||
@ -55,17 +55,9 @@ class Ui_AuthorsDialog(object):
|
||||
self.displayLabel.setBuddy(self.displayEdit)
|
||||
self.authorLayout.addRow(self.displayLabel, self.displayEdit)
|
||||
self.dialogLayout.addLayout(self.authorLayout)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(authorsDialog)
|
||||
self.buttonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
self.dialogLayout.addWidget(save_cancel_button_box(authorsDialog))
|
||||
self.retranslateUi(authorsDialog)
|
||||
authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'accepted()'), authorsDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'rejected()'), authorsDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(authorsDialog)
|
||||
|
||||
def retranslateUi(self, authorsDialog):
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
from openlp.core.lib import build_icon, translate, save_cancel_button_box
|
||||
|
||||
class Ui_EditSongDialog(object):
|
||||
def setupUi(self, editSongDialog):
|
||||
@ -264,16 +264,9 @@ class Ui_EditSongDialog(object):
|
||||
self.themeTabLayout.addWidget(self.commentsGroupBox)
|
||||
self.songTabWidget.addTab(self.themeTab, u'')
|
||||
self.dialogLayout.addWidget(self.songTabWidget)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(editSongDialog)
|
||||
self.buttonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.buttonBox = save_cancel_button_box(editSongDialog)
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
self.retranslateUi(editSongDialog)
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'rejected()'), editSongDialog.closePressed)
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'accepted()'), editSongDialog.accept)
|
||||
QtCore.QMetaObject.connectSlotsByName(editSongDialog)
|
||||
|
||||
def retranslateUi(self, editSongDialog):
|
||||
|
@ -333,11 +333,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
author = Author.populate(first_name=text.rsplit(u' ', 1)[0],
|
||||
last_name=text.rsplit(u' ', 1)[1], display_name=text)
|
||||
self.manager.save_object(author)
|
||||
author_item = QtGui.QListWidgetItem(
|
||||
unicode(author.display_name))
|
||||
author_item.setData(QtCore.Qt.UserRole,
|
||||
QtCore.QVariant(author.id))
|
||||
self.authorsListView.addItem(author_item)
|
||||
self.__addAuthorToList(author)
|
||||
self.loadAuthors()
|
||||
self.authorsComboBox.setCurrentIndex(0)
|
||||
else:
|
||||
@ -351,11 +347,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
message=translate('SongsPlugin.EditSongForm',
|
||||
'This author is already in the list.'))
|
||||
else:
|
||||
author_item = QtGui.QListWidgetItem(unicode(
|
||||
author.display_name))
|
||||
author_item.setData(QtCore.Qt.UserRole,
|
||||
QtCore.QVariant(author.id))
|
||||
self.authorsListView.addItem(author_item)
|
||||
self.__addAuthorToList(author)
|
||||
self.authorsComboBox.setCurrentIndex(0)
|
||||
else:
|
||||
QtGui.QMessageBox.warning(self,
|
||||
@ -365,6 +357,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
'or type in a new author and click the "Add Author to '
|
||||
'Song" button to add the new author.'))
|
||||
|
||||
def __addAuthorToList(self, author):
|
||||
"""
|
||||
Add an author to the author list.
|
||||
"""
|
||||
author_item = QtGui.QListWidgetItem(unicode(author.display_name))
|
||||
author_item.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
|
||||
self.authorsListView.addItem(author_item)
|
||||
|
||||
def onAuthorsListViewPressed(self):
|
||||
if self.authorsListView.count() > 1:
|
||||
self.authorRemoveButton.setEnabled(True)
|
||||
@ -653,7 +653,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.books = []
|
||||
self.topics = []
|
||||
|
||||
def closePressed(self):
|
||||
def reject(self):
|
||||
"""
|
||||
Exit Dialog and do not save
|
||||
"""
|
||||
|
@ -26,7 +26,8 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate, SpellTextEdit
|
||||
from openlp.core.lib import build_icon, save_cancel_button_box, translate, \
|
||||
SpellTextEdit
|
||||
from openlp.plugins.songs.lib import VerseType
|
||||
|
||||
class Ui_EditVerseDialog(object):
|
||||
@ -59,17 +60,8 @@ class Ui_EditVerseDialog(object):
|
||||
self.verseTypeLayout.addWidget(self.insertButton)
|
||||
self.verseTypeLayout.addStretch()
|
||||
self.dialogLayout.addLayout(self.verseTypeLayout)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(editVerseDialog)
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
|
||||
QtGui.QDialogButtonBox.Save)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
self.dialogLayout.addWidget(save_cancel_button_box(editVerseDialog))
|
||||
self.retranslateUi(editVerseDialog)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
|
||||
editVerseDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
|
||||
editVerseDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(editVerseDialog)
|
||||
|
||||
def retranslateUi(self, editVerseDialog):
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import translate, save_cancel_button_box
|
||||
|
||||
class Ui_SongBookDialog(object):
|
||||
def setupUi(self, songBookDialog):
|
||||
@ -49,17 +49,9 @@ class Ui_SongBookDialog(object):
|
||||
self.publisherLabel.setBuddy(self.publisherEdit)
|
||||
self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
|
||||
self.dialogLayout.addLayout(self.bookLayout)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(songBookDialog)
|
||||
self.buttonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
self.dialogLayout.addWidget(save_cancel_button_box(songBookDialog))
|
||||
self.retranslateUi(songBookDialog)
|
||||
songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'accepted()'), songBookDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'rejected()'), songBookDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(songBookDialog)
|
||||
|
||||
def retranslateUi(self, songBookDialog):
|
||||
|
@ -310,12 +310,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
||||
'the existing author %s?')) % (author.display_name,
|
||||
temp_display_name, author.display_name),
|
||||
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||
Receiver.send_message(u'cursor_busy')
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
self.mergeAuthors(author)
|
||||
self.resetAuthors()
|
||||
Receiver.send_message(u'songs_load_list')
|
||||
Receiver.send_message(u'cursor_normal')
|
||||
self.__mergeObjects(author, self.mergeAuthors,
|
||||
self.resetAuthors)
|
||||
else:
|
||||
# We restore the author's old first and last name as well as
|
||||
# his display name.
|
||||
@ -350,11 +346,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
||||
'with topic %s use the existing topic %s?')) % (topic.name,
|
||||
temp_name, topic.name),
|
||||
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||
Receiver.send_message(u'cursor_busy')
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
self.mergeTopics(topic)
|
||||
self.resetTopics()
|
||||
Receiver.send_message(u'cursor_normal')
|
||||
self.__mergeObjects(topic, self.mergeTopics, self.resetTopics)
|
||||
else:
|
||||
# We restore the topics's old name.
|
||||
topic.name = temp_name
|
||||
@ -392,16 +384,23 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
||||
'with book %s use the existing book %s?')) % (book.name,
|
||||
temp_name, book.name),
|
||||
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||
Receiver.send_message(u'cursor_busy')
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
self.mergeBooks(book)
|
||||
self.resetBooks()
|
||||
Receiver.send_message(u'cursor_normal')
|
||||
self.__mergeObjects(book, self.mergeBooks, self.resetBooks)
|
||||
else:
|
||||
# We restore the book's old name and publisher.
|
||||
book.name = temp_name
|
||||
book.publisher = temp_publisher
|
||||
|
||||
def __mergeObjects(self, object, merge, reset):
|
||||
"""
|
||||
Utility method to merge two objects to leave one in the database.
|
||||
"""
|
||||
Receiver.send_message(u'cursor_busy')
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
merge(object)
|
||||
reset()
|
||||
Receiver.send_message(u'songs_load_list')
|
||||
Receiver.send_message(u'cursor_normal')
|
||||
|
||||
def mergeAuthors(self, old_author):
|
||||
"""
|
||||
Merges two authors into one author.
|
||||
@ -508,42 +507,32 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
||||
|
||||
def onAuthorsListRowChanged(self, row):
|
||||
"""
|
||||
Called when the *authorsListWidget* current's row has changed.
|
||||
|
||||
``row``
|
||||
The current row. If there is no current row, the value is -1
|
||||
Called when the *authorsListWidget*s current row has changed.
|
||||
"""
|
||||
if row == -1:
|
||||
self.authorsDeleteButton.setEnabled(False)
|
||||
self.authorsEditButton.setEnabled(False)
|
||||
else:
|
||||
self.authorsDeleteButton.setEnabled(True)
|
||||
self.authorsEditButton.setEnabled(True)
|
||||
self.__rowChange(row, self.authorsEditButton, self.authorsDeleteButton)
|
||||
|
||||
def onTopicsListRowChanged(self, row):
|
||||
"""
|
||||
Called when the *booksListWidget* current's row has changed.
|
||||
|
||||
``row``
|
||||
The current row. If there is no current row, the value is -1.
|
||||
Called when the *topicsListWidget*s current row has changed.
|
||||
"""
|
||||
if row == -1:
|
||||
self.topicsDeleteButton.setEnabled(False)
|
||||
self.topicsEditButton.setEnabled(False)
|
||||
else:
|
||||
self.topicsDeleteButton.setEnabled(True)
|
||||
self.topicsEditButton.setEnabled(True)
|
||||
self.__rowChange(row, self.topicsEditButton, self.topicsDeleteButton)
|
||||
|
||||
def onBooksListRowChanged(self, row):
|
||||
"""
|
||||
Called when the *booksListWidget* current's row has changed.
|
||||
Called when the *booksListWidget*s current row has changed.
|
||||
"""
|
||||
self.__rowChange(row, self.booksEditButton, self.booksDeleteButton)
|
||||
|
||||
def __rowChange(self, row, editButton, deleteButton):
|
||||
"""
|
||||
Utility method to toggle if buttons are enabled.
|
||||
|
||||
``row``
|
||||
The current row. If there is no current row, the value is -1.
|
||||
"""
|
||||
if row == -1:
|
||||
self.booksDeleteButton.setEnabled(False)
|
||||
self.booksEditButton.setEnabled(False)
|
||||
deleteButton.setEnabled(False)
|
||||
editButton.setEnabled(False)
|
||||
else:
|
||||
self.booksDeleteButton.setEnabled(True)
|
||||
self.booksEditButton.setEnabled(True)
|
||||
deleteButton.setEnabled(True)
|
||||
editButton.setEnabled(True)
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import translate, save_cancel_button_box
|
||||
|
||||
class Ui_TopicsDialog(object):
|
||||
def setupUi(self, topicsDialog):
|
||||
@ -43,17 +43,9 @@ class Ui_TopicsDialog(object):
|
||||
self.nameLabel.setBuddy(self.nameEdit)
|
||||
self.nameLayout.addRow(self.nameLabel, self.nameEdit)
|
||||
self.dialogLayout.addLayout(self.nameLayout)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(topicsDialog)
|
||||
self.buttonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
self.dialogLayout.addWidget(save_cancel_button_box(topicsDialog))
|
||||
self.retranslateUi(topicsDialog)
|
||||
topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'accepted()'), topicsDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'rejected()'), topicsDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(topicsDialog)
|
||||
|
||||
def retranslateUi(self, topicsDialog):
|
||||
|
@ -133,30 +133,38 @@ class EasiSlidesImport(SongImport):
|
||||
pass
|
||||
|
||||
def _add_copyright(self, song):
|
||||
"""
|
||||
Assign the copyright information from the import to the song being
|
||||
created.
|
||||
|
||||
``song``
|
||||
The current song being imported.
|
||||
"""
|
||||
copyright = []
|
||||
try:
|
||||
copyright.append(unicode(song.Copyright).strip())
|
||||
except UnicodeDecodeError:
|
||||
log.exception(u'Unicode decode error while decoding Copyright')
|
||||
self._success = False
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
copyright.append(unicode(song.LicenceAdmin1).strip())
|
||||
except UnicodeDecodeError:
|
||||
log.exception(u'Unicode decode error while decoding LicenceAdmin1')
|
||||
self._success = False
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
copyright.append(unicode(song.LicenceAdmin2).strip())
|
||||
except UnicodeDecodeError:
|
||||
log.exception(u'Unicode decode error while decoding LicenceAdmin2')
|
||||
self._success = False
|
||||
except AttributeError:
|
||||
pass
|
||||
self.__add_copyright_element(copyright, song.Copyright)
|
||||
self.__add_copyright_element(copyright, song.LicenceAdmin1)
|
||||
self.__add_copyright_element(copyright, song.LicenceAdmin2)
|
||||
self.add_copyright(u' '.join(copyright))
|
||||
|
||||
def __add_copyright_element(self, copyright, element):
|
||||
"""
|
||||
Add a piece of copyright to the total copyright information for the
|
||||
song.
|
||||
|
||||
``copyright``
|
||||
The array to add the information to.
|
||||
|
||||
``element``
|
||||
The imported variable to get the data from.
|
||||
"""
|
||||
try:
|
||||
copyright.append(unicode(element).strip())
|
||||
except UnicodeDecodeError:
|
||||
log.exception(u'Unicode error decoding %s' % element)
|
||||
self._success = False
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
def _parse_and_add_lyrics(self, song):
|
||||
try:
|
||||
lyrics = unicode(song.Contents).strip()
|
||||
|
@ -337,16 +337,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
author_list = u''
|
||||
author_audit = []
|
||||
ccli = u''
|
||||
if item is None:
|
||||
if self.remoteTriggered is None:
|
||||
item = self.listView.currentItem()
|
||||
if item is None:
|
||||
return False
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
else:
|
||||
item_id = self.remoteSong
|
||||
else:
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
item_id = self._getIdOfItemToGenerate(item, self.remoteSong)
|
||||
service_item.add_capability(ItemCapabilities.AllowsEdit)
|
||||
service_item.add_capability(ItemCapabilities.AllowsPreview)
|
||||
service_item.add_capability(ItemCapabilities.AllowsLoop)
|
||||
|
Loading…
Reference in New Issue
Block a user