forked from openlp/openlp
Head1173
This commit is contained in:
commit
0dc2f3ed85
@ -3,6 +3,7 @@ recursive-include openlp *.sqlite
|
|||||||
recursive-include openlp *.csv
|
recursive-include openlp *.csv
|
||||||
recursive-include openlp *.html
|
recursive-include openlp *.html
|
||||||
recursive-include openlp *.js
|
recursive-include openlp *.js
|
||||||
|
recursive-include openlp *.css
|
||||||
recursive-include openlp *.qm
|
recursive-include openlp *.qm
|
||||||
recursive-include documentation *
|
recursive-include documentation *
|
||||||
recursive-include resources/forms *
|
recursive-include resources/forms *
|
||||||
|
@ -37,13 +37,15 @@ class OpenLPDockWidget(QtGui.QDockWidget):
|
|||||||
"""
|
"""
|
||||||
Custom DockWidget class to handle events
|
Custom DockWidget class to handle events
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent=None, name=None):
|
def __init__(self, parent=None, name=None, icon=None):
|
||||||
"""
|
"""
|
||||||
Initialise the DockWidget
|
Initialise the DockWidget
|
||||||
"""
|
"""
|
||||||
|
log.debug(u'Initialise the %s widget' % name)
|
||||||
QtGui.QDockWidget.__init__(self, parent)
|
QtGui.QDockWidget.__init__(self, parent)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
if name:
|
if name:
|
||||||
self.setObjectName(name)
|
self.setObjectName(name)
|
||||||
|
if icon:
|
||||||
|
self.setWindowIcon(icon)
|
||||||
self.setFloating(False)
|
self.setFloating(False)
|
||||||
log.debug(u'Init done')
|
|
@ -381,7 +381,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
if os.path.exists(thumb):
|
if os.path.exists(thumb):
|
||||||
filedate = os.stat(file).st_mtime
|
filedate = os.stat(file).st_mtime
|
||||||
thumbdate = os.stat(thumb).st_mtime
|
thumbdate = os.stat(thumb).st_mtime
|
||||||
#if file updated rebuild icon
|
# if file updated rebuild icon
|
||||||
if filedate > thumbdate:
|
if filedate > thumbdate:
|
||||||
self.iconFromFile(file, thumb)
|
self.iconFromFile(file, thumb)
|
||||||
else:
|
else:
|
||||||
@ -544,4 +544,4 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
Method to add processing when a service has been loaded and
|
Method to add processing when a service has been loaded and
|
||||||
individual service items need to be processed by the plugins
|
individual service items need to be processed by the plugins
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
191
openlp/core/lib/searchedit.py
Normal file
191
openlp/core/lib/searchedit.py
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||||
|
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||||
|
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||||
|
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||||
|
# Carsten Tinggaard, Frode Woldsund #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# This program is free software; you can redistribute it and/or modify it #
|
||||||
|
# under the terms of the GNU General Public License as published by the Free #
|
||||||
|
# Software Foundation; version 2 of the License. #
|
||||||
|
# #
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||||
|
# more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License along #
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
|
from openlp.core.lib import build_icon
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class SearchEdit(QtGui.QLineEdit):
|
||||||
|
"""
|
||||||
|
This is a specialised QLineEdit with a "clear" button inside for searches.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, parent):
|
||||||
|
"""
|
||||||
|
Constructor.
|
||||||
|
"""
|
||||||
|
QtGui.QLineEdit.__init__(self, parent)
|
||||||
|
self._currentSearchType = -1
|
||||||
|
self.clearButton = QtGui.QToolButton(self)
|
||||||
|
self.clearButton.setIcon(build_icon(u':/system/clear_shortcut.png'))
|
||||||
|
self.clearButton.setCursor(QtCore.Qt.ArrowCursor)
|
||||||
|
self.clearButton.setStyleSheet(
|
||||||
|
u'QToolButton { border: none; padding: 0px; }')
|
||||||
|
self.clearButton.resize(18, 18)
|
||||||
|
self.clearButton.hide()
|
||||||
|
QtCore.QObject.connect(
|
||||||
|
self.clearButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
|
self._onClearButtonClicked
|
||||||
|
)
|
||||||
|
QtCore.QObject.connect(
|
||||||
|
self,
|
||||||
|
QtCore.SIGNAL(u'textChanged(const QString&)'),
|
||||||
|
self._onSearchEditTextChanged
|
||||||
|
)
|
||||||
|
self._updateStyleSheet()
|
||||||
|
|
||||||
|
def _updateStyleSheet(self):
|
||||||
|
"""
|
||||||
|
Internal method to update the stylesheet depending on which widgets are
|
||||||
|
available and visible.
|
||||||
|
"""
|
||||||
|
frameWidth = self.style().pixelMetric(
|
||||||
|
QtGui.QStyle.PM_DefaultFrameWidth)
|
||||||
|
rightPadding = self.clearButton.sizeHint().width() + frameWidth
|
||||||
|
if hasattr(self, u'menuButton'):
|
||||||
|
leftPadding = self.menuButton.width()
|
||||||
|
self.setStyleSheet(
|
||||||
|
u'QLineEdit { padding-left: %spx; padding-right: %spx; } ' % \
|
||||||
|
(leftPadding, rightPadding))
|
||||||
|
else:
|
||||||
|
self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' % \
|
||||||
|
rightPadding)
|
||||||
|
msz = self.minimumSizeHint();
|
||||||
|
self.setMinimumSize(
|
||||||
|
max(msz.width(),
|
||||||
|
self.clearButton.sizeHint().width() + (frameWidth * 2) + 2),
|
||||||
|
max(msz.height(),
|
||||||
|
self.clearButton.height() + (frameWidth * 2) + 2)
|
||||||
|
)
|
||||||
|
|
||||||
|
def resizeEvent(self, event):
|
||||||
|
"""
|
||||||
|
Reimplemented method to react to resizing of the widget.
|
||||||
|
|
||||||
|
``event``
|
||||||
|
The event that happened.
|
||||||
|
"""
|
||||||
|
sz = self.clearButton.sizeHint()
|
||||||
|
frameWidth = self.style().pixelMetric(
|
||||||
|
QtGui.QStyle.PM_DefaultFrameWidth)
|
||||||
|
self.clearButton.move(self.rect().right() - frameWidth - sz.width(),
|
||||||
|
(self.rect().bottom() + 1 - sz.height()) / 2)
|
||||||
|
if hasattr(self, u'menuButton'):
|
||||||
|
sz = self.menuButton.sizeHint()
|
||||||
|
self.menuButton.move(self.rect().left() + frameWidth + 2,
|
||||||
|
(self.rect().bottom() + 1 - sz.height()) / 2)
|
||||||
|
|
||||||
|
def currentSearchType(self):
|
||||||
|
"""
|
||||||
|
Readonly property to return the current search type.
|
||||||
|
"""
|
||||||
|
return self._currentSearchType
|
||||||
|
|
||||||
|
def setSearchTypes(self, items):
|
||||||
|
"""
|
||||||
|
A list of tuples to be used in the search type menu. The first item in
|
||||||
|
the list will be preselected as the default.
|
||||||
|
|
||||||
|
``items``
|
||||||
|
The list of tuples to use. The tuples should contain an integer
|
||||||
|
identifier, an icon (QIcon instance or string) and a title for the
|
||||||
|
item in the menu. In short, they should look like this::
|
||||||
|
|
||||||
|
(<identifier>, <icon>, <title>)
|
||||||
|
|
||||||
|
For instance::
|
||||||
|
|
||||||
|
(1, <QIcon instance>, "Titles")
|
||||||
|
|
||||||
|
Or::
|
||||||
|
|
||||||
|
(2, ":/songs/authors.png", "Authors")
|
||||||
|
"""
|
||||||
|
menu = QtGui.QMenu(self)
|
||||||
|
first = None
|
||||||
|
for identifier, icon, title in items:
|
||||||
|
action = QtGui.QAction(build_icon(icon), title, menu)
|
||||||
|
action.setData(QtCore.QVariant(identifier))
|
||||||
|
menu.addAction(action)
|
||||||
|
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'),
|
||||||
|
self._onMenuActionTriggered)
|
||||||
|
if first is None:
|
||||||
|
first = action
|
||||||
|
self._currentSearchType = identifier
|
||||||
|
if not hasattr(self, u'menuButton'):
|
||||||
|
self.menuButton = QtGui.QToolButton(self)
|
||||||
|
self.menuButton.setIcon(build_icon(u':/system/clear_shortcut.png'))
|
||||||
|
self.menuButton.setCursor(QtCore.Qt.ArrowCursor)
|
||||||
|
self.menuButton.setPopupMode(QtGui.QToolButton.InstantPopup)
|
||||||
|
self.menuButton.setStyleSheet(
|
||||||
|
u'QToolButton { border: none; padding: 0px 10px 0px 0px; }')
|
||||||
|
self.menuButton.resize(QtCore.QSize(28, 18))
|
||||||
|
self.menuButton.setMenu(menu)
|
||||||
|
self.menuButton.setDefaultAction(first)
|
||||||
|
self.menuButton.show()
|
||||||
|
self._updateStyleSheet()
|
||||||
|
|
||||||
|
def _onSearchEditTextChanged(self, text):
|
||||||
|
"""
|
||||||
|
Internally implemented slot to react to when the text in the line edit
|
||||||
|
has changed so that we can show or hide the clear button.
|
||||||
|
|
||||||
|
``text``
|
||||||
|
A :class:`~PyQt4.QtCore.QString` instance which represents the text
|
||||||
|
in the line edit.
|
||||||
|
"""
|
||||||
|
self.clearButton.setVisible(not text.isEmpty())
|
||||||
|
|
||||||
|
def _onClearButtonClicked(self):
|
||||||
|
"""
|
||||||
|
Internally implemented slot to react to the clear button being pressed
|
||||||
|
to clear the line edit. Once it has cleared the line edit, it emits the
|
||||||
|
``cleared()`` signal so that an application can react to the clearing
|
||||||
|
of the line edit.
|
||||||
|
"""
|
||||||
|
self.clear()
|
||||||
|
self.emit(QtCore.SIGNAL(u'cleared()'))
|
||||||
|
|
||||||
|
def _onMenuActionTriggered(self):
|
||||||
|
"""
|
||||||
|
Internally implemented slot to react to the select of one of the search
|
||||||
|
types in the menu. Once it has set the correct action on the button,
|
||||||
|
and set the current search type (using the list of identifiers provided
|
||||||
|
by the developer), the ``searchTypeChanged(int)`` signal is emitted
|
||||||
|
with the identifier.
|
||||||
|
"""
|
||||||
|
sender = self.sender()
|
||||||
|
for action in self.menuButton.menu().actions():
|
||||||
|
action.setChecked(False)
|
||||||
|
self.menuButton.setDefaultAction(sender)
|
||||||
|
self._currentSearchType = sender.data().toInt()[0]
|
||||||
|
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
||||||
|
self._currentSearchType)
|
@ -58,7 +58,7 @@ class ItemCapabilities(object):
|
|||||||
NoLineBreaks = 7
|
NoLineBreaks = 7
|
||||||
OnLoadUpdate = 8
|
OnLoadUpdate = 8
|
||||||
AddIfNewItem = 9
|
AddIfNewItem = 9
|
||||||
|
ProvidesOwnDisplay = 10
|
||||||
|
|
||||||
class ServiceItem(object):
|
class ServiceItem(object):
|
||||||
"""
|
"""
|
||||||
@ -397,4 +397,4 @@ class ServiceItem(object):
|
|||||||
"""
|
"""
|
||||||
Returns the path of the raw frame
|
Returns the path of the raw frame
|
||||||
"""
|
"""
|
||||||
return self._raw_frames[row][u'path']
|
return self._raw_frames[row][u'path']
|
||||||
|
@ -55,7 +55,7 @@ class SettingsManager(object):
|
|||||||
self.mainwindow_left = mainwindow_docbars
|
self.mainwindow_left = mainwindow_docbars
|
||||||
self.mainwindow_right = mainwindow_docbars
|
self.mainwindow_right = mainwindow_docbars
|
||||||
self.slidecontroller = (self.width - (
|
self.slidecontroller = (self.width - (
|
||||||
self.mainwindow_left + self.mainwindow_right) - 100 ) / 2
|
self.mainwindow_left + self.mainwindow_right) - 100) / 2
|
||||||
self.slidecontroller_image = self.slidecontroller - 50
|
self.slidecontroller_image = self.slidecontroller - 50
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -76,7 +76,7 @@ class Ui_MainWindow(object):
|
|||||||
MainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
|
MainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
|
||||||
MainWindow.setWindowIcon(MainIcon)
|
MainWindow.setWindowIcon(MainIcon)
|
||||||
self.setDockNestingEnabled(True)
|
self.setDockNestingEnabled(True)
|
||||||
# Set up the main container, which contains all the other form widgets
|
# Set up the main container, which contains all the other form widgets.
|
||||||
self.MainContent = QtGui.QWidget(MainWindow)
|
self.MainContent = QtGui.QWidget(MainWindow)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
|
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
|
||||||
QtGui.QSizePolicy.Expanding)
|
QtGui.QSizePolicy.Expanding)
|
||||||
@ -141,13 +141,12 @@ class Ui_MainWindow(object):
|
|||||||
self.DefaultThemeLabel.setObjectName(u'DefaultThemeLabel')
|
self.DefaultThemeLabel.setObjectName(u'DefaultThemeLabel')
|
||||||
self.StatusBar.addPermanentWidget(self.DefaultThemeLabel)
|
self.StatusBar.addPermanentWidget(self.DefaultThemeLabel)
|
||||||
# Create the MediaManager
|
# Create the MediaManager
|
||||||
self.MediaManagerDock = OpenLPDockWidget(MainWindow)
|
self.MediaManagerDock = OpenLPDockWidget(
|
||||||
self.MediaManagerDock.setWindowIcon(
|
MainWindow, u'MediaManagerDock',
|
||||||
build_icon(u':/system/system_mediamanager.png'))
|
build_icon(u':/system/system_mediamanager.png'))
|
||||||
self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
|
self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
|
||||||
self.MediaManagerDock.setMinimumWidth(
|
self.MediaManagerDock.setMinimumWidth(
|
||||||
self.settingsmanager.mainwindow_left)
|
self.settingsmanager.mainwindow_left)
|
||||||
self.MediaManagerDock.setObjectName(u'MediaManagerDock')
|
|
||||||
self.MediaManagerContents = QtGui.QWidget(MainWindow)
|
self.MediaManagerContents = QtGui.QWidget(MainWindow)
|
||||||
self.MediaManagerContents.setObjectName(u'MediaManagerContents')
|
self.MediaManagerContents.setObjectName(u'MediaManagerContents')
|
||||||
self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
|
self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
|
||||||
@ -161,10 +160,9 @@ class Ui_MainWindow(object):
|
|||||||
MainWindow.addDockWidget(
|
MainWindow.addDockWidget(
|
||||||
QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)
|
QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)
|
||||||
# Create the service manager
|
# Create the service manager
|
||||||
self.ServiceManagerDock = OpenLPDockWidget(MainWindow)
|
self.ServiceManagerDock = OpenLPDockWidget(
|
||||||
self.ServiceManagerDock.setWindowIcon(
|
MainWindow, u'ServiceManagerDock',
|
||||||
build_icon(u':/system/system_servicemanager.png'))
|
build_icon(u':/system/system_servicemanager.png'))
|
||||||
self.ServiceManagerDock.setObjectName(u'ServiceManagerDock')
|
|
||||||
self.ServiceManagerDock.setMinimumWidth(
|
self.ServiceManagerDock.setMinimumWidth(
|
||||||
self.settingsmanager.mainwindow_right)
|
self.settingsmanager.mainwindow_right)
|
||||||
self.ServiceManagerContents = ServiceManager(self)
|
self.ServiceManagerContents = ServiceManager(self)
|
||||||
@ -172,10 +170,9 @@ class Ui_MainWindow(object):
|
|||||||
MainWindow.addDockWidget(
|
MainWindow.addDockWidget(
|
||||||
QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock)
|
QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock)
|
||||||
# Create the theme manager
|
# Create the theme manager
|
||||||
self.ThemeManagerDock = OpenLPDockWidget(MainWindow)
|
self.ThemeManagerDock = OpenLPDockWidget(
|
||||||
self.ThemeManagerDock.setWindowIcon(
|
MainWindow, u'ThemeManagerDock',
|
||||||
build_icon(u':/system/system_thememanager.png'))
|
build_icon(u':/system/system_thememanager.png'))
|
||||||
self.ThemeManagerDock.setObjectName(u'ThemeManagerDock')
|
|
||||||
self.ThemeManagerDock.setMinimumWidth(
|
self.ThemeManagerDock.setMinimumWidth(
|
||||||
self.settingsmanager.mainwindow_right)
|
self.settingsmanager.mainwindow_right)
|
||||||
self.ThemeManagerContents = ThemeManager(self)
|
self.ThemeManagerContents = ThemeManager(self)
|
||||||
@ -272,7 +269,7 @@ class Ui_MainWindow(object):
|
|||||||
self.SettingsPluginListItem.setObjectName(u'SettingsPluginListItem')
|
self.SettingsPluginListItem.setObjectName(u'SettingsPluginListItem')
|
||||||
MainWindow.actionList.add_action(self.SettingsPluginListItem,
|
MainWindow.actionList.add_action(self.SettingsPluginListItem,
|
||||||
u'Settings')
|
u'Settings')
|
||||||
#i18n Language Items
|
# i18n Language Items
|
||||||
self.AutoLanguageItem = QtGui.QAction(MainWindow)
|
self.AutoLanguageItem = QtGui.QAction(MainWindow)
|
||||||
self.AutoLanguageItem.setObjectName(u'AutoLanguageItem')
|
self.AutoLanguageItem.setObjectName(u'AutoLanguageItem')
|
||||||
self.AutoLanguageItem.setCheckable(True)
|
self.AutoLanguageItem.setCheckable(True)
|
||||||
@ -331,7 +328,7 @@ class Ui_MainWindow(object):
|
|||||||
None, self.ViewMediaManagerItem, self.ViewServiceManagerItem,
|
None, self.ViewMediaManagerItem, self.ViewServiceManagerItem,
|
||||||
self.ViewThemeManagerItem, None, self.ViewPreviewPanel,
|
self.ViewThemeManagerItem, None, self.ViewPreviewPanel,
|
||||||
self.ViewLivePanel))
|
self.ViewLivePanel))
|
||||||
#i18n add Language Actions
|
# i18n add Language Actions
|
||||||
add_actions(self.SettingsLanguageMenu, (self.AutoLanguageItem, None))
|
add_actions(self.SettingsLanguageMenu, (self.AutoLanguageItem, None))
|
||||||
add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions())
|
add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions())
|
||||||
add_actions(self.SettingsMenu, (self.SettingsPluginListItem,
|
add_actions(self.SettingsMenu, (self.SettingsPluginListItem,
|
||||||
@ -354,17 +351,8 @@ class Ui_MainWindow(object):
|
|||||||
QtCore.SIGNAL(u'aboutToShow()'), self.updateFileMenu)
|
QtCore.SIGNAL(u'aboutToShow()'), self.updateFileMenu)
|
||||||
QtCore.QObject.connect(self.FileExitItem,
|
QtCore.QObject.connect(self.FileExitItem,
|
||||||
QtCore.SIGNAL(u'triggered()'), MainWindow.close)
|
QtCore.SIGNAL(u'triggered()'), MainWindow.close)
|
||||||
QtCore.QObject.connect(self.ControlSplitter,
|
|
||||||
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
|
|
||||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
def trackSplitter(self, tab, pos):
|
|
||||||
"""
|
|
||||||
Splitter between the Preview and Live Controllers.
|
|
||||||
"""
|
|
||||||
self.liveController.widthChanged()
|
|
||||||
self.previewController.widthChanged()
|
|
||||||
|
|
||||||
def retranslateUi(self, MainWindow):
|
def retranslateUi(self, MainWindow):
|
||||||
"""
|
"""
|
||||||
Set up the translation system
|
Set up the translation system
|
||||||
@ -837,8 +825,18 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
else:
|
else:
|
||||||
event.ignore()
|
event.ignore()
|
||||||
else:
|
else:
|
||||||
self.cleanUp()
|
ret = QtGui.QMessageBox.question(self,
|
||||||
event.accept()
|
translate('OpenLP.MainWindow', 'Close OpenLP'),
|
||||||
|
translate('OpenLP.MainWindow', 'Are you sure you want to Exit?'),
|
||||||
|
QtGui.QMessageBox.StandardButtons(
|
||||||
|
QtGui.QMessageBox.Yes |
|
||||||
|
QtGui.QMessageBox.No),
|
||||||
|
QtGui.QMessageBox.Yes)
|
||||||
|
if ret == QtGui.QMessageBox.Yes:
|
||||||
|
self.cleanUp()
|
||||||
|
event.accept()
|
||||||
|
else:
|
||||||
|
event.ignore()
|
||||||
|
|
||||||
def cleanUp(self):
|
def cleanUp(self):
|
||||||
"""
|
"""
|
||||||
@ -998,8 +996,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
The service filename to add
|
The service filename to add
|
||||||
"""
|
"""
|
||||||
# The maxRecentFiles value does not have an interface and so never gets
|
# The maxRecentFiles value does not have an interface and so never gets
|
||||||
# actually stored in the settings therefore the default value of 20
|
# actually stored in the settings therefore the default value of 20 will
|
||||||
# will always be used.
|
# always be used.
|
||||||
maxRecentFiles = QtCore.QSettings().value(u'advanced/max recent files',
|
maxRecentFiles = QtCore.QSettings().value(u'advanced/max recent files',
|
||||||
QtCore.QVariant(20)).toInt()[0]
|
QtCore.QVariant(20)).toInt()[0]
|
||||||
if filename:
|
if filename:
|
||||||
@ -1009,4 +1007,4 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
self.recentFiles.insert(0, QtCore.QString(filename))
|
self.recentFiles.insert(0, QtCore.QString(filename))
|
||||||
while self.recentFiles.count() > maxRecentFiles:
|
while self.recentFiles.count() > maxRecentFiles:
|
||||||
# Don't care what API says takeLast works, removeLast doesn't!
|
# Don't care what API says takeLast works, removeLast doesn't!
|
||||||
self.recentFiles.takeLast()
|
self.recentFiles.takeLast()
|
||||||
|
@ -73,6 +73,7 @@ class SlideList(QtGui.QTableWidget):
|
|||||||
else:
|
else:
|
||||||
event.ignore()
|
event.ignore()
|
||||||
|
|
||||||
|
|
||||||
class SlideController(QtGui.QWidget):
|
class SlideController(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
SlideController is the slide controller widget. This widget is what the
|
SlideController is the slide controller widget. This widget is what the
|
||||||
@ -183,41 +184,23 @@ class SlideController(QtGui.QWidget):
|
|||||||
translate('OpenLP.SlideController',
|
translate('OpenLP.SlideController',
|
||||||
'Blank Screen'), self.HideMenu)
|
'Blank Screen'), self.HideMenu)
|
||||||
self.BlankScreen.setCheckable(True)
|
self.BlankScreen.setCheckable(True)
|
||||||
QtCore.QObject.connect(self.BlankScreen,
|
|
||||||
QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay)
|
|
||||||
self.ThemeScreen = QtGui.QAction(QtGui.QIcon(
|
self.ThemeScreen = QtGui.QAction(QtGui.QIcon(
|
||||||
u':/slides/slide_theme.png'),
|
u':/slides/slide_theme.png'),
|
||||||
translate('OpenLP.SlideController',
|
translate('OpenLP.SlideController',
|
||||||
'Blank to Theme'), self.HideMenu)
|
'Blank to Theme'), self.HideMenu)
|
||||||
self.ThemeScreen.setCheckable(True)
|
self.ThemeScreen.setCheckable(True)
|
||||||
QtCore.QObject.connect(self.ThemeScreen,
|
|
||||||
QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
|
|
||||||
if self.screens.display_count > 1:
|
|
||||||
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
|
|
||||||
u':/slides/slide_desktop.png'),
|
|
||||||
translate('OpenLP.SlideController',
|
|
||||||
'Show Desktop'), self.HideMenu)
|
|
||||||
self.DesktopScreen.setCheckable(True)
|
|
||||||
QtCore.QObject.connect(self.DesktopScreen,
|
|
||||||
QtCore.SIGNAL("triggered(bool)"), self.onHideDisplay)
|
|
||||||
self.HideMenu.setDefaultAction(self.BlankScreen)
|
self.HideMenu.setDefaultAction(self.BlankScreen)
|
||||||
self.HideMenu.menu().addAction(self.BlankScreen)
|
self.HideMenu.menu().addAction(self.BlankScreen)
|
||||||
self.HideMenu.menu().addAction(self.ThemeScreen)
|
self.HideMenu.menu().addAction(self.ThemeScreen)
|
||||||
if self.screens.display_count > 1:
|
if self.screens.display_count > 1:
|
||||||
|
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
|
||||||
|
u':/slides/slide_desktop.png'),
|
||||||
|
translate('OpenLP.SlideController',
|
||||||
|
'Show Desktop'), self.HideMenu)
|
||||||
self.HideMenu.menu().addAction(self.DesktopScreen)
|
self.HideMenu.menu().addAction(self.DesktopScreen)
|
||||||
if not self.isLive:
|
self.DesktopScreen.setCheckable(True)
|
||||||
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
QtCore.QObject.connect(self.DesktopScreen,
|
||||||
self.Toolbar.addToolbarButton(
|
QtCore.SIGNAL(u'triggered(bool)'), self.onHideDisplay)
|
||||||
u'Go Live', u':/general/general_live.png',
|
|
||||||
translate('OpenLP.SlideController', 'Move to live'),
|
|
||||||
self.onGoLive)
|
|
||||||
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
|
||||||
self.Toolbar.addToolbarButton(
|
|
||||||
u'Edit Song', u':/general/general_edit.png',
|
|
||||||
translate('OpenLP.SlideController',
|
|
||||||
'Edit and reload song preview'),
|
|
||||||
self.onEditSong)
|
|
||||||
if isLive:
|
|
||||||
self.Toolbar.addToolbarSeparator(u'Loop Separator')
|
self.Toolbar.addToolbarSeparator(u'Loop Separator')
|
||||||
self.Toolbar.addToolbarButton(
|
self.Toolbar.addToolbarButton(
|
||||||
u'Start Loop', u':/media/media_time.png',
|
u'Start Loop', u':/media/media_time.png',
|
||||||
@ -230,12 +213,23 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.DelaySpinBox = QtGui.QSpinBox()
|
self.DelaySpinBox = QtGui.QSpinBox()
|
||||||
self.DelaySpinBox.setMinimum(1)
|
self.DelaySpinBox.setMinimum(1)
|
||||||
self.DelaySpinBox.setMaximum(180)
|
self.DelaySpinBox.setMaximum(180)
|
||||||
self.Toolbar.addToolbarWidget(
|
self.Toolbar.addToolbarWidget(u'Image SpinBox', self.DelaySpinBox)
|
||||||
u'Image SpinBox', self.DelaySpinBox)
|
|
||||||
self.DelaySpinBox.setSuffix(translate('OpenLP.SlideController',
|
self.DelaySpinBox.setSuffix(translate('OpenLP.SlideController',
|
||||||
's'))
|
's'))
|
||||||
self.DelaySpinBox.setToolTip(translate('OpenLP.SlideController',
|
self.DelaySpinBox.setToolTip(translate('OpenLP.SlideController',
|
||||||
'Delay between slides in seconds'))
|
'Delay between slides in seconds'))
|
||||||
|
else:
|
||||||
|
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
||||||
|
self.Toolbar.addToolbarButton(
|
||||||
|
u'Go Live', u':/general/general_live.png',
|
||||||
|
translate('OpenLP.SlideController', 'Move to live'),
|
||||||
|
self.onGoLive)
|
||||||
|
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
||||||
|
self.Toolbar.addToolbarButton(
|
||||||
|
u'Edit Song', u':/general/general_edit.png',
|
||||||
|
translate('OpenLP.SlideController',
|
||||||
|
'Edit and reload song preview'),
|
||||||
|
self.onEditSong)
|
||||||
self.ControllerLayout.addWidget(self.Toolbar)
|
self.ControllerLayout.addWidget(self.Toolbar)
|
||||||
# Build a Media ToolBar
|
# Build a Media ToolBar
|
||||||
self.Mediabar = OpenLPToolbar(self)
|
self.Mediabar = OpenLPToolbar(self)
|
||||||
@ -251,42 +245,39 @@ class SlideController(QtGui.QWidget):
|
|||||||
u'Media Stop', u':/slides/media_playback_stop.png',
|
u'Media Stop', u':/slides/media_playback_stop.png',
|
||||||
translate('OpenLP.SlideController', 'Start playing media'),
|
translate('OpenLP.SlideController', 'Start playing media'),
|
||||||
self.onMediaStop)
|
self.onMediaStop)
|
||||||
if not self.isLive:
|
if self.isLive:
|
||||||
self.seekSlider = Phonon.SeekSlider()
|
# Build the Song Toolbar
|
||||||
self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
|
|
||||||
self.seekSlider.setObjectName(u'seekSlider')
|
|
||||||
self.Mediabar.addToolbarWidget(
|
|
||||||
u'Seek Slider', self.seekSlider)
|
|
||||||
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)
|
|
||||||
else:
|
|
||||||
self.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
|
||||||
self.volumeSlider.setTickInterval(1)
|
|
||||||
self.volumeSlider.setTickPosition(QtGui.QSlider.TicksAbove)
|
|
||||||
self.volumeSlider.setMinimum(0)
|
|
||||||
self.volumeSlider.setMaximum(10)
|
|
||||||
self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
|
|
||||||
self.volumeSlider.setObjectName(u'volumeSlider')
|
|
||||||
self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
|
|
||||||
self.ControllerLayout.addWidget(self.Mediabar)
|
|
||||||
# Build the Song Toolbar
|
|
||||||
if isLive:
|
|
||||||
self.SongMenu = QtGui.QToolButton(self.Toolbar)
|
self.SongMenu = QtGui.QToolButton(self.Toolbar)
|
||||||
self.SongMenu.setText(translate('OpenLP.SlideController',
|
self.SongMenu.setText(translate('OpenLP.SlideController',
|
||||||
'Go To'))
|
'Go To'))
|
||||||
self.SongMenu.setPopupMode(QtGui.QToolButton.InstantPopup)
|
self.SongMenu.setPopupMode(QtGui.QToolButton.InstantPopup)
|
||||||
self.Toolbar.addToolbarWidget(u'Song Menu', self.SongMenu)
|
self.Toolbar.addToolbarWidget(u'Song Menu', self.SongMenu)
|
||||||
self.SongMenu.setMenu(QtGui.QMenu(
|
self.SongMenu.setMenu(QtGui.QMenu(
|
||||||
translate('OpenLP.SlideController', 'Go To'),
|
translate('OpenLP.SlideController', 'Go To'), self.Toolbar))
|
||||||
self.Toolbar))
|
|
||||||
self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
|
self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
|
||||||
|
# Build the volumeSlider.
|
||||||
|
self.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
||||||
|
self.volumeSlider.setTickInterval(1)
|
||||||
|
self.volumeSlider.setTickPosition(QtGui.QSlider.TicksAbove)
|
||||||
|
self.volumeSlider.setMinimum(0)
|
||||||
|
self.volumeSlider.setMaximum(10)
|
||||||
|
else:
|
||||||
|
# Build the seekSlider.
|
||||||
|
self.seekSlider = Phonon.SeekSlider()
|
||||||
|
self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
|
||||||
|
self.seekSlider.setObjectName(u'seekSlider')
|
||||||
|
self.Mediabar.addToolbarWidget(u'Seek Slider', self.seekSlider)
|
||||||
|
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.ControllerLayout.addWidget(self.Mediabar)
|
||||||
# Screen preview area
|
# Screen preview area
|
||||||
self.PreviewFrame = QtGui.QFrame(self.Splitter)
|
self.PreviewFrame = QtGui.QFrame(self.Splitter)
|
||||||
self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 225))
|
self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio))
|
||||||
|
self.PreviewFrame.setMinimumHeight(100)
|
||||||
self.PreviewFrame.setSizePolicy(QtGui.QSizePolicy(
|
self.PreviewFrame.setSizePolicy(QtGui.QSizePolicy(
|
||||||
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum,
|
QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored,
|
||||||
QtGui.QSizePolicy.Label))
|
QtGui.QSizePolicy.Label))
|
||||||
self.PreviewFrame.setFrameShape(QtGui.QFrame.StyledPanel)
|
self.PreviewFrame.setFrameShape(QtGui.QFrame.StyledPanel)
|
||||||
self.PreviewFrame.setFrameShadow(QtGui.QFrame.Sunken)
|
self.PreviewFrame.setFrameShadow(QtGui.QFrame.Sunken)
|
||||||
@ -306,7 +297,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
Phonon.createPath(self.mediaObject, self.audio)
|
Phonon.createPath(self.mediaObject, self.audio)
|
||||||
if not self.isLive:
|
if not self.isLive:
|
||||||
self.video.setGeometry(QtCore.QRect(0, 0, 300, 225))
|
self.video.setGeometry(QtCore.QRect(0, 0, 300, 225))
|
||||||
self.video.setVisible(False)
|
|
||||||
self.SlideLayout.insertWidget(0, self.video)
|
self.SlideLayout.insertWidget(0, self.video)
|
||||||
# Actual preview screen
|
# Actual preview screen
|
||||||
self.SlidePreview = QtGui.QLabel(self)
|
self.SlidePreview = QtGui.QLabel(self)
|
||||||
@ -330,18 +320,24 @@ class SlideController(QtGui.QWidget):
|
|||||||
# Signals
|
# Signals
|
||||||
QtCore.QObject.connect(self.PreviewListWidget,
|
QtCore.QObject.connect(self.PreviewListWidget,
|
||||||
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
|
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
|
||||||
if not self.isLive:
|
if self.isLive:
|
||||||
QtCore.QObject.connect(self.PreviewListWidget,
|
QtCore.QObject.connect(self.BlankScreen,
|
||||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
QtCore.SIGNAL(u'triggered(bool)'), self.onBlankDisplay)
|
||||||
self.onGoLiveClick)
|
QtCore.QObject.connect(self.ThemeScreen,
|
||||||
if isLive:
|
QtCore.SIGNAL(u'triggered(bool)'), self.onThemeDisplay)
|
||||||
|
QtCore.QObject.connect(self.volumeSlider,
|
||||||
|
QtCore.SIGNAL(u'sliderReleased()'), self.mediaVolume)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'maindisplay_active'), self.updatePreview)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
|
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
|
||||||
self.receiveSpinDelay)
|
self.receiveSpinDelay)
|
||||||
if isLive:
|
|
||||||
self.Toolbar.makeWidgetsInvisible(self.loopList)
|
self.Toolbar.makeWidgetsInvisible(self.loopList)
|
||||||
self.Toolbar.actions[u'Stop Loop'].setVisible(False)
|
self.Toolbar.actions[u'Stop Loop'].setVisible(False)
|
||||||
else:
|
else:
|
||||||
|
QtCore.QObject.connect(self.PreviewListWidget,
|
||||||
|
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||||
|
self.onGoLiveClick)
|
||||||
self.Toolbar.makeWidgetsInvisible(self.songEditList)
|
self.Toolbar.makeWidgetsInvisible(self.songEditList)
|
||||||
self.Mediabar.setVisible(False)
|
self.Mediabar.setVisible(False)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
@ -381,54 +377,66 @@ class SlideController(QtGui.QWidget):
|
|||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix),
|
QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix),
|
||||||
self.onTextRequest)
|
self.onTextRequest)
|
||||||
|
QtCore.QObject.connect(self.parent.ControlSplitter,
|
||||||
|
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.previewSizeChanged)
|
||||||
QtCore.QObject.connect(self.Splitter,
|
QtCore.QObject.connect(self.Splitter,
|
||||||
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
|
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.previewSizeChanged)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem)
|
QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged)
|
QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged)
|
||||||
if self.isLive:
|
|
||||||
QtCore.QObject.connect(self.volumeSlider,
|
def paintEvent(self, event):
|
||||||
QtCore.SIGNAL(u'sliderReleased()'), self.mediaVolume)
|
"""
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
When the Slidecontroller is painted, we need to make sure, that the
|
||||||
QtCore.SIGNAL(u'maindisplay_active'), self.updatePreview)
|
SlidePreview's size is updated.
|
||||||
|
"""
|
||||||
|
# We need to make this circuit, because we have to consider the other
|
||||||
|
# slidecontroller as well.
|
||||||
|
log.debug(u'paintEvent live = %s' % self.isLive)
|
||||||
|
self.parent.previewController.previewSizeChanged()
|
||||||
|
self.parent.liveController.previewSizeChanged()
|
||||||
|
|
||||||
def screenSizeChanged(self):
|
def screenSizeChanged(self):
|
||||||
"""
|
"""
|
||||||
Settings dialog has changed the screen size of adjust output and
|
Settings dialog has changed the screen size of adjust output and
|
||||||
screen previews
|
screen previews.
|
||||||
"""
|
"""
|
||||||
log.debug(u'screenSizeChanged live = %s' % self.isLive)
|
log.debug(u'screenSizeChanged live = %s' % self.isLive)
|
||||||
# rebuild display as screen size changed
|
# rebuild display as screen size changed
|
||||||
self.display = MainDisplay(self, self.screens, self.isLive)
|
self.display = MainDisplay(self, self.screens, self.isLive)
|
||||||
self.display.imageManager = self.parent.renderManager.image_manager
|
self.display.imageManager = self.parent.renderManager.image_manager
|
||||||
self.display.alertTab = self.alertTab
|
self.display.alertTab = self.alertTab
|
||||||
|
self.display.setup()
|
||||||
|
# The SlidePreview's ratio.
|
||||||
self.ratio = float(self.screens.current[u'size'].width()) / \
|
self.ratio = float(self.screens.current[u'size'].width()) / \
|
||||||
float(self.screens.current[u'size'].height())
|
float(self.screens.current[u'size'].height())
|
||||||
self.display.setup()
|
self.previewSizeChanged()
|
||||||
self.SlidePreview.setFixedSize(
|
|
||||||
QtCore.QSize(self.settingsmanager.slidecontroller_image,
|
|
||||||
self.settingsmanager.slidecontroller_image / self.ratio))
|
|
||||||
|
|
||||||
def widthChanged(self):
|
def previewSizeChanged(self):
|
||||||
"""
|
"""
|
||||||
Handle changes of width from the splitter between the live and preview
|
Takes care of the SlidePreview's size. Is called when one of the the
|
||||||
controller. Event only issues when changes have finished
|
splitters is moved or when the screen size is changed.
|
||||||
"""
|
"""
|
||||||
log.debug(u'widthChanged live = %s' % self.isLive)
|
log.debug(u'previewSizeChanged live = %s' % self.isLive)
|
||||||
|
if self.ratio < float(self.PreviewFrame.width()) / float(
|
||||||
|
self.PreviewFrame.height()):
|
||||||
|
# We have to take the height as limit.
|
||||||
|
max_height = self.PreviewFrame.height() - self.grid.margin() * 2
|
||||||
|
self.SlidePreview.setFixedSize(QtCore.QSize(max_height * self.ratio,
|
||||||
|
max_height))
|
||||||
|
else:
|
||||||
|
# We have to take the width as limit.
|
||||||
|
max_width = self.PreviewFrame.width() - self.grid.margin() * 2
|
||||||
|
self.SlidePreview.setFixedSize(QtCore.QSize(max_width,
|
||||||
|
max_width / self.ratio))
|
||||||
width = self.parent.ControlSplitter.sizes()[self.split]
|
width = self.parent.ControlSplitter.sizes()[self.split]
|
||||||
height = width * self.parent.renderManager.screen_ratio
|
|
||||||
self.PreviewListWidget.setColumnWidth(0, width)
|
self.PreviewListWidget.setColumnWidth(0, width)
|
||||||
# Sort out image heights (Songs, bibles excluded)
|
# Sort out image heights (Songs, bibles excluded)
|
||||||
if self.serviceItem and not self.serviceItem.is_text():
|
if self.serviceItem and not self.serviceItem.is_text():
|
||||||
for framenumber in range(len(self.serviceItem.get_frames())):
|
for framenumber in range(len(self.serviceItem.get_frames())):
|
||||||
self.PreviewListWidget.setRowHeight(framenumber, height)
|
self.PreviewListWidget.setRowHeight(
|
||||||
|
framenumber, width / self.ratio)
|
||||||
def trackSplitter(self, tab, pos):
|
|
||||||
"""
|
|
||||||
Splitter between the slide list and the preview panel
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def onSongBarHandler(self):
|
def onSongBarHandler(self):
|
||||||
request = unicode(self.sender().text())
|
request = unicode(self.sender().text())
|
||||||
@ -554,6 +562,8 @@ class SlideController(QtGui.QWidget):
|
|||||||
if self.serviceItem.is_media():
|
if self.serviceItem.is_media():
|
||||||
self.onMediaClose()
|
self.onMediaClose()
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
|
if serviceItem.is_capable(ItemCapabilities.ProvidesOwnDisplay):
|
||||||
|
self._forceUnblank()
|
||||||
blanked = self.BlankScreen.isChecked()
|
blanked = self.BlankScreen.isChecked()
|
||||||
else:
|
else:
|
||||||
blanked = False
|
blanked = False
|
||||||
@ -561,8 +571,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
[serviceItem, self.isLive, blanked, slideno])
|
[serviceItem, self.isLive, blanked, slideno])
|
||||||
self.slideList = {}
|
self.slideList = {}
|
||||||
width = self.parent.ControlSplitter.sizes()[self.split]
|
width = self.parent.ControlSplitter.sizes()[self.split]
|
||||||
# Set pointing cursor when we have something to point at
|
|
||||||
self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor)
|
|
||||||
self.serviceItem = serviceItem
|
self.serviceItem = serviceItem
|
||||||
self.PreviewListWidget.clear()
|
self.PreviewListWidget.clear()
|
||||||
self.PreviewListWidget.setRowCount(0)
|
self.PreviewListWidget.setRowCount(0)
|
||||||
@ -691,7 +699,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
|
log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
|
||||||
if not self.display.primary:
|
if not self.display.primary:
|
||||||
self.onHideDisplay(True)
|
self.onBlankDisplay(True)
|
||||||
|
|
||||||
def onSlideBlank(self):
|
def onSlideBlank(self):
|
||||||
"""
|
"""
|
||||||
@ -1033,4 +1041,23 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.mediaObject.clearQueue()
|
self.mediaObject.clearQueue()
|
||||||
self.video.hide()
|
self.video.hide()
|
||||||
self.SlidePreview.clear()
|
self.SlidePreview.clear()
|
||||||
self.SlidePreview.show()
|
self.SlidePreview.show()
|
||||||
|
|
||||||
|
def _forceUnblank(self):
|
||||||
|
"""
|
||||||
|
Used by command items which provide their own displays to reset the
|
||||||
|
screen hide attributes
|
||||||
|
"""
|
||||||
|
if self.BlankScreen.isChecked:
|
||||||
|
self.BlankScreen.setChecked(False)
|
||||||
|
self.HideMenu.setDefaultAction(self.BlankScreen)
|
||||||
|
QtCore.QSettings().setValue(
|
||||||
|
self.parent.generalSettingsSection + u'/screen blank',
|
||||||
|
QtCore.QVariant(False))
|
||||||
|
if self.ThemeScreen.isChecked:
|
||||||
|
self.ThemeScreen.setChecked(False)
|
||||||
|
self.HideMenu.setDefaultAction(self.ThemeScreen)
|
||||||
|
if self.DesktopScreen.isChecked:
|
||||||
|
self.DesktopScreen.setChecked(False)
|
||||||
|
self.HideMenu.setDefaultAction(self.DesktopScreen)
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
os.remove(os.path.join(self.servicePath,
|
os.remove(os.path.join(self.servicePath,
|
||||||
unicode(text.text())))
|
unicode(text.text())))
|
||||||
except OSError:
|
except OSError:
|
||||||
#if not present do not worry
|
# if not present do not worry
|
||||||
pass
|
pass
|
||||||
self.listView.takeItem(row)
|
self.listView.takeItem(row)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
@ -172,9 +172,18 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
for item in items:
|
for item in items:
|
||||||
bitem = self.listView.item(item.row())
|
bitem = self.listView.item(item.row())
|
||||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||||
(path, name) = os.path.split(filename)
|
if os.path.exists(filename):
|
||||||
service_item.add_from_image(filename, name)
|
(path, name) = os.path.split(filename)
|
||||||
return True
|
service_item.add_from_image(filename, name)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
# File is no longer present
|
||||||
|
QtGui.QMessageBox.critical(
|
||||||
|
self, translate('ImagePlugin.MediaItem',
|
||||||
|
'Missing Image'),
|
||||||
|
unicode(translate('ImagePlugin.MediaItem',
|
||||||
|
'The Image %s no longer exists.')) % filename)
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -195,4 +204,4 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
self.resetButton.setVisible(True)
|
self.resetButton.setVisible(True)
|
||||||
|
|
||||||
def onPreviewClick(self):
|
def onPreviewClick(self):
|
||||||
MediaManagerItem.onPreviewClick(self)
|
MediaManagerItem.onPreviewClick(self)
|
||||||
|
@ -89,7 +89,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.ImageWidget.sizePolicy().hasHeightForWidth())
|
self.ImageWidget.sizePolicy().hasHeightForWidth())
|
||||||
self.ImageWidget.setSizePolicy(sizePolicy)
|
self.ImageWidget.setSizePolicy(sizePolicy)
|
||||||
self.ImageWidget.setObjectName(u'ImageWidget')
|
self.ImageWidget.setObjectName(u'ImageWidget')
|
||||||
#Replace backgrounds do not work at present so remove functionality.
|
# Replace backgrounds do not work at present so remove functionality.
|
||||||
self.blankButton = self.toolbar.addToolbarButton(
|
self.blankButton = self.toolbar.addToolbarButton(
|
||||||
translate('MediaPlugin.MediaItem', 'Replace Background'),
|
translate('MediaPlugin.MediaItem', 'Replace Background'),
|
||||||
u':/slides/slide_blank.png',
|
u':/slides/slide_blank.png',
|
||||||
@ -122,15 +122,24 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
if item is None:
|
if item is None:
|
||||||
return False
|
return False
|
||||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
service_item.title = unicode(
|
if os.path.exists(filename):
|
||||||
translate('MediaPlugin.MediaItem', 'Media'))
|
service_item.title = unicode(
|
||||||
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
translate('MediaPlugin.MediaItem', 'Media'))
|
||||||
# force a nonexistent theme
|
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
||||||
service_item.theme = -1
|
# force a nonexistent theme
|
||||||
frame = u':/media/image_clapperboard.png'
|
service_item.theme = -1
|
||||||
(path, name) = os.path.split(filename)
|
frame = u':/media/image_clapperboard.png'
|
||||||
service_item.add_from_command(path, name, frame)
|
(path, name) = os.path.split(filename)
|
||||||
return True
|
service_item.add_from_command(path, name, frame)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
# File is no longer present
|
||||||
|
QtGui.QMessageBox.critical(
|
||||||
|
self, translate('MediaPlugin.MediaItem',
|
||||||
|
'Missing Media File'),
|
||||||
|
unicode(translate('MediaPlugin.MediaItem',
|
||||||
|
'The file %s no longer exists.')) % filename)
|
||||||
|
return False
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
self.listView.setSelectionMode(
|
self.listView.setSelectionMode(
|
||||||
@ -159,4 +168,4 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
img = QtGui.QPixmap(u':/media/media_video.png').toImage()
|
img = QtGui.QPixmap(u':/media/media_video.png').toImage()
|
||||||
item_name.setIcon(build_icon(img))
|
item_name.setIcon(build_icon(img))
|
||||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||||
self.listView.addItem(item_name)
|
self.listView.addItem(item_name)
|
||||||
|
@ -255,8 +255,9 @@ class ImpressDocument(PresentationDocument):
|
|||||||
self.document = desktop.loadComponentFromURL(url, u'_blank',
|
self.document = desktop.loadComponentFromURL(url, u'_blank',
|
||||||
0, properties)
|
0, properties)
|
||||||
except:
|
except:
|
||||||
log.exception(u'Failed to load presentation')
|
log.exception(u'Failed to load presentation %s' % url)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.presentation = self.document.getPresentation()
|
self.presentation = self.document.getPresentation()
|
||||||
self.presentation.Display = \
|
self.presentation.Display = \
|
||||||
self.controller.plugin.renderManager.screens.current_display + 1
|
self.controller.plugin.renderManager.screens.current_display + 1
|
||||||
@ -478,4 +479,4 @@ class ImpressDocument(PresentationDocument):
|
|||||||
shape = notes.getByIndex(idx)
|
shape = notes.getByIndex(idx)
|
||||||
if shape.supportsService("com.sun.star.drawing.Text"):
|
if shape.supportsService("com.sun.star.drawing.Text"):
|
||||||
text += shape.getString() + '\n'
|
text += shape.getString() + '\n'
|
||||||
return text
|
return text
|
||||||
|
@ -30,7 +30,7 @@ import os
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||||
SettingsManager, translate, check_item_selected, Receiver
|
SettingsManager, translate, check_item_selected, Receiver, ItemCapabilities
|
||||||
from openlp.plugins.presentations.lib import MessageListener
|
from openlp.plugins.presentations.lib import MessageListener
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -153,7 +153,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
self.DisplayTypeComboBox.clear()
|
self.DisplayTypeComboBox.clear()
|
||||||
for item in self.controllers:
|
for item in self.controllers:
|
||||||
#load the drop down selection
|
# load the drop down selection
|
||||||
if self.controllers[item].enabled():
|
if self.controllers[item].enabled():
|
||||||
self.DisplayTypeComboBox.addItem(item)
|
self.DisplayTypeComboBox.addItem(item)
|
||||||
if self.DisplayTypeComboBox.count() > 1:
|
if self.DisplayTypeComboBox.count() > 1:
|
||||||
@ -249,28 +249,39 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
return False
|
return False
|
||||||
service_item.title = unicode(self.DisplayTypeComboBox.currentText())
|
service_item.title = unicode(self.DisplayTypeComboBox.currentText())
|
||||||
service_item.shortname = unicode(self.DisplayTypeComboBox.currentText())
|
service_item.shortname = unicode(self.DisplayTypeComboBox.currentText())
|
||||||
|
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
|
||||||
shortname = service_item.shortname
|
shortname = service_item.shortname
|
||||||
if shortname:
|
if shortname:
|
||||||
for item in items:
|
for item in items:
|
||||||
bitem = self.listView.item(item.row())
|
bitem = self.listView.item(item.row())
|
||||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||||
if shortname == self.Automatic:
|
if os.path.exists(filename):
|
||||||
service_item.shortname = self.findControllerByType(filename)
|
if shortname == self.Automatic:
|
||||||
if not service_item.shortname:
|
service_item.shortname = \
|
||||||
return False
|
self.findControllerByType(filename)
|
||||||
controller = self.controllers[service_item.shortname]
|
if not service_item.shortname:
|
||||||
(path, name) = os.path.split(filename)
|
return False
|
||||||
doc = controller.add_doc(filename)
|
controller = self.controllers[service_item.shortname]
|
||||||
if doc.get_thumbnail_path(1, True) is None:
|
(path, name) = os.path.split(filename)
|
||||||
doc.load_presentation()
|
doc = controller.add_doc(filename)
|
||||||
i = 1
|
if doc.get_thumbnail_path(1, True) is None:
|
||||||
img = doc.get_thumbnail_path(i, True)
|
doc.load_presentation()
|
||||||
while img:
|
i = 1
|
||||||
service_item.add_from_command(path, name, img)
|
|
||||||
i = i + 1
|
|
||||||
img = doc.get_thumbnail_path(i, True)
|
img = doc.get_thumbnail_path(i, True)
|
||||||
doc.close_presentation()
|
while img:
|
||||||
return True
|
service_item.add_from_command(path, name, img)
|
||||||
|
i = i + 1
|
||||||
|
img = doc.get_thumbnail_path(i, True)
|
||||||
|
doc.close_presentation()
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
# File is no longer present
|
||||||
|
QtGui.QMessageBox.critical(
|
||||||
|
self, translate('PresentationPlugin.MediaItem',
|
||||||
|
'Missing Presentation'),
|
||||||
|
unicode(translate('PresentationPlugin.MediaItem',
|
||||||
|
'The Presentation %s no longer exists.')) % filename)
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -280,7 +291,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
file type. This is used if "Automatic" is set as the preferred
|
file type. This is used if "Automatic" is set as the preferred
|
||||||
controller. Find the first (alphabetic) enabled controller which
|
controller. Find the first (alphabetic) enabled controller which
|
||||||
"supports" the extension. If none found, then look for a controller
|
"supports" the extension. If none found, then look for a controller
|
||||||
which "alsosupports" it instead.
|
which "also supports" it instead.
|
||||||
"""
|
"""
|
||||||
filetype = filename.split(u'.')[1]
|
filetype = filename.split(u'.')[1]
|
||||||
if not filetype:
|
if not filetype:
|
||||||
@ -293,4 +304,4 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
if self.controllers[controller].enabled():
|
if self.controllers[controller].enabled():
|
||||||
if filetype in self.controllers[controller].alsosupports:
|
if filetype in self.controllers[controller].alsosupports:
|
||||||
return controller
|
return controller
|
||||||
return None
|
return None
|
||||||
|
@ -29,6 +29,7 @@ import locale
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
from sqlalchemy.sql import or_
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, Receiver, \
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, Receiver, \
|
||||||
ItemCapabilities, translate, check_item_selected
|
ItemCapabilities, translate, check_item_selected
|
||||||
@ -36,6 +37,7 @@ from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
|||||||
SongImportForm
|
SongImportForm
|
||||||
from openlp.plugins.songs.lib import SongXMLParser, OpenLyricsParser
|
from openlp.plugins.songs.lib import SongXMLParser, OpenLyricsParser
|
||||||
from openlp.plugins.songs.lib.db import Author, Song
|
from openlp.plugins.songs.lib.db import Author, Song
|
||||||
|
from openlp.core.lib.searchedit import SearchEdit
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -88,20 +90,10 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.SearchTextLabel.setObjectName(u'SearchTextLabel')
|
self.SearchTextLabel.setObjectName(u'SearchTextLabel')
|
||||||
self.SearchLayout.setWidget(
|
self.SearchLayout.setWidget(
|
||||||
0, QtGui.QFormLayout.LabelRole, self.SearchTextLabel)
|
0, QtGui.QFormLayout.LabelRole, self.SearchTextLabel)
|
||||||
self.SearchTextEdit = QtGui.QLineEdit(self)
|
self.SearchTextEdit = SearchEdit(self)
|
||||||
self.SearchTextEdit.setObjectName(u'SearchTextEdit')
|
self.SearchTextEdit.setObjectName(u'SearchTextEdit')
|
||||||
self.SearchLayout.setWidget(
|
self.SearchLayout.setWidget(
|
||||||
0, QtGui.QFormLayout.FieldRole, self.SearchTextEdit)
|
0, QtGui.QFormLayout.FieldRole, self.SearchTextEdit)
|
||||||
self.SearchTypeLabel = QtGui.QLabel(self)
|
|
||||||
self.SearchTypeLabel.setAlignment(
|
|
||||||
QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft)
|
|
||||||
self.SearchTypeLabel.setObjectName(u'SearchTypeLabel')
|
|
||||||
self.SearchLayout.setWidget(
|
|
||||||
1, QtGui.QFormLayout.LabelRole, self.SearchTypeLabel)
|
|
||||||
self.SearchTypeComboBox = QtGui.QComboBox(self)
|
|
||||||
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 = QtGui.QHBoxLayout()
|
||||||
self.SearchButtonLayout.setMargin(0)
|
self.SearchButtonLayout.setMargin(0)
|
||||||
@ -113,9 +105,6 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.SearchTextButton = QtGui.QPushButton(self)
|
self.SearchTextButton = QtGui.QPushButton(self)
|
||||||
self.SearchTextButton.setObjectName(u'SearchTextButton')
|
self.SearchTextButton.setObjectName(u'SearchTextButton')
|
||||||
self.SearchButtonLayout.addWidget(self.SearchTextButton)
|
self.SearchButtonLayout.addWidget(self.SearchTextButton)
|
||||||
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
|
# Signals and slots
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
@ -124,8 +113,6 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick)
|
QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick)
|
||||||
QtCore.QObject.connect(self.SearchTextButton,
|
QtCore.QObject.connect(self.SearchTextButton,
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick)
|
QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick)
|
||||||
QtCore.QObject.connect(self.ClearTextButton,
|
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onClearTextButtonClick)
|
|
||||||
QtCore.QObject.connect(self.SearchTextEdit,
|
QtCore.QObject.connect(self.SearchTextEdit,
|
||||||
QtCore.SIGNAL(u'textChanged(const QString&)'),
|
QtCore.SIGNAL(u'textChanged(const QString&)'),
|
||||||
self.onSearchTextEditChanged)
|
self.onSearchTextEditChanged)
|
||||||
@ -139,6 +126,11 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
QtCore.SIGNAL(u'songs_edit'), self.onRemoteEdit)
|
QtCore.SIGNAL(u'songs_edit'), self.onRemoteEdit)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'songs_edit_clear'), self.onRemoteEditClear)
|
QtCore.SIGNAL(u'songs_edit_clear'), self.onRemoteEditClear)
|
||||||
|
QtCore.QObject.connect(self.SearchTextEdit,
|
||||||
|
QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
|
||||||
|
QtCore.QObject.connect(self.SearchTextEdit,
|
||||||
|
QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
||||||
|
self.onSearchTextButtonClick)
|
||||||
|
|
||||||
def configUpdated(self):
|
def configUpdated(self):
|
||||||
self.searchAsYouType = QtCore.QSettings().value(
|
self.searchAsYouType = QtCore.QSettings().value(
|
||||||
@ -154,47 +146,56 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.SearchTextLabel.setText(
|
self.SearchTextLabel.setText(
|
||||||
translate('SongsPlugin.MediaItem', 'Search:'))
|
translate('SongsPlugin.MediaItem', 'Search:'))
|
||||||
self.SearchTypeLabel.setText(
|
|
||||||
translate('SongsPlugin.MediaItem', 'Type:'))
|
|
||||||
self.ClearTextButton.setText(
|
|
||||||
translate('SongsPlugin.MediaItem', 'Clear'))
|
|
||||||
self.SearchTextButton.setText(
|
self.SearchTextButton.setText(
|
||||||
translate('SongsPlugin.MediaItem', 'Search'))
|
translate('SongsPlugin.MediaItem', 'Search'))
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
self.SearchTypeComboBox.addItem(
|
self.SearchTextEdit.setSearchTypes([
|
||||||
translate('SongsPlugin.MediaItem', 'Titles'))
|
(1, u':/songs/song_search_all.png',
|
||||||
self.SearchTypeComboBox.addItem(
|
translate('SongsPlugin.MediaItem', 'Entire Song')),
|
||||||
translate('SongsPlugin.MediaItem', 'Lyrics'))
|
(2, u':/songs/song_search_title.png',
|
||||||
self.SearchTypeComboBox.addItem(
|
translate('SongsPlugin.MediaItem', 'Titles')),
|
||||||
translate('SongsPlugin.MediaItem', 'Authors'))
|
(3, u':/songs/song_search_lyrics.png',
|
||||||
self.SearchTypeComboBox.addItem(
|
translate('SongsPlugin.MediaItem', 'Lyrics')),
|
||||||
translate('SongsPlugin.MediaItem', 'Themes'))
|
(4, u':/songs/song_search_author.png',
|
||||||
|
translate('SongsPlugin.MediaItem', 'Authors')),
|
||||||
|
(5, u':/slides/slide_theme.png',
|
||||||
|
translate('SongsPlugin.MediaItem', 'Themes'))
|
||||||
|
])
|
||||||
self.configUpdated()
|
self.configUpdated()
|
||||||
|
|
||||||
def onSearchTextButtonClick(self):
|
def onSearchTextButtonClick(self):
|
||||||
search_keywords = unicode(self.SearchTextEdit.displayText())
|
search_keywords = unicode(self.SearchTextEdit.displayText())
|
||||||
search_results = []
|
search_results = []
|
||||||
search_type = self.SearchTypeComboBox.currentIndex()
|
# search_type = self.SearchTypeComboBox.currentIndex()
|
||||||
if search_type == 0:
|
search_type = self.SearchTextEdit.currentSearchType()
|
||||||
|
if search_type == 1:
|
||||||
|
log.debug(u'Entire Song Search')
|
||||||
|
search_results = self.parent.manager.get_all_objects(Song,
|
||||||
|
or_(Song.search_title.like(u'%' + self.whitespace.sub(u' ',
|
||||||
|
search_keywords.lower()) + u'%'),
|
||||||
|
Song.search_lyrics.like(u'%' + search_keywords.lower() + \
|
||||||
|
u'%')), Song.search_title.asc())
|
||||||
|
self.displayResultsSong(search_results)
|
||||||
|
if search_type == 2:
|
||||||
log.debug(u'Titles Search')
|
log.debug(u'Titles Search')
|
||||||
search_results = self.parent.manager.get_all_objects(Song,
|
search_results = self.parent.manager.get_all_objects(Song,
|
||||||
Song.search_title.like(u'%' + self.whitespace.sub(u' ',
|
Song.search_title.like(u'%' + self.whitespace.sub(u' ',
|
||||||
search_keywords.lower()) + u'%'), Song.search_title.asc())
|
search_keywords.lower()) + u'%'), Song.search_title.asc())
|
||||||
self.displayResultsSong(search_results)
|
self.displayResultsSong(search_results)
|
||||||
elif search_type == 1:
|
elif search_type == 3:
|
||||||
log.debug(u'Lyrics Search')
|
log.debug(u'Lyrics Search')
|
||||||
search_results = self.parent.manager.get_all_objects(Song,
|
search_results = self.parent.manager.get_all_objects(Song,
|
||||||
Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'),
|
Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'),
|
||||||
Song.search_lyrics.asc())
|
Song.search_lyrics.asc())
|
||||||
self.displayResultsSong(search_results)
|
self.displayResultsSong(search_results)
|
||||||
elif search_type == 2:
|
elif search_type == 4:
|
||||||
log.debug(u'Authors Search')
|
log.debug(u'Authors Search')
|
||||||
search_results = self.parent.manager.get_all_objects(Author,
|
search_results = self.parent.manager.get_all_objects(Author,
|
||||||
Author.display_name.like(u'%' + search_keywords + u'%'),
|
Author.display_name.like(u'%' + search_keywords + u'%'),
|
||||||
Author.display_name.asc())
|
Author.display_name.asc())
|
||||||
self.displayResultsAuthor(search_results)
|
self.displayResultsAuthor(search_results)
|
||||||
elif search_type == 3:
|
elif search_type == 5:
|
||||||
log.debug(u'Theme Search')
|
log.debug(u'Theme Search')
|
||||||
search_results = self.parent.manager.get_all_objects(Song,
|
search_results = self.parent.manager.get_all_objects(Song,
|
||||||
Song.theme_name == search_keywords,
|
Song.theme_name == search_keywords,
|
||||||
@ -263,7 +264,9 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
if self.searchAsYouType:
|
if self.searchAsYouType:
|
||||||
search_length = 1
|
search_length = 1
|
||||||
if self.SearchTypeComboBox.currentIndex() == 1:
|
if self.SearchTextEdit.currentSearchType() == 1:
|
||||||
|
search_length = 3
|
||||||
|
elif self.SearchTextEdit.currentSearchType() == 3:
|
||||||
search_length = 7
|
search_length = 7
|
||||||
if len(text) > search_length:
|
if len(text) > search_length:
|
||||||
self.onSearchTextButtonClick()
|
self.onSearchTextButtonClick()
|
||||||
|
BIN
resources/images/general_search_clear.png
Normal file
BIN
resources/images/general_search_clear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 644 B |
@ -1,5 +1,9 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="songs">
|
<qresource prefix="songs">
|
||||||
|
<file>song_search_all.png</file>
|
||||||
|
<file>song_search_author.png</file>
|
||||||
|
<file>song_search_lyrics.png</file>
|
||||||
|
<file>song_search_title.png</file>
|
||||||
<file>topic_edit.png</file>
|
<file>topic_edit.png</file>
|
||||||
<file>author_add.png</file>
|
<file>author_add.png</file>
|
||||||
<file>author_delete.png</file>
|
<file>author_delete.png</file>
|
||||||
|
BIN
resources/images/song_search_all.png
Normal file
BIN
resources/images/song_search_all.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 607 B |
BIN
resources/images/song_search_author.png
Normal file
BIN
resources/images/song_search_author.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 409 B |
BIN
resources/images/song_search_lyrics.png
Normal file
BIN
resources/images/song_search_lyrics.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 335 B |
BIN
resources/images/song_search_title.png
Normal file
BIN
resources/images/song_search_title.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 245 B |
Loading…
Reference in New Issue
Block a user