This commit is contained in:
Tim Bentley 2011-02-08 19:27:03 +00:00
commit 7028c82c4c
31 changed files with 844 additions and 372 deletions

View File

@ -86,10 +86,10 @@ class BaseModel(object):
"""
Creates an instance of a class and populates it, returning the instance
"""
me = cls()
instance = cls()
for key in kwargs:
me.__setattr__(key, kwargs[key])
return me
instance.__setattr__(key, kwargs[key])
return instance
class Manager(object):
"""

View File

@ -60,8 +60,8 @@ class DisplayTags(object):
DisplayTags.html_expands.append(tag)
@staticmethod
def remove_html_tag(id):
def remove_html_tag(tag_id):
"""
Removes amd individual html_expands list.
Removes an individual html_expands tag.
"""
DisplayTags.html_expands.pop(id)
DisplayTags.html_expands.pop(tag_id)

View File

@ -61,10 +61,10 @@ class Image(object):
image = None
image_bytes = None
class ImageManager(QtCore.QObject):
"""
Image Manager handles the conversion and sizing of images.
"""
log.info(u'Image Manager loaded')

View File

@ -44,6 +44,9 @@ class PluginStatus(object):
class StringContent(object):
"""
Provide standard strings for objects to use.
"""
Name = u'name'
Import = u'import'
Load = u'load'

View File

@ -583,8 +583,7 @@ class ThemeXML(object):
self.background_end_color,
self.background_direction)
else:
filename = \
os.path.split(self.background_filename)[1]
filename = os.path.split(self.background_filename)[1]
self.add_background_image(filename)
self.add_font(self.font_main_name,
self.font_main_color,

View File

@ -33,11 +33,14 @@ processing version 1 themes in OpenLP version 2.
from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import QtGui
DELPHI_COLORS = {u'clRed': 0xFF0000,
u'clBlue': 0x0000FF,
u'clYellow': 0xFFFF00,
u'clBlack': 0x000000,
u'clWhite': 0xFFFFFF}
DELPHI_COLORS = {
u'clAqua': 0x00FFFF, u'clBlack': 0x000000, u'clBlue': 0x0000FF,
u'clFuchsia': 0xFF00FF, u'clGray': 0x808080, u'clGreen': 0x008000,
u'clLime': 0x00FF00, u'clMaroon': 0x800000, u'clNavy': 0x000080,
u'clOlive': 0x808000, u'clPurple': 0x800080, u'clRed': 0xFF0000,
u'clSilver': 0xC0C0C0, u'clTeal': 0x008080, u'clWhite': 0xFFFFFF,
u'clYellow': 0xFFFF00
}
BLANK_STYLE_XML = \
'''<?xml version="1.0" encoding="iso-8859-1"?>
@ -184,7 +187,6 @@ class Theme(object):
if element.tag != u'Theme':
element_text = element.text
val = 0
# easy!
if element_text is None:
val = element_text
# strings need special handling to sort the colours out

View File

@ -80,16 +80,6 @@ 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)
@ -139,11 +129,6 @@ 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(
@ -179,8 +164,6 @@ 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):
@ -201,8 +184,6 @@ 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):

View File

@ -23,27 +23,27 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
'''
"""
The :mod:`DisplayTagTab` provides an Tag Edit facility. The Base set are
protected and included each time loaded. Custom tags can be defined and saved.
The Custom Tag arrays are saved in a pickle so QSettings works on them. Base
Tags cannot be changed.
'''
"""
import cPickle
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate, DisplayTags
from openlp.core.lib.ui import critical_error_message_box
class DisplayTagTab(SettingsTab):
'''
"""
The :class:`DisplayTagTab` manages the settings tab .
'''
"""
def __init__(self):
'''
"""
Initialise the settings tab
'''
"""
SettingsTab.__init__(self, u'Display Tags')
def resizeEvent(self, event=None):
@ -67,9 +67,9 @@ class DisplayTagTab(SettingsTab):
self.selected = -1
def setupUi(self):
'''
"""
Configure the UI elements for the tab.
'''
"""
self.setObjectName(u'DisplayTagTab')
self.tabTitleVisible = \
translate(u'OpenLP.DisplayTagTab', 'Display Tags')

View File

@ -326,8 +326,7 @@ class MainDisplay(DisplayWidget):
vol = float(volume)/float(10)
if isBackground or not self.usePhonon:
js = u'show_video("init", "%s", %s, true); show_video("play");' % \
(videoPath.replace(u'\\', u'\\\\'), \
str(vol))
(videoPath.replace(u'\\', u'\\\\'), str(vol))
self.frame.evaluateJavaScript(js)
else:
self.phononActive = True
@ -398,8 +397,7 @@ class MainDisplay(DisplayWidget):
if u'video' in self.override:
Receiver.send_message(u'video_background_replaced')
self.override = {}
elif self.override[u'theme'] != \
serviceItem.themedata.theme_name:
elif self.override[u'theme'] != serviceItem.themedata.theme_name:
Receiver.send_message(u'live_theme_changed')
self.override = {}
else:

View File

@ -77,10 +77,10 @@ class Ui_MainWindow(object):
self.MainContentLayout.setMargin(0)
self.MainContentLayout.setObjectName(u'MainContentLayout')
mainWindow.setCentralWidget(self.MainContent)
self.ControlSplitter = QtGui.QSplitter(self.MainContent)
self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal)
self.ControlSplitter.setObjectName(u'ControlSplitter')
self.MainContentLayout.addWidget(self.ControlSplitter)
self.controlSplitter = QtGui.QSplitter(self.MainContent)
self.controlSplitter.setOrientation(QtCore.Qt.Horizontal)
self.controlSplitter.setObjectName(u'controlSplitter')
self.MainContentLayout.addWidget(self.controlSplitter)
# Create slide controllers
self.previewController = SlideController(self, self.settingsmanager,
self.screens)
@ -102,9 +102,9 @@ class Ui_MainWindow(object):
self.FileExportMenu = QtGui.QMenu(self.FileMenu)
self.FileExportMenu.setObjectName(u'FileExportMenu')
# View Menu
self.ViewMenu = QtGui.QMenu(self.MenuBar)
self.ViewMenu.setObjectName(u'ViewMenu')
self.ViewModeMenu = QtGui.QMenu(self.ViewMenu)
self.viewMenu = QtGui.QMenu(self.MenuBar)
self.viewMenu.setObjectName(u'viewMenu')
self.ViewModeMenu = QtGui.QMenu(self.viewMenu)
self.ViewModeMenu.setObjectName(u'ViewModeMenu')
# Tools Menu
self.ToolsMenu = QtGui.QMenu(self.MenuBar)
@ -125,38 +125,38 @@ class Ui_MainWindow(object):
self.DefaultThemeLabel.setObjectName(u'DefaultThemeLabel')
self.StatusBar.addPermanentWidget(self.DefaultThemeLabel)
# Create the MediaManager
self.MediaManagerDock = OpenLPDockWidget(mainWindow,
u'MediaManagerDock', u':/system/system_mediamanager.png')
self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
self.MediaManagerDock.setMinimumWidth(
self.mediaManagerDock = OpenLPDockWidget(mainWindow,
u'mediaManagerDock', u':/system/system_mediamanager.png')
self.mediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
self.mediaManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_left)
# Create the media toolbox
self.MediaToolBox = QtGui.QToolBox(self.MediaManagerDock)
self.MediaToolBox = QtGui.QToolBox(self.mediaManagerDock)
self.MediaToolBox.setObjectName(u'MediaToolBox')
self.MediaManagerDock.setWidget(self.MediaToolBox)
self.mediaManagerDock.setWidget(self.MediaToolBox)
mainWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea,
self.MediaManagerDock)
self.mediaManagerDock)
# Create the service manager
self.ServiceManagerDock = OpenLPDockWidget(mainWindow,
u'ServiceManagerDock', u':/system/system_servicemanager.png')
self.ServiceManagerDock.setMinimumWidth(
self.serviceManagerDock = OpenLPDockWidget(mainWindow,
u'serviceManagerDock', u':/system/system_servicemanager.png')
self.serviceManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_right)
self.ServiceManagerContents = ServiceManager(mainWindow,
self.ServiceManagerDock)
self.ServiceManagerDock.setWidget(self.ServiceManagerContents)
self.serviceManagerDock)
self.serviceManagerDock.setWidget(self.ServiceManagerContents)
mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
self.ServiceManagerDock)
self.serviceManagerDock)
# Create the theme manager
self.ThemeManagerDock = OpenLPDockWidget(mainWindow,
u'ThemeManagerDock', u':/system/system_thememanager.png')
self.ThemeManagerDock.setMinimumWidth(
self.themeManagerDock = OpenLPDockWidget(mainWindow,
u'themeManagerDock', u':/system/system_thememanager.png')
self.themeManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_right)
self.ThemeManagerContents = ThemeManager(mainWindow,
self.ThemeManagerDock)
self.themeManagerDock)
self.ThemeManagerContents.setObjectName(u'ThemeManagerContents')
self.ThemeManagerDock.setWidget(self.ThemeManagerContents)
self.themeManagerDock.setWidget(self.ThemeManagerContents)
mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
self.ThemeManagerDock)
self.themeManagerDock)
# Create the menu items
self.FileNewItem = icon_action(mainWindow, u'FileNewItem',
u':/general/general_new.png')
@ -186,14 +186,14 @@ class Ui_MainWindow(object):
mainWindow.actionList.add_action(self.ExportLanguageItem, u'Export')
self.ViewMediaManagerItem = icon_action(mainWindow,
u'ViewMediaManagerItem', u':/system/system_mediamanager.png',
self.MediaManagerDock.isVisible())
self.mediaManagerDock.isVisible())
self.ViewThemeManagerItem = icon_action(mainWindow,
u'ViewThemeManagerItem', u':/system/system_thememanager.png',
self.ThemeManagerDock.isVisible())
self.themeManagerDock.isVisible())
mainWindow.actionList.add_action(self.ViewMediaManagerItem, u'View')
self.ViewServiceManagerItem = icon_action(mainWindow,
u'ViewServiceManagerItem', u':/system/system_servicemanager.png',
self.ServiceManagerDock.isVisible())
self.serviceManagerDock.isVisible())
mainWindow.actionList.add_action(self.ViewServiceManagerItem, u'View')
self.ViewPreviewPanel = checkable_action(mainWindow,
u'ViewPreviewPanel', previewVisible)
@ -215,9 +215,9 @@ class Ui_MainWindow(object):
self.ToolsAddToolItem = icon_action(mainWindow, u'ToolsAddToolItem',
u':/tools/tools_add.png')
mainWindow.actionList.add_action(self.ToolsAddToolItem, u'Tools')
self.SettingsPluginListItem = icon_action(mainWindow,
u'SettingsPluginListItem', u':/system/settings_plugin_list.png')
mainWindow.actionList.add_action(self.SettingsPluginListItem,
self.settingsPluginListItem = icon_action(mainWindow,
u'settingsPluginListItem', u':/system/settings_plugin_list.png')
mainWindow.actionList.add_action(self.settingsPluginListItem,
u'Settings')
# i18n Language Items
self.AutoLanguageItem = checkable_action(mainWindow,
@ -264,14 +264,14 @@ class Ui_MainWindow(object):
self.FileExportMenu.menuAction(), self.FileExitItem)
add_actions(self.ViewModeMenu, (self.ModeDefaultItem,
self.ModeSetupItem, self.ModeLiveItem))
add_actions(self.ViewMenu, (self.ViewModeMenu.menuAction(),
add_actions(self.viewMenu, (self.ViewModeMenu.menuAction(),
None, self.ViewMediaManagerItem, self.ViewServiceManagerItem,
self.ViewThemeManagerItem, None, self.ViewPreviewPanel,
self.ViewLivePanel))
# i18n add Language Actions
add_actions(self.SettingsLanguageMenu, (self.AutoLanguageItem, None))
add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions())
add_actions(self.SettingsMenu, (self.SettingsPluginListItem,
add_actions(self.SettingsMenu, (self.settingsPluginListItem,
self.SettingsLanguageMenu.menuAction(), None,
self.SettingsShortcutsItem, self.SettingsConfigureItem))
add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None))
@ -279,7 +279,7 @@ class Ui_MainWindow(object):
self.HelpOnlineHelpItem, None, self.HelpWebSiteItem,
self.HelpAboutItem))
add_actions(self.MenuBar, (self.FileMenu.menuAction(),
self.ViewMenu.menuAction(), self.ToolsMenu.menuAction(),
self.viewMenu.menuAction(), self.ToolsMenu.menuAction(),
self.SettingsMenu.menuAction(), self.HelpMenu.menuAction()))
# Initialise the translation
self.retranslateUi(mainWindow)
@ -300,18 +300,18 @@ class Ui_MainWindow(object):
self.FileMenu.setTitle(translate('OpenLP.MainWindow', '&File'))
self.FileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import'))
self.FileExportMenu.setTitle(translate('OpenLP.MainWindow', '&Export'))
self.ViewMenu.setTitle(translate('OpenLP.MainWindow', '&View'))
self.viewMenu.setTitle(translate('OpenLP.MainWindow', '&View'))
self.ViewModeMenu.setTitle(translate('OpenLP.MainWindow', 'M&ode'))
self.ToolsMenu.setTitle(translate('OpenLP.MainWindow', '&Tools'))
self.SettingsMenu.setTitle(translate('OpenLP.MainWindow', '&Settings'))
self.SettingsLanguageMenu.setTitle(translate('OpenLP.MainWindow',
'&Language'))
self.HelpMenu.setTitle(translate('OpenLP.MainWindow', '&Help'))
self.MediaManagerDock.setWindowTitle(
self.mediaManagerDock.setWindowTitle(
translate('OpenLP.MainWindow', 'Media Manager'))
self.ServiceManagerDock.setWindowTitle(
self.serviceManagerDock.setWindowTitle(
translate('OpenLP.MainWindow', 'Service Manager'))
self.ThemeManagerDock.setWindowTitle(
self.themeManagerDock.setWindowTitle(
translate('OpenLP.MainWindow', 'Theme Manager'))
self.FileNewItem.setText(translate('OpenLP.MainWindow', '&New'))
self.FileNewItem.setToolTip(
@ -403,11 +403,11 @@ class Ui_MainWindow(object):
'Toggle the visibility of the live panel.'))
self.ViewLivePanel.setShortcut(
translate('OpenLP.MainWindow', 'F12'))
self.SettingsPluginListItem.setText(translate('OpenLP.MainWindow',
self.settingsPluginListItem.setText(translate('OpenLP.MainWindow',
'&Plugin List'))
self.SettingsPluginListItem.setStatusTip(
self.settingsPluginListItem.setStatusTip(
translate('OpenLP.MainWindow', 'List the Plugins'))
self.SettingsPluginListItem.setShortcut(
self.settingsPluginListItem.setShortcut(
translate('OpenLP.MainWindow', 'Alt+F7'))
self.HelpDocumentationItem.setText(
translate('OpenLP.MainWindow', '&User Guide'))
@ -501,20 +501,20 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'toggled(bool)'), self.setPreviewPanelVisibility)
QtCore.QObject.connect(self.ViewLivePanel,
QtCore.SIGNAL(u'toggled(bool)'), self.setLivePanelVisibility)
QtCore.QObject.connect(self.MediaManagerDock,
QtCore.QObject.connect(self.mediaManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.ViewMediaManagerItem.setChecked)
QtCore.QObject.connect(self.ServiceManagerDock,
QtCore.QObject.connect(self.serviceManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.ViewServiceManagerItem.setChecked)
QtCore.QObject.connect(self.ThemeManagerDock,
QtCore.QObject.connect(self.themeManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.ViewThemeManagerItem.setChecked)
QtCore.QObject.connect(self.HelpWebSiteItem,
QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked)
QtCore.QObject.connect(self.HelpAboutItem,
QtCore.SIGNAL(u'triggered()'), self.onHelpAboutItemClicked)
QtCore.QObject.connect(self.SettingsPluginListItem,
QtCore.QObject.connect(self.settingsPluginListItem,
QtCore.SIGNAL(u'triggered()'), self.onPluginItemClicked)
QtCore.QObject.connect(self.SettingsConfigureItem,
QtCore.SIGNAL(u'triggered()'), self.onSettingsConfigureItemClicked)
@ -748,9 +748,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
settings = QtCore.QSettings()
settings.setValue(u'%s/view mode' % self.generalSettingsSection,
mode)
self.MediaManagerDock.setVisible(media)
self.ServiceManagerDock.setVisible(service)
self.ThemeManagerDock.setVisible(theme)
self.mediaManagerDock.setVisible(media)
self.serviceManagerDock.setVisible(service)
self.themeManagerDock.setVisible(theme)
self.setPreviewPanelVisibility(preview)
self.setLivePanelVisibility(live)
@ -867,16 +867,16 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
theme)
def toggleMediaManager(self, visible):
if self.MediaManagerDock.isVisible() != visible:
self.MediaManagerDock.setVisible(visible)
if self.mediaManagerDock.isVisible() != visible:
self.mediaManagerDock.setVisible(visible)
def toggleServiceManager(self, visible):
if self.ServiceManagerDock.isVisible() != visible:
self.ServiceManagerDock.setVisible(visible)
if self.serviceManagerDock.isVisible() != visible:
self.serviceManagerDock.setVisible(visible)
def toggleThemeManager(self, visible):
if self.ThemeManagerDock.isVisible() != visible:
self.ThemeManagerDock.setVisible(visible)
if self.themeManagerDock.isVisible() != visible:
self.themeManagerDock.setVisible(visible)
def setPreviewPanelVisibility(self, visible):
"""

View File

@ -34,7 +34,9 @@ from plugindialog import Ui_PluginViewDialog
log = logging.getLogger(__name__)
class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
"""
The plugin form provides user control over the plugins OpenLP uses.
"""
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.parent = parent

View File

@ -0,0 +1,137 @@
# -*- 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 build_icon, translate, SpellTextEdit
class Ui_PrintServiceOrderDialog(object):
def setupUi(self, printServiceOrderDialog):
printServiceOrderDialog.setObjectName(u'printServiceOrderDialog')
self.dialogLayout = QtGui.QGridLayout(printServiceOrderDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.perviewLayout = QtGui.QVBoxLayout()
self.perviewLayout.setObjectName(u'perviewLayout')
self.previewLabel = QtGui.QLabel(printServiceOrderDialog)
self.previewLabel.setSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
self.previewLabel.setObjectName(u'previewLabel')
self.perviewLayout.addWidget(self.previewLabel)
self.previewWidget = QtGui.QPrintPreviewWidget(
self.printer, self, QtCore.Qt.Widget)
self.previewWidget.setEnabled(True)
self.previewWidget.setSizePolicy(
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
self.previewWidget.setObjectName(u'previewWidget')
# Give the previewWidget a fixed size, to prevent resizing when clicking
# the zoom buttons.
self.previewWidget.setFixedWidth(350)
self.perviewLayout.addWidget(self.previewWidget)
self.dialogLayout.addLayout(self.perviewLayout, 0, 0, 1, 1)
self.settingsLayout = QtGui.QVBoxLayout()
self.settingsLayout.setObjectName(u'settingsLayout')
self.serviceTitleLayout = QtGui.QGridLayout()
self.serviceTitleLayout.setObjectName(u'serviceTitleLayout')
self.serviceTitleLineEdit = QtGui.QLineEdit(printServiceOrderDialog)
self.serviceTitleLineEdit.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.serviceTitleLineEdit.setObjectName(u'serviceTitleLineEdit')
self.serviceTitleLayout.addWidget(self.serviceTitleLineEdit, 1, 1, 1, 1)
self.serviceTitleLabel = QtGui.QLabel(printServiceOrderDialog)
self.serviceTitleLabel.setSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
self.serviceTitleLabel.setObjectName(u'serviceTitleLabel')
self.serviceTitleLayout.addWidget(self.serviceTitleLabel, 1, 0, 1, 1)
self.settingsLayout.addLayout(self.serviceTitleLayout)
self.printSlideTextCheckBox = QtGui.QCheckBox(printServiceOrderDialog)
self.printSlideTextCheckBox.setObjectName(u'printSlideTextCheckBox')
self.settingsLayout.addWidget(self.printSlideTextCheckBox)
self.printNotesCheckBox = QtGui.QCheckBox(printServiceOrderDialog)
self.printNotesCheckBox.setObjectName(u'printNotesCheckBox')
self.settingsLayout.addWidget(self.printNotesCheckBox)
self.printMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog)
self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox')
self.settingsLayout.addWidget(self.printMetaDataCheckBox)
spacerItem = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.settingsLayout.addItem(spacerItem)
self.customNotesLabel = QtGui.QLabel(self)
self.customNotesLabel.setObjectName(u'customNotesLabel')
self.settingsLayout.addWidget(self.customNotesLabel)
self.customNoteEdit = SpellTextEdit(self)
self.customNoteEdit.setObjectName(u'customNoteEdit')
self.settingsLayout.addWidget(self.customNoteEdit)
self.dialogLayout.addLayout(self.settingsLayout, 0, 3, 1, 1)
self.buttonLayout = QtGui.QHBoxLayout()
self.buttonLayout.setObjectName(u'buttonLayout')
spacerItem = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.buttonLayout.addItem(spacerItem)
self.cancelButton = QtGui.QPushButton(printServiceOrderDialog)
self.cancelButton.setObjectName(u'cancelButton')
self.buttonLayout.addWidget(self.cancelButton)
self.printButton = QtGui.QPushButton(printServiceOrderDialog)
self.printButton.setObjectName(u'printButton')
self.buttonLayout.addWidget(self.printButton)
self.dialogLayout.addLayout(self.buttonLayout, 1, 3, 1, 1)
self.zoomButtonLayout = QtGui.QHBoxLayout()
self.zoomButtonLayout.setObjectName(u'zoomButtonLayout')
spacerItem = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.zoomButtonLayout.addItem(spacerItem)
self.zoomOutButton = QtGui.QToolButton(printServiceOrderDialog)
self.zoomOutButton.setIcon(
build_icon(u':/general/general_zoom_out.png'))
self.zoomOutButton.setObjectName(u'zoomOutButton')
self.zoomButtonLayout.addWidget(self.zoomOutButton)
self.zoomInButton = QtGui.QToolButton(printServiceOrderDialog)
self.zoomInButton.setIcon(build_icon(u':/general/general_zoom_in.png'))
self.zoomInButton.setObjectName(u'zoomInButton')
self.zoomButtonLayout.addWidget(self.zoomInButton)
self.dialogLayout.addLayout(self.zoomButtonLayout, 1, 0, 1, 1)
self.retranslateUi(printServiceOrderDialog)
QtCore.QMetaObject.connectSlotsByName(printServiceOrderDialog)
def retranslateUi(self, printServiceOrderDialog):
printServiceOrderDialog.setWindowTitle(
translate('OpenLP.PrintServiceOrderForm', 'Print Service Order'))
self.previewLabel.setText(
translate('OpenLP.ServiceManager', '<b>Preview:</b>'))
self.printSlideTextCheckBox.setText(translate(
'OpenLP.PrintServiceOrderForm', 'Include slide text if available'))
self.printNotesCheckBox.setText(translate(
'OpenLP.PrintServiceOrderForm', 'Include service item notes'))
self.printMetaDataCheckBox.setText(
translate('OpenLP.PrintServiceOrderForm',
'Include play length of media items'))
self.serviceTitleLabel.setText(translate(
'OpenLP.PrintServiceOrderForm', 'Title:'))
self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager',
'Service Order Sheet'))
self.printButton.setText(translate('OpenLP.ServiceManager', 'Print'))
self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel'))
self.customNotesLabel.setText(
translate('OpenLP.ServiceManager', '<b>Custom Service Notes:</b>'))

View File

@ -0,0 +1,184 @@
# -*- 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 #
###############################################################################
import datetime
import mutagen
import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
from openlp.core.ui.printserviceorderdialog import Ui_PrintServiceOrderDialog
class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
def __init__(self, parent, serviceManager):
"""
Constructor
"""
QtGui.QDialog.__init__(self, parent)
self.serviceManager = serviceManager
self.printer = QtGui.QPrinter()
self.printDialog = QtGui.QPrintDialog(self.printer, self)
self.document = QtGui.QTextDocument()
self.setupUi(self)
# Load the settings for the dialog.
settings = QtCore.QSettings()
settings.beginGroup(u'advanced')
self.printSlideTextCheckBox.setChecked(settings.value(
u'print slide text', QtCore.QVariant(False)).toBool())
self.printMetaDataCheckBox.setChecked(settings.value(
u'print file meta data', QtCore.QVariant(False)).toBool())
self.printNotesCheckBox.setChecked(settings.value(
u'print notes', QtCore.QVariant(False)).toBool())
settings.endGroup()
# Signals
QtCore.QObject.connect(self.printButton,
QtCore.SIGNAL(u'clicked()'), self.printServiceOrder)
QtCore.QObject.connect(self.zoomOutButton,
QtCore.SIGNAL(u'clicked()'), self.zoomOut)
QtCore.QObject.connect(self.zoomInButton,
QtCore.SIGNAL(u'clicked()'), self.zoomIn)
QtCore.QObject.connect(self.previewWidget,
QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested)
QtCore.QObject.connect(self.serviceTitleLineEdit,
QtCore.SIGNAL(u'textChanged(const QString)'),
self.updatePreviewText)
QtCore.QObject.connect(self.printSlideTextCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText)
QtCore.QObject.connect(self.printNotesCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText)
QtCore.QObject.connect(self.printMetaDataCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText)
QtCore.QObject.connect(self.customNoteEdit,
QtCore.SIGNAL(u'textChanged()'), self.updatePreviewText)
QtCore.QObject.connect(self.cancelButton,
QtCore.SIGNAL(u'clicked()'), self.reject)
self.updatePreviewText()
def updatePreviewText(self):
"""
Creates the html text and updates the html of *self.document*.
"""
text = u''
if self.serviceTitleLineEdit.text():
text += u'<h2>%s</h2>' % unicode(self.serviceTitleLineEdit.text())
for item in self.serviceManager.serviceItems:
item = item[u'service_item']
# Add the title of the service item.
text += u'<h4><img src="%s" /> %s</h4>' % (item.icon,
item.get_display_title())
# Add slide text of the service item.
if self.printSlideTextCheckBox.isChecked():
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
# Add service items' notes.
if self.printNotesCheckBox.isChecked():
if item.notes:
text += u'<p><b>%s</b></p>%s' % (translate(
'OpenLP.ServiceManager', 'Notes:'),
item.notes.replace(u'\n', u'<br />'))
# Add play length of media files.
if item.is_media() and self.printMetaDataCheckBox.isChecked():
path = os.path.join(item.get_frames()[0][u'path'],
item.get_frames()[0][u'title'])
if not os.path.isfile(path):
continue
file = mutagen.File(path)
if file is not None:
length = int(file.info.length)
text += u'<p><b>%s</b> %s</p>' % (translate(
'OpenLP.ServiceManager', u'Playing time:'),
unicode(datetime.timedelta(seconds=length)))
if self.customNoteEdit.toPlainText():
text += u'<h4>%s</h4>%s' % (translate('OpenLP.ServiceManager',
u'Custom Service Notes:'), self.customNoteEdit.toPlainText())
self.document.setHtml(text)
self.previewWidget.updatePreview()
def paintRequested(self, printer):
"""
Paint the preview of the *self.document*.
``printer``
A *QPrinter* object.
"""
self.document.print_(printer)
def printServiceOrder(self):
"""
Called, when the *printButton* is clicked. Opens the *printDialog*.
"""
if not self.printDialog.exec_():
return
# Print the document.
self.document.print_(self.printer)
self.accept()
def zoomIn(self):
"""
Called when *zoomInButton* is clicked.
"""
self.previewWidget.zoomIn()
def zoomOut(self):
"""
Called when *zoomOutButton* is clicked.
"""
self.previewWidget.zoomOut()
def accept(self):
"""
Save the settings and close the dialog.
"""
# Save the settings for this dialog.
settings = QtCore.QSettings()
settings.beginGroup(u'advanced')
settings.setValue(u'print slide text',
QtCore.QVariant(self.printSlideTextCheckBox.isChecked()))
settings.setValue(u'print file meta data',
QtCore.QVariant(self.printMetaDataCheckBox.isChecked()))
settings.setValue(u'print notes',
QtCore.QVariant(self.printNotesCheckBox.isChecked()))
settings.endGroup()
# Close the dialog.
return QtGui.QDialog.accept(self)
def reject(self):
"""
Close the dialog, do not print the service and do not save the settings.
"""
return QtGui.QDialog.reject(self)

View File

@ -23,10 +23,9 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import os
import logging
import cPickle
import logging
import os
import zipfile
log = logging.getLogger(__name__)
@ -38,6 +37,7 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
ThemeLevel
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
from openlp.core.ui.printserviceorderform import PrintServiceOrderForm
from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
split_filename
@ -67,8 +67,8 @@ class ServiceManagerList(QtGui.QTreeWidget):
class ServiceManager(QtGui.QWidget):
"""
Manages the services. This involves taking text strings from plugins and
adding them to the service. This service can then be zipped up with all
Manages the services. This involves taking text strings from plugins and
adding them to the service. This service can then be zipped up with all
the resources used into one OSZ file for use on any OpenLP v2 installation.
Also handles the UI tasks of moving things up and down etc.
"""
@ -391,7 +391,7 @@ class ServiceManager(QtGui.QWidget):
return QtGui.QMessageBox.question(self.mainwindow,
translate('OpenLP.ServiceManager', 'Modified Service'),
translate('OpenLP.ServiceManager', 'The current service has '
'been modified. Would you like to save this service?'),
'been modified. Would you like to save this service?'),
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
@ -1187,41 +1187,5 @@ class ServiceManager(QtGui.QWidget):
"""
Print a Service Order Sheet.
"""
if not self.serviceItems:
critical_error_message_box(
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())
settingDialog = PrintServiceOrderForm(self.mainwindow, self)
settingDialog.exec_()

View File

@ -78,7 +78,7 @@ class SlideController(QtGui.QWidget):
self.selectedRow = 0
self.serviceItem = None
self.alertTab = None
self.panel = QtGui.QWidget(parent.ControlSplitter)
self.panel = QtGui.QWidget(parent.controlSplitter)
self.slideList = {}
# Layout for holding panel
self.panelLayout = QtGui.QVBoxLayout(self.panel)
@ -455,7 +455,7 @@ class SlideController(QtGui.QWidget):
self.previewListWidget.resizeRowsToContents()
else:
# Sort out image heights.
width = self.parent.ControlSplitter.sizes()[self.split]
width = self.parent.controlSplitter.sizes()[self.split]
for framenumber in range(len(self.serviceItem.get_frames())):
self.previewListWidget.setRowHeight(
framenumber, width / self.ratio)
@ -584,7 +584,7 @@ class SlideController(QtGui.QWidget):
Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
[serviceItem, self.isLive, blanked, slideno])
self.slideList = {}
width = self.parent.ControlSplitter.sizes()[self.split]
width = self.parent.controlSplitter.sizes()[self.split]
self.serviceItem = serviceItem
self.previewListWidget.clear()
self.previewListWidget.setRowCount(0)

View File

@ -33,6 +33,13 @@ import re
log = logging.getLogger(__name__)
def get_reference_match(match_type):
"""
Provides the regexes and matches to use while parsing strings for bible
references.
``match_type``
The type of reference information trying to be extracted in this call.
"""
local_separator = unicode(u':;;\s*[:vV]\s*;;-;;\s*-\s*;;,;;\s*,\s*;;end'
).split(u';;') # English
# local_separator = unicode(u',;;\s*,\s*;;-;;\s*-\s*;;.;;\.;;[Ee]nde'

View File

@ -84,8 +84,6 @@ class ImageMediaItem(MediaManagerItem):
def initialise(self):
log.debug(u'initialise')
self.listView.clear()
self.listView.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection)
self.listView.setIconSize(QtCore.QSize(88, 50))
self.servicePath = os.path.join(
AppLocation.get_section_data_path(self.settingsSection),

View File

@ -151,8 +151,6 @@ class MediaMediaItem(MediaManagerItem):
return False
def initialise(self):
self.listView.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection)
self.listView.setIconSize(QtCore.QSize(88, 50))
self.loadList(SettingsManager.load_list(self.settingsSection,
self.settingsSection))

View File

@ -69,7 +69,8 @@ class ImpressController(PresentationController):
Initialise the class
"""
log.debug(u'Initialising')
PresentationController.__init__(self, plugin, u'Impress')
PresentationController.__init__(self, plugin, u'Impress',
ImpressDocument)
self.supports = [u'odp']
self.alsosupports = [u'ppt', u'pps', u'pptx', u'ppsx']
self.process = None
@ -183,14 +184,6 @@ class ImpressController(PresentationController):
except:
log.exception(u'Failed to terminate OpenOffice')
def add_doc(self, name):
"""
Called when a new Impress document is opened
"""
log.debug(u'Add Doc OpenOffice')
doc = ImpressDocument(self, name)
self.docs.append(doc)
return doc
class ImpressDocument(PresentationDocument):
"""
@ -431,35 +424,36 @@ class ImpressDocument(PresentationDocument):
def get_slide_text(self, slide_no):
"""
Returns the text on the slide
Returns the text on the slide.
``slide_no``
The slide the text is required for, starting at 1
The slide the text is required for, starting at 1
"""
return __get_text_from_slide(slide_no)
def get_slide_notes(self, slide_no):
"""
Returns the text in the slide notes.
``slide_no``
The slide the notes are required for, starting at 1
"""
return __get_text_from_page(slide_no, True)
def __get_text_from_page(self, slide_no, notes=False):
"""
Return any text extracted from the presentation page.
``notes``
A boolean. If set the method searches the notes of the slide.
"""
doc = self.document
pages = doc.getDrawPages()
text = ''
pages = self.document.getDrawPages()
page = pages.getByIndex(slide_no - 1)
if notes:
page = page.getNotesPage()
for idx in range(page.getCount()):
shape = page.getByIndex(idx)
if shape.supportsService("com.sun.star.drawing.Text"):
text += shape.getString() + '\n'
return text
def get_slide_notes(self, slide_no):
"""
Returns the text on the slide
``slide_no``
The slide the notes are required for, starting at 1
"""
doc = self.document
pages = doc.getDrawPages()
text = ''
page = pages.getByIndex(slide_no - 1)
notes = page.getNotesPage()
for idx in range(notes.getCount()):
shape = notes.getByIndex(idx)
if shape.supportsService("com.sun.star.drawing.Text"):
text += shape.getString() + '\n'
return text

View File

@ -186,7 +186,7 @@ class PresentationMediaItem(MediaManagerItem):
controller_name = self.findControllerByType(filename)
if controller_name:
controller = self.controllers[controller_name]
doc = controller.add_doc(unicode(file))
doc = controller.add_document(unicode(file))
thumb = os.path.join(doc.get_thumbnail_folder(), u'icon.png')
preview = doc.get_thumbnail_path(1, True)
if not preview and not initialLoad:
@ -226,7 +226,7 @@ class PresentationMediaItem(MediaManagerItem):
filepath = unicode(item.data(
QtCore.Qt.UserRole).toString())
for cidx in self.controllers:
doc = self.controllers[cidx].add_doc(filepath)
doc = self.controllers[cidx].add_document(filepath)
doc.presentation_deleted()
doc.close_presentation()
for row in row_list:
@ -260,7 +260,7 @@ class PresentationMediaItem(MediaManagerItem):
return False
controller = self.controllers[service_item.shortname]
(path, name) = os.path.split(filename)
doc = controller.add_doc(filename)
doc = controller.add_document(filename)
if doc.get_thumbnail_path(1, True) is None:
doc.load_presentation()
i = 1

View File

@ -59,7 +59,7 @@ class Controller(object):
self.controller = controller
if self.doc is not None:
self.shutdown()
self.doc = self.controller.add_doc(file)
self.doc = self.controller.add_document(file)
if not self.doc.load_presentation():
# Display error message to user
# Inform slidecontroller that the action failed?

View File

@ -53,7 +53,8 @@ class PowerpointController(PresentationController):
Initialise the class
"""
log.debug(u'Initialising')
PresentationController.__init__(self, plugin, u'Powerpoint')
PresentationController.__init__(self, plugin, u'Powerpoint',
PowerpointDocument)
self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
self.process = None
@ -97,14 +98,6 @@ class PowerpointController(PresentationController):
pass
self.process = None
def add_doc(self, name):
"""
Called when a new powerpoint document is opened
"""
log.debug(u'Add Doc PowerPoint')
doc = PowerpointDocument(self, name)
self.docs.append(doc)
return doc
class PowerpointDocument(PresentationDocument):
"""
@ -291,13 +284,7 @@ class PowerpointDocument(PresentationDocument):
``slide_no``
The slide the text is required for, starting at 1.
"""
text = ''
shapes = self.presentation.Slides(slide_no).Shapes
for idx in range(shapes.Count):
shape = shapes(idx + 1)
if shape.HasTextFrame:
text += shape.TextFrame.TextRange.Text + '\n'
return text
return _get_text_from_shapes(self.presentation.Slides(slide_no).Shapes)
def get_slide_notes(self, slide_no):
"""
@ -306,10 +293,19 @@ class PowerpointDocument(PresentationDocument):
``slide_no``
The slide the notes are required for, starting at 1.
"""
text = ''
shapes = self.presentation.Slides(slide_no).NotesPage.Shapes
for idx in range(shapes.Count):
shape = shapes(idx + 1)
if shape.HasTextFrame:
text += shape.TextFrame.TextRange.Text + '\n'
return text
return _get_text_from_shapes(
self.presentation.Slides(slide_no).NotesPage.Shapes)
def _get_text_from_shapes(shapes):
"""
Returns any text extracted from the shapes on a presentation slide.
``shapes``
A set of shapes to search for text.
"""
text = ''
for idx in range(shapes.Count):
shape = shapes(idx + 1)
if shape.HasTextFrame:
text += shape.TextFrame.TextRange.Text + '\n'
return text

View File

@ -49,7 +49,8 @@ class PptviewController(PresentationController):
"""
log.debug(u'Initialising')
self.process = None
PresentationController.__init__(self, plugin, u'Powerpoint Viewer')
PresentationController.__init__(self, plugin, u'Powerpoint Viewer',
PptviewDocument)
self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
def check_available(self):
@ -93,14 +94,6 @@ class PptviewController(PresentationController):
while self.docs:
self.docs[0].close_presentation()
def add_doc(self, name):
"""
Called when a new powerpoint document is opened
"""
log.debug(u'Add Doc PPTView')
doc = PptviewDocument(self, name)
self.docs.append(doc)
return doc
class PptviewDocument(PresentationDocument):
"""
@ -247,4 +240,4 @@ class PptviewDocument(PresentationDocument):
"""
Triggers the previous slide on the running presentation
"""
self.controller.process.PrevStep(self.pptid)
self.controller.process.PrevStep(self.pptid)

View File

@ -35,151 +35,6 @@ from openlp.core.utils import AppLocation
log = logging.getLogger(__name__)
class PresentationController(object):
"""
This class is used to control interactions with presentation applications
by creating a runtime environment. This is a base class for presentation
controllers to inherit from.
To create a new controller, take a copy of this file and name it so it ends
with ``controller.py``, i.e. ``foobarcontroller.py``. Make sure it inherits
:class:`~openlp.plugins.presentations.lib.presentationcontroller.PresentationController`,
and then fill in the blanks. If possible try to make sure it loads on all
platforms, usually by using :mod:``os.name`` checks, although
``__init__``, ``check_available`` and ``presentation_deleted`` should
always be implemented.
See :class:`~openlp.plugins.presentations.lib.impresscontroller.ImpressController`,
:class:`~openlp.plugins.presentations.lib.powerpointcontroller.PowerpointController` or
:class:`~openlp.plugins.presentations.lib.pptviewcontroller.PptviewController`
for examples.
**Basic Attributes**
``name``
The name that appears in the options and the media manager
``enabled``
The controller is enabled
``available``
The controller is available on this machine. Set by init via
call to check_available
``plugin``
The presentationplugin object
``supports``
The primary native file types this application supports
``alsosupports``
Other file types the application can import, although not necessarily
the first choice due to potential incompatibilities
**Hook Functions**
``kill()``
Called at system exit to clean up any running presentations
``check_available()``
Returns True if presentation application is installed/can run on this
machine
``presentation_deleted()``
Deletes presentation specific files, e.g. thumbnails
"""
log.info(u'PresentationController loaded')
def __init__(self, plugin=None, name=u'PresentationController'):
"""
This is the constructor for the presentationcontroller object. This
provides an easy way for descendent plugins to populate common data.
This method *must* be overridden, like so::
class MyPresentationController(PresentationController):
def __init__(self, plugin):
PresentationController.__init(
self, plugin, u'My Presenter App')
``plugin``
Defaults to *None*. The presentationplugin object
``name``
Name of the application, to appear in the application
"""
self.supports = []
self.alsosupports = []
self.docs = []
self.plugin = plugin
self.name = name
self.settings_section = self.plugin.settingsSection
self.available = self.check_available()
self.temp_folder = os.path.join(
AppLocation.get_section_data_path(self.settings_section), name)
self.thumbnail_folder = os.path.join(
AppLocation.get_section_data_path(self.settings_section),
u'thumbnails')
self.thumbnail_prefix = u'slide'
if not os.path.isdir(self.thumbnail_folder):
os.makedirs(self.thumbnail_folder)
if not os.path.isdir(self.temp_folder):
os.makedirs(self.temp_folder)
def enabled(self):
"""
Return whether the controller is currently enabled
"""
if self.available:
return QtCore.QSettings().value(
self.settings_section + u'/' + self.name,
QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0] == \
QtCore.Qt.Checked
else:
return False
def check_available(self):
"""
Presentation app is able to run on this machine
"""
return False
def start_process(self):
"""
Loads a running version of the presentation application in the
background.
"""
pass
def kill(self):
"""
Called at system exit to clean up any running presentations and
close the application
"""
log.debug(u'Kill')
self.close_presentation()
def add_doc(self, name):
"""
Called when a new presentation document is opened
"""
doc = PresentationDocument(self, name)
self.docs.append(doc)
return doc
def remove_doc(self, doc=None):
"""
Called to remove an open document from the collection
"""
log.debug(u'remove_doc Presentation')
if doc is None:
return
if doc in self.docs:
self.docs.remove(doc)
def close_presentation(self):
pass
class PresentationDocument(object):
"""
Base class for presentation documents to inherit from.
@ -440,4 +295,152 @@ class PresentationDocument(object):
``slide_no``
The slide the notes are required for, starting at 1
"""
return ''
return ''
class PresentationController(object):
"""
This class is used to control interactions with presentation applications
by creating a runtime environment. This is a base class for presentation
controllers to inherit from.
To create a new controller, take a copy of this file and name it so it ends
with ``controller.py``, i.e. ``foobarcontroller.py``. Make sure it inherits
:class:`~openlp.plugins.presentations.lib.presentationcontroller.PresentationController`,
and then fill in the blanks. If possible try to make sure it loads on all
platforms, usually by using :mod:``os.name`` checks, although
``__init__``, ``check_available`` and ``presentation_deleted`` should
always be implemented.
See :class:`~openlp.plugins.presentations.lib.impresscontroller.ImpressController`,
:class:`~openlp.plugins.presentations.lib.powerpointcontroller.PowerpointController` or
:class:`~openlp.plugins.presentations.lib.pptviewcontroller.PptviewController`
for examples.
**Basic Attributes**
``name``
The name that appears in the options and the media manager
``enabled``
The controller is enabled
``available``
The controller is available on this machine. Set by init via
call to check_available
``plugin``
The presentationplugin object
``supports``
The primary native file types this application supports
``alsosupports``
Other file types the application can import, although not necessarily
the first choice due to potential incompatibilities
**Hook Functions**
``kill()``
Called at system exit to clean up any running presentations
``check_available()``
Returns True if presentation application is installed/can run on this
machine
``presentation_deleted()``
Deletes presentation specific files, e.g. thumbnails
"""
log.info(u'PresentationController loaded')
def __init__(self, plugin=None, name=u'PresentationController',
document_class=PresentationDocument):
"""
This is the constructor for the presentationcontroller object. This
provides an easy way for descendent plugins to populate common data.
This method *must* be overridden, like so::
class MyPresentationController(PresentationController):
def __init__(self, plugin):
PresentationController.__init(
self, plugin, u'My Presenter App')
``plugin``
Defaults to *None*. The presentationplugin object
``name``
Name of the application, to appear in the application
"""
self.supports = []
self.alsosupports = []
self.docs = []
self.plugin = plugin
self.name = name
self.document_class = document_class
self.settings_section = self.plugin.settingsSection
self.available = self.check_available()
self.temp_folder = os.path.join(
AppLocation.get_section_data_path(self.settings_section), name)
self.thumbnail_folder = os.path.join(
AppLocation.get_section_data_path(self.settings_section),
u'thumbnails')
self.thumbnail_prefix = u'slide'
if not os.path.isdir(self.thumbnail_folder):
os.makedirs(self.thumbnail_folder)
if not os.path.isdir(self.temp_folder):
os.makedirs(self.temp_folder)
def enabled(self):
"""
Return whether the controller is currently enabled
"""
if self.available:
return QtCore.QSettings().value(
self.settings_section + u'/' + self.name,
QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0] == \
QtCore.Qt.Checked
else:
return False
def check_available(self):
"""
Presentation app is able to run on this machine
"""
return False
def start_process(self):
"""
Loads a running version of the presentation application in the
background.
"""
pass
def kill(self):
"""
Called at system exit to clean up any running presentations and
close the application
"""
log.debug(u'Kill')
self.close_presentation()
def add_document(self, name):
"""
Called when a new presentation document is opened
"""
document = self.document_class(self, name)
self.docs.append(document)
return document
def remove_doc(self, doc=None):
"""
Called to remove an open document from the collection
"""
log.debug(u'remove_doc Presentation')
if doc is None:
return
if doc in self.docs:
self.docs.remove(doc)
def close_presentation(self):
pass

View File

@ -104,6 +104,15 @@ class VerseType(object):
def retrieve_windows_encoding(recommendation=None):
"""
Determines which encoding to use on an information source. The process uses
both automated detection, which is passed to this method as a
recommendation, and user confirmation to return an encoding.
``recommendation``
A recommended encoding discovered programmatically for the user to
confirm.
"""
# map chardet result to compatible windows standard code page
codepage_mapping = {'IBM866': u'cp866', 'TIS-620': u'cp874',
'SHIFT_JIS': u'cp932', 'GB2312': u'cp936', 'HZ-GB-2312': u'cp936',

View File

@ -71,7 +71,6 @@ class Topic(BaseModel):
def init_schema(url):
"""
Setup the songs database connection and initialise the database schema.

View File

@ -36,9 +36,6 @@ from openlp.plugins.songs.lib.songimport import SongImport
log = logging.getLogger(__name__)
class OpenSongImportError(Exception):
pass
class OpenSongImport(SongImport):
"""
Import songs exported from OpenSong

View File

@ -0,0 +1,206 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>494</width>
<height>426</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QGridLayout" name="dialogLayout">
<item row="0" column="3">
<layout class="QVBoxLayout" name="settingsLayout">
<item>
<layout class="QGridLayout" name="serviceTitleLayout">
<item row="1" column="1">
<widget class="QLineEdit" name="serviceTitleLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="serviceTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Service Title:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="printSlideTextCheckBox">
<property name="text">
<string>Include slide text if avaialbe</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="printNotesCheckBox">
<property name="text">
<string>Include service item notes</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="printMetaDataCheckBox">
<property name="text">
<string>Include play lenght of media items</string>
</property>
</widget>
</item>
<item>
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="customNotesLabel">
<property name="text">
<string>&lt;b&gt;Custom Notes:&lt;/b&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="customNoteEdit"/>
</item>
</layout>
</item>
<item row="1" column="3">
<layout class="QHBoxLayout" name="buttonLayout">
<item>
<spacer name="spacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="printButton">
<property name="text">
<string>Print</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="zoomButtonLayout">
<item>
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="zoomOutButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_zoom_out.png</normaloff>:/general/general_zoom_out.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="zoomInButton">
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_zoom_in.png</normaloff>:/general/general_zoom_in.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="perviewLayout">
<item>
<widget class="QLabel" name="previewLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Preview:</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="previewWidget" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
<zorder></zorder>
</widget>
<resources>
<include location="../images/openlp-2.qrc"/>
</resources>
<connections/>
</ui>

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

View File

@ -41,6 +41,8 @@
<file>general_export.png</file>
<file>general_import.png</file>
<file>general_new.png</file>
<file>general_zoom_out.png</file>
<file>general_zoom_in.png</file>
<file>general_open.png</file>
<file>general_save.png</file>
<file>general_email.png</file>