forked from openlp/openlp
Add ability to print OOS document
bzr-revno: 1258
This commit is contained in:
commit
5d8d468269
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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())
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user