mirror of https://gitlab.com/openlp/openlp.git
HEAD
This commit is contained in:
commit
35bcb8eabd
|
@ -27,9 +27,8 @@
|
|||
import os
|
||||
import sys
|
||||
import logging
|
||||
|
||||
from logging import FileHandler
|
||||
from optparse import OptionParser
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
log = logging.getLogger()
|
||||
|
@ -167,7 +166,7 @@ def main():
|
|||
if not os.path.exists(log_path):
|
||||
os.makedirs(log_path)
|
||||
filename = os.path.join(log_path, u'openlp.log')
|
||||
logfile = FileHandler(filename, u'w')
|
||||
logfile = logging.FileHandler(filename, u'w')
|
||||
logfile.setFormatter(logging.Formatter(
|
||||
u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
|
||||
log.addHandler(logfile)
|
||||
|
|
|
@ -174,6 +174,8 @@ def resize_image(image, width, height):
|
|||
"""
|
||||
preview = QtGui.QImage(image)
|
||||
if not preview.isNull():
|
||||
if preview.width() == width and preview.height == height:
|
||||
return preview
|
||||
preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio,
|
||||
QtCore.Qt.SmoothTransformation)
|
||||
realw = preview.width()
|
||||
|
|
|
@ -66,7 +66,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
The shortened (usually singular) name for the plugin e.g. *'Song'*
|
||||
for the Songs plugin.
|
||||
|
||||
``self.PluginNameVisible``
|
||||
``self.pluginNameVisible``
|
||||
The user visible name for a plugin which should use a suitable
|
||||
translation function.
|
||||
|
||||
|
@ -108,21 +108,17 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
self.icon = None
|
||||
if title:
|
||||
self.title = title
|
||||
self.Toolbar = None
|
||||
self.toolbar = None
|
||||
self.remoteTriggered = None
|
||||
self.ServiceItemIconName = None
|
||||
self.serviceItemIconName = None
|
||||
self.singleServiceItem = True
|
||||
self.PageLayout = QtGui.QVBoxLayout(self)
|
||||
self.PageLayout.setSpacing(0)
|
||||
self.PageLayout.setContentsMargins(4, 0, 4, 0)
|
||||
self.pageLayout = QtGui.QVBoxLayout(self)
|
||||
self.pageLayout.setSpacing(0)
|
||||
self.pageLayout.setContentsMargins(4, 0, 4, 0)
|
||||
self.requiredIcons()
|
||||
self.initPluginNameVisible()
|
||||
self.setupUi()
|
||||
self.retranslateUi()
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
pass
|
||||
|
||||
def requiredIcons(self):
|
||||
"""
|
||||
This method is called to define the icons for the plugin.
|
||||
|
@ -149,9 +145,9 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
A method to help developers easily add a toolbar to the media
|
||||
manager item.
|
||||
"""
|
||||
if self.Toolbar is None:
|
||||
self.Toolbar = OpenLPToolbar(self)
|
||||
self.PageLayout.addWidget(self.Toolbar)
|
||||
if self.toolbar is None:
|
||||
self.toolbar = OpenLPToolbar(self)
|
||||
self.pageLayout.addWidget(self.toolbar)
|
||||
|
||||
def addToolbarButton(
|
||||
self, title, tooltip, icon, slot=None, checkable=False):
|
||||
|
@ -180,13 +176,13 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
# break compatability), but it makes sense for the icon to
|
||||
# come before the tooltip (as you have to have an icon, but
|
||||
# not neccesarily a tooltip)
|
||||
self.Toolbar.addToolbarButton(title, icon, tooltip, slot, checkable)
|
||||
self.toolbar.addToolbarButton(title, icon, tooltip, slot, checkable)
|
||||
|
||||
def addToolbarSeparator(self):
|
||||
"""
|
||||
A very simple method to add a separator to the toolbar.
|
||||
"""
|
||||
self.Toolbar.addSeparator()
|
||||
self.toolbar.addSeparator()
|
||||
|
||||
def setupUi(self):
|
||||
"""
|
||||
|
@ -215,7 +211,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
unicode(translate('MediaManagerItem', 'Import %s')) %
|
||||
self.PluginNameShort,
|
||||
unicode(translate('MediaManagerItem', 'Import a %s')) %
|
||||
self.PluginNameVisible,
|
||||
self.pluginNameVisible,
|
||||
u':/general/general_import.png', self.onImportClick)
|
||||
## File Button ##
|
||||
if self.hasFileIcon:
|
||||
|
@ -223,7 +219,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
unicode(translate('MediaManagerItem', 'Load %s')) %
|
||||
self.PluginNameShort,
|
||||
unicode(translate('MediaManagerItem', 'Load a new %s')) %
|
||||
self.PluginNameVisible,
|
||||
self.pluginNameVisible,
|
||||
u':/general/general_open.png', self.onFileClick)
|
||||
## New Button ##
|
||||
if self.hasNewIcon:
|
||||
|
@ -231,7 +227,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
unicode(translate('MediaManagerItem', 'New %s')) %
|
||||
self.PluginNameShort,
|
||||
unicode(translate('MediaManagerItem', 'Add a new %s')) %
|
||||
self.PluginNameVisible,
|
||||
self.pluginNameVisible,
|
||||
u':/general/general_new.png', self.onNewClick)
|
||||
## Edit Button ##
|
||||
if self.hasEditIcon:
|
||||
|
@ -240,7 +236,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
self.PluginNameShort,
|
||||
unicode(translate(
|
||||
'MediaManagerItem', 'Edit the selected %s')) %
|
||||
self.PluginNameVisible,
|
||||
self.pluginNameVisible,
|
||||
u':/general/general_edit.png', self.onEditClick)
|
||||
## Delete Button ##
|
||||
if self.hasDeleteIcon:
|
||||
|
@ -275,61 +271,67 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
Creates the main widget for listing items the media item is tracking
|
||||
"""
|
||||
#Add the List widget
|
||||
self.ListView = self.ListViewWithDnD_class(self)
|
||||
self.ListView.uniformItemSizes = True
|
||||
self.ListView.setGeometry(QtCore.QRect(10, 100, 256, 591))
|
||||
self.ListView.setSpacing(1)
|
||||
self.ListView.setSelectionMode(
|
||||
self.listView = self.ListViewWithDnD_class(self)
|
||||
self.listView.uniformItemSizes = True
|
||||
self.listView.setGeometry(QtCore.QRect(10, 100, 256, 591))
|
||||
self.listView.setSpacing(1)
|
||||
self.listView.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.ListView.setAlternatingRowColors(True)
|
||||
self.ListView.setDragEnabled(True)
|
||||
self.ListView.setObjectName(u'%sListView' % self.PluginNameShort)
|
||||
#Add tp PageLayout
|
||||
self.PageLayout.addWidget(self.ListView)
|
||||
self.listView.setAlternatingRowColors(True)
|
||||
self.listView.setDragEnabled(True)
|
||||
self.listView.setObjectName(u'%sListView' % self.PluginNameShort)
|
||||
#Add to pageLayout
|
||||
self.pageLayout.addWidget(self.listView)
|
||||
#define and add the context menu
|
||||
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
if self.hasEditIcon:
|
||||
self.ListView.addAction(
|
||||
self.listView.addAction(
|
||||
context_menu_action(
|
||||
self.ListView, u':/general/general_edit.png',
|
||||
self.listView, u':/general/general_edit.png',
|
||||
unicode(translate('MediaManagerItem', '&Edit %s')) %
|
||||
self.PluginNameVisible,
|
||||
self.pluginNameVisible,
|
||||
self.onEditClick))
|
||||
self.ListView.addAction(context_menu_separator(self.ListView))
|
||||
self.listView.addAction(context_menu_separator(self.listView))
|
||||
if self.hasDeleteIcon:
|
||||
self.ListView.addAction(
|
||||
self.listView.addAction(
|
||||
context_menu_action(
|
||||
self.ListView, u':/general/general_delete.png',
|
||||
self.listView, u':/general/general_delete.png',
|
||||
unicode(translate('MediaManagerItem', '&Delete %s')) %
|
||||
self.PluginNameVisible,
|
||||
self.pluginNameVisible,
|
||||
self.onDeleteClick))
|
||||
self.ListView.addAction(context_menu_separator(self.ListView))
|
||||
self.ListView.addAction(
|
||||
self.listView.addAction(context_menu_separator(self.listView))
|
||||
self.listView.addAction(
|
||||
context_menu_action(
|
||||
self.ListView, u':/general/general_preview.png',
|
||||
self.listView, u':/general/general_preview.png',
|
||||
unicode(translate('MediaManagerItem', '&Preview %s')) %
|
||||
self.PluginNameVisible,
|
||||
self.pluginNameVisible,
|
||||
self.onPreviewClick))
|
||||
self.ListView.addAction(
|
||||
self.listView.addAction(
|
||||
context_menu_action(
|
||||
self.ListView, u':/general/general_live.png',
|
||||
self.listView, u':/general/general_live.png',
|
||||
translate('MediaManagerItem', '&Show Live'),
|
||||
self.onLiveClick))
|
||||
self.ListView.addAction(
|
||||
self.listView.addAction(
|
||||
context_menu_action(
|
||||
self.ListView, u':/general/general_add.png',
|
||||
self.listView, u':/general/general_add.png',
|
||||
translate('MediaManagerItem', '&Add to Service'),
|
||||
self.onAddClick))
|
||||
if self.addToServiceItem:
|
||||
self.ListView.addAction(
|
||||
self.listView.addAction(
|
||||
context_menu_action(
|
||||
self.ListView, u':/general/general_add.png',
|
||||
self.listView, u':/general/general_add.png',
|
||||
translate('MediaManagerItem',
|
||||
'&Add to selected Service Item'),
|
||||
self.onAddEditClick))
|
||||
QtCore.QObject.connect(
|
||||
self.ListView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||
self.onPreviewClick)
|
||||
if QtCore.QSettings().value(u'advanced/double click live',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
QtCore.QObject.connect(self.listView,
|
||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||
self.onLiveClick)
|
||||
else:
|
||||
QtCore.QObject.connect(self.listView,
|
||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||
self.onPreviewClick)
|
||||
|
||||
def initialise(self):
|
||||
"""
|
||||
|
@ -372,8 +374,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
count = 0
|
||||
filelist = []
|
||||
while count < self.ListView.count():
|
||||
bitem = self.ListView.item(count)
|
||||
while count < self.listView.count():
|
||||
bitem = self.listView.item(count)
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
filelist.append(filename)
|
||||
count += 1
|
||||
|
@ -383,16 +385,19 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
Validates to see if the file still exists or thumbnail is up to date
|
||||
"""
|
||||
if os.path.exists(file):
|
||||
if not os.path.exists(file):
|
||||
return False
|
||||
if os.path.exists(thumb):
|
||||
filedate = os.stat(file).st_mtime
|
||||
thumbdate = os.stat(thumb).st_mtime
|
||||
#if file updated rebuild icon
|
||||
if filedate > thumbdate:
|
||||
self.IconFromFile(file, thumb)
|
||||
return True
|
||||
return False
|
||||
self.iconFromFile(file, thumb)
|
||||
else:
|
||||
self.iconFromFile(file, thumb)
|
||||
return True
|
||||
|
||||
def IconFromFile(self, file, thumb):
|
||||
def iconFromFile(self, file, thumb):
|
||||
"""
|
||||
Create a thumbnail icon from a given file
|
||||
|
||||
|
@ -433,7 +438,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
Preview an item by building a service item then adding that service
|
||||
item to the preview slide controller.
|
||||
"""
|
||||
if not self.ListView.selectedIndexes() and not self.remoteTriggered:
|
||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||
QtGui.QMessageBox.information(self,
|
||||
translate('MediaManagerItem', 'No Items Selected'),
|
||||
translate('MediaManagerItem',
|
||||
|
@ -450,7 +455,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
Send an item live by building a service item then adding that service
|
||||
item to the live slide controller.
|
||||
"""
|
||||
if not self.ListView.selectedIndexes():
|
||||
if not self.listView.selectedIndexes():
|
||||
QtGui.QMessageBox.information(self,
|
||||
translate('MediaManagerItem', 'No Items Selected'),
|
||||
translate('MediaManagerItem',
|
||||
|
@ -466,7 +471,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
Add a selected item to the current service
|
||||
"""
|
||||
if not self.ListView.selectedIndexes() and not self.remoteTriggered:
|
||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||
QtGui.QMessageBox.information(self,
|
||||
translate('MediaManagerItem', 'No Items Selected'),
|
||||
translate('MediaManagerItem',
|
||||
|
@ -482,7 +487,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
self.parent.serviceManager.addServiceItem(service_item,
|
||||
replace=self.remoteTriggered)
|
||||
else:
|
||||
items = self.ListView.selectedIndexes()
|
||||
items = self.listView.selectedIndexes()
|
||||
for item in items:
|
||||
service_item = self.buildServiceItem(item)
|
||||
if service_item:
|
||||
|
@ -493,7 +498,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
"""
|
||||
Add a selected item to an existing item in the current service.
|
||||
"""
|
||||
if not self.ListView.selectedIndexes() and not self.remoteTriggered:
|
||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||
QtGui.QMessageBox.information(self,
|
||||
translate('MediaManagerItem', 'No items selected'),
|
||||
translate('MediaManagerItem',
|
||||
|
@ -522,10 +527,10 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
Common method for generating a service item
|
||||
"""
|
||||
service_item = ServiceItem(self.parent)
|
||||
if self.ServiceItemIconName:
|
||||
service_item.add_icon(self.ServiceItemIconName)
|
||||
if self.serviceItemIconName:
|
||||
service_item.add_icon(self.serviceItemIconName)
|
||||
else:
|
||||
service_item.add_icon(self.parent.icon)
|
||||
service_item.add_icon(self.parent.icon_path)
|
||||
if self.generateSlideData(service_item, item):
|
||||
return service_item
|
||||
else:
|
||||
|
|
|
@ -269,8 +269,22 @@ class Plugin(QtCore.QObject):
|
|||
if self.settings_tab:
|
||||
self.settingsForm.insertTab(self.settings_tab, self.weight)
|
||||
|
||||
def canDeleteTheme(self, theme):
|
||||
def usesTheme(self, theme):
|
||||
"""
|
||||
Called to ask the plugin if a theme can be deleted
|
||||
Called to find out if a plugin is currently using a theme.
|
||||
|
||||
Returns True if the theme is being used, otherwise returns False.
|
||||
"""
|
||||
return True
|
||||
return False
|
||||
|
||||
def renameTheme(self, oldTheme, newTheme):
|
||||
"""
|
||||
Renames a theme a plugin is using making the plugin use the new name.
|
||||
|
||||
``oldTheme``
|
||||
The name of the theme the plugin should stop using.
|
||||
|
||||
``newTheme``
|
||||
The new name the plugin should now use.
|
||||
"""
|
||||
pass
|
||||
|
|
|
@ -117,8 +117,7 @@ class ServiceItem(object):
|
|||
service item in the service manager.
|
||||
|
||||
``icon``
|
||||
An instance of QIcon or a string to an icon in the resource or on
|
||||
disk.
|
||||
A string to an icon in the resources or on disk.
|
||||
"""
|
||||
self.icon = icon
|
||||
self.iconic_representation = build_icon(icon)
|
||||
|
|
|
@ -71,27 +71,27 @@ class OpenLPToolbar(QtGui.QToolBar):
|
|||
``objectname``
|
||||
The name of the object, as used in `<button>.setObjectName()`.
|
||||
"""
|
||||
ToolbarButton = None
|
||||
toolbarButton = None
|
||||
if icon:
|
||||
ButtonIcon = build_icon(icon)
|
||||
buttonIcon = build_icon(icon)
|
||||
if slot and not checkable:
|
||||
ToolbarButton = self.addAction(ButtonIcon, title, slot)
|
||||
toolbarButton = self.addAction(buttonIcon, title, slot)
|
||||
else:
|
||||
ToolbarButton = self.addAction(ButtonIcon, title)
|
||||
self.icons[title] = ButtonIcon
|
||||
toolbarButton = self.addAction(buttonIcon, title)
|
||||
self.icons[title] = buttonIcon
|
||||
else:
|
||||
ToolbarButton = QtGui.QAction(title, ToolbarButton)
|
||||
self.addAction(ToolbarButton)
|
||||
QtCore.QObject.connect(ToolbarButton,
|
||||
toolbarButton = QtGui.QAction(title, toolbarButton)
|
||||
self.addAction(toolbarButton)
|
||||
QtCore.QObject.connect(toolbarButton,
|
||||
QtCore.SIGNAL(u'triggered()'), slot)
|
||||
if tooltip:
|
||||
ToolbarButton.setToolTip(tooltip)
|
||||
toolbarButton.setToolTip(tooltip)
|
||||
if checkable:
|
||||
ToolbarButton.setCheckable(True)
|
||||
QtCore.QObject.connect(ToolbarButton,
|
||||
toolbarButton.setCheckable(True)
|
||||
QtCore.QObject.connect(toolbarButton,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), slot)
|
||||
self.actions[title] = ToolbarButton
|
||||
return ToolbarButton
|
||||
self.actions[title] = toolbarButton
|
||||
return toolbarButton
|
||||
|
||||
def addToolbarSeparator(self, handle):
|
||||
"""
|
||||
|
|
|
@ -203,7 +203,7 @@ class Theme(object):
|
|||
val = element_text
|
||||
if (element.tag.find(u'Color') > 0 or
|
||||
(element.tag.find(u'BackgroundParameter') == 0 and
|
||||
type(val) == type(0))):
|
||||
isinstance(int, val))):
|
||||
# convert to a wx.Colour
|
||||
if not delphi_color_change:
|
||||
val = QtGui.QColor(
|
||||
|
|
|
@ -46,9 +46,9 @@ from maindisplay import DisplayManager
|
|||
from amendthemeform import AmendThemeForm
|
||||
from slidecontroller import SlideController
|
||||
from splashscreen import SplashScreen
|
||||
from displaytab import DisplayTab
|
||||
from generaltab import GeneralTab
|
||||
from themestab import ThemesTab
|
||||
from advancedtab import AdvancedTab
|
||||
from aboutform import AboutForm
|
||||
from pluginform import PluginForm
|
||||
from settingsform import SettingsForm
|
||||
|
|
|
@ -24,98 +24,89 @@
|
|||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import translate
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
|
||||
class Ui_AboutDialog(object):
|
||||
def setupUi(self, AboutDialog):
|
||||
AboutDialog.setObjectName(u'AboutDialog')
|
||||
AboutDialog.resize(516, 481)
|
||||
LogoIcon = QtGui.QIcon()
|
||||
LogoIcon.addPixmap(QtGui.QPixmap(u':/icon/openlp-logo-16x16.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
AboutDialog.setWindowIcon(LogoIcon)
|
||||
self.AboutDialogLayout = QtGui.QVBoxLayout(AboutDialog)
|
||||
self.AboutDialogLayout.setSpacing(8)
|
||||
self.AboutDialogLayout.setMargin(8)
|
||||
self.AboutDialogLayout.setObjectName(u'AboutDialogLayout')
|
||||
self.LogoLabel = QtGui.QLabel(AboutDialog)
|
||||
self.LogoLabel.setPixmap(
|
||||
def setupUi(self, aboutDialog):
|
||||
aboutDialog.setObjectName(u'aboutDialog')
|
||||
aboutDialog.resize(516, 481)
|
||||
aboutDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
|
||||
self.aboutDialogLayout = QtGui.QVBoxLayout(aboutDialog)
|
||||
self.aboutDialogLayout.setSpacing(8)
|
||||
self.aboutDialogLayout.setMargin(8)
|
||||
self.aboutDialogLayout.setObjectName(u'aboutDialogLayout')
|
||||
self.logoLabel = QtGui.QLabel(aboutDialog)
|
||||
self.logoLabel.setPixmap(
|
||||
QtGui.QPixmap(u':/graphics/openlp-about-logo.png'))
|
||||
self.LogoLabel.setScaledContents(False)
|
||||
self.LogoLabel.setIndent(0)
|
||||
self.LogoLabel.setObjectName(u'LogoLabel')
|
||||
self.AboutDialogLayout.addWidget(self.LogoLabel)
|
||||
self.AboutNotebook = QtGui.QTabWidget(AboutDialog)
|
||||
self.AboutNotebook.setObjectName(u'AboutNotebook')
|
||||
self.AboutTab = QtGui.QWidget()
|
||||
self.AboutTab.setObjectName(u'AboutTab')
|
||||
self.AboutTabLayout = QtGui.QVBoxLayout(self.AboutTab)
|
||||
self.AboutTabLayout.setSpacing(0)
|
||||
self.AboutTabLayout.setMargin(8)
|
||||
self.AboutTabLayout.setObjectName(u'AboutTabLayout')
|
||||
self.AboutTextEdit = QtGui.QPlainTextEdit(self.AboutTab)
|
||||
self.AboutTextEdit.setReadOnly(True)
|
||||
self.AboutTextEdit.setObjectName(u'AboutTextEdit')
|
||||
self.AboutTabLayout.addWidget(self.AboutTextEdit)
|
||||
self.AboutNotebook.addTab(self.AboutTab, '')
|
||||
self.CreditsTab = QtGui.QWidget()
|
||||
self.CreditsTab.setObjectName(u'CreditsTab')
|
||||
self.CreditsTabLayout = QtGui.QVBoxLayout(self.CreditsTab)
|
||||
self.CreditsTabLayout.setSpacing(0)
|
||||
self.CreditsTabLayout.setMargin(8)
|
||||
self.CreditsTabLayout.setObjectName(u'CreditsTabLayout')
|
||||
self.CreditsTextEdit = QtGui.QPlainTextEdit(self.CreditsTab)
|
||||
self.CreditsTextEdit.setReadOnly(True)
|
||||
self.CreditsTextEdit.setObjectName(u'CreditsTextEdit')
|
||||
self.CreditsTabLayout.addWidget(self.CreditsTextEdit)
|
||||
self.AboutNotebook.addTab(self.CreditsTab, '')
|
||||
self.LicenseTab = QtGui.QWidget()
|
||||
self.LicenseTab.setObjectName(u'LicenseTab')
|
||||
self.LicenseTabLayout = QtGui.QVBoxLayout(self.LicenseTab)
|
||||
self.LicenseTabLayout.setSpacing(8)
|
||||
self.LicenseTabLayout.setMargin(8)
|
||||
self.LicenseTabLayout.setObjectName(u'LicenseTabLayout')
|
||||
self.LicenseTextEdit = QtGui.QPlainTextEdit(self.LicenseTab)
|
||||
self.LicenseTextEdit.setReadOnly(True)
|
||||
self.LicenseTextEdit.setObjectName(u'LicenseTextEdit')
|
||||
self.LicenseTabLayout.addWidget(self.LicenseTextEdit)
|
||||
self.AboutNotebook.addTab(self.LicenseTab, '')
|
||||
self.AboutDialogLayout.addWidget(self.AboutNotebook)
|
||||
self.ButtonWidget = QtGui.QWidget(AboutDialog)
|
||||
self.ButtonWidget.setObjectName(u'ButtonWidget')
|
||||
self.ButtonWidgetLayout = QtGui.QHBoxLayout(self.ButtonWidget)
|
||||
self.ButtonWidgetLayout.setSpacing(8)
|
||||
self.ButtonWidgetLayout.setMargin(0)
|
||||
self.ButtonWidgetLayout.setObjectName(u'ButtonWidgetLayout')
|
||||
ButtonSpacer = QtGui.QSpacerItem(275, 20,
|
||||
self.logoLabel.setScaledContents(False)
|
||||
self.logoLabel.setIndent(0)
|
||||
self.logoLabel.setObjectName(u'logoLabel')
|
||||
self.aboutDialogLayout.addWidget(self.logoLabel)
|
||||
self.aboutNotebook = QtGui.QTabWidget(aboutDialog)
|
||||
self.aboutNotebook.setObjectName(u'aboutNotebook')
|
||||
self.aboutTab = QtGui.QWidget()
|
||||
self.aboutTab.setObjectName(u'aboutTab')
|
||||
self.aboutTabLayout = QtGui.QVBoxLayout(self.aboutTab)
|
||||
self.aboutTabLayout.setSpacing(0)
|
||||
self.aboutTabLayout.setMargin(8)
|
||||
self.aboutTabLayout.setObjectName(u'aboutTabLayout')
|
||||
self.aboutTextEdit = QtGui.QPlainTextEdit(self.aboutTab)
|
||||
self.aboutTextEdit.setReadOnly(True)
|
||||
self.aboutTextEdit.setObjectName(u'aboutTextEdit')
|
||||
self.aboutTabLayout.addWidget(self.aboutTextEdit)
|
||||
self.aboutNotebook.addTab(self.aboutTab, '')
|
||||
self.creditsTab = QtGui.QWidget()
|
||||
self.creditsTab.setObjectName(u'creditsTab')
|
||||
self.creditsTabLayout = QtGui.QVBoxLayout(self.creditsTab)
|
||||
self.creditsTabLayout.setSpacing(0)
|
||||
self.creditsTabLayout.setMargin(8)
|
||||
self.creditsTabLayout.setObjectName(u'creditsTabLayout')
|
||||
self.creditsTextEdit = QtGui.QPlainTextEdit(self.creditsTab)
|
||||
self.creditsTextEdit.setReadOnly(True)
|
||||
self.creditsTextEdit.setObjectName(u'creditsTextEdit')
|
||||
self.creditsTabLayout.addWidget(self.creditsTextEdit)
|
||||
self.aboutNotebook.addTab(self.creditsTab, '')
|
||||
self.licenseTab = QtGui.QWidget()
|
||||
self.licenseTab.setObjectName(u'licenseTab')
|
||||
self.licenseTabLayout = QtGui.QVBoxLayout(self.licenseTab)
|
||||
self.licenseTabLayout.setSpacing(8)
|
||||
self.licenseTabLayout.setMargin(8)
|
||||
self.licenseTabLayout.setObjectName(u'licenseTabLayout')
|
||||
self.licenseTextEdit = QtGui.QPlainTextEdit(self.licenseTab)
|
||||
self.licenseTextEdit.setReadOnly(True)
|
||||
self.licenseTextEdit.setObjectName(u'licenseTextEdit')
|
||||
self.licenseTabLayout.addWidget(self.licenseTextEdit)
|
||||
self.aboutNotebook.addTab(self.licenseTab, '')
|
||||
self.aboutDialogLayout.addWidget(self.aboutNotebook)
|
||||
self.buttonWidget = QtGui.QWidget(aboutDialog)
|
||||
self.buttonWidget.setObjectName(u'buttonWidget')
|
||||
self.buttonWidgetLayout = QtGui.QHBoxLayout(self.buttonWidget)
|
||||
self.buttonWidgetLayout.setSpacing(8)
|
||||
self.buttonWidgetLayout.setMargin(0)
|
||||
self.buttonWidgetLayout.setObjectName(u'buttonWidgetLayout')
|
||||
buttonSpacer = QtGui.QSpacerItem(275, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.ButtonWidgetLayout.addItem(ButtonSpacer)
|
||||
self.ContributeButton = QtGui.QPushButton(self.ButtonWidget)
|
||||
ContributeIcon = QtGui.QIcon()
|
||||
ContributeIcon.addPixmap(
|
||||
QtGui.QPixmap(u':/system/system_contribute.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.ContributeButton.setIcon(ContributeIcon)
|
||||
self.ContributeButton.setObjectName(u'ContributeButton')
|
||||
self.ButtonWidgetLayout.addWidget(self.ContributeButton)
|
||||
self.CloseButton = QtGui.QPushButton(self.ButtonWidget)
|
||||
CloseIcon = QtGui.QIcon()
|
||||
CloseIcon.addPixmap(QtGui.QPixmap(u':/system/system_close.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.CloseButton.setIcon(CloseIcon)
|
||||
self.CloseButton.setObjectName(u'CloseButton')
|
||||
self.ButtonWidgetLayout.addWidget(self.CloseButton)
|
||||
self.AboutDialogLayout.addWidget(self.ButtonWidget)
|
||||
self.buttonWidgetLayout.addItem(buttonSpacer)
|
||||
self.contributeButton = QtGui.QPushButton(self.buttonWidget)
|
||||
self.contributeButton.setIcon(
|
||||
build_icon(u':/system/system_contribute.png'))
|
||||
self.contributeButton.setObjectName(u'contributeButton')
|
||||
self.buttonWidgetLayout.addWidget(self.contributeButton)
|
||||
self.closeButton = QtGui.QPushButton(self.buttonWidget)
|
||||
self.closeButton.setIcon(build_icon(u':/system/system_close.png'))
|
||||
self.closeButton.setObjectName(u'closeButton')
|
||||
self.buttonWidgetLayout.addWidget(self.closeButton)
|
||||
self.aboutDialogLayout.addWidget(self.buttonWidget)
|
||||
self.retranslateUi(aboutDialog)
|
||||
self.aboutNotebook.setCurrentIndex(0)
|
||||
QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL(u'clicked()'),
|
||||
aboutDialog.close)
|
||||
QtCore.QMetaObject.connectSlotsByName(aboutDialog)
|
||||
|
||||
self.retranslateUi(AboutDialog)
|
||||
self.AboutNotebook.setCurrentIndex(0)
|
||||
QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL(u'clicked()'),
|
||||
AboutDialog.close)
|
||||
QtCore.QMetaObject.connectSlotsByName(AboutDialog)
|
||||
|
||||
def retranslateUi(self, AboutDialog):
|
||||
AboutDialog.setWindowTitle(translate('AboutForm', 'About OpenLP'))
|
||||
self.AboutTextEdit.setPlainText(translate('AboutForm',
|
||||
def retranslateUi(self, aboutDialog):
|
||||
aboutDialog.setWindowTitle(translate('AboutForm', 'About OpenLP'))
|
||||
self.aboutTextEdit.setPlainText(translate('AboutForm',
|
||||
'OpenLP <version><revision> - Open Source Lyrics '
|
||||
'Projection\n'
|
||||
'\n'
|
||||
|
@ -131,11 +122,10 @@ class Ui_AboutDialog(object):
|
|||
'like to see more free Christian software being written, please '
|
||||
'consider contributing by using the button below.'
|
||||
))
|
||||
self.AboutNotebook.setTabText(
|
||||
|
||||
self.AboutNotebook.indexOf(self.AboutTab),
|
||||
self.aboutNotebook.setTabText(
|
||||
self.aboutNotebook.indexOf(self.aboutTab),
|
||||
translate('AboutForm', 'About'))
|
||||
self.CreditsTextEdit.setPlainText(translate('AboutForm',
|
||||
self.creditsTextEdit.setPlainText(translate('AboutForm',
|
||||
'Project Lead\n'
|
||||
' Raoul "superfly" Snyman\n'
|
||||
'\n'
|
||||
|
@ -165,10 +155,10 @@ class Ui_AboutDialog(object):
|
|||
' Matthias "matthub" Hub (Mac OS X)\n'
|
||||
' Raoul "superfly" Snyman (Windows)\n'
|
||||
))
|
||||
self.AboutNotebook.setTabText(
|
||||
self.AboutNotebook.indexOf(self.CreditsTab),
|
||||
self.aboutNotebook.setTabText(
|
||||
self.aboutNotebook.indexOf(self.creditsTab),
|
||||
translate('AboutForm', 'Credits'))
|
||||
self.LicenseTextEdit.setPlainText(translate('AboutForm',
|
||||
self.licenseTextEdit.setPlainText(translate('AboutForm',
|
||||
'Copyright \xa9 2004-2010 Raoul Snyman\n'
|
||||
'Portions copyright \xa9 2004-2010 '
|
||||
'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri, '
|
||||
|
@ -557,8 +547,8 @@ class Ui_AboutDialog(object):
|
|||
'linking proprietary applications with the library. If this is '
|
||||
'what you want to do, use the GNU Lesser General Public License '
|
||||
'instead of this License.'))
|
||||
self.AboutNotebook.setTabText(
|
||||
self.AboutNotebook.indexOf(self.LicenseTab),
|
||||
self.aboutNotebook.setTabText(
|
||||
self.aboutNotebook.indexOf(self.licenseTab),
|
||||
translate('AboutForm', 'License'))
|
||||
self.ContributeButton.setText(translate('AboutForm', 'Contribute'))
|
||||
self.CloseButton.setText(translate('AboutForm', 'Close'))
|
||||
self.contributeButton.setText(translate('AboutForm', 'Contribute'))
|
||||
self.closeButton.setText(translate('AboutForm', 'Close'))
|
||||
|
|
|
@ -40,7 +40,7 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog):
|
|||
QtGui.QDialog.__init__(self, parent)
|
||||
self.applicationVersion = applicationVersion
|
||||
self.setupUi(self)
|
||||
about_text = self.AboutTextEdit.toPlainText()
|
||||
about_text = self.aboutTextEdit.toPlainText()
|
||||
about_text = about_text.replace(u'<version>',
|
||||
self.applicationVersion[u'version'])
|
||||
if self.applicationVersion[u'build']:
|
||||
|
@ -49,8 +49,8 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog):
|
|||
else:
|
||||
build_text = u''
|
||||
about_text = about_text.replace(u'<revision>', build_text)
|
||||
self.AboutTextEdit.setPlainText(about_text)
|
||||
QtCore.QObject.connect(self.ContributeButton,
|
||||
self.aboutTextEdit.setPlainText(about_text)
|
||||
QtCore.QObject.connect(self.contributeButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onContributeButtonClicked)
|
||||
|
||||
def onContributeButtonClicked(self):
|
||||
|
|
|
@ -0,0 +1,190 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
||||
# Thompson, Jon Tibble, Carsten Tinggaard #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`advancedtab` provides an advanced settings facility.
|
||||
"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate
|
||||
|
||||
class AdvancedTab(SettingsTab):
|
||||
"""
|
||||
The :class:`AdvancedTab` manages the advanced settings tab including the UI
|
||||
and the loading and saving of the displayed settings.
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
Initialise the settings tab
|
||||
"""
|
||||
SettingsTab.__init__(self, u'Advanced')
|
||||
|
||||
def setupUi(self):
|
||||
"""
|
||||
Configure the UI elements for the tab.
|
||||
"""
|
||||
self.setObjectName(u'AdvancedTab')
|
||||
self.tabTitleVisible = translate('AdvancedTab', 'Advanced')
|
||||
self.advancedTabLayout = QtGui.QHBoxLayout(self)
|
||||
self.advancedTabLayout.setSpacing(8)
|
||||
self.advancedTabLayout.setMargin(8)
|
||||
self.leftWidget = QtGui.QWidget(self)
|
||||
self.leftLayout = QtGui.QVBoxLayout(self.leftWidget)
|
||||
self.leftLayout.setSpacing(8)
|
||||
self.leftLayout.setMargin(0)
|
||||
self.uiGroupBox = QtGui.QGroupBox(self.leftWidget)
|
||||
self.uiGroupBox.setObjectName(u'uiGroupBox')
|
||||
self.uiLayout = QtGui.QVBoxLayout(self.uiGroupBox)
|
||||
self.uiLayout.setSpacing(8)
|
||||
self.uiLayout.setMargin(6)
|
||||
self.uiLayout.setObjectName(u'uiLayout')
|
||||
self.recentLayout = QtGui.QHBoxLayout()
|
||||
self.recentLayout.setSpacing(8)
|
||||
self.recentLayout.setMargin(0)
|
||||
self.recentLayout.setObjectName(u'recentLayout')
|
||||
self.recentLabel = QtGui.QLabel(self.uiGroupBox)
|
||||
self.recentLabel.setObjectName(u'recentLabel')
|
||||
self.recentLayout.addWidget(self.recentLabel)
|
||||
self.recentSpinBox = QtGui.QSpinBox(self.uiGroupBox)
|
||||
self.recentSpinBox.setObjectName(u'recentSpinBox')
|
||||
self.recentSpinBox.setMinimum(0)
|
||||
self.recentLayout.addWidget(self.recentSpinBox)
|
||||
self.recentSpacer = QtGui.QSpacerItem(50, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.recentLayout.addItem(self.recentSpacer)
|
||||
self.uiLayout.addLayout(self.recentLayout)
|
||||
self.mediaPluginCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||
self.mediaPluginCheckBox.setObjectName(u'mediaPluginCheckBox')
|
||||
self.uiLayout.addWidget(self.mediaPluginCheckBox)
|
||||
self.doubleClickLiveCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||
self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox')
|
||||
self.uiLayout.addWidget(self.doubleClickLiveCheckBox)
|
||||
self.leftLayout.addWidget(self.uiGroupBox)
|
||||
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget)
|
||||
# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
|
||||
# self.sharedDirGroupBox.setGeometry(QtCore.QRect(0, 65, 500, 85))
|
||||
# self.sharedDirGroupBox.setMaximumSize(QtCore.QSize(500, 85))
|
||||
# self.sharedDirLayout = QtGui.QVBoxLayout(self.sharedDirGroupBox)
|
||||
# self.sharedDirLayout.setSpacing(8)
|
||||
# self.sharedDirLayout.setMargin(8)
|
||||
# self.sharedCheckBox = QtGui.QCheckBox(self.sharedDirGroupBox)
|
||||
# self.sharedCheckBox.setObjectName(u'sharedCheckBox')
|
||||
# self.sharedDirLayout.addWidget(self.sharedCheckBox)
|
||||
# self.sharedSubLayout = QtGui.QHBoxLayout()
|
||||
# self.sharedSubLayout.setSpacing(8)
|
||||
# self.sharedSubLayout.setMargin(0)
|
||||
# self.sharedLabel = QtGui.QLabel(self.sharedDirGroupBox)
|
||||
# self.sharedLabel.setObjectName(u'sharedLabel')
|
||||
# self.sharedSubLayout.addWidget(self.sharedLabel)
|
||||
# self.sharedLineEdit = QtGui.QLineEdit(self.sharedDirGroupBox)
|
||||
# self.sharedLineEdit.setObjectName(u'sharedLineEdit')
|
||||
# self.sharedSubLayout.addWidget(self.sharedLineEdit)
|
||||
# self.sharedPushButton = QtGui.QPushButton(self.sharedDirGroupBox)
|
||||
# self.sharedPushButton.setObjectName(u'sharedPushButton')
|
||||
# self.sharedSubLayout.addWidget(self.sharedPushButton)
|
||||
# self.sharedDirLayout.addLayout(self.sharedSubLayout)
|
||||
# self.leftLayout.addWidget(self.sharedDirGroupBox)
|
||||
self.leftSpacer = QtGui.QSpacerItem(20, 40,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.leftLayout.addItem(self.leftSpacer)
|
||||
self.advancedTabLayout.addWidget(self.leftWidget)
|
||||
self.rightWidget = QtGui.QWidget(self)
|
||||
self.rightLayout = QtGui.QVBoxLayout(self.rightWidget)
|
||||
self.rightLayout.setSpacing(8)
|
||||
self.rightLayout.setMargin(0)
|
||||
# self.databaseGroupBox = QtGui.QGroupBox(self.rightWidget)
|
||||
# self.databaseGroupBox.setObjectName(u'databaseGroupBox')
|
||||
# self.databaseGroupBox.setEnabled(False)
|
||||
# self.databaseLayout = QtGui.QVBoxLayout(self.databaseGroupBox)
|
||||
# self.databaseLayout.setSpacing(8)
|
||||
# self.databaseLayout.setMargin(8)
|
||||
# self.rightLayout.addWidget(self.databaseGroupBox)
|
||||
self.rightSpacer = QtGui.QSpacerItem(20, 40,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
|
||||
self.rightLayout.addItem(self.rightSpacer)
|
||||
self.advancedTabLayout.addWidget(self.rightWidget)
|
||||
# QtCore.QObject.connect(self.sharedCheckBox,
|
||||
# QtCore.SIGNAL(u'stateChanged(int)'), self.onSharedCheckBoxChanged)
|
||||
|
||||
def retranslateUi(self):
|
||||
"""
|
||||
Setup the interface translation strings.
|
||||
"""
|
||||
self.uiGroupBox.setTitle(translate('AdvancedTab', 'UI Settings'))
|
||||
self.recentLabel.setText(
|
||||
translate('AdvancedTab', 'Number of recent files to display:'))
|
||||
self.mediaPluginCheckBox.setText(translate('AdvancedTab',
|
||||
'Save currently selected media manager plugin'))
|
||||
self.doubleClickLiveCheckBox.setText(translate('AdvancedTab',
|
||||
'Double-click to send items straight to live (requires restart)'))
|
||||
# self.sharedDirGroupBox.setTitle(
|
||||
# translate('AdvancedTab', 'Central Data Store'))
|
||||
# self.sharedCheckBox.setText(
|
||||
# translate('AdvancedTab', 'Enable a shared data location'))
|
||||
# self.sharedLabel.setText(translate('AdvancedTab', 'Store location:'))
|
||||
# self.sharedPushButton.setText(translate('AdvancedTab', 'Browse...'))
|
||||
# self.databaseGroupBox.setTitle(translate('AdvancedTab', 'Databases'))
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
Load settings from disk.
|
||||
"""
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
# The max recent files value does not have an interface and so never
|
||||
# gets actually stored in the settings therefore the default value of
|
||||
# 20 will always be used.
|
||||
self.recentSpinBox.setMaximum(QtCore.QSettings().value(
|
||||
u'max recent files', QtCore.QVariant(20)).toInt()[0])
|
||||
self.recentSpinBox.setValue(settings.value(u'recent file count',
|
||||
QtCore.QVariant(4)).toInt()[0])
|
||||
self.mediaPluginCheckBox.setChecked(
|
||||
settings.value(u'save current plugin',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.doubleClickLiveCheckBox.setChecked(
|
||||
settings.value(u'double click live',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
settings.endGroup()
|
||||
|
||||
def save(self):
|
||||
"""
|
||||
Save settings to disk.
|
||||
"""
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue(u'recent file count',
|
||||
QtCore.QVariant(self.recentSpinBox.value()))
|
||||
settings.setValue(u'save current plugin',
|
||||
QtCore.QVariant(self.mediaPluginCheckBox.isChecked()))
|
||||
settings.setValue(u'double click live',
|
||||
QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked()))
|
||||
settings.endGroup()
|
||||
|
||||
def onSharedCheckBoxChanged(self, checked):
|
||||
"""
|
||||
Enables the widgets to allow a shared data location
|
||||
"""
|
||||
self.sharedLabel.setEnabled(checked)
|
||||
self.sharedTextEdit.setEnabled(checked)
|
||||
self.sharedPushButton.setEnabled(checked)
|
|
@ -130,9 +130,9 @@ class Ui_AmendThemeDialog(object):
|
|||
self.ImageLineEdit.setObjectName(u'ImageLineEdit')
|
||||
self.horizontalLayout_2.addWidget(self.ImageLineEdit)
|
||||
self.ImageToolButton = QtGui.QToolButton(self.ImageFilenameWidget)
|
||||
icon1 = build_icon(u':/general/general_open.png')
|
||||
self.ImageToolButton.setIcon(icon1)
|
||||
self.ImageToolButton.setIcon(build_icon(u':/general/general_open.png'))
|
||||
self.ImageToolButton.setObjectName(u'ImageToolButton')
|
||||
self.ImageToolButton.setAutoRaise(True)
|
||||
self.horizontalLayout_2.addWidget(self.ImageToolButton)
|
||||
self.BackgroundLayout.setWidget(4, QtGui.QFormLayout.FieldRole,
|
||||
self.ImageFilenameWidget)
|
||||
|
|
|
@ -36,15 +36,21 @@ from amendthemedialog import Ui_AmendThemeDialog
|
|||
log = logging.getLogger(u'AmendThemeForm')
|
||||
|
||||
class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
|
||||
"""
|
||||
The :class:`AmendThemeForm` class provides the user interface to set up
|
||||
new and edit existing themes.
|
||||
"""
|
||||
def __init__(self, parent):
|
||||
"""
|
||||
Initialise the theme editor user interface
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.thememanager = parent
|
||||
self.path = None
|
||||
self.theme = ThemeXML()
|
||||
self.setupUi(self)
|
||||
#define signals
|
||||
#Buttons
|
||||
# define signals
|
||||
# Buttons
|
||||
QtCore.QObject.connect(self.Color1PushButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked)
|
||||
QtCore.QObject.connect(self.Color2PushButton,
|
||||
|
@ -59,8 +65,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
QtCore.QObject.connect(self.ShadowColorPushButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked)
|
||||
QtCore.QObject.connect(self.ImageToolButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onImageToolButtonClicked)
|
||||
#Combo boxes
|
||||
QtCore.SIGNAL(u'clicked()'), self.onImageToolButtonClicked)
|
||||
# Combo boxes
|
||||
QtCore.QObject.connect(self.BackgroundComboBox,
|
||||
QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected)
|
||||
QtCore.QObject.connect(self.BackgroundTypeComboBox,
|
||||
|
@ -82,16 +88,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected)
|
||||
QtCore.QObject.connect(self.VerticalComboBox,
|
||||
QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected)
|
||||
#Spin boxes
|
||||
# Spin boxes
|
||||
QtCore.QObject.connect(self.FontMainSizeSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onFontMainSizeSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.FontFooterSizeSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onFontFooterSizeSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.FontMainDefaultCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onFontMainDefaultCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.FontMainXSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'), self.onFontMainXSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.FontMainYSpinBox,
|
||||
|
@ -108,9 +111,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
QtCore.QObject.connect(self.FontMainLineSpacingSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onFontMainLineSpacingSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.FontFooterDefaultCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onFontFooterDefaultCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.FontFooterXSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onFontFooterXSpinBoxChanged)
|
||||
|
@ -123,16 +123,23 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
QtCore.QObject.connect(self.FontFooterHeightSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onFontFooterHeightSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.OutlineCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.ShadowSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onShadowSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.ShadowCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.OutlineSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onOutlineSpinBoxChanged)
|
||||
# CheckBoxes
|
||||
QtCore.QObject.connect(self.FontMainDefaultCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onFontMainDefaultCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.FontFooterDefaultCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onFontFooterDefaultCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.OutlineCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.ShadowCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.SlideTransitionCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onSlideTransitionCheckBoxChanged)
|
||||
|
|
|
@ -1,244 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
||||
# Thompson, Jon Tibble, Carsten Tinggaard #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
|
||||
from openlp.core.lib import SettingsTab, Receiver, translate
|
||||
|
||||
class DisplayTab(SettingsTab):
|
||||
"""
|
||||
Provide the UI for managing display related settings
|
||||
"""
|
||||
def __init__(self, screens):
|
||||
"""
|
||||
Initialise the display tab from a SettingsTab
|
||||
"""
|
||||
self.screens = screens
|
||||
SettingsTab.__init__(self, u'Display')
|
||||
|
||||
def setupUi(self):
|
||||
"""
|
||||
Set up the UI widgets to show the settings
|
||||
"""
|
||||
self.tabTitleVisible = translate('DisplayTab', 'Displays')
|
||||
self.layoutWidget = QtGui.QWidget(self)
|
||||
self.layoutWidget.setGeometry(QtCore.QRect(0, 40, 241, 79))
|
||||
self.layoutWidget.setObjectName(u'layoutWidget')
|
||||
self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
|
||||
self.verticalLayout.setObjectName(u'verticalLayout')
|
||||
self.CurrentGroupBox = QtGui.QGroupBox(self.layoutWidget)
|
||||
self.CurrentGroupBox.setObjectName(u'CurrentGroupBox')
|
||||
self.horizontalLayout = QtGui.QHBoxLayout(self.CurrentGroupBox)
|
||||
self.horizontalLayout.setObjectName(u'horizontalLayout')
|
||||
self.verticalLayout_6 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_6.setObjectName(u'verticalLayout_6')
|
||||
self.XLabel = QtGui.QLabel(self.CurrentGroupBox)
|
||||
self.XLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.XLabel.setObjectName(u'XLabel')
|
||||
self.verticalLayout_6.addWidget(self.XLabel)
|
||||
self.Xpos = QtGui.QLabel(self.CurrentGroupBox)
|
||||
self.Xpos.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.Xpos.setObjectName(u'Xpos')
|
||||
self.verticalLayout_6.addWidget(self.Xpos)
|
||||
self.horizontalLayout.addLayout(self.verticalLayout_6)
|
||||
self.verticalLayout_7 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_7.setObjectName(u'verticalLayout_7')
|
||||
self.YLabel = QtGui.QLabel(self.CurrentGroupBox)
|
||||
self.YLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.YLabel.setObjectName(u'YLabel')
|
||||
self.verticalLayout_7.addWidget(self.YLabel)
|
||||
self.Ypos = QtGui.QLabel(self.CurrentGroupBox)
|
||||
self.Ypos.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.Ypos.setObjectName(u'Ypos')
|
||||
self.verticalLayout_7.addWidget(self.Ypos)
|
||||
self.horizontalLayout.addLayout(self.verticalLayout_7)
|
||||
self.verticalLayout_9 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_9.setObjectName(u'verticalLayout_9')
|
||||
self.HeightLabel = QtGui.QLabel(self.CurrentGroupBox)
|
||||
self.HeightLabel.setMaximumSize(QtCore.QSize(100, 16777215))
|
||||
self.HeightLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.HeightLabel.setObjectName(u'HeightLabel')
|
||||
self.verticalLayout_9.addWidget(self.HeightLabel)
|
||||
self.Height = QtGui.QLabel(self.CurrentGroupBox)
|
||||
self.Height.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.Height.setObjectName(u'Height')
|
||||
self.verticalLayout_9.addWidget(self.Height)
|
||||
self.horizontalLayout.addLayout(self.verticalLayout_9)
|
||||
self.verticalLayout_8 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_8.setObjectName(u'verticalLayout_8')
|
||||
self.WidthLabel = QtGui.QLabel(self.CurrentGroupBox)
|
||||
self.WidthLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.WidthLabel.setObjectName(u'WidthLabel')
|
||||
self.verticalLayout_8.addWidget(self.WidthLabel)
|
||||
self.Width = QtGui.QLabel(self.CurrentGroupBox)
|
||||
self.Width.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.Width.setObjectName(u'Width')
|
||||
self.verticalLayout_8.addWidget(self.Width)
|
||||
self.horizontalLayout.addLayout(self.verticalLayout_8)
|
||||
self.verticalLayout.addWidget(self.CurrentGroupBox)
|
||||
self.CurrentGroupBox_2 = QtGui.QGroupBox(self)
|
||||
self.CurrentGroupBox_2.setGeometry(QtCore.QRect(0, 130, 248, 87))
|
||||
self.CurrentGroupBox_2.setMaximumSize(QtCore.QSize(500, 16777215))
|
||||
self.CurrentGroupBox_2.setObjectName(u'CurrentGroupBox_2')
|
||||
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.CurrentGroupBox_2)
|
||||
self.horizontalLayout_2.setObjectName(u'horizontalLayout_2')
|
||||
self.verticalLayout_2 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_2.setObjectName(u'verticalLayout_2')
|
||||
self.XAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
|
||||
self.XAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.XAmendLabel.setObjectName(u'XAmendLabel')
|
||||
self.verticalLayout_2.addWidget(self.XAmendLabel)
|
||||
self.XposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
|
||||
self.XposEdit.setMaximumSize(QtCore.QSize(50, 16777215))
|
||||
self.XposEdit.setMaxLength(4)
|
||||
self.XposEdit.setObjectName(u'XposEdit')
|
||||
self.verticalLayout_2.addWidget(self.XposEdit)
|
||||
self.horizontalLayout_2.addLayout(self.verticalLayout_2)
|
||||
self.verticalLayout_3 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_3.setObjectName(u'verticalLayout_3')
|
||||
self.YAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
|
||||
self.YAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.YAmendLabel.setObjectName(u'YAmendLabel')
|
||||
self.verticalLayout_3.addWidget(self.YAmendLabel)
|
||||
self.YposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
|
||||
self.YposEdit.setMaximumSize(QtCore.QSize(50, 16777215))
|
||||
self.YposEdit.setMaxLength(4)
|
||||
self.YposEdit.setObjectName(u'YposEdit')
|
||||
self.verticalLayout_3.addWidget(self.YposEdit)
|
||||
self.horizontalLayout_2.addLayout(self.verticalLayout_3)
|
||||
self.verticalLayout_4 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_4.setObjectName(u'verticalLayout_4')
|
||||
self.HeightAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
|
||||
self.HeightAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.HeightAmendLabel.setObjectName(u'HeightAmendLabel')
|
||||
self.verticalLayout_4.addWidget(self.HeightAmendLabel)
|
||||
self.HeightEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
|
||||
self.HeightEdit.setMaximumSize(QtCore.QSize(50, 16777215))
|
||||
self.HeightEdit.setMaxLength(4)
|
||||
self.HeightEdit.setObjectName(u'HeightEdit')
|
||||
self.verticalLayout_4.addWidget(self.HeightEdit)
|
||||
self.horizontalLayout_2.addLayout(self.verticalLayout_4)
|
||||
self.verticalLayout_5 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_5.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
|
||||
self.verticalLayout_5.setObjectName(u'verticalLayout_5')
|
||||
self.WidthAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
|
||||
self.WidthAmendLabel.setMaximumSize(QtCore.QSize(100, 16777215))
|
||||
self.WidthAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.WidthAmendLabel.setObjectName(u'WidthAmendLabel')
|
||||
self.verticalLayout_5.addWidget(self.WidthAmendLabel)
|
||||
self.WidthEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
|
||||
self.WidthEdit.setMaximumSize(QtCore.QSize(60, 16777215))
|
||||
self.WidthEdit.setObjectName(u'WidthEdit')
|
||||
self.verticalLayout_5.addWidget(self.WidthEdit)
|
||||
self.horizontalLayout_2.addLayout(self.verticalLayout_5)
|
||||
self.OverrideCheckBox = QtGui.QCheckBox(self)
|
||||
self.OverrideCheckBox.setGeometry(QtCore.QRect(0, 10, 191, 23))
|
||||
self.OverrideCheckBox.setObjectName(u'OverrideCheckBox')
|
||||
QtCore.QMetaObject.connectSlotsByName(self)
|
||||
QtCore.QObject.connect(self.OverrideCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onOverrideCheckBoxChanged)
|
||||
|
||||
def retranslateUi(self):
|
||||
"""
|
||||
Provide i18n support for this UI
|
||||
"""
|
||||
#self.setWindowTitle(translate('DisplayTab', 'Amend Display Settings'))
|
||||
self.CurrentGroupBox.setTitle(
|
||||
translate('DisplayTab', 'Default Settings'))
|
||||
self.XLabel.setText(translate('DisplayTab', 'X:'))
|
||||
self.Xpos.setText(u'0')
|
||||
self.YLabel.setText(translate('DisplayTab', 'Y:'))
|
||||
self.Ypos.setText(u'0')
|
||||
self.HeightLabel.setText(translate('DisplayTab', 'Height:'))
|
||||
self.Height.setText(u'0')
|
||||
self.WidthLabel.setText(translate('DisplayTab', 'Width:'))
|
||||
self.Width.setText(u'0')
|
||||
self.CurrentGroupBox_2.setTitle(
|
||||
translate('DisplayTab', 'Custom Settings'))
|
||||
self.XAmendLabel.setText(translate('DisplayTab', 'X:'))
|
||||
self.YAmendLabel.setText(translate('DisplayTab', 'Y:'))
|
||||
self.HeightAmendLabel.setText(translate('DisplayTab', 'Height:'))
|
||||
self.WidthAmendLabel.setText(translate('DisplayTab', 'Width'))
|
||||
self.OverrideCheckBox.setText(
|
||||
translate('DisplayTab', 'Override display settings'))
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
Load current display settings
|
||||
"""
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
self.Xpos.setText(unicode(self.screens.current[u'size'].x()))
|
||||
self.Ypos.setText(unicode(self.screens.current[u'size'].y()))
|
||||
self.Height.setText(unicode(self.screens.current[u'size'].height()))
|
||||
self.Width.setText(unicode(self.screens.current[u'size'].width()))
|
||||
xpos = settings.value(u'x position',
|
||||
QtCore.QVariant(self.screens.current[u'size'].x())).toString()
|
||||
self.XposEdit.setText(xpos)
|
||||
ypos = settings.value(u'y position',
|
||||
QtCore.QVariant(self.screens.current[u'size'].y())).toString()
|
||||
self.YposEdit.setText(ypos)
|
||||
height = settings.value(u'height',
|
||||
QtCore.QVariant(self.screens.current[u'size'].height())).toString()
|
||||
self.HeightEdit.setText(height)
|
||||
width = settings.value(u'width',
|
||||
QtCore.QVariant(self.screens.current[u'size'].width())).toString()
|
||||
self.WidthEdit.setText(width)
|
||||
self.amend_display = settings.value(u'amend display',
|
||||
QtCore.QVariant(False)).toBool()
|
||||
self.OverrideCheckBox.setChecked(self.amend_display)
|
||||
self.amend_display_start = self.amend_display
|
||||
|
||||
def onOverrideCheckBoxChanged(self, check_state):
|
||||
self.amend_display = False
|
||||
# we have a set value convert to True/False
|
||||
if check_state == QtCore.Qt.Checked:
|
||||
self.amend_display = True
|
||||
|
||||
def save(self):
|
||||
"""
|
||||
Save chosen settings
|
||||
"""
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue('x position', QtCore.QVariant(self.XposEdit.text()))
|
||||
settings.setValue('y position', QtCore.QVariant(self.YposEdit.text()))
|
||||
settings.setValue('height', QtCore.QVariant(self.HeightEdit.text()))
|
||||
settings.setValue('width', QtCore.QVariant(self.WidthEdit.text()))
|
||||
settings.setValue('amend display', QtCore.QVariant(self.amend_display))
|
||||
self.postSetUp()
|
||||
|
||||
def postSetUp(self):
|
||||
self.screens.override[u'size'] = QtCore.QRect(int(self.XposEdit.text()),
|
||||
int(self.YposEdit.text()), int(self.WidthEdit.text()),
|
||||
int(self.HeightEdit.text()))
|
||||
if self.amend_display:
|
||||
self.screens.set_override_display()
|
||||
else:
|
||||
self.screens.reset_current_display()
|
||||
#only trigger event if data has changed in this edit session
|
||||
if self.amend_display_start != self.amend_display:
|
||||
self.amend_display_start = self.amend_display
|
||||
Receiver.send_message(u'config_screen_changed')
|
|
@ -36,7 +36,7 @@ class GeneralTab(SettingsTab):
|
|||
Initialise the general settings tab
|
||||
"""
|
||||
self.screens = screens
|
||||
self.MonitorNumber = 0
|
||||
self.monitorNumber = 0
|
||||
SettingsTab.__init__(self, u'General')
|
||||
|
||||
def preLoad(self):
|
||||
|
@ -46,10 +46,10 @@ class GeneralTab(SettingsTab):
|
|||
"""
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
self.MonitorNumber = settings.value(u'monitor',
|
||||
self.monitorNumber = settings.value(u'monitor',
|
||||
QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
|
||||
self.screens.set_current_display(self.MonitorNumber)
|
||||
self.screens.monitor_number = self.MonitorNumber
|
||||
self.screens.set_current_display(self.monitorNumber)
|
||||
self.screens.monitor_number = self.monitorNumber
|
||||
self.screens.display = settings.value(
|
||||
u'display on monitor', QtCore.QVariant(True)).toBool()
|
||||
settings.endGroup()
|
||||
|
@ -64,13 +64,12 @@ class GeneralTab(SettingsTab):
|
|||
self.GeneralLayout.setSpacing(8)
|
||||
self.GeneralLayout.setMargin(8)
|
||||
self.GeneralLayout.setObjectName(u'GeneralLayout')
|
||||
self.GeneralLeftWidget = QtGui.QWidget(self)
|
||||
self.GeneralLeftWidget.setObjectName(u'GeneralLeftWidget')
|
||||
self.GeneralLeftLayout = QtGui.QVBoxLayout(self.GeneralLeftWidget)
|
||||
self.GeneralLeftLayout = QtGui.QVBoxLayout()
|
||||
self.GeneralLeftLayout.setObjectName(u'GeneralLeftLayout')
|
||||
self.GeneralLeftLayout.setSpacing(8)
|
||||
self.GeneralLeftLayout.setMargin(0)
|
||||
self.MonitorGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget)
|
||||
self.GeneralLayout.addLayout(self.GeneralLeftLayout)
|
||||
self.MonitorGroupBox = QtGui.QGroupBox(self)
|
||||
self.MonitorGroupBox.setObjectName(u'MonitorGroupBox')
|
||||
self.MonitorLayout = QtGui.QVBoxLayout(self.MonitorGroupBox)
|
||||
self.MonitorLayout.setSpacing(8)
|
||||
|
@ -87,7 +86,7 @@ class GeneralTab(SettingsTab):
|
|||
self.DisplayOnMonitorCheck.setObjectName(u'MonitorComboBox')
|
||||
self.MonitorLayout.addWidget(self.DisplayOnMonitorCheck)
|
||||
self.GeneralLeftLayout.addWidget(self.MonitorGroupBox)
|
||||
self.StartupGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget)
|
||||
self.StartupGroupBox = QtGui.QGroupBox(self)
|
||||
self.StartupGroupBox.setObjectName(u'StartupGroupBox')
|
||||
self.StartupLayout = QtGui.QVBoxLayout(self.StartupGroupBox)
|
||||
self.StartupLayout.setSpacing(8)
|
||||
|
@ -103,7 +102,7 @@ class GeneralTab(SettingsTab):
|
|||
self.ShowSplashCheckBox.setObjectName(u'ShowSplashCheckBox')
|
||||
self.StartupLayout.addWidget(self.ShowSplashCheckBox)
|
||||
self.GeneralLeftLayout.addWidget(self.StartupGroupBox)
|
||||
self.SettingsGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget)
|
||||
self.SettingsGroupBox = QtGui.QGroupBox(self)
|
||||
self.SettingsGroupBox.setObjectName(u'SettingsGroupBox')
|
||||
self.SettingsLayout = QtGui.QVBoxLayout(self.SettingsGroupBox)
|
||||
self.SettingsLayout.setSpacing(8)
|
||||
|
@ -120,14 +119,12 @@ class GeneralTab(SettingsTab):
|
|||
self.GeneralLeftSpacer = QtGui.QSpacerItem(20, 40,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.GeneralLeftLayout.addItem(self.GeneralLeftSpacer)
|
||||
self.GeneralLayout.addWidget(self.GeneralLeftWidget)
|
||||
self.GeneralRightWidget = QtGui.QWidget(self)
|
||||
self.GeneralRightWidget.setObjectName(u'GeneralRightWidget')
|
||||
self.GeneralRightLayout = QtGui.QVBoxLayout(self.GeneralRightWidget)
|
||||
self.GeneralRightLayout = QtGui.QVBoxLayout()
|
||||
self.GeneralRightLayout.setSpacing(8)
|
||||
self.GeneralRightLayout.setMargin(0)
|
||||
self.GeneralRightLayout.setObjectName(u'GeneralRightLayout')
|
||||
self.CCLIGroupBox = QtGui.QGroupBox(self.GeneralRightWidget)
|
||||
self.GeneralLayout.addLayout(self.GeneralRightLayout)
|
||||
self.CCLIGroupBox = QtGui.QGroupBox(self)
|
||||
self.CCLIGroupBox.setObjectName(u'CCLIGroupBox')
|
||||
self.CCLILayout = QtGui.QGridLayout(self.CCLIGroupBox)
|
||||
self.CCLILayout.setMargin(8)
|
||||
|
@ -153,10 +150,137 @@ class GeneralTab(SettingsTab):
|
|||
self.PasswordEdit.setObjectName(u'PasswordEdit')
|
||||
self.CCLILayout.addWidget(self.PasswordEdit, 2, 1, 1, 1)
|
||||
self.GeneralRightLayout.addWidget(self.CCLIGroupBox)
|
||||
# Moved here from display tab
|
||||
self.displayGroupBox = QtGui.QGroupBox(self)
|
||||
self.displayGroupBox.setObjectName(u'displayGroupBox')
|
||||
self.displayLayout = QtGui.QVBoxLayout(self.displayGroupBox)
|
||||
self.displayLayout.setSpacing(8)
|
||||
self.displayLayout.setMargin(8)
|
||||
self.displayLayout.setObjectName(u'displayLayout')
|
||||
self.currentLayout = QtGui.QHBoxLayout()
|
||||
self.currentLayout.setSpacing(8)
|
||||
self.currentLayout.setMargin(0)
|
||||
self.currentLayout.setObjectName(u'currentLayout')
|
||||
self.currentXLayout = QtGui.QVBoxLayout()
|
||||
self.currentXLayout.setSpacing(0)
|
||||
self.currentXLayout.setMargin(0)
|
||||
self.currentXLayout.setObjectName(u'currentXLayout')
|
||||
self.currentXLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.currentXLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.currentXLabel.setObjectName(u'currentXLabel')
|
||||
self.currentXLayout.addWidget(self.currentXLabel)
|
||||
self.currentXValueLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.currentXValueLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.currentXValueLabel.setObjectName(u'currentXValueLabel')
|
||||
self.currentXLayout.addWidget(self.currentXValueLabel)
|
||||
self.currentLayout.addLayout(self.currentXLayout)
|
||||
self.currentYLayout = QtGui.QVBoxLayout()
|
||||
self.currentYLayout.setSpacing(0)
|
||||
self.currentYLayout.setMargin(0)
|
||||
self.currentYLayout.setObjectName(u'currentYLayout')
|
||||
self.currentYLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.currentYLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.currentYLabel.setObjectName(u'currentYLabel')
|
||||
self.currentYLayout.addWidget(self.currentYLabel)
|
||||
self.currentYValueLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.currentYValueLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.currentYValueLabel.setObjectName(u'currentYValueLabel')
|
||||
self.currentYLayout.addWidget(self.currentYValueLabel)
|
||||
self.currentLayout.addLayout(self.currentYLayout)
|
||||
self.currentHeightLayout = QtGui.QVBoxLayout()
|
||||
self.currentHeightLayout.setSpacing(0)
|
||||
self.currentHeightLayout.setMargin(0)
|
||||
self.currentHeightLayout.setObjectName(u'currentHeightLayout')
|
||||
self.currentHeightLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.currentHeightLabel.setMaximumSize(QtCore.QSize(100, 16777215))
|
||||
self.currentHeightLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.currentHeightLabel.setObjectName(u'currentHeightLabel')
|
||||
self.currentHeightLayout.addWidget(self.currentHeightLabel)
|
||||
self.currentHeightValueLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.currentHeightValueLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.currentHeightValueLabel.setObjectName(u'Height')
|
||||
self.currentHeightLayout.addWidget(self.currentHeightValueLabel)
|
||||
self.currentLayout.addLayout(self.currentHeightLayout)
|
||||
self.currentWidthLayout = QtGui.QVBoxLayout()
|
||||
self.currentWidthLayout.setSpacing(0)
|
||||
self.currentWidthLayout.setMargin(0)
|
||||
self.currentWidthLayout.setObjectName(u'currentWidthLayout')
|
||||
self.currentWidthLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.currentWidthLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.currentWidthLabel.setObjectName(u'currentWidthLabel')
|
||||
self.currentWidthLayout.addWidget(self.currentWidthLabel)
|
||||
self.currentWidthValueLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.currentWidthValueLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.currentWidthValueLabel.setObjectName(u'currentWidthValueLabel')
|
||||
self.currentWidthLayout.addWidget(self.currentWidthValueLabel)
|
||||
self.currentLayout.addLayout(self.currentWidthLayout)
|
||||
self.displayLayout.addLayout(self.currentLayout)
|
||||
self.overrideCheckBox = QtGui.QCheckBox(self.displayGroupBox)
|
||||
self.overrideCheckBox.setObjectName(u'overrideCheckBox')
|
||||
self.displayLayout.addWidget(self.overrideCheckBox)
|
||||
self.GeneralRightLayout.addWidget(self.displayGroupBox)
|
||||
# Custom position
|
||||
self.customLayout = QtGui.QHBoxLayout()
|
||||
self.customLayout.setSpacing(8)
|
||||
self.customLayout.setMargin(0)
|
||||
self.customLayout.setObjectName(u'customLayout')
|
||||
self.customXLayout = QtGui.QVBoxLayout()
|
||||
self.customXLayout.setSpacing(0)
|
||||
self.customXLayout.setMargin(0)
|
||||
self.customXLayout.setObjectName(u'customXLayout')
|
||||
self.customXLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.customXLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.customXLabel.setObjectName(u'customXLabel')
|
||||
self.customXLayout.addWidget(self.customXLabel)
|
||||
self.customXValueEdit = QtGui.QLineEdit(self.displayGroupBox)
|
||||
self.customXValueEdit.setObjectName(u'customXValueEdit')
|
||||
self.customXLayout.addWidget(self.customXValueEdit)
|
||||
self.customLayout.addLayout(self.customXLayout)
|
||||
self.customYLayout = QtGui.QVBoxLayout()
|
||||
self.customYLayout.setSpacing(0)
|
||||
self.customYLayout.setMargin(0)
|
||||
self.customYLayout.setObjectName(u'customYLayout')
|
||||
self.customYLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.customYLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.customYLabel.setObjectName(u'customYLabel')
|
||||
self.customYLayout.addWidget(self.customYLabel)
|
||||
self.customYValueEdit = QtGui.QLineEdit(self.displayGroupBox)
|
||||
self.customYValueEdit.setObjectName(u'customYValueEdit')
|
||||
self.customYLayout.addWidget(self.customYValueEdit)
|
||||
self.customLayout.addLayout(self.customYLayout)
|
||||
self.customHeightLayout = QtGui.QVBoxLayout()
|
||||
self.customHeightLayout.setSpacing(0)
|
||||
self.customHeightLayout.setMargin(0)
|
||||
self.customHeightLayout.setObjectName(u'customHeightLayout')
|
||||
self.customHeightLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.customHeightLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.customHeightLabel.setObjectName(u'customHeightLabel')
|
||||
self.customHeightLayout.addWidget(self.customHeightLabel)
|
||||
self.customHeightValueEdit = QtGui.QLineEdit(self.displayGroupBox)
|
||||
self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')
|
||||
self.customHeightLayout.addWidget(self.customHeightValueEdit)
|
||||
self.customLayout.addLayout(self.customHeightLayout)
|
||||
self.customWidthLayout = QtGui.QVBoxLayout()
|
||||
self.customWidthLayout.setSpacing(0)
|
||||
self.customWidthLayout.setMargin(0)
|
||||
self.customWidthLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
|
||||
self.customWidthLayout.setObjectName(u'customWidthLayout')
|
||||
self.customWidthLabel = QtGui.QLabel(self.displayGroupBox)
|
||||
self.customWidthLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.customWidthLabel.setObjectName(u'customWidthLabel')
|
||||
self.customWidthLayout.addWidget(self.customWidthLabel)
|
||||
self.customWidthValueEdit = QtGui.QLineEdit(self.displayGroupBox)
|
||||
self.customWidthValueEdit.setObjectName(u'customWidthValueEdit')
|
||||
self.customWidthLayout.addWidget(self.customWidthValueEdit)
|
||||
self.customLayout.addLayout(self.customWidthLayout)
|
||||
self.displayLayout.addLayout(self.customLayout)
|
||||
# Bottom spacer
|
||||
self.GeneralRightSpacer = QtGui.QSpacerItem(20, 40,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.GeneralRightLayout.addItem(self.GeneralRightSpacer)
|
||||
self.GeneralLayout.addWidget(self.GeneralRightWidget)
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.overrideCheckBox,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled)
|
||||
|
||||
def retranslateUi(self):
|
||||
"""
|
||||
|
@ -164,30 +288,46 @@ class GeneralTab(SettingsTab):
|
|||
"""
|
||||
self.MonitorGroupBox.setTitle(translate('GeneralTab', 'Monitors'))
|
||||
self.MonitorLabel.setText(
|
||||
translate('GeneralTab', 'Select monitor for output display:'))
|
||||
translate('OpenLP.GeneralTab', 'Select monitor for output display:'))
|
||||
self.DisplayOnMonitorCheck.setText(
|
||||
translate('GeneralTab', 'Display if a single screen'))
|
||||
translate('OpenLP.GeneralTab', 'Display if a single screen'))
|
||||
self.StartupGroupBox.setTitle(
|
||||
translate('GeneralTab', 'Application Startup'))
|
||||
translate('OpenLP.GeneralTab', 'Application Startup'))
|
||||
self.WarningCheckBox.setText(
|
||||
translate('GeneralTab', 'Show blank screen warning'))
|
||||
translate('OpenLP.GeneralTab', 'Show blank screen warning'))
|
||||
self.AutoOpenCheckBox.setText(
|
||||
translate('GeneralTab', 'Automatically open the last service'))
|
||||
translate('OpenLP.GeneralTab', 'Automatically open the last service'))
|
||||
self.ShowSplashCheckBox.setText(
|
||||
translate('GeneralTab', 'Show the splash screen'))
|
||||
self.SettingsGroupBox.setTitle(
|
||||
translate('GeneralTab', 'Application Settings'))
|
||||
self.SaveCheckServiceCheckBox.setText(
|
||||
translate('GeneralTab',
|
||||
translate('OpenLP.GeneralTab', 'Show the splash screen'))
|
||||
self.SettingsGroupBox.setTitle(translate('OpenLP.GeneralTab',
|
||||
'Application Settings'))
|
||||
self.SaveCheckServiceCheckBox.setText(translate('OpenLP.GeneralTab',
|
||||
'Prompt to save Service before starting New'))
|
||||
self.AutoPreviewCheckBox.setText(
|
||||
translate('GeneralTab', 'Preview Next Song from Service Manager'))
|
||||
self.AutoPreviewCheckBox.setText(translate('OpenLP.GeneralTab',
|
||||
'Preview Next Song from Service Manager'))
|
||||
self.CCLIGroupBox.setTitle(translate('GeneralTab', 'CCLI Details'))
|
||||
self.NumberLabel.setText(translate('GeneralTab', 'CCLI Number:'))
|
||||
self.UsernameLabel.setText(
|
||||
translate('GeneralTab', 'SongSelect Username:'))
|
||||
self.UsernameLabel.setText(translate('OpenLP.GeneralTab',
|
||||
'SongSelect Username:'))
|
||||
self.PasswordLabel.setText(
|
||||
translate('GeneralTab', 'SongSelect Password:'))
|
||||
translate('OpenLP.GeneralTab', 'SongSelect Password:'))
|
||||
# Moved from display tab
|
||||
self.displayGroupBox.setTitle(
|
||||
translate('OpenLP.GeneralTab', 'Display Position'))
|
||||
self.currentXLabel.setText(translate('OpenLP.GeneralTab', 'X'))
|
||||
self.currentXValueLabel.setText(u'0')
|
||||
self.currentYLabel.setText(translate('OpenLP.GeneralTab', 'Y'))
|
||||
self.currentYValueLabel.setText(u'0')
|
||||
self.currentHeightLabel.setText(translate('OpenLP.GeneralTab', 'Height'))
|
||||
self.currentHeightValueLabel.setText(u'0')
|
||||
self.currentWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width'))
|
||||
self.currentWidthValueLabel.setText(u'0')
|
||||
self.overrideCheckBox.setText(translate('OpenLP.GeneralTab',
|
||||
'Override display position'))
|
||||
self.customXLabel.setText(translate('DisplayTab', 'X'))
|
||||
self.customYLabel.setText(translate('DisplayTab', 'Y'))
|
||||
self.customHeightLabel.setText(translate('DisplayTab', 'Height'))
|
||||
self.customWidthLabel.setText(translate('DisplayTab', 'Width'))
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
|
@ -199,7 +339,7 @@ class GeneralTab(SettingsTab):
|
|||
screen_name = u'%s %d' % (translate('GeneralTab', 'Screen'),
|
||||
screen[u'number'] + 1)
|
||||
if screen[u'primary']:
|
||||
screen_name = u'%s (%s)' % (screen_name,
|
||||
screen_name = u'%s (%s)' % (screen_name,
|
||||
translate('GeneralTab', 'primary'))
|
||||
self.MonitorComboBox.addItem(screen_name)
|
||||
self.NumberEdit.setText(unicode(settings.value(
|
||||
|
@ -210,7 +350,7 @@ class GeneralTab(SettingsTab):
|
|||
u'songselect password', QtCore.QVariant(u'')).toString()))
|
||||
self.SaveCheckServiceCheckBox.setChecked(settings.value(u'save prompt',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.MonitorComboBox.setCurrentIndex(self.MonitorNumber)
|
||||
self.MonitorComboBox.setCurrentIndex(self.monitorNumber)
|
||||
self.DisplayOnMonitorCheck.setChecked(self.screens.display)
|
||||
self.WarningCheckBox.setChecked(settings.value(u'blank warning',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
|
@ -220,16 +360,49 @@ class GeneralTab(SettingsTab):
|
|||
QtCore.QVariant(True)).toBool())
|
||||
self.AutoPreviewCheckBox.setChecked(settings.value(u'auto preview',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.currentXValueLabel.setText(
|
||||
unicode(self.screens.current[u'size'].x()))
|
||||
self.currentYValueLabel.setText(
|
||||
unicode(self.screens.current[u'size'].y()))
|
||||
self.currentHeightValueLabel.setText(
|
||||
unicode(self.screens.current[u'size'].height()))
|
||||
self.currentWidthValueLabel.setText(
|
||||
unicode(self.screens.current[u'size'].width()))
|
||||
self.overrideCheckBox.setChecked(settings.value(u'override position',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
if self.overrideCheckBox.isChecked():
|
||||
self.customXValueEdit.setText(settings.value(u'x position',
|
||||
QtCore.QVariant(self.screens.current[u'size'].x())).toString())
|
||||
self.customYValueEdit.setText(settings.value(u'y position',
|
||||
QtCore.QVariant(self.screens.current[u'size'].y())).toString())
|
||||
self.customHeightValueEdit.setText(settings.value(u'height',
|
||||
QtCore.QVariant(self.screens.current[u'size'].height())).toString())
|
||||
self.customWidthValueEdit.setText(settings.value(u'width',
|
||||
QtCore.QVariant(self.screens.current[u'size'].width())).toString())
|
||||
else:
|
||||
self.customXValueEdit.setText(
|
||||
unicode(self.screens.current[u'size'].x()))
|
||||
self.customYValueEdit.setText(
|
||||
unicode(self.screens.current[u'size'].y()))
|
||||
self.customHeightValueEdit.setText(
|
||||
unicode(self.screens.current[u'size'].height()))
|
||||
self.customWidthValueEdit.setText(
|
||||
unicode(self.screens.current[u'size'].width()))
|
||||
settings.endGroup()
|
||||
self.customXValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
||||
self.customYValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
||||
self.customHeightValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
||||
self.customWidthValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
||||
self.override_changed = False
|
||||
|
||||
def save(self):
|
||||
"""
|
||||
Save the settings from the form
|
||||
"""
|
||||
self.MonitorNumber = self.MonitorComboBox.currentIndex()
|
||||
self.monitorNumber = self.MonitorComboBox.currentIndex()
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue(u'monitor', QtCore.QVariant(self.MonitorNumber))
|
||||
settings.setValue(u'monitor', QtCore.QVariant(self.monitorNumber))
|
||||
settings.setValue(u'display on monitor',
|
||||
QtCore.QVariant(self.DisplayOnMonitorCheck.isChecked()))
|
||||
settings.setValue(u'blank warning',
|
||||
|
@ -248,11 +421,40 @@ class GeneralTab(SettingsTab):
|
|||
QtCore.QVariant(self.UsernameEdit.displayText()))
|
||||
settings.setValue(u'songselect password',
|
||||
QtCore.QVariant(self.PasswordEdit.displayText()))
|
||||
settings.setValue(u'x position',
|
||||
QtCore.QVariant(self.customXValueEdit.text()))
|
||||
settings.setValue(u'y position',
|
||||
QtCore.QVariant(self.customYValueEdit.text()))
|
||||
settings.setValue(u'height',
|
||||
QtCore.QVariant(self.customHeightValueEdit.text()))
|
||||
settings.setValue(u'width',
|
||||
QtCore.QVariant(self.customWidthValueEdit.text()))
|
||||
settings.setValue(u'override position',
|
||||
QtCore.QVariant(self.overrideCheckBox.isChecked()))
|
||||
settings.endGroup()
|
||||
self.screens.display = self.DisplayOnMonitorCheck.isChecked()
|
||||
#Monitor Number has changed.
|
||||
if self.screens.monitor_number != self.MonitorNumber:
|
||||
self.screens.monitor_number = self.MonitorNumber
|
||||
self.screens.set_current_display(self.MonitorNumber)
|
||||
if self.screens.monitor_number != self.monitorNumber:
|
||||
self.screens.monitor_number = self.monitorNumber
|
||||
self.screens.set_current_display(self.monitorNumber)
|
||||
Receiver.send_message(u'config_screen_changed')
|
||||
Receiver.send_message(u'config_updated')
|
||||
|
||||
def postSetUp(self):
|
||||
self.screens.override[u'size'] = QtCore.QRect(
|
||||
int(self.customXValueEdit.text()),
|
||||
int(self.customYValueEdit.text()),
|
||||
int(self.customWidthValueEdit.text()),
|
||||
int(self.customHeightValueEdit.text()))
|
||||
if self.overrideCheckBox.isChecked():
|
||||
self.screens.set_override_display()
|
||||
Receiver.send_message(u'config_screen_changed')
|
||||
else:
|
||||
self.screens.reset_current_display()
|
||||
|
||||
def onOverrideCheckBoxToggled(self, checked):
|
||||
self.customXValueEdit.setEnabled(checked)
|
||||
self.customYValueEdit.setEnabled(checked)
|
||||
self.customHeightValueEdit.setEnabled(checked)
|
||||
self.customWidthValueEdit.setEnabled(checked)
|
||||
self.override_changed = True
|
||||
|
|
|
@ -154,9 +154,10 @@ class DisplayWidget(QtGui.QGraphicsView):
|
|||
"""
|
||||
log.info(u'MainDisplay loaded')
|
||||
|
||||
def __init__(self, parent=None, name=None):
|
||||
def __init__(self, parent=None, name=None, primary=False):
|
||||
QtGui.QWidget.__init__(self, None)
|
||||
self.parent = parent
|
||||
self.primary = primary
|
||||
self.hotkey_map = {
|
||||
QtCore.Qt.Key_Return: 'servicemanager_next_item',
|
||||
QtCore.Qt.Key_Space: 'slidecontroller_live_next_noloop',
|
||||
|
@ -189,6 +190,14 @@ class DisplayWidget(QtGui.QGraphicsView):
|
|||
else:
|
||||
event.ignore()
|
||||
|
||||
def resetDisplay(self):
|
||||
log.debug(u'resetDisplay')
|
||||
Receiver.send_message(u'slidecontroller_live_stop_loop')
|
||||
if self.primary:
|
||||
self.setVisible(False)
|
||||
else:
|
||||
self.setVisible(True)
|
||||
|
||||
class MainDisplay(DisplayWidget):
|
||||
"""
|
||||
This is the form that is used to display things on the projector.
|
||||
|
@ -206,7 +215,7 @@ class MainDisplay(DisplayWidget):
|
|||
The list of screens.
|
||||
"""
|
||||
log.debug(u'Initialisation started')
|
||||
DisplayWidget.__init__(self, parent)
|
||||
DisplayWidget.__init__(self, parent, primary=True)
|
||||
self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
|
||||
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
|
@ -222,7 +231,6 @@ class MainDisplay(DisplayWidget):
|
|||
self.setupText()
|
||||
self.setupAlert()
|
||||
self.setupBlank()
|
||||
self.primary = True
|
||||
self.blankFrame = None
|
||||
self.frame = None
|
||||
#Hide desktop for now until we know where to put it
|
||||
|
@ -239,22 +247,24 @@ class MainDisplay(DisplayWidget):
|
|||
self.screen = self.screens.current
|
||||
#Sort out screen locations and sizes
|
||||
self.setGeometry(self.screen[u'size'])
|
||||
self.scene.setSceneRect(0,0,self.size().width(), self.size().height())
|
||||
self.webView.setGeometry(0, 0, self.size().width(), self.size().height())
|
||||
self.scene.setSceneRect(0, 0, self.size().width(),
|
||||
self.size().height())
|
||||
self.webView.setGeometry(0, 0, self.size().width(),
|
||||
self.size().height())
|
||||
#Build a custom splash screen
|
||||
self.InitialFrame = QtGui.QImage(
|
||||
self.initialFrame = QtGui.QImage(
|
||||
self.screen[u'size'].width(),
|
||||
self.screen[u'size'].height(),
|
||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
splash_image = QtGui.QImage(u':/graphics/openlp-splash-screen.png')
|
||||
painter_image = QtGui.QPainter()
|
||||
painter_image.begin(self.InitialFrame)
|
||||
painter_image.fillRect(self.InitialFrame.rect(), QtCore.Qt.white)
|
||||
painter_image.begin(self.initialFrame)
|
||||
painter_image.fillRect(self.initialFrame.rect(), QtCore.Qt.white)
|
||||
painter_image.drawImage(
|
||||
(self.screen[u'size'].width() - splash_image.width()) / 2,
|
||||
(self.screen[u'size'].height() - splash_image.height()) / 2,
|
||||
splash_image)
|
||||
self.displayImage(self.InitialFrame)
|
||||
self.displayImage(self.initialFrame)
|
||||
self.repaint()
|
||||
#Build a Black screen
|
||||
painter = QtGui.QPainter()
|
||||
|
@ -280,18 +290,21 @@ class MainDisplay(DisplayWidget):
|
|||
|
||||
def setupScene(self):
|
||||
self.scene = QtGui.QGraphicsScene(self)
|
||||
self.scene.setSceneRect(0,0,self.size().width(), self.size().height())
|
||||
self.scene.setSceneRect(0, 0, self.size().width(), self.size().height())
|
||||
self.setScene(self.scene)
|
||||
|
||||
def setupVideo(self):
|
||||
self.webView = QtWebKit.QWebView()
|
||||
self.page = self.webView.page()
|
||||
self.videoDisplay = self.page.mainFrame()
|
||||
self.videoDisplay.setScrollBarPolicy(QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.videoDisplay.setScrollBarPolicy(QtCore.Qt.Horizontal, QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.videoDisplay.setScrollBarPolicy(QtCore.Qt.Vertical,
|
||||
QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.videoDisplay.setScrollBarPolicy(QtCore.Qt.Horizontal,
|
||||
QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.proxy = QtGui.QGraphicsProxyWidget()
|
||||
self.proxy.setWidget(self.webView)
|
||||
self.proxy.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
|
||||
self.proxy.setWindowFlags(QtCore.Qt.Window |
|
||||
QtCore.Qt.FramelessWindowHint)
|
||||
self.proxy.setZValue(1)
|
||||
self.scene.addItem(self.proxy)
|
||||
|
||||
|
@ -319,14 +332,6 @@ class MainDisplay(DisplayWidget):
|
|||
self.displayBlank.setZValue(10)
|
||||
self.scene.addItem(self.displayBlank)
|
||||
|
||||
def resetDisplay(self):
|
||||
log.debug(u'resetDisplay')
|
||||
Receiver.send_message(u'slidecontroller_live_stop_loop')
|
||||
if self.primary:
|
||||
self.setVisible(False)
|
||||
else:
|
||||
self.setVisible(True)
|
||||
|
||||
# def hideDisplayForVideo(self):
|
||||
# """
|
||||
# Hides the main display if for the video to be played
|
||||
|
@ -353,6 +358,8 @@ class MainDisplay(DisplayWidget):
|
|||
else:
|
||||
self.displayBlank.setPixmap(
|
||||
QtGui.QPixmap.fromImage(self.blankFrame))
|
||||
if mode != HideMode.Screen and self.isHidden():
|
||||
self.setVisible(True)
|
||||
|
||||
def showDisplay(self, message=u''):
|
||||
"""
|
||||
|
@ -362,6 +369,8 @@ class MainDisplay(DisplayWidget):
|
|||
"""
|
||||
log.debug(u'showDisplay')
|
||||
self.displayBlank.setPixmap(self.transparent)
|
||||
if self.isHidden():
|
||||
self.setVisible(True)
|
||||
#Trigger actions when display is active again
|
||||
Receiver.send_message(u'maindisplay_active')
|
||||
|
||||
|
@ -385,9 +394,9 @@ class MainDisplay(DisplayWidget):
|
|||
if location == 0:
|
||||
self.alertText.setPos(0, 0)
|
||||
elif location == 1:
|
||||
self.alertText.setPos(0,self.size().height()/2)
|
||||
self.alertText.setPos(0, self.size().height() / 2)
|
||||
else:
|
||||
self.alertText.setPos(0,self.size().height() - 76)
|
||||
self.alertText.setPos(0, self.size().height() - 76)
|
||||
self.alertText.setHtml(message)
|
||||
|
||||
def displayImage(self, frame):
|
||||
|
@ -412,7 +421,8 @@ class MainDisplay(DisplayWidget):
|
|||
log.debug(u'adddisplayVideo')
|
||||
self.displayImage(self.transparent)
|
||||
self.videoDisplay.setHtml(HTMLVIDEO %
|
||||
(path, self.screen[u'size'].width(), self.screen[u'size'].height()))
|
||||
(path, self.screen[u'size'].width(),
|
||||
self.screen[u'size'].height()))
|
||||
|
||||
def frameView(self, frame, transition=False):
|
||||
"""
|
||||
|
@ -513,7 +523,7 @@ class VideoDisplay(Phonon.VideoWidget):
|
|||
Sets up the screen on a particular screen.
|
||||
"""
|
||||
log.debug(u'VideoDisplay Setup %s for %s ' % (self.screens,
|
||||
self.screens.monitor_number))
|
||||
self.screens.monitor_number))
|
||||
self.screen = self.screens.current
|
||||
#Sort out screen locations and sizes
|
||||
self.setGeometry(self.screen[u'size'])
|
||||
|
@ -531,8 +541,8 @@ class VideoDisplay(Phonon.VideoWidget):
|
|||
Shutting down so clean up connections
|
||||
"""
|
||||
self.onMediaStop()
|
||||
for pth in self.outputPaths():
|
||||
disconnected = pth.disconnect()
|
||||
for path in self.outputPaths():
|
||||
path.disconnect()
|
||||
|
||||
# def onMediaBackground(self, message=None):
|
||||
# """
|
||||
|
@ -657,8 +667,8 @@ class AudioPlayer(QtCore.QObject):
|
|||
Shutting down so clean up connections
|
||||
"""
|
||||
self.onMediaStop()
|
||||
for pth in self.mediaObject.outputPaths():
|
||||
disconnected = pth.disconnect()
|
||||
for path in self.mediaObject.outputPaths():
|
||||
path.disconnect()
|
||||
|
||||
def onMediaQueue(self, message):
|
||||
"""
|
||||
|
|
|
@ -38,7 +38,7 @@ from openlp.core.utils import check_latest_version, AppLocation, add_actions, \
|
|||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
media_manager_style = """
|
||||
MEDIA_MANAGER_STYLE = """
|
||||
QToolBox::tab {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 palette(button), stop: 1.0 palette(dark));
|
||||
|
@ -174,7 +174,7 @@ class Ui_MainWindow(object):
|
|||
self.MediaManagerDock = OpenLPDockWidget(MainWindow)
|
||||
self.MediaManagerDock.setWindowIcon(
|
||||
build_icon(u':/system/system_mediamanager.png'))
|
||||
self.MediaManagerDock.setStyleSheet(media_manager_style)
|
||||
self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
|
||||
self.MediaManagerDock.setMinimumWidth(
|
||||
self.settingsmanager.mainwindow_left)
|
||||
self.MediaManagerDock.setObjectName(u'MediaManagerDock')
|
||||
|
@ -469,7 +469,8 @@ class Ui_MainWindow(object):
|
|||
'&Plugin List'))
|
||||
self.SettingsPluginListItem.setStatusTip(
|
||||
translate('MainWindow', 'List the Plugins'))
|
||||
self.SettingsPluginListItem.setShortcut(translate('MainWindow', 'Alt+F7'))
|
||||
self.SettingsPluginListItem.setShortcut(
|
||||
translate('MainWindow', 'Alt+F7'))
|
||||
self.HelpDocumentationItem.setText(
|
||||
translate('MainWindow', '&User Guide'))
|
||||
self.HelpAboutItem.setText(translate('MainWindow', '&About'))
|
||||
|
@ -657,6 +658,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
log.info(u'Load Themes')
|
||||
self.ThemeManagerContents.loadThemes()
|
||||
log.info(u'Load data from Settings')
|
||||
if QtCore.QSettings().value(u'advanced/save current plugin',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
savedPlugin = QtCore.QSettings().value(
|
||||
u'advanced/current media plugin', QtCore.QVariant()).toInt()[0]
|
||||
if savedPlugin != -1:
|
||||
self.MediaToolBox.setCurrentIndex(savedPlugin)
|
||||
self.settingsForm.postSetUp()
|
||||
|
||||
def setAutoLanguage(self, value):
|
||||
|
@ -819,6 +826,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
"""
|
||||
# Clean temporary files used by services
|
||||
self.ServiceManagerContents.cleanUp()
|
||||
if QtCore.QSettings().value(u'advanced/save current plugin',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
QtCore.QSettings().setValue(u'advanced/current media plugin',
|
||||
QtCore.QVariant(self.MediaToolBox.currentIndex()))
|
||||
# Call the cleanup method to shutdown plugins.
|
||||
log.info(u'cleanup plugins')
|
||||
self.plugin_manager.finalise_plugins()
|
||||
|
@ -897,6 +908,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.ViewLivePanel.setChecked(visible)
|
||||
|
||||
def loadSettings(self):
|
||||
"""
|
||||
Load the main window settings.
|
||||
"""
|
||||
log.debug(u'Loading QSettings')
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.generalSettingsSection)
|
||||
|
@ -911,6 +925,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
settings.endGroup()
|
||||
|
||||
def saveSettings(self):
|
||||
"""
|
||||
Save the main window settings.
|
||||
"""
|
||||
log.debug(u'Saving QSettings')
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.generalSettingsSection)
|
||||
|
@ -928,15 +945,19 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
settings.endGroup()
|
||||
|
||||
def updateFileMenu(self):
|
||||
"""
|
||||
Updates the file menu with the latest list of service files accessed.
|
||||
"""
|
||||
recentFileCount = QtCore.QSettings().value(
|
||||
u'advanced/recent file count', QtCore.QVariant(4)).toInt()[0]
|
||||
self.FileMenu.clear()
|
||||
add_actions(self.FileMenu, self.FileMenuActions[:-1])
|
||||
existingRecentFiles = []
|
||||
for file in self.recentFiles:
|
||||
if QtCore.QFile.exists(file):
|
||||
existingRecentFiles.append(file)
|
||||
if existingRecentFiles:
|
||||
existingRecentFiles = [file for file in self.recentFiles
|
||||
if QtCore.QFile.exists(file)]
|
||||
recentFilesToDisplay = existingRecentFiles[0:recentFileCount]
|
||||
if recentFilesToDisplay:
|
||||
self.FileMenu.addSeparator()
|
||||
for fileId, filename in enumerate(existingRecentFiles):
|
||||
for fileId, filename in enumerate(recentFilesToDisplay):
|
||||
action = QtGui.QAction(u'&%d %s' % (fileId +1,
|
||||
QtCore.QFileInfo(filename).fileName()), self)
|
||||
action.setData(QtCore.QVariant(filename))
|
||||
|
@ -947,13 +968,22 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.FileMenu.addAction(self.FileMenuActions[-1])
|
||||
|
||||
def addRecentFile(self, filename):
|
||||
recentFileCount = QtCore.QSettings().value(
|
||||
self.generalSettingsSection + u'/max recent files',
|
||||
QtCore.QVariant(4)).toInt()[0]
|
||||
"""
|
||||
Adds a service to the list of recently used files.
|
||||
|
||||
``filename``
|
||||
The service filename to add
|
||||
"""
|
||||
# The maxRecentFiles value does not have an interface and so never gets
|
||||
# actually stored in the settings therefore the default value of 20
|
||||
# will always be used.
|
||||
maxRecentFiles = QtCore.QSettings().value(u'advanced/max recent files',
|
||||
QtCore.QVariant(20)).toInt()[0]
|
||||
if filename:
|
||||
position = self.recentFiles.indexOf(filename)
|
||||
if position != -1:
|
||||
self.recentFiles.removeAt(position)
|
||||
self.recentFiles.insert(0, QtCore.QString(filename))
|
||||
while self.recentFiles.count() > recentFileCount:
|
||||
self.recentFiles.removeLast()
|
||||
while self.recentFiles.count() > maxRecentFiles:
|
||||
# Don't care what API says takeLast works, removeLast doesn't!
|
||||
self.recentFiles.takeLast()
|
||||
|
|
|
@ -33,7 +33,8 @@ log = logging.getLogger(__name__)
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
|
||||
Receiver, build_icon, ItemCapabilities, SettingsManager, translate, ThemeLevel
|
||||
Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \
|
||||
ThemeLevel
|
||||
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
|
||||
from openlp.core.utils import AppLocation
|
||||
|
||||
|
@ -129,7 +130,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
translate('ServiceManager', 'Save Service'),
|
||||
u':/general/general_save.png',
|
||||
translate('ServiceManager', 'Save this service'),
|
||||
self.onSaveService)
|
||||
self.onQuickSaveService)
|
||||
self.Toolbar.addSeparator()
|
||||
self.ThemeLabel = QtGui.QLabel(translate('ServiceManager', 'Theme:'),
|
||||
self)
|
||||
|
@ -574,16 +575,16 @@ class ServiceManager(QtGui.QWidget):
|
|||
SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
|
||||
translate('ServiceManager', 'OpenLP Service Files (*.osz)'))
|
||||
else:
|
||||
filename = SettingsManager.get_last_dir(
|
||||
self.parent.serviceSettingsSection)
|
||||
filename = os.path.join(SettingsManager.get_last_dir(
|
||||
self.parent.serviceSettingsSection), self.serviceName)
|
||||
if filename:
|
||||
filename = QtCore.QDir.toNativeSeparators(filename)
|
||||
splittedFile = filename.split(u'.')
|
||||
if splittedFile[-1] != u'osz':
|
||||
filename = filename + u'.osz'
|
||||
filename = unicode(filename)
|
||||
self.isNew = False
|
||||
SettingsManager.set_last_dir(
|
||||
self.parent.serviceSettingsSection,
|
||||
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
|
||||
os.path.split(filename)[0])
|
||||
service = []
|
||||
servicefile = filename + u'.osd'
|
||||
|
|
|
@ -24,40 +24,44 @@
|
|||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import translate
|
||||
|
||||
from openlp.core.lib import translate, build_icon
|
||||
|
||||
class Ui_SettingsDialog(object):
|
||||
def setupUi(self, SettingsDialog):
|
||||
SettingsDialog.setObjectName(u'SettingsDialog')
|
||||
SettingsDialog.resize(724, 502)
|
||||
self.SettingsLayout = QtGui.QVBoxLayout(SettingsDialog)
|
||||
self.SettingsLayout.setSpacing(8)
|
||||
self.SettingsLayout.setMargin(8)
|
||||
self.SettingsLayout.setObjectName(u'SettingsLayout')
|
||||
self.SettingsTabWidget = QtGui.QTabWidget(SettingsDialog)
|
||||
self.SettingsTabWidget.setObjectName(u'SettingsTabWidget')
|
||||
self.SettingsLayout.addWidget(self.SettingsTabWidget)
|
||||
self.ButtonsBox = QtGui.QDialogButtonBox(SettingsDialog)
|
||||
SettingsDialog.setWindowIcon(
|
||||
build_icon(u':/system/system_settings.png'))
|
||||
self.settingsLayout = QtGui.QVBoxLayout(SettingsDialog)
|
||||
self.settingsLayout.setSpacing(8)
|
||||
self.settingsLayout.setMargin(8)
|
||||
self.settingsLayout.setObjectName(u'settingsLayout')
|
||||
self.settingsTabWidget = QtGui.QTabWidget(SettingsDialog)
|
||||
self.settingsTabWidget.setObjectName(u'settingsTabWidget')
|
||||
self.settingsLayout.addWidget(self.settingsTabWidget)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(SettingsDialog)
|
||||
sizePolicy = QtGui.QSizePolicy(
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(
|
||||
self.ButtonsBox.sizePolicy().hasHeightForWidth())
|
||||
self.ButtonsBox.setSizePolicy(sizePolicy)
|
||||
self.ButtonsBox.setMaximumSize(QtCore.QSize(16777215, 16777215))
|
||||
self.ButtonsBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.ButtonsBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
||||
self.ButtonsBox.setObjectName(u'ButtonsBox')
|
||||
self.SettingsLayout.addWidget(self.ButtonsBox)
|
||||
self.buttonBox.sizePolicy().hasHeightForWidth())
|
||||
self.buttonBox.setSizePolicy(sizePolicy)
|
||||
self.buttonBox.setMaximumSize(QtCore.QSize(16777215, 16777215))
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.settingsLayout.addWidget(self.buttonBox)
|
||||
self.retranslateUi(SettingsDialog)
|
||||
self.SettingsTabWidget.setCurrentIndex(0)
|
||||
QtCore.QObject.connect(self.ButtonsBox,
|
||||
self.settingsTabWidget.setCurrentIndex(0)
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'accepted()'), SettingsDialog.accept)
|
||||
QtCore.QObject.connect(self.ButtonsBox,
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'rejected()'), SettingsDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(SettingsDialog)
|
||||
|
||||
def retranslateUi(self, SettingsDialog):
|
||||
SettingsDialog.setWindowTitle(translate('SettingsForm', 'Settings'))
|
||||
SettingsDialog.setWindowTitle(translate('SettingsForm',
|
||||
'Configure OpenLP'))
|
||||
|
|
|
@ -29,7 +29,7 @@ import logging
|
|||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.ui import GeneralTab, ThemesTab, DisplayTab
|
||||
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab
|
||||
from settingsdialog import Ui_SettingsDialog
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -45,52 +45,52 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
# General tab
|
||||
self.GeneralTab = GeneralTab(screens)
|
||||
self.addTab(u'General', self.GeneralTab)
|
||||
self.generalTab = GeneralTab(screens)
|
||||
self.addTab(u'General', self.generalTab)
|
||||
# Themes tab
|
||||
self.ThemesTab = ThemesTab(mainWindow)
|
||||
self.addTab(u'Themes', self.ThemesTab)
|
||||
# Display tab
|
||||
self.DisplayTab = DisplayTab(screens)
|
||||
self.addTab(u'Display', self.DisplayTab)
|
||||
self.themesTab = ThemesTab(mainWindow)
|
||||
self.addTab(u'Themes', self.themesTab)
|
||||
# Advanced tab
|
||||
self.advancedTab = AdvancedTab()
|
||||
self.addTab(u'Advanced', self.advancedTab)
|
||||
|
||||
def addTab(self, name, tab):
|
||||
"""
|
||||
Add a tab to the form
|
||||
"""
|
||||
log.info(u'Adding %s tab' % tab.tabTitle)
|
||||
self.SettingsTabWidget.addTab(tab, tab.tabTitleVisible)
|
||||
self.settingsTabWidget.addTab(tab, tab.tabTitleVisible)
|
||||
|
||||
def insertTab(self, tab, location):
|
||||
"""
|
||||
Add a tab to the form at a specific location
|
||||
"""
|
||||
log.debug(u'Inserting %s tab' % tab.tabTitle)
|
||||
#13 : There are 3 tables currently and locations starts at -10
|
||||
self.SettingsTabWidget.insertTab(
|
||||
location + 13, tab, tab.tabTitleVisible)
|
||||
# 14 : There are 3 tables currently and locations starts at -10
|
||||
self.settingsTabWidget.insertTab(
|
||||
location + 14, tab, tab.tabTitleVisible)
|
||||
|
||||
def removeTab(self, name):
|
||||
"""
|
||||
Remove a tab from the form
|
||||
"""
|
||||
log.debug(u'remove %s tab' % name)
|
||||
for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||
if self.SettingsTabWidget.widget(tab_index):
|
||||
if self.SettingsTabWidget.widget(tab_index).tabTitle == name:
|
||||
self.SettingsTabWidget.removeTab(tab_index)
|
||||
for tabIndex in range(0, self.settingsTabWidget.count()):
|
||||
if self.settingsTabWidget.widget(tabIndex):
|
||||
if self.settingsTabWidget.widget(tabIndex).tabTitle == name:
|
||||
self.settingsTabWidget.removeTab(tabIndex)
|
||||
|
||||
def accept(self):
|
||||
"""
|
||||
Process the form saving the settings
|
||||
"""
|
||||
for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||
self.SettingsTabWidget.widget(tab_index).save()
|
||||
for tabIndex in range(0, self.settingsTabWidget.count()):
|
||||
self.settingsTabWidget.widget(tabIndex).save()
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
def postSetUp(self):
|
||||
"""
|
||||
Run any post-setup code for the tabs on the form
|
||||
"""
|
||||
for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||
self.SettingsTabWidget.widget(tab_index).postSetUp()
|
||||
for tabIndex in range(0, self.settingsTabWidget.count()):
|
||||
self.settingsTabWidget.widget(tabIndex).postSetUp()
|
||||
|
|
|
@ -202,15 +202,21 @@ class SlideController(QtGui.QWidget):
|
|||
self.Toolbar.addToolbarWidget(u'Hide Menu', self.HideMenu)
|
||||
self.HideMenu.setMenu(QtGui.QMenu(
|
||||
translate('SlideController', 'Hide'), self.Toolbar))
|
||||
self.BlankScreen = QtGui.QAction(QtGui.QIcon( u':/slides/slide_blank.png'), u'Blank Screen', self.HideMenu)
|
||||
self.BlankScreen = QtGui.QAction(QtGui.QIcon(
|
||||
u':/slides/slide_blank.png'), u'Blank Screen', self.HideMenu)
|
||||
self.BlankScreen.setCheckable(True)
|
||||
QtCore.QObject.connect(self.BlankScreen, QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay)
|
||||
self.ThemeScreen = QtGui.QAction(QtGui.QIcon(u':/slides/slide_theme.png'), u'Blank to Theme', self.HideMenu)
|
||||
QtCore.QObject.connect(self.BlankScreen,
|
||||
QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay)
|
||||
self.ThemeScreen = QtGui.QAction(QtGui.QIcon(
|
||||
u':/slides/slide_theme.png'), u'Blank to Theme', self.HideMenu)
|
||||
self.ThemeScreen.setCheckable(True)
|
||||
QtCore.QObject.connect(self.ThemeScreen, QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
|
||||
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(u':/slides/slide_desktop.png'), u'Show Desktop', self.HideMenu)
|
||||
QtCore.QObject.connect(self.ThemeScreen,
|
||||
QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
|
||||
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
|
||||
u':/slides/slide_desktop.png'), u'Show Desktop', self.HideMenu)
|
||||
self.DesktopScreen.setCheckable(True)
|
||||
QtCore.QObject.connect(self.DesktopScreen, QtCore.SIGNAL("triggered(bool)"), self.onHideDisplay)
|
||||
QtCore.QObject.connect(self.DesktopScreen,
|
||||
QtCore.SIGNAL("triggered(bool)"), self.onHideDisplay)
|
||||
self.HideMenu.setDefaultAction(self.BlankScreen)
|
||||
self.HideMenu.menu().addAction(self.BlankScreen)
|
||||
self.HideMenu.menu().addAction(self.ThemeScreen)
|
||||
|
@ -241,9 +247,8 @@ class SlideController(QtGui.QWidget):
|
|||
self.Toolbar.addToolbarWidget(
|
||||
u'Image SpinBox', self.DelaySpinBox)
|
||||
self.DelaySpinBox.setSuffix(translate('SlideController', 's'))
|
||||
self.DelaySpinBox.setToolTip(
|
||||
translate('SlideController',
|
||||
'Delay between slides in seconds'))
|
||||
self.DelaySpinBox.setToolTip(translate('SlideController',
|
||||
'Delay between slides in seconds'))
|
||||
self.ControllerLayout.addWidget(self.Toolbar)
|
||||
#Build a Media ToolBar
|
||||
self.Mediabar = OpenLPToolbar(self)
|
||||
|
@ -268,8 +273,7 @@ class SlideController(QtGui.QWidget):
|
|||
self.volumeSlider = Phonon.VolumeSlider()
|
||||
self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
|
||||
self.volumeSlider.setObjectName(u'volumeSlider')
|
||||
self.Mediabar.addToolbarWidget(
|
||||
u'Audio Volume', self.volumeSlider)
|
||||
self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
|
||||
self.ControllerLayout.addWidget(self.Mediabar)
|
||||
# Build the Song Toolbar
|
||||
if isLive:
|
||||
|
@ -328,6 +332,11 @@ class SlideController(QtGui.QWidget):
|
|||
# Signals
|
||||
QtCore.QObject.connect(self.PreviewListWidget,
|
||||
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
|
||||
if not self.isLive:
|
||||
if QtCore.QSettings().value(u'advanced/double click live',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
QtCore.QObject.connect(self.PreviewListWidget,
|
||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLive)
|
||||
if isLive:
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
|
||||
|
|
|
@ -48,6 +48,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
QtGui.QWidget.__init__(self, parent)
|
||||
self.parent = parent
|
||||
self.settingsSection = u'themes'
|
||||
self.serviceComboBox = self.parent.ServiceManagerContents.ThemeComboBox
|
||||
self.Layout = QtGui.QVBoxLayout(self)
|
||||
self.Layout.setSpacing(0)
|
||||
self.Layout.setMargin(0)
|
||||
|
@ -116,6 +117,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
self.thumbPath = os.path.join(self.path, u'thumbnails')
|
||||
self.checkThemesExists(self.thumbPath)
|
||||
self.amendThemeForm.path = self.path
|
||||
self.oldBackgroundImage = None
|
||||
# Last little bits of setting up
|
||||
self.global_theme = unicode(QtCore.QSettings().value(
|
||||
self.settingsSection + u'/global theme',
|
||||
|
@ -182,11 +184,17 @@ class ThemeManager(QtGui.QWidget):
|
|||
Loads the settings for the theme that is to be edited and launches the
|
||||
theme editing form so the user can make their changes.
|
||||
"""
|
||||
self.editingDefault = False
|
||||
if check_item_selected(self.ThemeListWidget, translate('ThemeManager',
|
||||
'You must select a theme to edit.')):
|
||||
item = self.ThemeListWidget.currentItem()
|
||||
themeName = unicode(item.text())
|
||||
if themeName != unicode(item.data(QtCore.Qt.UserRole).toString()):
|
||||
self.editingDefault = True
|
||||
theme = self.getThemeData(
|
||||
unicode(item.data(QtCore.Qt.UserRole).toString()))
|
||||
if theme.background_type == u'image':
|
||||
self.oldBackgroundImage = theme.background_filename
|
||||
self.amendThemeForm.loadTheme(theme)
|
||||
self.saveThemeName = unicode(
|
||||
item.data(QtCore.Qt.UserRole).toString())
|
||||
|
@ -212,37 +220,44 @@ class ThemeManager(QtGui.QWidget):
|
|||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
else:
|
||||
for plugin in self.parent.plugin_manager.plugins:
|
||||
if not plugin.canDeleteTheme(theme):
|
||||
if plugin.usesTheme(theme):
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('ThemeManager', 'Error'),
|
||||
unicode(translate('ThemeManager',
|
||||
'Theme %s is use in %s plugin.')) % \
|
||||
(theme, plugin.name))
|
||||
return
|
||||
if unicode(self.parent.ServiceManagerContents.ThemeComboBox \
|
||||
.currentText()) == theme:
|
||||
if unicode(self.serviceComboBox.currentText()) == theme:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('ThemeManager', 'Error'),
|
||||
unicode(translate('ThemeManager',
|
||||
'Theme %s is use by the service manager.')) % theme)
|
||||
return
|
||||
self.themelist.remove(theme)
|
||||
th = theme + u'.png'
|
||||
row = self.ThemeListWidget.row(item)
|
||||
self.ThemeListWidget.takeItem(row)
|
||||
try:
|
||||
os.remove(os.path.join(self.path, th))
|
||||
os.remove(os.path.join(self.thumbPath, th))
|
||||
encoding = get_filesystem_encoding()
|
||||
shutil.rmtree(
|
||||
os.path.join(self.path, theme).encode(encoding))
|
||||
except OSError:
|
||||
#if not present do not worry
|
||||
pass
|
||||
# As we do not reload the themes push out the change
|
||||
# Reaload the list as the internal lists and events need
|
||||
# to be triggered
|
||||
self.pushThemes()
|
||||
self.deleteTheme(theme)
|
||||
|
||||
def deleteTheme(self, theme):
|
||||
"""
|
||||
Delete a theme.
|
||||
|
||||
``theme``
|
||||
The theme to delete.
|
||||
"""
|
||||
self.themelist.remove(theme)
|
||||
th = theme + u'.png'
|
||||
try:
|
||||
os.remove(os.path.join(self.path, th))
|
||||
os.remove(os.path.join(self.thumbPath, th))
|
||||
encoding = get_filesystem_encoding()
|
||||
shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
|
||||
except OSError:
|
||||
#if not present do not worry
|
||||
pass
|
||||
# As we do not reload the themes push out the change
|
||||
# Reaload the list as the internal lists and events need
|
||||
# to be triggered
|
||||
self.pushThemes()
|
||||
|
||||
def onExportTheme(self):
|
||||
"""
|
||||
|
@ -532,18 +547,31 @@ class ThemeManager(QtGui.QWidget):
|
|||
os.mkdir(os.path.join(self.path, name))
|
||||
theme_file = os.path.join(theme_dir, name + u'.xml')
|
||||
log.debug(theme_file)
|
||||
editedServiceTheme = False
|
||||
result = QtGui.QMessageBox.Yes
|
||||
if self.saveThemeName != name:
|
||||
if os.path.exists(theme_file):
|
||||
result = QtGui.QMessageBox.question(self,
|
||||
translate('ThemeManager', 'Theme Exists'),
|
||||
translate('ThemeManager',
|
||||
'A theme with this name already exists. '
|
||||
'Would you like to overwrite it?'),
|
||||
translate('ThemeManager', 'A theme with this name already '
|
||||
'exists. Would you like to overwrite it?'),
|
||||
(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||
QtGui.QMessageBox.No)
|
||||
if self.saveThemeName != u'':
|
||||
for plugin in self.parent.plugin_manager.plugins:
|
||||
if plugin.usesTheme(self.saveThemeName):
|
||||
plugin.renameTheme(self.saveThemeName, name)
|
||||
if unicode(self.serviceComboBox.currentText()) == name:
|
||||
editedServiceTheme = True
|
||||
self.deleteTheme(self.saveThemeName)
|
||||
if result == QtGui.QMessageBox.Yes:
|
||||
# Save the theme, overwriting the existing theme if necessary.
|
||||
if image_to and self.oldBackgroundImage and \
|
||||
image_to != self.oldBackgroundImage:
|
||||
try:
|
||||
os.remove(self.oldBackgroundImage)
|
||||
except OSError:
|
||||
log.exception(u'Unable to remove old theme background')
|
||||
outfile = None
|
||||
try:
|
||||
outfile = open(theme_file, u'w')
|
||||
|
@ -563,6 +591,26 @@ class ThemeManager(QtGui.QWidget):
|
|||
log.exception(u'Failed to save theme image')
|
||||
self.generateAndSaveImage(self.path, name, theme_xml)
|
||||
self.loadThemes()
|
||||
# Check if we need to set a new service theme
|
||||
if editedServiceTheme:
|
||||
newThemeIndex = self.serviceComboBox.findText(name)
|
||||
if newThemeIndex != -1:
|
||||
self.serviceComboBox.setCurrentIndex(newThemeIndex)
|
||||
if self.editingDefault:
|
||||
newThemeItem = self.ThemeListWidget.findItems(name,
|
||||
QtCore.Qt.MatchExactly)[0]
|
||||
newThemeIndex = self.ThemeListWidget.indexFromItem(
|
||||
newThemeItem).row()
|
||||
self.global_theme = unicode(
|
||||
self.ThemeListWidget.item(newThemeIndex).text())
|
||||
newName = unicode(translate('ThemeManager', '%s (default)')) % \
|
||||
self.global_theme
|
||||
self.ThemeListWidget.item(newThemeIndex).setText(newName)
|
||||
QtCore.QSettings().setValue(
|
||||
self.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(self.global_theme))
|
||||
Receiver.send_message(u'theme_update_global', self.global_theme)
|
||||
self.pushThemes()
|
||||
else:
|
||||
# Don't close the dialog - allow the user to change the name of
|
||||
# the theme or to cancel the theme dialog completely.
|
||||
|
|
|
@ -25,16 +25,13 @@
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import build_icon, translate
|
||||
|
||||
class Ui_AlertDialog(object):
|
||||
def setupUi(self, AlertDialog):
|
||||
AlertDialog.setObjectName(u'AlertDialog')
|
||||
AlertDialog.resize(567, 440)
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
AlertDialog.setWindowIcon(icon)
|
||||
AlertDialog.setWindowIcon(build_icon(u':/icon/openlp.org-icon-32.bmp'))
|
||||
self.AlertDialogLayout = QtGui.QVBoxLayout(AlertDialog)
|
||||
self.AlertDialogLayout.setSpacing(8)
|
||||
self.AlertDialogLayout.setMargin(8)
|
||||
|
@ -79,25 +76,16 @@ class Ui_AlertDialog(object):
|
|||
self.ManageButtonLayout.setSpacing(8)
|
||||
self.ManageButtonLayout.setObjectName(u'ManageButtonLayout')
|
||||
self.NewButton = QtGui.QPushButton(AlertDialog)
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap(u':/general/general_new.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.NewButton.setIcon(icon1)
|
||||
self.NewButton.setIcon(build_icon(u':/general/general_new.png'))
|
||||
self.NewButton.setObjectName(u'NewButton')
|
||||
self.ManageButtonLayout.addWidget(self.NewButton)
|
||||
self.SaveButton = QtGui.QPushButton(AlertDialog)
|
||||
self.SaveButton.setEnabled(False)
|
||||
icon2 = QtGui.QIcon()
|
||||
icon2.addPixmap(QtGui.QPixmap(u':/general/general_save.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.SaveButton.setIcon(icon2)
|
||||
self.SaveButton.setIcon(build_icon(u':/general/general_save.png'))
|
||||
self.SaveButton.setObjectName(u'SaveButton')
|
||||
self.ManageButtonLayout.addWidget(self.SaveButton)
|
||||
self.DeleteButton = QtGui.QPushButton(AlertDialog)
|
||||
icon3 = QtGui.QIcon()
|
||||
icon3.addPixmap(QtGui.QPixmap(u':/general/general_delete.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.DeleteButton.setIcon(icon3)
|
||||
self.DeleteButton.setIcon(build_icon(u':/general/general_delete.png'))
|
||||
self.DeleteButton.setObjectName(u'DeleteButton')
|
||||
self.ManageButtonLayout.addWidget(self.DeleteButton)
|
||||
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
|
||||
|
@ -111,22 +99,17 @@ class Ui_AlertDialog(object):
|
|||
spacerItem1 = QtGui.QSpacerItem(181, 0, QtGui.QSizePolicy.Expanding,
|
||||
QtGui.QSizePolicy.Minimum)
|
||||
self.AlertButtonLayout.addItem(spacerItem1)
|
||||
displayIcon = build_icon(u':/general/general_live.png')
|
||||
self.DisplayButton = QtGui.QPushButton(AlertDialog)
|
||||
icon4 = QtGui.QIcon()
|
||||
icon4.addPixmap(QtGui.QPixmap(u':/general/general_live.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.DisplayButton.setIcon(icon4)
|
||||
self.DisplayButton.setIcon(displayIcon)
|
||||
self.DisplayButton.setObjectName(u'DisplayButton')
|
||||
self.AlertButtonLayout.addWidget(self.DisplayButton)
|
||||
self.DisplayCloseButton = QtGui.QPushButton(AlertDialog)
|
||||
self.DisplayCloseButton.setIcon(icon4)
|
||||
self.DisplayCloseButton.setIcon(displayIcon)
|
||||
self.DisplayCloseButton.setObjectName(u'DisplayCloseButton')
|
||||
self.AlertButtonLayout.addWidget(self.DisplayCloseButton)
|
||||
self.CloseButton = QtGui.QPushButton(AlertDialog)
|
||||
icon5 = QtGui.QIcon()
|
||||
icon5.addPixmap(QtGui.QPixmap(u':/system/system_close.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.CloseButton.setIcon(icon5)
|
||||
self.CloseButton.setIcon(build_icon(u':/system/system_close.png'))
|
||||
self.CloseButton.setObjectName(u'CloseButton')
|
||||
self.AlertButtonLayout.addWidget(self.CloseButton)
|
||||
self.AlertDialogLayout.addLayout(self.AlertButtonLayout)
|
||||
|
|
|
@ -274,10 +274,6 @@ class AlertsTab(SettingsTab):
|
|||
self.FontComboBox.setCurrentFont(font)
|
||||
self.updateDisplay()
|
||||
|
||||
def onItemSelected(self):
|
||||
self.EditButton.setEnabled(True)
|
||||
self.DeleteButton.setEnabled(True)
|
||||
|
||||
def save(self):
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
|
|
|
@ -38,7 +38,8 @@ class BiblePlugin(Plugin):
|
|||
def __init__(self, plugin_helpers):
|
||||
Plugin.__init__(self, u'Bibles', u'1.9.2', plugin_helpers)
|
||||
self.weight = -9
|
||||
self.icon = build_icon(u':/plugins/plugin_bibles.png')
|
||||
self.icon_path = u':/plugins/plugin_bibles.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
#Register the bible Manager
|
||||
self.status = PluginStatus.Active
|
||||
self.manager = None
|
||||
|
@ -84,8 +85,8 @@ class BiblePlugin(Plugin):
|
|||
self.ExportBibleItem.setVisible(False)
|
||||
|
||||
def onBibleImportClick(self):
|
||||
if self.media_item:
|
||||
self.media_item.onImportClick()
|
||||
if self.mediaItem:
|
||||
self.mediaItem.onImportClick()
|
||||
|
||||
def about(self):
|
||||
about_text = translate('BiblePlugin',
|
||||
|
@ -94,7 +95,26 @@ class BiblePlugin(Plugin):
|
|||
'displayed on the screen during the service.')
|
||||
return about_text
|
||||
|
||||
def canDeleteTheme(self, theme):
|
||||
def usesTheme(self, theme):
|
||||
"""
|
||||
Called to find out if the bible plugin is currently using a theme.
|
||||
|
||||
Returns True if the theme is being used, otherwise returns False.
|
||||
"""
|
||||
if self.settings_tab.bible_theme == theme:
|
||||
return False
|
||||
return True
|
||||
return True
|
||||
return False
|
||||
|
||||
def renameTheme(self, oldTheme, newTheme):
|
||||
"""
|
||||
Rename the theme the bible plugin is using making the plugin use the
|
||||
new name.
|
||||
|
||||
``oldTheme``
|
||||
The name of the theme the plugin should stop using. Unused for
|
||||
this particular plugin.
|
||||
|
||||
``newTheme``
|
||||
The new name the plugin should now use.
|
||||
"""
|
||||
self.settings_tab.bible_theme = newTheme
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import translate
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
|
||||
class Ui_BibleImportWizard(object):
|
||||
def setupUi(self, BibleImportWizard):
|
||||
|
@ -61,10 +62,10 @@ class Ui_BibleImportWizard(object):
|
|||
BibleImportWizard.addPage(self.WelcomePage)
|
||||
self.SelectPage = QtGui.QWizardPage()
|
||||
self.SelectPage.setObjectName(u'SelectPage')
|
||||
self.SelectPageLayout = QtGui.QVBoxLayout(self.SelectPage)
|
||||
self.SelectPageLayout.setSpacing(8)
|
||||
self.SelectPageLayout.setMargin(20)
|
||||
self.SelectPageLayout.setObjectName(u'SelectPageLayout')
|
||||
self.selectPageLayout = QtGui.QVBoxLayout(self.SelectPage)
|
||||
self.selectPageLayout.setSpacing(8)
|
||||
self.selectPageLayout.setMargin(20)
|
||||
self.selectPageLayout.setObjectName(u'selectPageLayout')
|
||||
self.FormatSelectLayout = QtGui.QHBoxLayout()
|
||||
self.FormatSelectLayout.setSpacing(8)
|
||||
self.FormatSelectLayout.setObjectName(u'FormatSelectLayout')
|
||||
|
@ -81,7 +82,7 @@ class Ui_BibleImportWizard(object):
|
|||
spacerItem2 = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.FormatSelectLayout.addItem(spacerItem2)
|
||||
self.SelectPageLayout.addLayout(self.FormatSelectLayout)
|
||||
self.selectPageLayout.addLayout(self.FormatSelectLayout)
|
||||
self.FormatWidget = QtGui.QStackedWidget(self.SelectPage)
|
||||
self.FormatWidget.setObjectName(u'FormatWidget')
|
||||
self.OsisPage = QtGui.QWidget()
|
||||
|
@ -104,10 +105,8 @@ class Ui_BibleImportWizard(object):
|
|||
self.OsisLocationLayout.addWidget(self.OSISLocationEdit)
|
||||
self.OsisFileButton = QtGui.QToolButton(self.OsisPage)
|
||||
self.OsisFileButton.setMaximumSize(QtCore.QSize(32, 16777215))
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/general/general_open.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.OsisFileButton.setIcon(icon)
|
||||
generalIcon = build_icon(u':/general/general_open.png')
|
||||
self.OsisFileButton.setIcon(generalIcon)
|
||||
self.OsisFileButton.setObjectName(u'OsisFileButton')
|
||||
self.OsisLocationLayout.addWidget(self.OsisFileButton)
|
||||
self.OsisLayout.setLayout(1, QtGui.QFormLayout.FieldRole,
|
||||
|
@ -137,7 +136,7 @@ class Ui_BibleImportWizard(object):
|
|||
self.CsvBooksLayout.addWidget(self.BooksLocationEdit)
|
||||
self.BooksFileButton = QtGui.QToolButton(self.CsvPage)
|
||||
self.BooksFileButton.setMaximumSize(QtCore.QSize(32, 16777215))
|
||||
self.BooksFileButton.setIcon(icon)
|
||||
self.BooksFileButton.setIcon(generalIcon)
|
||||
self.BooksFileButton.setObjectName(u'BooksFileButton')
|
||||
self.CsvBooksLayout.addWidget(self.BooksFileButton)
|
||||
self.CsvSourceLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
|
||||
|
@ -154,7 +153,7 @@ class Ui_BibleImportWizard(object):
|
|||
self.CsvVerseLayout.addWidget(self.CsvVerseLocationEdit)
|
||||
self.CsvVersesFileButton = QtGui.QToolButton(self.CsvPage)
|
||||
self.CsvVersesFileButton.setMaximumSize(QtCore.QSize(32, 16777215))
|
||||
self.CsvVersesFileButton.setIcon(icon)
|
||||
self.CsvVersesFileButton.setIcon(generalIcon)
|
||||
self.CsvVersesFileButton.setObjectName(u'CsvVersesFileButton')
|
||||
self.CsvVerseLayout.addWidget(self.CsvVersesFileButton)
|
||||
self.CsvSourceLayout.setLayout(1, QtGui.QFormLayout.FieldRole,
|
||||
|
@ -177,7 +176,7 @@ class Ui_BibleImportWizard(object):
|
|||
self.OpenSongFileEdit.setObjectName(u'OpenSongFileEdit')
|
||||
self.OpenSongFileLayout.addWidget(self.OpenSongFileEdit)
|
||||
self.OpenSongBrowseButton = QtGui.QToolButton(self.OpenSongPage)
|
||||
self.OpenSongBrowseButton.setIcon(icon)
|
||||
self.OpenSongBrowseButton.setIcon(generalIcon)
|
||||
self.OpenSongBrowseButton.setObjectName(u'OpenSongBrowseButton')
|
||||
self.OpenSongFileLayout.addWidget(self.OpenSongBrowseButton)
|
||||
self.OpenSongLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
|
||||
|
@ -251,7 +250,7 @@ class Ui_BibleImportWizard(object):
|
|||
self.WebDownloadTabWidget.addTab(self.ProxyServerTab, u'')
|
||||
self.WebDownloadLayout.addWidget(self.WebDownloadTabWidget)
|
||||
self.FormatWidget.addWidget(self.WebDownloadPage)
|
||||
self.SelectPageLayout.addWidget(self.FormatWidget)
|
||||
self.selectPageLayout.addWidget(self.FormatWidget)
|
||||
BibleImportWizard.addPage(self.SelectPage)
|
||||
self.LicenseDetailsPage = QtGui.QWizardPage()
|
||||
self.LicenseDetailsPage.setObjectName(u'LicenseDetailsPage')
|
||||
|
|
|
@ -342,7 +342,7 @@ class BibleDB(QtCore.QObject, Manager):
|
|||
verse_list.extend(verses)
|
||||
else:
|
||||
log.debug(u'OpenLP failed to find book %s', book)
|
||||
QtGui.QMessageBox.information(self.bible_plugin.media_item,
|
||||
QtGui.QMessageBox.information(self.bible_plugin.mediaItem,
|
||||
translate('BibleDB', 'Book not found'),
|
||||
translate('BibleDB', u'The book you requested could not '
|
||||
'be found in this bible. Please check your spelling '
|
||||
|
|
|
@ -55,6 +55,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
|
||||
def __init__(self, parent, icon, title):
|
||||
self.PluginNameShort = u'Bible'
|
||||
self.pluginNameVisible = translate('BiblesPlugin.MediaItem', 'Bible')
|
||||
self.IconPath = u'songs/song'
|
||||
self.ListViewWithDnD_class = BibleListView
|
||||
self.lastReference = []
|
||||
|
@ -70,9 +71,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||
obj = obj.toPyObject()
|
||||
return unicode(obj)
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = translate('BiblesPlugin.MediaItem', 'Bible')
|
||||
|
||||
def requiredIcons(self):
|
||||
MediaManagerItem.requiredIcons(self)
|
||||
self.hasImportIcon = True
|
||||
|
@ -131,7 +129,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.QuickClearLabel.setObjectName(u'QuickSearchLabel')
|
||||
self.QuickLayout.addWidget(self.QuickClearLabel, 4, 0, 1, 1)
|
||||
self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab)
|
||||
self.ClearQuickSearchComboBox.setObjectName(u'ClearQuickSearchComboBox')
|
||||
self.ClearQuickSearchComboBox.setObjectName(
|
||||
u'ClearQuickSearchComboBox')
|
||||
self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 4, 1, 1, 2)
|
||||
self.QuickSearchButtonLayout = QtGui.QHBoxLayout()
|
||||
self.QuickSearchButtonLayout.setMargin(0)
|
||||
|
@ -169,7 +168,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.AdvancedVersionComboBox.setObjectName(u'AdvancedVersionComboBox')
|
||||
self.AdvancedLayout.addWidget(self.AdvancedVersionComboBox, 0, 1, 1, 2)
|
||||
self.AdvancedSecondBibleLabel = QtGui.QLabel(self.AdvancedTab)
|
||||
self.AdvancedSecondBibleLabel.setObjectName(u'AdvancedSecondBibleLabel')
|
||||
self.AdvancedSecondBibleLabel.setObjectName(
|
||||
u'AdvancedSecondBibleLabel')
|
||||
self.AdvancedLayout.addWidget(self.AdvancedSecondBibleLabel, 1, 0, 1, 1)
|
||||
self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab)
|
||||
self.AdvancedSecondBibleComboBox.setSizeAdjustPolicy(
|
||||
|
@ -223,7 +223,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||
u'AdvancedSearchButtonLayout')
|
||||
self.AdvancedSearchButtonSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.AdvancedSearchButtonLayout.addItem(self.AdvancedSearchButtonSpacer)
|
||||
self.AdvancedSearchButtonLayout.addItem(
|
||||
self.AdvancedSearchButtonSpacer)
|
||||
self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab)
|
||||
self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton')
|
||||
self.AdvancedSearchButtonLayout.addWidget(self.AdvancedSearchButton)
|
||||
|
@ -235,7 +236,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.SearchTabWidget.addTab(self.AdvancedTab,
|
||||
translate('BiblesPlugin.MediaItem', 'Advanced'))
|
||||
# Add the search tab widget to the page layout
|
||||
self.PageLayout.addWidget(self.SearchTabWidget)
|
||||
self.pageLayout.addWidget(self.SearchTabWidget)
|
||||
# Combo Boxes
|
||||
QtCore.QObject.connect(self.AdvancedVersionComboBox,
|
||||
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox)
|
||||
|
@ -271,8 +272,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.SearchProgress.setFormat('')
|
||||
self.SearchProgress.setMinimum(0)
|
||||
self.SearchProgress.setMaximum(0)
|
||||
self.SearchProgress.setGeometry(self.ListView.geometry().left(),
|
||||
self.ListView.geometry().top(), 81, 23)
|
||||
self.SearchProgress.setGeometry(self.listView.geometry().left(),
|
||||
self.listView.geometry().top(), 81, 23)
|
||||
self.SearchProgress.setVisible(False)
|
||||
self.SearchProgress.setObjectName(u'SearchProgress')
|
||||
|
||||
|
@ -370,9 +371,9 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.initialiseBible(bible)
|
||||
|
||||
def onListViewResize(self, width, height):
|
||||
self.SearchProgress.setGeometry(self.ListView.geometry().x(),
|
||||
(self.ListView.geometry().y() + self.ListView.geometry().height())\
|
||||
- 23, 81, 23)
|
||||
listViewGeometry = self.listView.geometry()
|
||||
self.SearchProgress.setGeometry(listViewGeometry.x(),
|
||||
(listViewGeometry.y() + listViewGeometry.height()) - 23, 81, 23)
|
||||
|
||||
def onSearchProgressShow(self):
|
||||
self.SearchProgress.setVisible(True)
|
||||
|
@ -436,7 +437,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
chapter_to, verse_to)
|
||||
self.search_results = self.parent.manager.get_verses(bible, versetext)
|
||||
if self.ClearAdvancedSearchComboBox.currentIndex() == 0:
|
||||
self.ListView.clear()
|
||||
self.listView.clear()
|
||||
self.lastReference = []
|
||||
self.lastReference.append(versetext)
|
||||
self.displayResults(bible)
|
||||
|
@ -456,7 +457,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
bible = unicode(self.QuickVersionComboBox.currentText())
|
||||
text = unicode(self.QuickSearchEdit.text())
|
||||
if self.ClearQuickSearchComboBox.currentIndex() == 0:
|
||||
self.ListView.clear()
|
||||
self.listView.clear()
|
||||
self.lastReference = []
|
||||
self.lastReference.append(text)
|
||||
self.search_results = self.parent.manager.get_verses(bible, text)
|
||||
|
@ -465,7 +466,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
log.debug(u'generating slide data')
|
||||
items = self.ListView.selectedIndexes()
|
||||
items = self.listView.selectedIndexes()
|
||||
if len(items) == 0:
|
||||
return False
|
||||
old_chapter = u''
|
||||
|
@ -506,7 +507,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
bible2_permission = u''
|
||||
# Let's loop through the main lot, and assemble our verses
|
||||
for item in items:
|
||||
bitem = self.ListView.item(item.row())
|
||||
bitem = self.listView.item(item.row())
|
||||
reference = bitem.data(QtCore.Qt.UserRole)
|
||||
if isinstance(reference, QtCore.QVariant):
|
||||
reference = reference.toPyObject()
|
||||
|
@ -617,7 +618,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||
else:
|
||||
self.AdvancedSearchButton.setEnabled(True)
|
||||
self.AdvancedMessage.setText(u'')
|
||||
self.adjustComboBox(1, self.chapters_from, self.AdvancedFromChapter)
|
||||
self.adjustComboBox(1, self.chapters_from,
|
||||
self.AdvancedFromChapter)
|
||||
self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter)
|
||||
self.adjustComboBox(1, self.verses, self.AdvancedFromVerse)
|
||||
self.adjustComboBox(1, self.verses, self.AdvancedToVerse)
|
||||
|
@ -653,8 +655,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||
'text': QtCore.QVariant(verse.text)
|
||||
}
|
||||
bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(vdict))
|
||||
self.ListView.addItem(bible_verse)
|
||||
row = self.ListView.setCurrentRow(count)
|
||||
self.listView.addItem(bible_verse)
|
||||
row = self.listView.setCurrentRow(count)
|
||||
if row:
|
||||
row.setSelected(True)
|
||||
|
||||
|
|
|
@ -50,7 +50,8 @@ class CustomPlugin(Plugin):
|
|||
self.weight = -5
|
||||
self.custommanager = Manager(u'custom', init_schema)
|
||||
self.edit_custom_form = EditCustomForm(self.custommanager)
|
||||
self.icon = build_icon(u':/plugins/plugin_custom.png')
|
||||
self.icon_path = u':/plugins/plugin_custom.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
self.status = PluginStatus.Active
|
||||
|
||||
def getSettingsTab(self):
|
||||
|
@ -68,8 +69,30 @@ class CustomPlugin(Plugin):
|
|||
'songs plugin.<br>')
|
||||
return about_text
|
||||
|
||||
def canDeleteTheme(self, theme):
|
||||
if not self.custommanager.get_all_objects_filtered(CustomSlide,
|
||||
def usesTheme(self, theme):
|
||||
"""
|
||||
Called to find out if the custom plugin is currently using a theme.
|
||||
|
||||
Returns True if the theme is being used, otherwise returns False.
|
||||
"""
|
||||
if self.custommanager.get_all_objects_filtered(CustomSlide,
|
||||
CustomSlide.theme_name == theme):
|
||||
return True
|
||||
return False
|
||||
return False
|
||||
|
||||
def renameTheme(self, oldTheme, newTheme):
|
||||
"""
|
||||
Renames a theme the custom plugin is using making the plugin use the
|
||||
new name.
|
||||
|
||||
``oldTheme``
|
||||
The name of the theme the plugin should stop using.
|
||||
|
||||
``newTheme``
|
||||
The new name the plugin should now use.
|
||||
"""
|
||||
customsUsingTheme = self.custommanager.get_all_objects_filtered(
|
||||
CustomSlide, CustomSlide.theme_name == oldTheme)
|
||||
for custom in customsUsingTheme:
|
||||
custom.theme_name = newTheme
|
||||
self.custommanager.save_object(custom)
|
||||
|
|
|
@ -25,16 +25,14 @@
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import build_icon, translate
|
||||
|
||||
class Ui_customEditDialog(object):
|
||||
def setupUi(self, customEditDialog):
|
||||
customEditDialog.setObjectName(u'customEditDialog')
|
||||
customEditDialog.resize(590, 541)
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
customEditDialog.setWindowIcon(icon)
|
||||
customEditDialog.setWindowIcon(
|
||||
build_icon(u':/icon/openlp.org-icon-32.bmp'))
|
||||
self.gridLayout = QtGui.QGridLayout(customEditDialog)
|
||||
self.gridLayout.setObjectName(u'gridLayout')
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
|
@ -56,20 +54,14 @@ class Ui_customEditDialog(object):
|
|||
self.verticalLayout = QtGui.QVBoxLayout()
|
||||
self.verticalLayout.setObjectName(u'verticalLayout')
|
||||
self.UpButton = QtGui.QPushButton(customEditDialog)
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap(u':/services/service_up.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.UpButton.setIcon(icon1)
|
||||
self.UpButton.setIcon(build_icon(u':/services/service_up.png'))
|
||||
self.UpButton.setObjectName(u'UpButton')
|
||||
self.verticalLayout.addWidget(self.UpButton)
|
||||
spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum,
|
||||
QtGui.QSizePolicy.Expanding)
|
||||
self.verticalLayout.addItem(spacerItem)
|
||||
self.DownButton = QtGui.QPushButton(customEditDialog)
|
||||
icon2 = QtGui.QIcon()
|
||||
icon2.addPixmap(QtGui.QPixmap(u':/services/service_down.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.DownButton.setIcon(icon2)
|
||||
self.DownButton.setIcon(build_icon(u':/services/service_down.png'))
|
||||
self.DownButton.setObjectName(u'DownButton')
|
||||
self.verticalLayout.addWidget(self.DownButton)
|
||||
self.horizontalLayout_4.addLayout(self.verticalLayout)
|
||||
|
@ -138,7 +130,6 @@ class Ui_customEditDialog(object):
|
|||
QtGui.QDialogButtonBox.Save)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(customEditDialog)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
|
||||
customEditDialog.accept)
|
||||
|
|
|
@ -47,6 +47,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
|
||||
def __init__(self, parent, icon, title):
|
||||
self.PluginNameShort = u'Custom'
|
||||
self.pluginNameVisible = translate('CustomPlugin.MediaItem', 'Custom')
|
||||
self.IconPath = u'custom/custom'
|
||||
# this next is a class, not an instance of a class - it will
|
||||
# be instanced by the base MediaManagerItem
|
||||
|
@ -67,9 +68,6 @@ class CustomMediaItem(MediaManagerItem):
|
|||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'custom_preview'), self.onPreviewClick)
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = translate('CustomPlugin.MediaItem', 'Custom')
|
||||
|
||||
def requiredIcons(self):
|
||||
MediaManagerItem.requiredIcons(self)
|
||||
|
||||
|
@ -86,12 +84,12 @@ class CustomMediaItem(MediaManagerItem):
|
|||
self.onRemoteEditClear()
|
||||
|
||||
def loadCustomListView(self, list):
|
||||
self.ListView.clear()
|
||||
self.listView.clear()
|
||||
for customSlide in list:
|
||||
custom_name = QtGui.QListWidgetItem(customSlide.title)
|
||||
custom_name.setData(
|
||||
QtCore.Qt.UserRole, QtCore.QVariant(customSlide.id))
|
||||
self.ListView.addItem(custom_name)
|
||||
self.listView.addItem(custom_name)
|
||||
|
||||
def onNewClick(self):
|
||||
self.parent.edit_custom_form.loadCustom(0)
|
||||
|
@ -121,10 +119,10 @@ class CustomMediaItem(MediaManagerItem):
|
|||
"""
|
||||
Edit a custom item
|
||||
"""
|
||||
if check_item_selected(self.ListView,
|
||||
if check_item_selected(self.listView,
|
||||
translate('CustomPlugin.MediaItem',
|
||||
'You haven\'t selected an item to edit.')):
|
||||
item = self.ListView.currentItem()
|
||||
item = self.listView.currentItem()
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
self.parent.edit_custom_form.loadCustom(item_id, False)
|
||||
self.parent.edit_custom_form.exec_()
|
||||
|
@ -134,17 +132,17 @@ class CustomMediaItem(MediaManagerItem):
|
|||
"""
|
||||
Remove a custom item from the list and database
|
||||
"""
|
||||
if check_item_selected(self.ListView,
|
||||
if check_item_selected(self.listView,
|
||||
translate('CustomPlugin.MediaItem',
|
||||
'You haven\'t selected an item to delete.')):
|
||||
row_list = [item.row() for item in self.ListView.selectedIndexes()]
|
||||
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
||||
row_list.sort(reverse=True)
|
||||
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
for item in self.ListView.selectedIndexes()]
|
||||
for item in self.listView.selectedIndexes()]
|
||||
for id in id_list:
|
||||
self.parent.custommanager.delete_object(CustomSlide, id)
|
||||
for row in row_list:
|
||||
self.ListView.takeItem(row)
|
||||
self.listView.takeItem(row)
|
||||
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
raw_slides = []
|
||||
|
@ -153,7 +151,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
theme = None
|
||||
if item is None:
|
||||
if self.remoteTriggered is None:
|
||||
item = self.ListView.currentItem()
|
||||
item = self.listView.currentItem()
|
||||
if item is None:
|
||||
return False
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
|
|
|
@ -36,7 +36,8 @@ class ImagePlugin(Plugin):
|
|||
def __init__(self, plugin_helpers):
|
||||
Plugin.__init__(self, u'Images', u'1.9.2', plugin_helpers)
|
||||
self.weight = -7
|
||||
self.icon = build_icon(u':/plugins/plugin_images.png')
|
||||
self.icon_path = u':/plugins/plugin_images.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
self.status = PluginStatus.Active
|
||||
|
||||
def getSettingsTab(self):
|
||||
|
|
|
@ -50,15 +50,13 @@ class ImageMediaItem(MediaManagerItem):
|
|||
|
||||
def __init__(self, parent, icon, title):
|
||||
self.PluginNameShort = u'Image'
|
||||
self.pluginNameVisible = translate('ImagePlugin.MediaItem', 'Image')
|
||||
self.IconPath = u'images/image'
|
||||
# this next is a class, not an instance of a class - it will
|
||||
# be instanced by the base MediaManagerItem
|
||||
self.ListViewWithDnD_class = ImageListView
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = translate('ImagePlugin.MediaItem', 'Image')
|
||||
|
||||
def retranslateUi(self):
|
||||
self.OnNewPrompt = translate('ImagePlugin.MediaItem',
|
||||
'Select Image(s)')
|
||||
|
@ -75,10 +73,10 @@ class ImageMediaItem(MediaManagerItem):
|
|||
|
||||
def initialise(self):
|
||||
log.debug(u'initialise')
|
||||
self.ListView.clear()
|
||||
self.ListView.setSelectionMode(
|
||||
self.listView.clear()
|
||||
self.listView.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.ListView.setIconSize(QtCore.QSize(88, 50))
|
||||
self.listView.setIconSize(QtCore.QSize(88, 50))
|
||||
self.servicePath = os.path.join(
|
||||
AppLocation.get_section_data_path(self.settingsSection),
|
||||
u'thumbnails')
|
||||
|
@ -89,10 +87,10 @@ class ImageMediaItem(MediaManagerItem):
|
|||
|
||||
def addListViewToToolBar(self):
|
||||
MediaManagerItem.addListViewToToolBar(self)
|
||||
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
self.ListView.addAction(
|
||||
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
self.listView.addAction(
|
||||
context_menu_action(
|
||||
self.ListView, u':/slides/slide_blank.png',
|
||||
self.listView, u':/slides/slide_blank.png',
|
||||
translate('ImagePlugin.MediaItem', 'Replace Live Background'),
|
||||
self.onReplaceClick))
|
||||
|
||||
|
@ -106,23 +104,23 @@ class ImageMediaItem(MediaManagerItem):
|
|||
self.ImageWidget.sizePolicy().hasHeightForWidth())
|
||||
self.ImageWidget.setSizePolicy(sizePolicy)
|
||||
self.ImageWidget.setObjectName(u'ImageWidget')
|
||||
self.blankButton = self.Toolbar.addToolbarButton(
|
||||
self.blankButton = self.toolbar.addToolbarButton(
|
||||
u'Replace Background', u':/slides/slide_blank.png',
|
||||
translate('ImagePlugin.MediaItem', 'Replace Live Background'),
|
||||
self.onReplaceClick, False)
|
||||
# Add the song widget to the page layout
|
||||
self.PageLayout.addWidget(self.ImageWidget)
|
||||
self.pageLayout.addWidget(self.ImageWidget)
|
||||
|
||||
def onDeleteClick(self):
|
||||
"""
|
||||
Remove an image item from the list
|
||||
"""
|
||||
if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem',
|
||||
if check_item_selected(self.listView, translate('ImagePlugin.MediaItem',
|
||||
'You must select an item to delete.')):
|
||||
row_list = [item.row() for item in self.ListView.selectedIndexes()]
|
||||
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
||||
row_list.sort(reverse=True)
|
||||
for row in row_list:
|
||||
text = self.ListView.item(row)
|
||||
text = self.listView.item(row)
|
||||
if text:
|
||||
try:
|
||||
os.remove(os.path.join(self.servicePath,
|
||||
|
@ -130,7 +128,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||
except OSError:
|
||||
#if not present do not worry
|
||||
pass
|
||||
self.ListView.takeItem(row)
|
||||
self.listView.takeItem(row)
|
||||
SettingsManager.set_list(self.settingsSection,
|
||||
self.settingsSection, self.getFileList())
|
||||
|
||||
|
@ -144,14 +142,14 @@ class ImageMediaItem(MediaManagerItem):
|
|||
else:
|
||||
icon = build_icon(u':/general/general_delete.png')
|
||||
else:
|
||||
icon = self.IconFromFile(file, thumb)
|
||||
icon = self.iconFromFile(file, thumb)
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
item_name.setIcon(icon)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||
self.ListView.addItem(item_name)
|
||||
self.listView.addItem(item_name)
|
||||
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
items = self.ListView.selectedIndexes()
|
||||
items = self.listView.selectedIndexes()
|
||||
if items:
|
||||
service_item.title = unicode(
|
||||
translate('ImagePlugin.MediaItem', 'Image(s)'))
|
||||
|
@ -160,7 +158,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||
service_item.add_capability(ItemCapabilities.AllowsLoop)
|
||||
service_item.add_capability(ItemCapabilities.AllowsAdditions)
|
||||
for item in items:
|
||||
bitem = self.ListView.item(item.row())
|
||||
bitem = self.listView.item(item.row())
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
frame = QtGui.QImage(unicode(filename))
|
||||
(path, name) = os.path.split(filename)
|
||||
|
@ -170,12 +168,12 @@ class ImageMediaItem(MediaManagerItem):
|
|||
return False
|
||||
|
||||
def onReplaceClick(self):
|
||||
if check_item_selected(self.ListView,
|
||||
if check_item_selected(self.listView,
|
||||
translate('ImagePlugin.MediaItem',
|
||||
'You must select an item to process.')):
|
||||
items = self.ListView.selectedIndexes()
|
||||
items = self.listView.selectedIndexes()
|
||||
for item in items:
|
||||
bitem = self.ListView.item(item.row())
|
||||
bitem = self.listView.item(item.row())
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
frame = QtGui.QImage(unicode(filename))
|
||||
self.parent.displayManager.displayImageWithText(frame)
|
||||
|
|
|
@ -47,6 +47,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||
|
||||
def __init__(self, parent, icon, title):
|
||||
self.PluginNameShort = u'Media'
|
||||
self.pluginNameVisible = translate('MediaPlugin.MediaItem', 'Media')
|
||||
self.IconPath = u'images/image'
|
||||
self.background = False
|
||||
# this next is a class, not an instance of a class - it will
|
||||
|
@ -56,10 +57,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||
u':/media/media_video.png').toImage()
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.singleServiceItem = False
|
||||
self.ServiceItemIconName = u':/media/media_video.png'
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = translate('MediaPlugin.MediaItem', 'Media')
|
||||
self.serviceItemIconName = u':/media/media_video.png'
|
||||
|
||||
def retranslateUi(self):
|
||||
self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
|
||||
|
@ -76,9 +74,9 @@ class MediaMediaItem(MediaManagerItem):
|
|||
|
||||
def addListViewToToolBar(self):
|
||||
MediaManagerItem.addListViewToToolBar(self)
|
||||
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
self.ListView.addAction(
|
||||
context_menu_action(self.ListView, u':/slides/slide_blank.png',
|
||||
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
self.listView.addAction(
|
||||
context_menu_action(self.listView, u':/slides/slide_blank.png',
|
||||
translate('MediaPlugin.MediaItem', 'Replace Live Background'),
|
||||
self.onReplaceClick))
|
||||
|
||||
|
@ -93,25 +91,25 @@ class MediaMediaItem(MediaManagerItem):
|
|||
self.ImageWidget.setSizePolicy(sizePolicy)
|
||||
self.ImageWidget.setObjectName(u'ImageWidget')
|
||||
#Replace backgrounds do not work at present so remove functionality.
|
||||
self.blankButton = self.Toolbar.addToolbarButton(
|
||||
self.blankButton = self.toolbar.addToolbarButton(
|
||||
u'Replace Background', u':/slides/slide_blank.png',
|
||||
translate('MediaPlugin.MediaItem', 'Replace Live Background'),
|
||||
self.onReplaceClick, False)
|
||||
# Add the song widget to the page layout
|
||||
self.PageLayout.addWidget(self.ImageWidget)
|
||||
self.pageLayout.addWidget(self.ImageWidget)
|
||||
|
||||
def onReplaceClick(self):
|
||||
|
||||
if check_item_selected(self.ListView,
|
||||
if check_item_selected(self.listView,
|
||||
translate('ImagePlugin.MediaItem',
|
||||
'You must select an item to process.')):
|
||||
item = self.ListView.currentItem()
|
||||
item = self.listView.currentItem()
|
||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
self.parent.displayManager.displayVideo(filename)
|
||||
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
if item is None:
|
||||
item = self.ListView.currentItem()
|
||||
item = self.listView.currentItem()
|
||||
if item is None:
|
||||
return False
|
||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
|
@ -124,9 +122,9 @@ class MediaMediaItem(MediaManagerItem):
|
|||
return True
|
||||
|
||||
def initialise(self):
|
||||
self.ListView.setSelectionMode(
|
||||
self.listView.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
self.ListView.setIconSize(QtCore.QSize(88, 50))
|
||||
self.listView.setIconSize(QtCore.QSize(88, 50))
|
||||
self.loadList(SettingsManager.load_list(self.settingsSection,
|
||||
self.settingsSection))
|
||||
|
||||
|
@ -134,12 +132,12 @@ class MediaMediaItem(MediaManagerItem):
|
|||
"""
|
||||
Remove a media item from the list
|
||||
"""
|
||||
if check_item_selected(self.ListView, translate('MediaPlugin.MediaItem',
|
||||
if check_item_selected(self.listView, translate('MediaPlugin.MediaItem',
|
||||
'You must select an item to delete.')):
|
||||
row_list = [item.row() for item in self.ListView.selectedIndexes()]
|
||||
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
||||
row_list.sort(reverse=True)
|
||||
for row in row_list:
|
||||
self.ListView.takeItem(row)
|
||||
self.listView.takeItem(row)
|
||||
SettingsManager.set_list(self.settingsSection,
|
||||
self.settingsSection, self.getFileList())
|
||||
|
||||
|
@ -150,4 +148,4 @@ class MediaMediaItem(MediaManagerItem):
|
|||
img = QtGui.QPixmap(u':/media/media_video.png').toImage()
|
||||
item_name.setIcon(build_icon(img))
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||
self.ListView.addItem(item_name)
|
||||
self.listView.addItem(item_name)
|
||||
|
|
|
@ -38,7 +38,8 @@ class MediaPlugin(Plugin):
|
|||
def __init__(self, plugin_helpers):
|
||||
Plugin.__init__(self, u'Media', u'1.9.2', plugin_helpers)
|
||||
self.weight = -6
|
||||
self.icon = build_icon(u':/plugins/plugin_media.png')
|
||||
self.icon_path = u':/plugins/plugin_media.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
# passed with drag and drop messages
|
||||
self.dnd_id = u'Media'
|
||||
self.status = PluginStatus.Active
|
||||
|
|
|
@ -37,8 +37,6 @@ import logging
|
|||
import os
|
||||
import time
|
||||
|
||||
from openlp.core.lib import resize_image
|
||||
|
||||
if os.name == u'nt':
|
||||
from win32com.client import Dispatch
|
||||
import pywintypes
|
||||
|
@ -74,6 +72,7 @@ class ImpressController(PresentationController):
|
|||
self.alsosupports = [u'.ppt', u'.pps', u'.pptx', u'.ppsx']
|
||||
self.process = None
|
||||
self.desktop = None
|
||||
self.manager = None
|
||||
|
||||
def check_available(self):
|
||||
"""
|
||||
|
@ -104,6 +103,10 @@ class ImpressController(PresentationController):
|
|||
self.process.waitForStarted()
|
||||
|
||||
def get_uno_desktop(self):
|
||||
"""
|
||||
On non-Windows platforms, use Uno. Get the OpenOffice desktop
|
||||
which will be used to manage impress
|
||||
"""
|
||||
log.debug(u'get UNO Desktop Openoffice')
|
||||
ctx = None
|
||||
loop = 0
|
||||
|
@ -134,10 +137,19 @@ class ImpressController(PresentationController):
|
|||
return None
|
||||
|
||||
def get_com_desktop(self):
|
||||
"""
|
||||
On Windows platforms, use COM. Return the desktop object which
|
||||
will be used to manage Impress
|
||||
"""
|
||||
log.debug(u'get COM Desktop OpenOffice')
|
||||
if not self.manager:
|
||||
return None
|
||||
return self.manager.createInstance(u'com.sun.star.frame.Desktop')
|
||||
|
||||
def get_com_servicemanager(self):
|
||||
"""
|
||||
Return the OOo service manager for windows
|
||||
"""
|
||||
log.debug(u'get_com_servicemanager openoffice')
|
||||
try:
|
||||
return Dispatch(u'com.sun.star.ServiceManager')
|
||||
|
@ -171,13 +183,23 @@ class ImpressController(PresentationController):
|
|||
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):
|
||||
"""
|
||||
Class which holds information and controls a single presentation
|
||||
"""
|
||||
|
||||
def __init__(self, controller, presentation):
|
||||
"""
|
||||
Constructor, store information about the file and initialise
|
||||
"""
|
||||
log.debug(u'Init Presentation OpenOffice')
|
||||
PresentationDocument.__init__(self, controller, presentation)
|
||||
self.document = None
|
||||
|
@ -208,9 +230,8 @@ class ImpressDocument(PresentationDocument):
|
|||
desktop = self.controller.get_uno_desktop()
|
||||
url = uno.systemPathToFileUrl(self.filepath)
|
||||
if desktop is None:
|
||||
return
|
||||
return False
|
||||
self.desktop = desktop
|
||||
#print "s.dsk2 ", self.desktop
|
||||
properties = []
|
||||
properties.append(self.create_property(u'Minimized', True))
|
||||
properties = tuple(properties)
|
||||
|
@ -219,12 +240,13 @@ class ImpressDocument(PresentationDocument):
|
|||
0, properties)
|
||||
except:
|
||||
log.exception(u'Failed to load presentation')
|
||||
return
|
||||
return False
|
||||
self.presentation = self.document.getPresentation()
|
||||
self.presentation.Display = \
|
||||
self.controller.plugin.renderManager.screens.current_display + 1
|
||||
self.control = None
|
||||
self.create_thumbnails()
|
||||
return True
|
||||
|
||||
def create_thumbnails(self):
|
||||
"""
|
||||
|
@ -234,30 +256,36 @@ class ImpressDocument(PresentationDocument):
|
|||
if self.check_thumbnails():
|
||||
return
|
||||
if os.name == u'nt':
|
||||
thumbdir = u'file:///' + self.thumbnailpath.replace(
|
||||
thumbdirurl = u'file:///' + self.get_temp_folder().replace(
|
||||
u'\\', u'/').replace(u':', u'|').replace(u' ', u'%20')
|
||||
else:
|
||||
thumbdir = uno.systemPathToFileUrl(self.thumbnailpath)
|
||||
thumbdirurl = uno.systemPathToFileUrl(self.get_temp_folder())
|
||||
props = []
|
||||
props.append(self.create_property(u'FilterName', u'impress_png_Export'))
|
||||
props = tuple(props)
|
||||
doc = self.document
|
||||
pages = doc.getDrawPages()
|
||||
if not os.path.isdir(self.get_temp_folder()):
|
||||
os.makedirs(self.get_temp_folder())
|
||||
for idx in range(pages.getCount()):
|
||||
page = pages.getByIndex(idx)
|
||||
doc.getCurrentController().setCurrentPage(page)
|
||||
path = u'%s/%s%s.png' % (thumbdir, self.controller.thumbnailprefix,
|
||||
unicode(idx + 1))
|
||||
urlpath = u'%s/%s.png' % (thumbdirurl, unicode(idx + 1))
|
||||
path = os.path.join(self.get_temp_folder(),
|
||||
unicode(idx + 1) + u'.png')
|
||||
try:
|
||||
doc.storeToURL(path , props)
|
||||
preview = resize_image(path, 640, 480)
|
||||
doc.storeToURL(urlpath, props)
|
||||
self.convert_thumbnail(path, idx + 1)
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
preview.save(path, u'png')
|
||||
except:
|
||||
log.exception(u'%s - Unable to store openoffice preview' % path)
|
||||
|
||||
def create_property(self, name, value):
|
||||
"""
|
||||
Create an OOo style property object which are passed into some
|
||||
Uno methods
|
||||
"""
|
||||
log.debug(u'create property OpenOffice')
|
||||
if os.name == u'nt':
|
||||
prop = self.controller.manager.\
|
||||
|
@ -288,6 +316,9 @@ class ImpressDocument(PresentationDocument):
|
|||
self.controller.remove_doc(self)
|
||||
|
||||
def is_loaded(self):
|
||||
"""
|
||||
Returns true if a presentation is loaded
|
||||
"""
|
||||
log.debug(u'is loaded OpenOffice')
|
||||
#print "is_loaded "
|
||||
if self.presentation is None or self.document is None:
|
||||
|
@ -302,6 +333,9 @@ class ImpressDocument(PresentationDocument):
|
|||
return True
|
||||
|
||||
def is_active(self):
|
||||
"""
|
||||
Returns true if a presentation is active and running
|
||||
"""
|
||||
log.debug(u'is active OpenOffice')
|
||||
#print "is_active "
|
||||
if not self.is_loaded():
|
||||
|
@ -313,10 +347,16 @@ class ImpressDocument(PresentationDocument):
|
|||
return True
|
||||
|
||||
def unblank_screen(self):
|
||||
"""
|
||||
Unblanks the screen
|
||||
"""
|
||||
log.debug(u'unblank screen OpenOffice')
|
||||
return self.control.resume()
|
||||
|
||||
def blank_screen(self):
|
||||
"""
|
||||
Blanks the screen
|
||||
"""
|
||||
log.debug(u'blank screen OpenOffice')
|
||||
self.control.blankScreen(0)
|
||||
|
||||
|
@ -331,6 +371,9 @@ class ImpressDocument(PresentationDocument):
|
|||
return False
|
||||
|
||||
def stop_presentation(self):
|
||||
"""
|
||||
Stop the presentation, remove from screen
|
||||
"""
|
||||
log.debug(u'stop presentation OpenOffice')
|
||||
# deactivate should hide the screen according to docs, but doesn't
|
||||
#self.control.deactivate()
|
||||
|
@ -338,6 +381,9 @@ class ImpressDocument(PresentationDocument):
|
|||
self.control = None
|
||||
|
||||
def start_presentation(self):
|
||||
"""
|
||||
Start the presentation from the beginning
|
||||
"""
|
||||
log.debug(u'start presentation OpenOffice')
|
||||
if self.control is None or not self.control.isRunning():
|
||||
self.presentation.start()
|
||||
|
@ -354,12 +400,21 @@ class ImpressDocument(PresentationDocument):
|
|||
self.goto_slide(1)
|
||||
|
||||
def get_slide_number(self):
|
||||
"""
|
||||
Return the current slide number on the screen, from 1
|
||||
"""
|
||||
return self.control.getCurrentSlideIndex() + 1
|
||||
|
||||
def get_slide_count(self):
|
||||
"""
|
||||
Return the total number of slides
|
||||
"""
|
||||
return self.document.getDrawPages().getCount()
|
||||
|
||||
def goto_slide(self, slideno):
|
||||
"""
|
||||
Go to a specific slide (from 1)
|
||||
"""
|
||||
self.control.gotoSlideIndex(slideno-1)
|
||||
|
||||
def next_step(self):
|
||||
|
|
|
@ -30,14 +30,17 @@ from PyQt4 import QtCore, QtGui
|
|||
|
||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||
SettingsManager, translate, check_item_selected
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.plugins.presentations.lib import MessageListener
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# We have to explicitly create separate classes for each plugin
|
||||
# in order for DnD to the Service manager to work correctly.
|
||||
class PresentationListView(BaseListWithDnD):
|
||||
"""
|
||||
Class for the list of Presentations
|
||||
|
||||
We have to explicitly create separate classes for each plugin
|
||||
in order for DnD to the Service manager to work correctly.
|
||||
"""
|
||||
def __init__(self, parent=None):
|
||||
self.PluginName = u'Presentations'
|
||||
BaseListWithDnD.__init__(self, parent)
|
||||
|
@ -45,13 +48,18 @@ class PresentationListView(BaseListWithDnD):
|
|||
class PresentationMediaItem(MediaManagerItem):
|
||||
"""
|
||||
This is the Presentation media manager item for Presentation Items.
|
||||
It can present files using Openoffice
|
||||
It can present files using Openoffice and Powerpoint
|
||||
"""
|
||||
log.info(u'Presentations Media Item loaded')
|
||||
|
||||
def __init__(self, parent, icon, title, controllers):
|
||||
"""
|
||||
Constructor. Setup defaults
|
||||
"""
|
||||
self.controllers = controllers
|
||||
self.PluginNameShort = u'Presentation'
|
||||
self.pluginNameVisible = translate('PresentationPlugin.MediaItem',
|
||||
'Presentation')
|
||||
self.IconPath = u'presentations/presentation'
|
||||
self.Automatic = u''
|
||||
# this next is a class, not an instance of a class - it will
|
||||
|
@ -60,11 +68,10 @@ class PresentationMediaItem(MediaManagerItem):
|
|||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.message_listener = MessageListener(self)
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = translate('PresentationPlugin.MediaItem',
|
||||
'Presentation')
|
||||
|
||||
def retranslateUi(self):
|
||||
"""
|
||||
The name of the plugin media displayed in UI
|
||||
"""
|
||||
self.OnNewPrompt = translate('PresentationPlugin.MediaItem',
|
||||
'Select Presentation(s)')
|
||||
self.Automatic = translate('PresentationPlugin.MediaItem',
|
||||
|
@ -82,12 +89,18 @@ class PresentationMediaItem(MediaManagerItem):
|
|||
'Presentations (%s)' % fileType)
|
||||
|
||||
def requiredIcons(self):
|
||||
"""
|
||||
Set which icons the media manager tab should show
|
||||
"""
|
||||
MediaManagerItem.requiredIcons(self)
|
||||
self.hasFileIcon = True
|
||||
self.hasNewIcon = False
|
||||
self.hasEditIcon = False
|
||||
|
||||
def addEndHeaderBar(self):
|
||||
"""
|
||||
Display custom media manager items for presentations
|
||||
"""
|
||||
self.PresentationWidget = QtGui.QWidget(self)
|
||||
sizePolicy = QtGui.QSizePolicy(
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
|
@ -108,18 +121,16 @@ class PresentationMediaItem(MediaManagerItem):
|
|||
self.DisplayTypeLabel.setText(
|
||||
translate('PresentationPlugin.MediaItem', 'Present using:'))
|
||||
# Add the Presentation widget to the page layout
|
||||
self.PageLayout.addWidget(self.PresentationWidget)
|
||||
self.pageLayout.addWidget(self.PresentationWidget)
|
||||
|
||||
def initialise(self):
|
||||
self.servicePath = os.path.join(
|
||||
AppLocation.get_section_data_path(self.settingsSection),
|
||||
u'thumbnails')
|
||||
self.ListView.setIconSize(QtCore.QSize(88, 50))
|
||||
if not os.path.exists(self.servicePath):
|
||||
os.mkdir(self.servicePath)
|
||||
"""
|
||||
Populate the media manager tab
|
||||
"""
|
||||
self.listView.setIconSize(QtCore.QSize(88, 50))
|
||||
list = SettingsManager.load_list(
|
||||
self.settingsSection, u'presentations')
|
||||
self.loadList(list)
|
||||
self.loadList(list, True)
|
||||
for item in self.controllers:
|
||||
#load the drop down selection
|
||||
if self.controllers[item].enabled:
|
||||
|
@ -128,7 +139,12 @@ class PresentationMediaItem(MediaManagerItem):
|
|||
self.DisplayTypeComboBox.insertItem(0, self.Automatic)
|
||||
self.DisplayTypeComboBox.setCurrentIndex(0)
|
||||
|
||||
def loadList(self, list):
|
||||
def loadList(self, list, initialLoad=False):
|
||||
"""
|
||||
Add presentations into the media manager
|
||||
This is called both on initial load of the plugin to populate with
|
||||
existing files, and when the user adds new files via the media manager
|
||||
"""
|
||||
currlist = self.getFileList()
|
||||
titles = []
|
||||
for file in currlist:
|
||||
|
@ -138,67 +154,73 @@ class PresentationMediaItem(MediaManagerItem):
|
|||
continue
|
||||
filename = os.path.split(unicode(file))[1]
|
||||
if titles.count(filename) > 0:
|
||||
QtGui.QMessageBox.critical(
|
||||
self, translate('PresentationPlugin.MediaItem',
|
||||
'File exists'),
|
||||
if not initialLoad:
|
||||
QtGui.QMessageBox.critical(
|
||||
self, translate('PresentationPlugin.MediaItem',
|
||||
'File exists'),
|
||||
translate('PresentationPlugin.MediaItem',
|
||||
'A presentation with that filename already exists.'),
|
||||
QtGui.QMessageBox.Ok)
|
||||
else:
|
||||
icon = None
|
||||
for controller in self.controllers:
|
||||
thumbPath = os.path.join(
|
||||
AppLocation.get_section_data_path(
|
||||
self.settingsSection),
|
||||
u'thumbnails', controller, filename)
|
||||
thumb = os.path.join(thumbPath, u'slide1.png')
|
||||
preview = os.path.join(
|
||||
AppLocation.get_section_data_path(
|
||||
self.settingsSection),
|
||||
controller, u'thumbnails', filename, u'slide1.png')
|
||||
if os.path.exists(preview):
|
||||
if os.path.exists(thumb):
|
||||
if self.validate(preview, thumb):
|
||||
icon = build_icon(thumb)
|
||||
else:
|
||||
icon = build_icon(
|
||||
u':/general/general_delete.png')
|
||||
else:
|
||||
os.makedirs(thumbPath)
|
||||
icon = self.IconFromFile(preview, thumb)
|
||||
if not icon:
|
||||
QtGui.QMessageBox.Ok)
|
||||
continue
|
||||
controller_name = self.findControllerByType(filename)
|
||||
if controller_name:
|
||||
controller = self.controllers[controller_name]
|
||||
doc = controller.add_doc(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:
|
||||
doc.load_presentation()
|
||||
preview = doc.get_thumbnail_path(1, True)
|
||||
doc.close_presentation()
|
||||
if preview and self.validate(preview, thumb):
|
||||
icon = build_icon(thumb)
|
||||
else:
|
||||
icon = build_icon(u':/general/general_delete.png')
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||
item_name.setIcon(icon)
|
||||
self.ListView.addItem(item_name)
|
||||
else:
|
||||
if initialLoad:
|
||||
icon = build_icon(u':/general/general_delete.png')
|
||||
else:
|
||||
QtGui.QMessageBox.critical(
|
||||
self, translate('PresentationPlugin.MediaItem',
|
||||
'Unsupported file'),
|
||||
translate('PresentationPlugin.MediaItem',
|
||||
'This type of presentation is not supported'),
|
||||
QtGui.QMessageBox.Ok)
|
||||
continue
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||
item_name.setIcon(icon)
|
||||
self.listView.addItem(item_name)
|
||||
|
||||
def onDeleteClick(self):
|
||||
"""
|
||||
Remove a presentation item from the list
|
||||
"""
|
||||
if check_item_selected(self.ListView,
|
||||
if check_item_selected(self.listView,
|
||||
translate('PresentationPlugin.MediaItem',
|
||||
'You must select an item to delete.')):
|
||||
items = self.ListView.selectedIndexes()
|
||||
items = self.listView.selectedIndexes()
|
||||
row_list = [item.row() for item in items]
|
||||
row_list.sort(reverse=True)
|
||||
for item in items:
|
||||
filepath = unicode(item.data(
|
||||
QtCore.Qt.UserRole).toString())
|
||||
#not sure of this has errors
|
||||
#John please can you look at .
|
||||
for cidx in self.controllers:
|
||||
doc = self.controllers[cidx].add_doc(filepath)
|
||||
doc.presentation_deleted()
|
||||
doc.close_presentation()
|
||||
for row in row_list:
|
||||
self.ListView.takeItem(row)
|
||||
self.listView.takeItem(row)
|
||||
SettingsManager.set_list(self.settingsSection,
|
||||
self.settingsSection, self.getFileList())
|
||||
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
items = self.ListView.selectedIndexes()
|
||||
"""
|
||||
Load the relevant information for displaying the presentation
|
||||
in the slidecontroller. In the case of powerpoints, an image
|
||||
for each slide
|
||||
"""
|
||||
items = self.listView.selectedIndexes()
|
||||
if len(items) > 1:
|
||||
return False
|
||||
service_item.title = unicode(self.DisplayTypeComboBox.currentText())
|
||||
|
@ -206,7 +228,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||
shortname = service_item.shortname
|
||||
if shortname:
|
||||
for item in items:
|
||||
bitem = self.ListView.item(item.row())
|
||||
bitem = self.listView.item(item.row())
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
if shortname == self.Automatic:
|
||||
service_item.shortname = self.findControllerByType(filename)
|
||||
|
@ -215,20 +237,27 @@ class PresentationMediaItem(MediaManagerItem):
|
|||
controller = self.controllers[service_item.shortname]
|
||||
(path, name) = os.path.split(filename)
|
||||
doc = controller.add_doc(filename)
|
||||
if doc.get_slide_preview_file(1) is None:
|
||||
if doc.get_thumbnail_path(1, True) is None:
|
||||
doc.load_presentation()
|
||||
i = 1
|
||||
img = doc.get_slide_preview_file(i)
|
||||
img = doc.get_thumbnail_path(i, True)
|
||||
while img:
|
||||
service_item.add_from_command(path, name, img)
|
||||
i = i + 1
|
||||
img = doc.get_slide_preview_file(i)
|
||||
img = doc.get_thumbnail_path(i, True)
|
||||
doc.close_presentation()
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def findControllerByType(self, filename):
|
||||
"""
|
||||
Determine the default application controller to use for the selected
|
||||
file type. This is used if "Automatic" is set as the preferred
|
||||
controller. Find the first (alphabetic) enabled controller which
|
||||
"supports" the extension. If none found, then look for a controller
|
||||
which "alsosupports" it instead.
|
||||
"""
|
||||
filetype = os.path.splitext(filename)[1]
|
||||
if not filetype:
|
||||
return None
|
||||
|
|
|
@ -41,17 +41,28 @@ class Controller(object):
|
|||
log.info(u'Controller loaded')
|
||||
|
||||
def __init__(self, live):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
self.is_live = live
|
||||
self.doc = None
|
||||
log.info(u'%s controller loaded' % live)
|
||||
|
||||
def add_handler(self, controller, file, is_blank):
|
||||
"""
|
||||
Add a handler, which is an instance of a presentation and
|
||||
slidecontroller combination. If the slidecontroller has a display
|
||||
then load the presentation.
|
||||
"""
|
||||
log.debug(u'Live = %s, add_handler %s' % (self.is_live, file))
|
||||
self.controller = controller
|
||||
if self.doc is not None:
|
||||
self.shutdown()
|
||||
self.doc = self.controller.add_doc(file)
|
||||
self.doc.load_presentation()
|
||||
if not self.doc.load_presentation():
|
||||
# Display error message to user
|
||||
# Inform slidecontroller that the action failed?
|
||||
return
|
||||
if self.is_live:
|
||||
self.doc.start_presentation()
|
||||
if is_blank:
|
||||
|
@ -60,6 +71,10 @@ class Controller(object):
|
|||
self.doc.slidenumber = 0
|
||||
|
||||
def activate(self):
|
||||
"""
|
||||
Active the presentation, and show it on the screen.
|
||||
Use the last slide number.
|
||||
"""
|
||||
log.debug(u'Live = %s, activate' % self.is_live)
|
||||
if self.doc.is_active():
|
||||
return
|
||||
|
@ -71,6 +86,9 @@ class Controller(object):
|
|||
self.doc.goto_slide(self.doc.slidenumber)
|
||||
|
||||
def slide(self, slide):
|
||||
"""
|
||||
Go to a specific slide
|
||||
"""
|
||||
log.debug(u'Live = %s, slide' % self.is_live)
|
||||
if not self.is_live:
|
||||
return
|
||||
|
@ -152,6 +170,9 @@ class Controller(object):
|
|||
#self.timer.stop()
|
||||
|
||||
def blank(self):
|
||||
"""
|
||||
Instruct the controller to blank the presentation
|
||||
"""
|
||||
log.debug(u'Live = %s, blank' % self.is_live)
|
||||
if not self.is_live:
|
||||
return
|
||||
|
@ -162,6 +183,9 @@ class Controller(object):
|
|||
self.doc.blank_screen()
|
||||
|
||||
def stop(self):
|
||||
"""
|
||||
Instruct the controller to stop and hide the presentation
|
||||
"""
|
||||
log.debug(u'Live = %s, stop' % self.is_live)
|
||||
if not self.is_live:
|
||||
return
|
||||
|
@ -172,6 +196,9 @@ class Controller(object):
|
|||
self.doc.stop_presentation()
|
||||
|
||||
def unblank(self):
|
||||
"""
|
||||
Instruct the controller to unblank the presentation
|
||||
"""
|
||||
log.debug(u'Live = %s, unblank' % self.is_live)
|
||||
if not self.is_live:
|
||||
return
|
||||
|
@ -246,6 +273,9 @@ class MessageListener(object):
|
|||
controller.add_handler(self.controllers[self.handler], file, is_blank)
|
||||
|
||||
def slide(self, message):
|
||||
"""
|
||||
React to the message to move to a specific slide
|
||||
"""
|
||||
is_live = message[1]
|
||||
slide = message[2]
|
||||
if is_live:
|
||||
|
@ -254,6 +284,9 @@ class MessageListener(object):
|
|||
self.preview_handler.slide(slide)
|
||||
|
||||
def first(self, message):
|
||||
"""
|
||||
React to the message to move to the first slide
|
||||
"""
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.first()
|
||||
|
@ -261,6 +294,9 @@ class MessageListener(object):
|
|||
self.preview_handler.first()
|
||||
|
||||
def last(self, message):
|
||||
"""
|
||||
React to the message to move to the last slide
|
||||
"""
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.last()
|
||||
|
@ -268,6 +304,9 @@ class MessageListener(object):
|
|||
self.preview_handler.last()
|
||||
|
||||
def next(self, message):
|
||||
"""
|
||||
React to the message to move to the next animation/slide
|
||||
"""
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.next()
|
||||
|
@ -275,6 +314,9 @@ class MessageListener(object):
|
|||
self.preview_handler.next()
|
||||
|
||||
def previous(self, message):
|
||||
"""
|
||||
React to the message to move to the previous animation/slide
|
||||
"""
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.previous()
|
||||
|
@ -282,6 +324,10 @@ class MessageListener(object):
|
|||
self.preview_handler.previous()
|
||||
|
||||
def shutdown(self, message):
|
||||
"""
|
||||
React to message to shutdown the presentation. I.e. end the show
|
||||
and close the file
|
||||
"""
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
Receiver.send_message(u'maindisplay_show')
|
||||
|
@ -290,19 +336,34 @@ class MessageListener(object):
|
|||
self.preview_handler.shutdown()
|
||||
|
||||
def hide(self, message):
|
||||
"""
|
||||
React to the message to show the desktop
|
||||
"""
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.stop()
|
||||
|
||||
def blank(self, message):
|
||||
"""
|
||||
React to the message to blank the display
|
||||
"""
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.blank()
|
||||
|
||||
def unblank(self, message):
|
||||
"""
|
||||
React to the message to unblank the display
|
||||
"""
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.unblank()
|
||||
|
||||
def timeout(self):
|
||||
"""
|
||||
The presentation may be timed or might be controlled by the
|
||||
application directly, rather than through OpenLP. Poll occassionally
|
||||
to check which slide is currently displayed so the slidecontroller
|
||||
view can be updated
|
||||
"""
|
||||
self.live_handler.poll()
|
||||
|
|
|
@ -97,13 +97,23 @@ class PowerpointController(PresentationController):
|
|||
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):
|
||||
"""
|
||||
Class which holds information and controls a single presentation
|
||||
"""
|
||||
|
||||
def __init__(self, controller, presentation):
|
||||
"""
|
||||
Constructor, store information about the file and initialise
|
||||
"""
|
||||
log.debug(u'Init Presentation Powerpoint')
|
||||
PresentationDocument.__init__(self, controller, presentation)
|
||||
self.presentation = None
|
||||
|
@ -111,22 +121,23 @@ class PowerpointDocument(PresentationDocument):
|
|||
def load_presentation(self):
|
||||
"""
|
||||
Called when a presentation is added to the SlideController.
|
||||
It builds the environment, starts communcations with the background
|
||||
OpenOffice task started earlier. If OpenOffice is not present is is
|
||||
started. Once the environment is available the presentation is loaded
|
||||
and started.
|
||||
Opens the PowerPoint file using the process created earlier
|
||||
|
||||
``presentation``
|
||||
The file name of the presentations to run.
|
||||
"""
|
||||
log.debug(u'LoadPresentation')
|
||||
if not self.controller.process.Visible:
|
||||
if not self.controller.process or not self.controller.process.Visible:
|
||||
self.controller.start_process()
|
||||
self.controller.process.Presentations.Open(self.filepath, False, False,
|
||||
True)
|
||||
try:
|
||||
self.controller.process.Presentations.Open(self.filepath, False,
|
||||
False, True)
|
||||
except pywintypes.com_error:
|
||||
return False
|
||||
self.presentation = self.controller.process.Presentations(
|
||||
self.controller.process.Presentations.Count)
|
||||
self.create_thumbnails()
|
||||
return True
|
||||
|
||||
def create_thumbnails(self):
|
||||
"""
|
||||
|
@ -139,8 +150,8 @@ class PowerpointDocument(PresentationDocument):
|
|||
"""
|
||||
if self.check_thumbnails():
|
||||
return
|
||||
self.presentation.Export(os.path.join(self.thumbnailpath, ''), 'png',
|
||||
320, 240)
|
||||
self.presentation.Export(os.path.join(self.get_thumbnail_folder(), ''),
|
||||
'png', 320, 240)
|
||||
|
||||
def close_presentation(self):
|
||||
"""
|
||||
|
@ -298,4 +309,4 @@ class PowerpointDocument(PresentationDocument):
|
|||
shape = shapes(idx + 1)
|
||||
if shape.HasTextFrame:
|
||||
text += shape.TextFrame.TextRange.Text + '\n'
|
||||
return text
|
||||
return text
|
||||
|
|
|
@ -93,13 +93,22 @@ class PptviewController(PresentationController):
|
|||
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):
|
||||
"""
|
||||
Class which holds information and controls a single presentation
|
||||
"""
|
||||
def __init__(self, controller, presentation):
|
||||
"""
|
||||
Constructor, store information about the file and initialise
|
||||
"""
|
||||
log.debug(u'Init Presentation PowerPoint')
|
||||
PresentationDocument.__init__(self, controller, presentation)
|
||||
self.presentation = None
|
||||
|
@ -117,17 +126,31 @@ class PptviewDocument(PresentationDocument):
|
|||
The file name of the presentations to run.
|
||||
"""
|
||||
log.debug(u'LoadPresentation')
|
||||
#if self.pptid >= 0:
|
||||
# self.close_presentation()
|
||||
rendermanager = self.controller.plugin.renderManager
|
||||
rect = rendermanager.screens.current[u'size']
|
||||
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
|
||||
filepath = str(self.filepath.replace(u'/', u'\\'))
|
||||
if not os.path.isdir(self.get_temp_folder()):
|
||||
os.makedirs(self.get_temp_folder())
|
||||
self.pptid = self.controller.process.OpenPPT(filepath, None, rect,
|
||||
str(os.path.join(self.thumbnailpath,
|
||||
self.controller.thumbnailprefix)))
|
||||
if self.pptid:
|
||||
str(self.get_temp_folder()) + '\\slide')
|
||||
if self.pptid >= 0:
|
||||
self.create_thumbnails()
|
||||
self.stop_presentation()
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def create_thumbnails(self):
|
||||
"""
|
||||
PPTviewLib creates large BMP's, but we want small PNG's for consistency.
|
||||
Convert them here.
|
||||
"""
|
||||
if self.check_thumbnails():
|
||||
return
|
||||
for idx in range(self.get_slide_count()):
|
||||
path = u'%s\\slide%s.bmp' % (self.get_temp_folder(), unicode(idx + 1))
|
||||
self.convert_thumbnail(path, idx + 1)
|
||||
|
||||
def close_presentation(self):
|
||||
"""
|
||||
|
@ -224,17 +247,3 @@ class PptviewDocument(PresentationDocument):
|
|||
"""
|
||||
self.controller.process.PrevStep(self.pptid)
|
||||
|
||||
def get_slide_preview_file(self, slide_no):
|
||||
"""
|
||||
Returns an image path containing a preview for the requested slide
|
||||
|
||||
``slide_no``
|
||||
The slide an image is required for, starting at 1
|
||||
"""
|
||||
path = os.path.join(self.thumbnailpath,
|
||||
self.controller.thumbnailprefix + unicode(slide_no) + u'.bmp')
|
||||
if os.path.isfile(path):
|
||||
return path
|
||||
else:
|
||||
return None
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import shutil
|
|||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Receiver
|
||||
from openlp.core.lib import Receiver, resize_image
|
||||
from openlp.core.utils import AppLocation
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -63,6 +63,13 @@ class PresentationController(object):
|
|||
``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()``
|
||||
|
@ -109,12 +116,16 @@ class PresentationController(object):
|
|||
QtCore.Qt.Checked
|
||||
else:
|
||||
self.enabled = False
|
||||
self.thumbnailroot = os.path.join(
|
||||
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),
|
||||
name, u'thumbnails')
|
||||
self.thumbnailprefix = u'slide'
|
||||
if not os.path.isdir(self.thumbnailroot):
|
||||
os.makedirs(self.thumbnailroot)
|
||||
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 check_available(self):
|
||||
"""
|
||||
|
@ -208,14 +219,19 @@ class PresentationDocument(object):
|
|||
``previous_step()``
|
||||
Triggers the previous slide on the running presentation
|
||||
|
||||
``get_slide_preview_file(slide_no)``
|
||||
``get_thumbnail_path(slide_no, check_exists)``
|
||||
Returns a path to an image containing a preview for the requested slide
|
||||
|
||||
"""
|
||||
def __init__(self, controller, name):
|
||||
"""
|
||||
Constructor for the PresentationController class
|
||||
"""
|
||||
self.slidenumber = 0
|
||||
self.controller = controller
|
||||
self.store_filename(name)
|
||||
self.filepath = name
|
||||
if not os.path.isdir(self.get_thumbnail_folder()):
|
||||
os.mkdir(self.get_thumbnail_folder())
|
||||
|
||||
def load_presentation(self):
|
||||
"""
|
||||
|
@ -224,9 +240,10 @@ class PresentationDocument(object):
|
|||
|
||||
``presentation``
|
||||
The file name of the presentations to the run.
|
||||
|
||||
|
||||
Returns False if the file could not be opened
|
||||
"""
|
||||
pass
|
||||
return False
|
||||
|
||||
def presentation_deleted(self):
|
||||
"""
|
||||
|
@ -234,33 +251,37 @@ class PresentationDocument(object):
|
|||
a file, e.g. thumbnails
|
||||
"""
|
||||
try:
|
||||
shutil.rmtree(self.thumbnailpath)
|
||||
shutil.rmtree(self.get_thumbnail_folder())
|
||||
shutil.rmtree(self.get_temp_folder())
|
||||
except OSError:
|
||||
log.exception(u'Failed to delete presentation controller files')
|
||||
|
||||
def store_filename(self, presentation):
|
||||
def get_file_name(self):
|
||||
"""
|
||||
Set properties for the filename and thumbnail paths
|
||||
Return just the filename of the presention, without the directory
|
||||
"""
|
||||
self.filepath = presentation
|
||||
self.filename = self.get_file_name(presentation)
|
||||
self.thumbnailpath = self.get_thumbnail_path(presentation)
|
||||
if not os.path.isdir(self.thumbnailpath):
|
||||
os.mkdir(self.thumbnailpath)
|
||||
return os.path.split(self.filepath)[1]
|
||||
|
||||
def get_file_name(self, presentation):
|
||||
return os.path.split(presentation)[1]
|
||||
|
||||
def get_thumbnail_path(self, presentation):
|
||||
def get_thumbnail_folder(self):
|
||||
"""
|
||||
The location where thumbnail images will be stored
|
||||
"""
|
||||
return os.path.join(
|
||||
self.controller.thumbnailroot, self.get_file_name(presentation))
|
||||
self.controller.thumbnail_folder, self.get_file_name())
|
||||
|
||||
def get_temp_folder(self):
|
||||
"""
|
||||
The location where thumbnail images will be stored
|
||||
"""
|
||||
return os.path.join(
|
||||
self.controller.temp_folder, self.get_file_name())
|
||||
|
||||
def check_thumbnails(self):
|
||||
"""
|
||||
Returns true if the thumbnail images look to exist and are more
|
||||
recent than the powerpoint
|
||||
"""
|
||||
lastimage = self.get_slide_preview_file(self.get_slide_count())
|
||||
lastimage = self.get_thumbnail_path(self.get_slide_count(), True)
|
||||
if not (lastimage and os.path.isfile(lastimage)):
|
||||
return False
|
||||
imgdate = os.stat(lastimage).st_mtime
|
||||
|
@ -350,16 +371,27 @@ class PresentationDocument(object):
|
|||
"""
|
||||
pass
|
||||
|
||||
def get_slide_preview_file(self, slide_no):
|
||||
def convert_thumbnail(self, file, idx):
|
||||
"""
|
||||
Convert the slide image the application made to a standard 320x240
|
||||
.png image.
|
||||
"""
|
||||
if self.check_thumbnails():
|
||||
return
|
||||
if os.path.isfile(file):
|
||||
img = resize_image(file, 320, 240)
|
||||
img.save(self.get_thumbnail_path(idx, False))
|
||||
|
||||
def get_thumbnail_path(self, slide_no, check_exists):
|
||||
"""
|
||||
Returns an image path containing a preview for the requested slide
|
||||
|
||||
``slide_no``
|
||||
The slide an image is required for, starting at 1
|
||||
"""
|
||||
path = os.path.join(self.thumbnailpath,
|
||||
self.controller.thumbnailprefix + unicode(slide_no) + u'.png')
|
||||
if os.path.isfile(path):
|
||||
path = os.path.join(self.get_thumbnail_folder(),
|
||||
self.controller.thumbnail_prefix + unicode(slide_no) + u'.png')
|
||||
if os.path.isfile(path) or not check_exists:
|
||||
return path
|
||||
else:
|
||||
return None
|
||||
|
|
|
@ -32,10 +32,16 @@ class PresentationTab(SettingsTab):
|
|||
PresentationsTab is the Presentations settings tab in the settings dialog.
|
||||
"""
|
||||
def __init__(self, title, controllers):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
self.controllers = controllers
|
||||
SettingsTab.__init__(self, title)
|
||||
|
||||
def setupUi(self):
|
||||
"""
|
||||
Create the controls for the settings tab
|
||||
"""
|
||||
self.setObjectName(u'PresentationTab')
|
||||
self.tabTitleVisible = translate('PresentationPlugin.PresentationTab',
|
||||
'Presentations')
|
||||
|
@ -89,6 +95,9 @@ class PresentationTab(SettingsTab):
|
|||
self.PresentationLayout.addWidget(self.PresentationRightWidget)
|
||||
|
||||
def retranslateUi(self):
|
||||
"""
|
||||
Make any translation changes
|
||||
"""
|
||||
self.VerseDisplayGroupBox.setTitle(
|
||||
translate('PresentationPlugin.PresentationTab',
|
||||
'Available Controllers'))
|
||||
|
@ -100,6 +109,9 @@ class PresentationTab(SettingsTab):
|
|||
translate('PresentationPlugin.PresentationTab', 'available')))
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
Load the settings.
|
||||
"""
|
||||
for key in self.controllers:
|
||||
controller = self.controllers[key]
|
||||
if controller.available:
|
||||
|
@ -109,6 +121,9 @@ class PresentationTab(SettingsTab):
|
|||
QtCore.QVariant(0)).toInt()[0])
|
||||
|
||||
def save(self):
|
||||
"""
|
||||
Save the settings.
|
||||
"""
|
||||
for key in self.controllers:
|
||||
controller = self.controllers[key]
|
||||
checkbox = self.PresenterCheckboxes[controller.name]
|
||||
|
|
|
@ -33,14 +33,23 @@ from openlp.plugins.presentations.lib import *
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
class PresentationPlugin(Plugin):
|
||||
"""
|
||||
This plugin allowed a Presentation to be opened, controlled and displayed
|
||||
on the output display. The plugin controls third party applications such
|
||||
as OpenOffice.org Impress, Microsoft PowerPoint and the PowerPoint viewer
|
||||
"""
|
||||
log = logging.getLogger(u'PresentationPlugin')
|
||||
|
||||
def __init__(self, plugin_helpers):
|
||||
"""
|
||||
PluginPresentation constructor.
|
||||
"""
|
||||
log.debug(u'Initialised')
|
||||
self.controllers = {}
|
||||
Plugin.__init__(self, u'Presentations', u'1.9.2', plugin_helpers)
|
||||
self.weight = -8
|
||||
self.icon = build_icon(u':/plugins/plugin_presentations.png')
|
||||
self.icon_path = u':/plugins/plugin_presentations.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
self.status = PluginStatus.Active
|
||||
|
||||
def getSettingsTab(self):
|
||||
|
@ -50,6 +59,10 @@ class PresentationPlugin(Plugin):
|
|||
return PresentationTab(self.name, self.controllers)
|
||||
|
||||
def initialise(self):
|
||||
"""
|
||||
Initialise the plugin. Determine which controllers are enabled
|
||||
are start their processes.
|
||||
"""
|
||||
log.info(u'Presentations Initialising')
|
||||
Plugin.initialise(self)
|
||||
self.insertToolboxItem()
|
||||
|
@ -58,6 +71,10 @@ class PresentationPlugin(Plugin):
|
|||
self.controllers[controller].start_process()
|
||||
|
||||
def finalise(self):
|
||||
"""
|
||||
Finalise the plugin. Ask all the enabled presentation applications
|
||||
to close down their applications and release resources.
|
||||
"""
|
||||
log.info(u'Plugin Finalise')
|
||||
#Ask each controller to tidy up
|
||||
for key in self.controllers:
|
||||
|
@ -74,6 +91,10 @@ class PresentationPlugin(Plugin):
|
|||
self, self.icon, self.name, self.controllers)
|
||||
|
||||
def registerControllers(self, controller):
|
||||
"""
|
||||
Register each presentation controller (Impress, PPT etc) and
|
||||
store for later use
|
||||
"""
|
||||
self.controllers[controller.name] = controller
|
||||
|
||||
def checkPreConditions(self):
|
||||
|
@ -108,9 +129,13 @@ class PresentationPlugin(Plugin):
|
|||
return False
|
||||
|
||||
def about(self):
|
||||
"""
|
||||
Return information about this plugin
|
||||
"""
|
||||
about_text = translate('PresentationPlugin',
|
||||
'<b>Presentation Plugin</b> <br> Delivers '
|
||||
'the ability to show presentations using a number of different '
|
||||
'programs. The choice of available presentation programs is '
|
||||
'available to the user in a drop down box.')
|
||||
return about_text
|
||||
return about_text
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import build_icon, translate
|
||||
from openlp.plugins.songs.lib import VerseType
|
||||
|
||||
class Ui_EditVerseDialog(object):
|
||||
|
@ -61,10 +61,7 @@ class Ui_EditVerseDialog(object):
|
|||
self.VerseNumberBox.setObjectName(u'VerseNumberBox')
|
||||
self.VerseTypeLayout.addWidget(self.VerseNumberBox)
|
||||
self.InsertButton = QtGui.QPushButton(EditVerseDialog)
|
||||
self.AddIcon = QtGui.QIcon()
|
||||
self.AddIcon.addPixmap(QtGui.QPixmap(u':/general/general_add.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.InsertButton.setIcon(self.AddIcon)
|
||||
self.InsertButton.setIcon(build_icon(u':/general/general_add.png'))
|
||||
self.InsertButton.setObjectName(u'InsertButton')
|
||||
self.VerseTypeLayout.addWidget(self.InsertButton)
|
||||
self.VerseTypeSpacer = QtGui.QSpacerItem(40, 20,
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import build_icon, translate
|
||||
|
||||
class Ui_SongImportWizard(object):
|
||||
def setupUi(self, SongImportWizard):
|
||||
|
@ -109,21 +109,16 @@ class Ui_SongImportWizard(object):
|
|||
self.OpenLyricsButtonLayout.setSpacing(8)
|
||||
self.OpenLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout')
|
||||
self.OpenLyricsAddButton = QtGui.QPushButton(self.OpenLyricsPage)
|
||||
self.OpenIcon = QtGui.QIcon()
|
||||
self.OpenIcon.addPixmap(QtGui.QPixmap(u':/general/general_open.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.DeleteIcon = QtGui.QIcon()
|
||||
self.DeleteIcon.addPixmap(
|
||||
QtGui.QPixmap(u':/general/general_delete.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.OpenLyricsAddButton.setIcon(self.OpenIcon)
|
||||
self.OpenLyricsAddButton.setIcon(
|
||||
build_icon(u':/general/general_open.png'))
|
||||
self.OpenLyricsAddButton.setObjectName(u'OpenLyricsAddButton')
|
||||
self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsAddButton)
|
||||
self.OpenLyricsButtonSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.OpenLyricsButtonLayout.addItem(self.OpenLyricsButtonSpacer)
|
||||
self.OpenLyricsRemoveButton = QtGui.QPushButton(self.OpenLyricsPage)
|
||||
self.OpenLyricsRemoveButton.setIcon(self.DeleteIcon)
|
||||
self.OpenLyricsRemoveButton.setIcon(
|
||||
build_icon(u':/general/general_delete.png'))
|
||||
self.OpenLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton')
|
||||
self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsRemoveButton)
|
||||
self.OpenLyricsLayout.addLayout(self.OpenLyricsButtonLayout)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
###############################################################################
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from sqlalchemy.sql import and_
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
|
||||
|
@ -97,6 +98,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||
QtGui.QMessageBox.critical(self, dlg_title, sel_text)
|
||||
|
||||
def resetAuthors(self):
|
||||
"""
|
||||
Reloads the Authors list.
|
||||
"""
|
||||
self.AuthorsListWidget.clear()
|
||||
authors = self.songmanager.get_all_objects(Author, Author.display_name)
|
||||
for author in authors:
|
||||
|
@ -109,6 +113,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||
self.AuthorsListWidget.addItem(author_name)
|
||||
|
||||
def resetTopics(self):
|
||||
"""
|
||||
Reloads the Topics list.
|
||||
"""
|
||||
self.TopicsListWidget.clear()
|
||||
topics = self.songmanager.get_all_objects(Topic, Topic.name)
|
||||
for topic in topics:
|
||||
|
@ -117,13 +124,88 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||
self.TopicsListWidget.addItem(topic_name)
|
||||
|
||||
def resetBooks(self):
|
||||
"""
|
||||
Reloads the Books list.
|
||||
"""
|
||||
self.BooksListWidget.clear()
|
||||
books = self.songmanager.get_all_objects(Book, Book.name)
|
||||
for book in books:
|
||||
book_name = QtGui.QListWidgetItem(book.name)
|
||||
book_name = QtGui.QListWidgetItem(u'%s (%s)' % (book.name,
|
||||
book.publisher))
|
||||
book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id))
|
||||
self.BooksListWidget.addItem(book_name)
|
||||
|
||||
def checkAuthor(self, new_author, edit=False):
|
||||
"""
|
||||
Returns False when the given Author is already in the list elsewise
|
||||
True.
|
||||
"""
|
||||
authors = self.songmanager.get_all_objects_filtered(Author,
|
||||
and_(
|
||||
Author.first_name == new_author.first_name,
|
||||
Author.last_name == new_author.last_name,
|
||||
Author.display_name == new_author.display_name
|
||||
)
|
||||
)
|
||||
if len(authors) > 0:
|
||||
# If we edit an existing Author, we need to make sure that we do
|
||||
# not return False when nothing has changed (because this would
|
||||
# cause an error message later on).
|
||||
if edit:
|
||||
if authors[0].id == new_author.id:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def checkTopic(self, new_topic, edit=False):
|
||||
"""
|
||||
Returns False when the given Topic is already in the list elsewise True.
|
||||
"""
|
||||
topics = self.songmanager.get_all_objects_filtered(Topic,
|
||||
Topic.name == new_topic.name
|
||||
)
|
||||
if len(topics) > 0:
|
||||
# If we edit an existing Topic, we need to make sure that we do
|
||||
# not return False when nothing has changed (because this would
|
||||
# cause an error message later on).
|
||||
if edit:
|
||||
if topics[0].id == new_topic.id:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def checkBook(self, new_book, edit=False):
|
||||
"""
|
||||
Returns False when the given Book is already in the list elsewise True.
|
||||
"""
|
||||
books = self.songmanager.get_all_objects_filtered(Book,
|
||||
and_(
|
||||
Book.name == new_book.name,
|
||||
Book.publisher == new_book.publisher
|
||||
)
|
||||
)
|
||||
if len(books) > 0:
|
||||
# If we edit an existing Book, we need to make sure that we do
|
||||
# not return False when nothing has changed (because this would
|
||||
# cause an error message later on).
|
||||
if edit:
|
||||
if books[0].id == new_book.id:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def onAuthorAddButtonClick(self):
|
||||
self.authorform.setAutoDisplayName(True)
|
||||
if self.authorform.exec_():
|
||||
|
@ -131,86 +213,93 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||
first_name=unicode(self.authorform.FirstNameEdit.text()),
|
||||
last_name=unicode(self.authorform.LastNameEdit.text()),
|
||||
display_name=unicode(self.authorform.DisplayEdit.text()))
|
||||
if self.songmanager.save_object(author):
|
||||
self.resetAuthors()
|
||||
if self.checkAuthor(author):
|
||||
if self.songmanager.save_object(author):
|
||||
self.resetAuthors()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(
|
||||
self, translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Error'),
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Couldn\'t add your author.'))
|
||||
'Could not add your author.'))
|
||||
|
||||
def onTopicAddButtonClick(self):
|
||||
if self.topicform.exec_():
|
||||
topic = Topic.populate(name=unicode(self.topicform.NameEdit.text()))
|
||||
if self.songmanager.save_object(topic):
|
||||
self.resetTopics()
|
||||
if self.checkTopic(topic):
|
||||
if self.songmanager.save_object(topic):
|
||||
self.resetTopics()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(
|
||||
self, translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Error'),
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Couldn\'t add your topic.'))
|
||||
'Could not add your topic.'))
|
||||
|
||||
def onBookAddButtonClick(self):
|
||||
if self.bookform.exec_():
|
||||
book = Book.populate(
|
||||
name=unicode(self.bookform.NameEdit.text()),
|
||||
publisher=unicode(self.bookform.PublisherEdit.text()))
|
||||
if self.songmanager.save_object(book):
|
||||
self.resetBooks()
|
||||
if self.checkBook(book):
|
||||
if self.songmanager.save_object(book):
|
||||
self.resetBooks()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(
|
||||
self, translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Error'),
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Couldn\'t add your book.'))
|
||||
'Could not add your book.'))
|
||||
|
||||
def onAuthorEditButtonClick(self):
|
||||
author_id = self._getCurrentItemId(self.AuthorsListWidget)
|
||||
if author_id != -1:
|
||||
author = self.songmanager.get_object(Author, author_id)
|
||||
# Just make sure none of the fields is None
|
||||
if author.first_name is None:
|
||||
author.first_name = u''
|
||||
if author.last_name is None:
|
||||
author.last_name = u''
|
||||
if author.display_name is None:
|
||||
author.display_name = u''
|
||||
self.authorform.setAutoDisplayName(False)
|
||||
self.authorform.FirstNameEdit.setText(author.first_name)
|
||||
self.authorform.LastNameEdit.setText(author.last_name)
|
||||
self.authorform.DisplayEdit.setText(author.display_name)
|
||||
# Save the author's first and last name as well as the display name
|
||||
# for the case that they have to be restored.
|
||||
temp_first_name = author.first_name
|
||||
temp_last_name = author.last_name
|
||||
temp_display_name = author.display_name
|
||||
if self.authorform.exec_(False):
|
||||
author.first_name = unicode(
|
||||
self.authorform.FirstNameEdit.text())
|
||||
author.last_name = unicode(self.authorform.LastNameEdit.text())
|
||||
author.display_name = unicode(
|
||||
self.authorform.DisplayEdit.text())
|
||||
if self.songmanager.save_object(author):
|
||||
self.resetAuthors()
|
||||
if self.checkAuthor(author, True):
|
||||
if self.songmanager.save_object(author):
|
||||
self.resetAuthors()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(
|
||||
self, translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Error'),
|
||||
# We restore the author's old first and last name as well as
|
||||
# his display name.
|
||||
author.first_name = temp_first_name
|
||||
author.last_name = temp_last_name
|
||||
author.display_name = temp_display_name
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Couldn\'t save your author.'))
|
||||
'Could not save your author.'))
|
||||
|
||||
def onTopicEditButtonClick(self):
|
||||
topic_id = self._getCurrentItemId(self.TopicsListWidget)
|
||||
if topic_id != -1:
|
||||
topic = self.songmanager.get_object(Topic, topic_id)
|
||||
self.topicform.NameEdit.setText(topic.name)
|
||||
# Save the topic's name for the case that he has to be restored.
|
||||
temp_name = topic.name
|
||||
if self.topicform.exec_(False):
|
||||
topic.name = unicode(self.topicform.NameEdit.text())
|
||||
if self.songmanager.save_object(topic):
|
||||
self.resetTopics()
|
||||
if self.checkTopic(topic, True):
|
||||
if self.songmanager.save_object(topic):
|
||||
self.resetTopics()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(
|
||||
self, translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Error'),
|
||||
# We restore the topics's old name.
|
||||
topic.name = temp_name
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Couldn\'t save your topic.'))
|
||||
'Could not save your topic.'))
|
||||
|
||||
def onBookEditButtonClick(self):
|
||||
book_id = self._getCurrentItemId(self.BooksListWidget)
|
||||
|
@ -218,17 +307,24 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||
book = self.songmanager.get_object(Book, book_id)
|
||||
self.bookform.NameEdit.setText(book.name)
|
||||
self.bookform.PublisherEdit.setText(book.publisher)
|
||||
# Save the book's name and publisher for the case that they have to
|
||||
# be restored.
|
||||
temp_name = book.name
|
||||
temp_publisher = book.publisher
|
||||
if self.bookform.exec_(False):
|
||||
book.name = unicode(self.bookform.NameEdit.text())
|
||||
book.publisher = unicode(self.bookform.PublisherEdit.text())
|
||||
if self.songmanager.save_object(book):
|
||||
self.resetBooks()
|
||||
if self.checkBook(book, True):
|
||||
if self.songmanager.save_object(book):
|
||||
self.resetBooks()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(
|
||||
self, translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Error'),
|
||||
# We restore the book's old name and publisher.
|
||||
book.name = temp_name
|
||||
book.publisher = temp_publisher
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Couldn\'t save your book.'))
|
||||
'Could not save your book.'))
|
||||
|
||||
def onAuthorDeleteButtonClick(self):
|
||||
"""
|
||||
|
@ -236,13 +332,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||
"""
|
||||
self._deleteItem(Author, self.AuthorsListWidget, self.resetAuthors,
|
||||
translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Are you sure you want to delete the selected author?'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'This author can\'t be deleted, they are currently '
|
||||
'This author cannot be deleted, they are currently '
|
||||
'assigned to at least one song.'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'No author selected!'))
|
||||
translate('SongsPlugin.SongMaintenanceForm', 'No author selected!'))
|
||||
|
||||
def onTopicDeleteButtonClick(self):
|
||||
"""
|
||||
|
@ -250,13 +345,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||
"""
|
||||
self._deleteItem(Topic, self.TopicsListWidget, self.resetTopics,
|
||||
translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Are you sure you want to delete the selected topic?'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'This topic can\'t be deleted, it is currently '
|
||||
'assigned to at least one song.'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'No topic selected!'))
|
||||
'Are you sure you want to delete the selected topic?'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'This topic cannot be deleted, it is currently '
|
||||
'assigned to at least one song.'),
|
||||
translate('SongsPlugin.SongMaintenanceForm', 'No topic selected!'))
|
||||
|
||||
def onBookDeleteButtonClick(self):
|
||||
"""
|
||||
|
@ -266,7 +360,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||
translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'Are you sure you want to delete the selected book?'),
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'This book can\'t be deleted, it is currently '
|
||||
translate('SongsPlugin.SongMaintenanceForm',
|
||||
'This book cannot be deleted, it is currently '
|
||||
'assigned to at least one song.'),
|
||||
translate('SongsPlugin.SongMaintenanceForm', u'No book selected!'))
|
||||
translate('SongsPlugin.SongMaintenanceForm', 'No book selected!'))
|
||||
|
|
|
@ -49,6 +49,7 @@ class SongMediaItem(MediaManagerItem):
|
|||
|
||||
def __init__(self, parent, icon, title):
|
||||
self.PluginNameShort = u'Song'
|
||||
self.pluginNameVisible = translate('SongsPlugin.MediaItem', 'Song')
|
||||
self.IconPath = u'songs/song'
|
||||
self.ListViewWithDnD_class = SongListView
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
|
@ -61,9 +62,6 @@ class SongMediaItem(MediaManagerItem):
|
|||
# which Song is required.
|
||||
self.remoteSong = -1
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
self.PluginNameVisible = translate('SongsPlugin.MediaItem', 'Song')
|
||||
|
||||
def requiredIcons(self):
|
||||
MediaManagerItem.requiredIcons(self)
|
||||
|
||||
|
@ -75,7 +73,7 @@ class SongMediaItem(MediaManagerItem):
|
|||
translate('SongsPlugin.MediaItem',
|
||||
'Maintain the lists of authors, topics and books'),
|
||||
':/songs/song_maintenance.png', self.onSongMaintenanceClick)
|
||||
self.PageLayout.setSpacing(4)
|
||||
self.pageLayout.setSpacing(4)
|
||||
self.SearchLayout = QtGui.QFormLayout()
|
||||
self.SearchLayout.setMargin(0)
|
||||
self.SearchLayout.setSpacing(4)
|
||||
|
@ -100,7 +98,7 @@ class SongMediaItem(MediaManagerItem):
|
|||
self.SearchTypeComboBox.setObjectName(u'SearchTypeComboBox')
|
||||
self.SearchLayout.setWidget(
|
||||
1, QtGui.QFormLayout.FieldRole, self.SearchTypeComboBox)
|
||||
self.PageLayout.addLayout(self.SearchLayout)
|
||||
self.pageLayout.addLayout(self.SearchLayout)
|
||||
self.SearchButtonLayout = QtGui.QHBoxLayout()
|
||||
self.SearchButtonLayout.setMargin(0)
|
||||
self.SearchButtonLayout.setSpacing(4)
|
||||
|
@ -114,7 +112,7 @@ class SongMediaItem(MediaManagerItem):
|
|||
self.ClearTextButton = QtGui.QPushButton(self)
|
||||
self.ClearTextButton.setObjectName(u'ClearTextButton')
|
||||
self.SearchButtonLayout.addWidget(self.ClearTextButton)
|
||||
self.PageLayout.addLayout(self.SearchButtonLayout)
|
||||
self.pageLayout.addLayout(self.SearchButtonLayout)
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.SearchTextEdit,
|
||||
QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick)
|
||||
|
@ -193,7 +191,7 @@ class SongMediaItem(MediaManagerItem):
|
|||
|
||||
def displayResultsSong(self, searchresults):
|
||||
log.debug(u'display results Song')
|
||||
self.ListView.clear()
|
||||
self.listView.clear()
|
||||
for song in searchresults:
|
||||
author_list = u''
|
||||
for author in song.authors:
|
||||
|
@ -204,11 +202,11 @@ class SongMediaItem(MediaManagerItem):
|
|||
song_detail = u'%s (%s)' % (song_title, author_list)
|
||||
song_name = QtGui.QListWidgetItem(song_detail)
|
||||
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
||||
self.ListView.addItem(song_name)
|
||||
self.listView.addItem(song_name)
|
||||
|
||||
def displayResultsAuthor(self, searchresults):
|
||||
log.debug(u'display results Author')
|
||||
self.ListView.clear()
|
||||
self.listView.clear()
|
||||
for author in searchresults:
|
||||
for song in author.songs:
|
||||
song_detail = unicode(
|
||||
|
@ -216,7 +214,7 @@ class SongMediaItem(MediaManagerItem):
|
|||
(author.display_name, song.title)
|
||||
song_name = QtGui.QListWidgetItem(song_detail)
|
||||
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
||||
self.ListView.addItem(song_name)
|
||||
self.listView.addItem(song_name)
|
||||
|
||||
def onClearTextButtonClick(self):
|
||||
"""
|
||||
|
@ -247,18 +245,6 @@ class SongMediaItem(MediaManagerItem):
|
|||
self.edit_song_form.newSong()
|
||||
self.edit_song_form.exec_()
|
||||
|
||||
def onEditAuthorClick(self):
|
||||
self.authors_form.load_form()
|
||||
self.authors_form.exec_()
|
||||
|
||||
def onEditTopicClick(self):
|
||||
self.topics_form.load_form()
|
||||
self.topics_form.exec_()
|
||||
|
||||
def onEditBookClick(self):
|
||||
self.song_book_form.load_form()
|
||||
self.song_book_form.exec_()
|
||||
|
||||
def onSongMaintenanceClick(self):
|
||||
self.song_maintenance_form.exec_()
|
||||
|
||||
|
@ -284,9 +270,9 @@ class SongMediaItem(MediaManagerItem):
|
|||
"""
|
||||
Edit a song
|
||||
"""
|
||||
if check_item_selected(self.ListView, translate('SongsPlugin.MediaItem',
|
||||
if check_item_selected(self.listView, translate('SongsPlugin.MediaItem',
|
||||
'You must select an item to edit.')):
|
||||
item = self.ListView.currentItem()
|
||||
item = self.listView.currentItem()
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
self.edit_song_form.loadSong(item_id, False)
|
||||
self.edit_song_form.exec_()
|
||||
|
@ -295,9 +281,9 @@ class SongMediaItem(MediaManagerItem):
|
|||
"""
|
||||
Remove a song from the list and database
|
||||
"""
|
||||
if check_item_selected(self.ListView, translate('SongsPlugin.MediaItem',
|
||||
if check_item_selected(self.listView, translate('SongsPlugin.MediaItem',
|
||||
'You must select an item to delete.')):
|
||||
items = self.ListView.selectedIndexes()
|
||||
items = self.listView.selectedIndexes()
|
||||
if len(items) == 1:
|
||||
del_message = translate('SongsPlugin.MediaItem',
|
||||
'Delete song?')
|
||||
|
@ -325,7 +311,7 @@ class SongMediaItem(MediaManagerItem):
|
|||
ccli = u''
|
||||
if item is None:
|
||||
if self.remoteTriggered is None:
|
||||
item = self.ListView.currentItem()
|
||||
item = self.listView.currentItem()
|
||||
if item is None:
|
||||
return False
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
|
|
|
@ -58,7 +58,8 @@ class SongsPlugin(Plugin):
|
|||
Plugin.__init__(self, u'Songs', u'1.9.2', plugin_helpers)
|
||||
self.weight = -10
|
||||
self.manager = Manager(u'songs', init_schema)
|
||||
self.icon = build_icon(u':/plugins/plugin_songs.png')
|
||||
self.icon_path = u':/plugins/plugin_songs.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
self.status = PluginStatus.Active
|
||||
|
||||
def getSettingsTab(self):
|
||||
|
@ -150,8 +151,8 @@ class SongsPlugin(Plugin):
|
|||
pass
|
||||
|
||||
def onSongImportItemClicked(self):
|
||||
if self.media_item:
|
||||
self.media_item.onImportClick()
|
||||
if self.mediaItem:
|
||||
self.mediaItem.onImportClick()
|
||||
|
||||
def onImportSofItemClick(self):
|
||||
filenames = QtGui.QFileDialog.getOpenFileNames(
|
||||
|
@ -191,8 +192,30 @@ class SongsPlugin(Plugin):
|
|||
'This plugin allows songs to be managed and displayed.')
|
||||
return about_text
|
||||
|
||||
def canDeleteTheme(self, theme):
|
||||
if not self.manager.get_all_objects_filtered(Song,
|
||||
def usesTheme(self, theme):
|
||||
"""
|
||||
Called to find out if the song plugin is currently using a theme.
|
||||
|
||||
Returns True if the theme is being used, otherwise returns False.
|
||||
"""
|
||||
if self.manager.get_all_objects_filtered(Song,
|
||||
Song.theme_name == theme):
|
||||
return True
|
||||
return False
|
||||
return False
|
||||
|
||||
def renameTheme(self, oldTheme, newTheme):
|
||||
"""
|
||||
Renames a theme the song plugin is using making the plugin use the new
|
||||
name.
|
||||
|
||||
``oldTheme``
|
||||
The name of the theme the plugin should stop using.
|
||||
|
||||
``newTheme``
|
||||
The new name the plugin should now use.
|
||||
"""
|
||||
songsUsingTheme = self.manager.get_all_objects_filtered(Song,
|
||||
Song.theme_name == oldTheme)
|
||||
for song in songsUsingTheme:
|
||||
song.theme_name = newTheme
|
||||
self.custommanager.save_object(song)
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import translate
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
|
||||
class Ui_SongUsageDetailDialog(object):
|
||||
def setupUi(self, SongUsageDetailDialog):
|
||||
|
@ -60,10 +61,8 @@ class Ui_SongUsageDetailDialog(object):
|
|||
self.FileLineEdit.setObjectName(u'FileLineEdit')
|
||||
self.horizontalLayout.addWidget(self.FileLineEdit)
|
||||
self.SaveFilePushButton = QtGui.QPushButton(self.FileGroupBox)
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/general/general_load.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.SaveFilePushButton.setIcon(icon)
|
||||
self.SaveFilePushButton.setIcon(
|
||||
build_icon(u':/general/general_load.png'))
|
||||
self.SaveFilePushButton.setObjectName(u'SaveFilePushButton')
|
||||
self.horizontalLayout.addWidget(self.SaveFilePushButton)
|
||||
self.verticalLayout_4.addLayout(self.horizontalLayout)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="AboutDialogLayout">
|
||||
<layout class="QVBoxLayout" name="aboutDialogLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
|
@ -47,11 +47,11 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="AboutNotebook">
|
||||
<widget class="QTabWidget" name="aboutNotebook">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="AboutTab">
|
||||
<widget class="QWidget" name="aboutTab">
|
||||
<attribute name="title">
|
||||
<string>About</string>
|
||||
</attribute>
|
||||
|
@ -63,7 +63,7 @@
|
|||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="AboutTextEdit">
|
||||
<widget class="QPlainTextEdit" name="aboutTextEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -80,11 +80,11 @@ OpenLP is written and maintained by volunteers. If you would like to see more fr
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="CreditsTab">
|
||||
<widget class="QWidget" name="creditsTab">
|
||||
<attribute name="title">
|
||||
<string>Credits</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="CreditsTabLayout">
|
||||
<layout class="QVBoxLayout" name="creditsTabLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -92,7 +92,7 @@ OpenLP is written and maintained by volunteers. If you would like to see more fr
|
|||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="CreditsTextEdit">
|
||||
<widget class="QPlainTextEdit" name="creditsTextEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -116,11 +116,11 @@ Testers
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="LicenseTab">
|
||||
<widget class="QWidget" name="licenseTab">
|
||||
<attribute name="title">
|
||||
<string>License</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="LicenseTabLayout">
|
||||
<layout class="QVBoxLayout" name="licenseTabLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
|
@ -128,7 +128,7 @@ Testers
|
|||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="LicenseTextEdit">
|
||||
<widget class="QPlainTextEdit" name="licenseTextEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -272,8 +272,8 @@ This General Public License does not permit incorporating your program into prop
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="ButtonWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="ButtonWidgetLayout">
|
||||
<widget class="QWidget" name="buttonWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="buttonWidgetLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
|
@ -294,7 +294,7 @@ This General Public License does not permit incorporating your program into prop
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ContributeButton">
|
||||
<widget class="QPushButton" name="contributeButton">
|
||||
<property name="text">
|
||||
<string>Contribute</string>
|
||||
</property>
|
||||
|
@ -305,7 +305,7 @@ This General Public License does not permit incorporating your program into prop
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="CloseButton">
|
||||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
|
@ -326,14 +326,14 @@ This General Public License does not permit incorporating your program into prop
|
|||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>ContributeButton</tabstop>
|
||||
<tabstop>contributeButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../images/openlp-2.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>CloseButton</sender>
|
||||
<sender>closeButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>AboutDialog</receiver>
|
||||
<slot>close()</slot>
|
||||
|
|
Loading…
Reference in New Issue