forked from openlp/openlp
HEAD
This commit is contained in:
commit
2ae79a4480
@ -83,6 +83,9 @@ class EventReceiver(QtCore.QObject):
|
||||
|
||||
``audit_changed``
|
||||
Audit information may have changed
|
||||
|
||||
``config_updated``
|
||||
Informs components the config has changed
|
||||
"""
|
||||
global log
|
||||
log = logging.getLogger(u'EventReceiver')
|
||||
|
@ -113,7 +113,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.title = title
|
||||
self.Toolbar = None
|
||||
self.PageLayout = QtGui.QVBoxLayout(self)
|
||||
self.PageLayout.setSpacing(0)
|
||||
self.PageLayout.setSpacing(4)
|
||||
self.PageLayout.setMargin(0)
|
||||
self.requiredIcons()
|
||||
self.setupUi()
|
||||
|
@ -25,9 +25,40 @@
|
||||
import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver
|
||||
from openlp.core.lib import Receiver, str_to_bool
|
||||
|
||||
class MainDisplay(QtGui.QWidget):
|
||||
class DisplayLabel(QtGui.QWidget):
|
||||
"""
|
||||
Customised version of QTableWidget which can respond to keyboard
|
||||
events.
|
||||
"""
|
||||
def __init__(self, parent=None, name=None):
|
||||
QQtGui.QWidget.__init__(self, parent)
|
||||
self.parent = parent
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
if type(event) == QtGui.QKeyEvent:
|
||||
#here accept the event and do something
|
||||
if event.key() == QtCore.Qt.Key_Up:
|
||||
Receiver().send_message(u'slidecontroller_previous')
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_Down:
|
||||
Receiver().send_message(u'slidecontroller_next')
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_PageUp:
|
||||
Receiver().send_message(u'slidecontroller_first')
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_PageDown:
|
||||
Receiver().send_message(u'slidecontroller_last')
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_Escape:
|
||||
self.resetDisplay()
|
||||
event.accept()
|
||||
event.ignore()
|
||||
else:
|
||||
event.ignore()
|
||||
|
||||
class MainDisplay(DisplayLabel):
|
||||
"""
|
||||
This is the form that is used to display things on the projector.
|
||||
"""
|
||||
@ -59,6 +90,7 @@ class MainDisplay(QtGui.QWidget):
|
||||
self.layout.addWidget(self.display)
|
||||
self.displayBlank = False
|
||||
self.blankFrame = None
|
||||
self.frame = None
|
||||
self.alertactive = False
|
||||
self.alertTab = None
|
||||
self.timer_id = 0
|
||||
@ -66,6 +98,10 @@ class MainDisplay(QtGui.QWidget):
|
||||
QtCore.SIGNAL(u'live_slide_blank'), self.blankDisplay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'alert_text'), self.displayAlert)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'presentations_start'), self.hideDisplay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'presentations_stop'), self.showDisplay)
|
||||
|
||||
def setup(self, screenNumber):
|
||||
"""
|
||||
@ -84,21 +120,24 @@ class MainDisplay(QtGui.QWidget):
|
||||
self.setGeometry(screen[u'size'])
|
||||
if not screen[u'primary']:
|
||||
self.showFullScreen()
|
||||
self.primary = False
|
||||
else:
|
||||
self.showMinimized()
|
||||
self.setVisible(False)
|
||||
self.primary = True
|
||||
#Build a custom splash screen
|
||||
self.InitialFrame = QtGui.QImage(
|
||||
screen[u'size'].width(), 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.drawImage(
|
||||
(screen[u'size'].width() - splash_image.width()) / 2,
|
||||
(screen[u'size'].height() - splash_image.height()) / 2,
|
||||
splash_image)
|
||||
self.frameView(self.InitialFrame)
|
||||
if str_to_bool(self.parent.generalConfig.get_config(u'show splash', u'True')):
|
||||
self.InitialFrame = QtGui.QImage(
|
||||
screen[u'size'].width(), 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.drawImage(
|
||||
(screen[u'size'].width() - splash_image.width()) / 2,
|
||||
(screen[u'size'].height() - splash_image.height()) / 2,
|
||||
splash_image)
|
||||
self.frameView(self.InitialFrame)
|
||||
#Build a Black screen
|
||||
painter = QtGui.QPainter()
|
||||
self.blankFrame = QtGui.QImage(
|
||||
@ -107,6 +146,17 @@ class MainDisplay(QtGui.QWidget):
|
||||
painter.begin(self.blankFrame)
|
||||
painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black)
|
||||
|
||||
def resetDisplay(self):
|
||||
if self.primary:
|
||||
self.setVisible(False)
|
||||
|
||||
def hideDisplay(self):
|
||||
self.setVisible(False)
|
||||
|
||||
def showDisplay(self):
|
||||
if not self.primary:
|
||||
self.setVisible(True)
|
||||
|
||||
def frameView(self, frame):
|
||||
"""
|
||||
Called from a slide controller to display a frame
|
||||
@ -119,6 +169,9 @@ class MainDisplay(QtGui.QWidget):
|
||||
self.displayAlert()
|
||||
elif not self.displayBlank:
|
||||
self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||
if not self.isVisible():
|
||||
self.setVisible(True)
|
||||
self.showFullScreen()
|
||||
|
||||
def blankDisplay(self):
|
||||
if not self.displayBlank:
|
||||
@ -126,7 +179,8 @@ class MainDisplay(QtGui.QWidget):
|
||||
self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
|
||||
else:
|
||||
self.displayBlank = False
|
||||
self.frameView(self.frame)
|
||||
if self.frame is not None:
|
||||
self.frameView(self.frame)
|
||||
|
||||
def displayAlert(self, text=u''):
|
||||
"""
|
||||
|
@ -107,9 +107,18 @@ class Ui_MainWindow(object):
|
||||
self.MediaManagerDock = OpenLPDockWidget(MainWindow)
|
||||
MediaManagerIcon = buildIcon(u':/system/system_mediamanager.png')
|
||||
self.MediaManagerDock.setWindowIcon(MediaManagerIcon)
|
||||
self.MediaManagerDock.setObjectName(u'MediaManagerDock')
|
||||
self.MediaManagerDock.setStyleSheet("""
|
||||
QToolBox::tab {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 palette(light), stop: 1.0 palette(dark));
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
margin: 0;
|
||||
}
|
||||
""")
|
||||
self.MediaManagerDock.setMinimumWidth(
|
||||
self.settingsmanager.mainwindow_left)
|
||||
self.MediaManagerDock.setObjectName(u'MediaManagerDock')
|
||||
self.MediaManagerContents = QtGui.QWidget()
|
||||
self.MediaManagerContents.setObjectName(u'MediaManagerContents')
|
||||
self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
|
||||
@ -368,7 +377,7 @@ class Ui_MainWindow(object):
|
||||
self.action_Preview_Panel.setStatusTip(translate(u'mainWindow',
|
||||
u'Toggle the visibility of the Preview Panel'))
|
||||
self.action_Preview_Panel.setShortcut(translate(u'mainWindow', u'F11'))
|
||||
self.ToolsAlertItem.setText(translate(u'mainWindow', u'Nursery &Alert'))
|
||||
self.ToolsAlertItem.setText(translate(u'mainWindow', u'&Alert'))
|
||||
self.ToolsAlertItem.setStatusTip(
|
||||
translate(u'mainWindow', u'Show an alert message'))
|
||||
self.ToolsAlertItem.setShortcut(translate(u'mainWindow', u'F7'))
|
||||
@ -414,12 +423,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
plugins.
|
||||
"""
|
||||
QtGui.QMainWindow.__init__(self)
|
||||
self.closeEvent = self.onCloseEvent
|
||||
self.screenList = screens
|
||||
self.serviceNotSaved = False
|
||||
self.settingsmanager = SettingsManager(screens)
|
||||
self.mainDisplay = MainDisplay(self, screens)
|
||||
self.generalConfig = PluginConfig(u'General')
|
||||
self.mainDisplay = MainDisplay(self, screens)
|
||||
self.alertForm = AlertForm(self)
|
||||
self.aboutForm = AboutForm(self)
|
||||
self.settingsForm = SettingsForm(self.screenList, self)
|
||||
@ -593,7 +601,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
self.RenderManager.update_display(screen_number)
|
||||
self.mainDisplay.setup(screen_number)
|
||||
|
||||
def onCloseEvent(self, event):
|
||||
def closeEvent(self, event):
|
||||
"""
|
||||
Hook to close the main window and display windows on exit
|
||||
"""
|
||||
|
@ -426,8 +426,10 @@ class ServiceManager(QtGui.QWidget):
|
||||
files retrieved from the zip file are placed in a temporary directory
|
||||
and will only be used for this service.
|
||||
"""
|
||||
filename = QtGui.QFileDialog.getOpenFileName(self, u'Open Service',
|
||||
self.config.get_last_dir(), u'Services (*.osz)')
|
||||
filename = QtGui.QFileDialog.getOpenFileName(self,
|
||||
translate(u'ThemeManager', u'Open Service'),
|
||||
self.config.get_last_dir(),
|
||||
u'Services (*.osz)')
|
||||
filename = unicode(filename)
|
||||
name = filename.split(os.path.sep)
|
||||
if filename != u'':
|
||||
|
@ -27,6 +27,7 @@ import logging
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.ui import GeneralTab, ThemesTab, AlertsTab
|
||||
from openlp.core.lib import Receiver
|
||||
from settingsdialog import Ui_SettingsDialog
|
||||
|
||||
log = logging.getLogger(u'SettingsForm')
|
||||
@ -64,6 +65,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
||||
def accept(self):
|
||||
for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||
self.SettingsTabWidget.widget(tab_index).save()
|
||||
Receiver().send_message(u'config_updated')
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
def postSetUp(self):
|
||||
|
@ -195,8 +195,14 @@ class SlideController(QtGui.QWidget):
|
||||
Receiver().send_message(u'request_spin_delay')
|
||||
if isLive:
|
||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||
else:
|
||||
pass
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'slidecontroller_first'), self.onSlideSelectedFirst)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'slidecontroller_next'), self.onSlideSelectedNext)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'slidecontroller_previous'), self.onSlideSelectedPrevious)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'slidecontroller_last'), self.onSlideSelectedLast)
|
||||
|
||||
def receiveSpinDelay(self, value):
|
||||
self.DelaySpinBox.setValue(int(value))
|
||||
@ -319,7 +325,8 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
Go to the first slide.
|
||||
"""
|
||||
if self.commandItem.service_item_type == ServiceType.Command:
|
||||
if self.commandItem is not None and \
|
||||
self.commandItem.service_item_type == ServiceType.Command:
|
||||
Receiver().send_message(u'%s_first'% self.commandItem.name.lower())
|
||||
else:
|
||||
self.PreviewListWidget.selectRow(0)
|
||||
@ -329,12 +336,13 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
Blank the screen.
|
||||
"""
|
||||
if self.commandItem.service_item_type == ServiceType.Command:
|
||||
if self.commandItem is not None and \
|
||||
self.commandItem.service_item_type == ServiceType.Command:
|
||||
if blanked:
|
||||
Receiver().send_message(u'%s_blank'% self.commandItem.name.lower())
|
||||
else:
|
||||
Receiver().send_message(u'%s_unblank'% self.commandItem.name.lower())
|
||||
else:
|
||||
else:
|
||||
self.parent.mainDisplay.blankDisplay()
|
||||
|
||||
def onSlideSelected(self):
|
||||
@ -345,7 +353,7 @@ class SlideController(QtGui.QWidget):
|
||||
row = self.PreviewListWidget.currentRow()
|
||||
if row > -1 and row < self.PreviewListWidget.rowCount():
|
||||
if self.commandItem.service_item_type == ServiceType.Command:
|
||||
Receiver().send_message(u'%s_slide'% self.commandItem.name.lower(), [row])
|
||||
Receiver().send_message(u'%s_slide'% self.commandItem.name.lower(), [row])
|
||||
else:
|
||||
#label = self.PreviewListWidget.cellWidget(row, 0)
|
||||
frame = self.serviceitem.frames[row][u'image']
|
||||
@ -361,7 +369,8 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
Go to the next slide.
|
||||
"""
|
||||
if self.commandItem.service_item_type == ServiceType.Command:
|
||||
if self.commandItem is not None and \
|
||||
self.commandItem.service_item_type == ServiceType.Command:
|
||||
Receiver().send_message(u'%s_next'% self.commandItem.name.lower())
|
||||
else:
|
||||
row = self.PreviewListWidget.currentRow() + 1
|
||||
@ -374,7 +383,8 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
Go to the previous slide.
|
||||
"""
|
||||
if self.commandItem.service_item_type == ServiceType.Command:
|
||||
if self.commandItem is not None and \
|
||||
self.commandItem.service_item_type == ServiceType.Command:
|
||||
Receiver().send_message(
|
||||
u'%s_previous'% self.commandItem.name.lower())
|
||||
else:
|
||||
@ -388,7 +398,8 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
Go to the last slide.
|
||||
"""
|
||||
if self.commandItem.service_item_type == ServiceType.Command:
|
||||
if self.commandItem is not None and \
|
||||
self.commandItem.service_item_type == ServiceType.Command:
|
||||
Receiver().send_message(u'%s_last'% self.commandItem.name.lower())
|
||||
else:
|
||||
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1)
|
||||
|
@ -224,13 +224,14 @@ class ThemeManager(QtGui.QWidget):
|
||||
zip.close()
|
||||
|
||||
def onImportTheme(self):
|
||||
files = QtGui.QFileDialog.getOpenFileNames(None,
|
||||
translate(u'ThemeManager',
|
||||
u'Select Theme Import File'),
|
||||
self.path, u'Theme (*.*)')
|
||||
files = QtGui.QFileDialog.getOpenFileNames(self,
|
||||
translate(u'ThemeManager', u'Select Theme Import File'),
|
||||
self.config.get_last_dir(),
|
||||
u'Theme (*.*)')
|
||||
log.info(u'New Themes %s', unicode(files))
|
||||
if len(files) > 0:
|
||||
for file in files:
|
||||
self.config.set_last_dir(filename)
|
||||
self.unzipTheme(file, self.path)
|
||||
self.loadThemes()
|
||||
|
||||
|
@ -44,7 +44,7 @@ def check_latest_version(config, current_version):
|
||||
req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
|
||||
req.add_header(u'User-Agent', u'OpenLP%s' % current_version)
|
||||
try:
|
||||
handle = urllib2.urlopen(req, None, 1)
|
||||
handle = urllib2.urlopen(req, None)
|
||||
html = handle.read()
|
||||
version_string = unicode(html).rstrip()
|
||||
except IOError, e:
|
||||
|
@ -41,7 +41,6 @@ class BiblesTab(SettingsTab):
|
||||
self.paragraph_style = True
|
||||
self.show_new_chapters = False
|
||||
self.display_style = 0
|
||||
self.bible_search = True
|
||||
SettingsTab.__init__(
|
||||
self, translate(u'BiblesTab', u'Bibles'), u'Bibles')
|
||||
|
||||
@ -98,7 +97,6 @@ class BiblesTab(SettingsTab):
|
||||
self.LayoutStyleComboBox.addItem(QtCore.QString())
|
||||
self.LayoutStyleLayout.addWidget(self.LayoutStyleComboBox)
|
||||
self.VerseDisplayLayout.addWidget(self.LayoutStyleWidget, 2, 0, 1, 1)
|
||||
|
||||
self.BibleThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
|
||||
self.BibleThemeWidget.setObjectName(u'BibleThemeWidget')
|
||||
self.BibleThemeLayout = QtGui.QHBoxLayout(self.BibleThemeWidget)
|
||||
@ -112,10 +110,13 @@ class BiblesTab(SettingsTab):
|
||||
self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox')
|
||||
self.BibleThemeComboBox.addItem(QtCore.QString())
|
||||
self.BibleThemeLayout.addWidget(self.BibleThemeComboBox)
|
||||
self.VerseDisplayLayout.addWidget(self.BibleThemeWidget, 3, 0, 1, 1)
|
||||
self.BibleDuelCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
|
||||
self.BibleDuelCheckBox.setObjectName(u'BibleDuelCheckBox')
|
||||
self.VerseDisplayLayout.addWidget(self.BibleDuelCheckBox, 3, 0, 1, 1)
|
||||
self.VerseDisplayLayout.addWidget(self.BibleThemeWidget, 4, 0, 1, 1)
|
||||
self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
|
||||
self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel')
|
||||
self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 4, 0, 1, 1)
|
||||
self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 5, 0, 1, 1)
|
||||
self.BibleLeftLayout.addWidget(self.VerseDisplayGroupBox)
|
||||
self.BibleLeftSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
@ -127,27 +128,11 @@ class BiblesTab(SettingsTab):
|
||||
self.BibleRightLayout.setObjectName(u'BibleRightLayout')
|
||||
self.BibleRightLayout.setSpacing(8)
|
||||
self.BibleRightLayout.setMargin(0)
|
||||
self.BibleSearchGroupBox = QtGui.QGroupBox(self)
|
||||
self.BibleSearchGroupBox.setObjectName(u'BibleSearchGroupBox')
|
||||
self.BibleSearchLayout = QtGui.QVBoxLayout(self.BibleSearchGroupBox)
|
||||
self.BibleSearchLayout.setObjectName(u'BibleSearchLayout')
|
||||
self.BibleSearchLayout.setSpacing(8)
|
||||
self.BibleSearchLayout.setMargin(8)
|
||||
self.BibleSearchCheckBox = QtGui.QCheckBox(self.BibleSearchGroupBox)
|
||||
self.BibleSearchCheckBox.setObjectName(u'BibleSearchCheckBox')
|
||||
self.BibleSearchLayout.addWidget(self.BibleSearchCheckBox)
|
||||
self.BibleRightLayout.addWidget(self.BibleSearchGroupBox)
|
||||
self.BibleRightSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.BibleRightLayout.addItem(self.BibleRightSpacer)
|
||||
self.BibleLayout.addWidget(self.BibleRightWidget)
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.NewChaptersCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onNewChaptersCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.BibleSearchCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onBibleSearchCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.DisplayStyleComboBox,
|
||||
QtCore.SIGNAL(u'activated(int)'),
|
||||
self.onDisplayStyleComboBoxChanged)
|
||||
@ -156,6 +141,9 @@ class BiblesTab(SettingsTab):
|
||||
QtCore.QObject.connect(self.LayoutStyleComboBox,
|
||||
QtCore.SIGNAL(u'activated(int)'),
|
||||
self.onLayoutStyleComboBoxChanged)
|
||||
QtCore.QObject.connect(self.BibleDuelCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onBibleDuelCheckBox)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'update_themes'), self.updateThemeList)
|
||||
|
||||
@ -186,10 +174,8 @@ class BiblesTab(SettingsTab):
|
||||
3, translate(u'SettingsForm', u'[ and ]'))
|
||||
self.ChangeNoteLabel.setText(translate(u'SettingsForm',
|
||||
u'Note:\nChanges don\'t affect verses already in the service'))
|
||||
self.BibleSearchGroupBox.setTitle(
|
||||
translate(u'SettingsForm', u'Search'))
|
||||
self.BibleSearchCheckBox.setText(
|
||||
translate(u'SettingsForm', u'Search-as-you-type'))
|
||||
self.BibleDuelCheckBox.setText(
|
||||
translate(u'SettingsForm', u'Display Duel Bible Verses'))
|
||||
|
||||
def onBibleThemeComboBoxChanged(self):
|
||||
self.bible_theme = self.BibleThemeComboBox.currentText()
|
||||
@ -200,19 +186,17 @@ class BiblesTab(SettingsTab):
|
||||
def onLayoutStyleComboBoxChanged(self):
|
||||
self.layout_style = self.LayoutStyleComboBox.currentIndex()
|
||||
|
||||
def onNewChaptersCheckBoxChanged(self):
|
||||
check_state = self.NewChaptersCheckBox.checkState()
|
||||
def onNewChaptersCheckBoxChanged(self, check_state):
|
||||
self.show_new_chapters = False
|
||||
# we have a set value convert to True/False
|
||||
if check_state == QtCore.Qt.Checked:
|
||||
self.show_new_chapters = True
|
||||
|
||||
def onBibleSearchCheckBoxChanged(self):
|
||||
check_state = self.BibleSearchCheckBox.checkState()
|
||||
self.bible_search = False
|
||||
def onBibleDuelCheckBox(self, check_state):
|
||||
self.duel_bibles = False
|
||||
# we have a set value convert to True/False
|
||||
if check_state == QtCore.Qt.Checked:
|
||||
self.bible_search = True
|
||||
self.duel_bibles = True
|
||||
|
||||
def load(self):
|
||||
self.show_new_chapters = str_to_bool(
|
||||
@ -222,12 +206,12 @@ class BiblesTab(SettingsTab):
|
||||
self.layout_style = int(
|
||||
self.config.get_config(u'verse layout style', u'0'))
|
||||
self.bible_theme = self.config.get_config(u'bible theme', u'0')
|
||||
self.bible_search = str_to_bool(
|
||||
self.config.get_config(u'search as type', u'True'))
|
||||
self.duel_bibles = str_to_bool(
|
||||
self.config.get_config(u'duel bibles', u'True'))
|
||||
self.NewChaptersCheckBox.setChecked(self.show_new_chapters)
|
||||
self.DisplayStyleComboBox.setCurrentIndex(self.display_style)
|
||||
self.LayoutStyleComboBox.setCurrentIndex(self.layout_style)
|
||||
self.BibleSearchCheckBox.setChecked(self.bible_search)
|
||||
self.BibleDuelCheckBox.setChecked(self.duel_bibles)
|
||||
|
||||
def save(self):
|
||||
self.config.set_config(
|
||||
@ -236,7 +220,7 @@ class BiblesTab(SettingsTab):
|
||||
u'display brackets', unicode(self.display_style))
|
||||
self.config.set_config(
|
||||
u'verse layout style', unicode(self.layout_style))
|
||||
self.config.set_config(u'search as type', unicode(self.bible_search))
|
||||
self.config.set_config(u'duel bibles', unicode(self.duel_bibles))
|
||||
self.config.set_config(u'bible theme', unicode(self.bible_theme))
|
||||
|
||||
def updateThemeList(self, theme_list):
|
||||
|
@ -28,7 +28,7 @@ import time
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, MediaManagerItem, Receiver, \
|
||||
BaseListWithDnD
|
||||
BaseListWithDnD, str_to_bool
|
||||
from openlp.plugins.bibles.forms import BibleImportForm
|
||||
from openlp.plugins.bibles.lib.manager import BibleMode
|
||||
|
||||
@ -80,7 +80,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.QuickVerticalLayout = QtGui.QVBoxLayout(self.QuickTab)
|
||||
self.QuickVerticalLayout.setObjectName("verticalLayout")
|
||||
self.QuickLayout = QtGui.QGridLayout()
|
||||
self.QuickLayout.setMargin(5)
|
||||
self.QuickLayout.setMargin(0)
|
||||
self.QuickLayout.setSpacing(4)
|
||||
self.QuickLayout.setObjectName(u'QuickLayout')
|
||||
self.QuickVersionLabel = QtGui.QLabel(self.QuickTab)
|
||||
@ -127,7 +127,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.AdvancedVerticalLayout = QtGui.QVBoxLayout(self.AdvancedTab)
|
||||
self.AdvancedVerticalLayout.setObjectName("verticalLayout")
|
||||
self.AdvancedLayout = QtGui.QGridLayout()
|
||||
self.AdvancedLayout.setMargin(5)
|
||||
self.AdvancedLayout.setMargin(0)
|
||||
self.AdvancedLayout.setSpacing(4)
|
||||
self.AdvancedLayout.setObjectName(u'AdvancedLayout')
|
||||
self.AdvancedVersionLabel = QtGui.QLabel(self.AdvancedTab)
|
||||
@ -173,10 +173,10 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.ClearAdvancedSearchComboBox.setObjectName(
|
||||
u'ClearAdvancedSearchComboBox')
|
||||
self.AdvancedLayout.addWidget(
|
||||
self.ClearAdvancedSearchComboBox, 5, 2, 1, 1)
|
||||
self.ClearAdvancedSearchComboBox, 5, 2, 1, 2)
|
||||
self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab)
|
||||
self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton')
|
||||
self.AdvancedLayout.addWidget(self.AdvancedSearchButton, 5, 3, 1, 1)
|
||||
self.AdvancedLayout.addWidget(self.AdvancedSearchButton, 6, 3, 1, 1)
|
||||
self.AdvancedVerticalLayout.addLayout(self.AdvancedLayout)
|
||||
self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab)
|
||||
self.AdvancedSecondBibleComboBox.setObjectName(u'SecondBible')
|
||||
@ -203,6 +203,17 @@ class BibleMediaItem(MediaManagerItem):
|
||||
QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton)
|
||||
QtCore.QObject.connect(self.QuickSearchButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
||||
|
||||
def configUpdated(self):
|
||||
if str_to_bool(
|
||||
self.parent.config.get_config(u'duel bibles', u'False')):
|
||||
self.AdvancedSecondBibleComboBox.setVisible(True)
|
||||
self.QuickSecondBibleComboBox.setVisible(True)
|
||||
else:
|
||||
self.AdvancedSecondBibleComboBox.setVisible(False)
|
||||
self.QuickSecondBibleComboBox.setVisible(False)
|
||||
|
||||
def retranslateUi(self):
|
||||
log.debug(u'retranslateUi')
|
||||
@ -242,6 +253,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
log.debug(u'bible manager initialise')
|
||||
self.loadBibles()
|
||||
self.parent.biblemanager.set_media_manager(self)
|
||||
self.configUpdated()
|
||||
log.debug(u'bible manager initialise complete')
|
||||
|
||||
def setQuickMessage(self, text):
|
||||
|
@ -27,7 +27,7 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, translate, SongXMLParser, \
|
||||
BaseListWithDnD, Receiver
|
||||
BaseListWithDnD, Receiver, str_to_bool
|
||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm
|
||||
|
||||
class SongListView(BaseListWithDnD):
|
||||
@ -68,42 +68,48 @@ class SongMediaItem(MediaManagerItem):
|
||||
u'Maintain the lists of authors, topics and books'),
|
||||
':/songs/song_maintenance.png', self.onSongMaintenanceClick,
|
||||
'SongMaintenanceItem')
|
||||
## Add the SongListView widget ##
|
||||
# Create the tab widget
|
||||
self.SongWidget = QtGui.QWidget(self)
|
||||
sizePolicy = QtGui.QSizePolicy(
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(
|
||||
self.SongWidget.sizePolicy().hasHeightForWidth())
|
||||
self.SongWidget.setSizePolicy(sizePolicy)
|
||||
self.SongWidget.setObjectName(u'SongWidget')
|
||||
self.SearchLayout = QtGui.QGridLayout(self.SongWidget)
|
||||
self.SearchLayout.setMargin(5)
|
||||
self.SearchLayout = QtGui.QFormLayout()
|
||||
self.SearchLayout.setMargin(0)
|
||||
self.SearchLayout.setSpacing(4)
|
||||
self.SearchLayout.setObjectName(u'SearchLayout')
|
||||
self.SearchTypeComboBox = QtGui.QComboBox(self.SongWidget)
|
||||
self.SearchTypeComboBox.setObjectName(u'SearchTypeComboBox')
|
||||
self.SearchLayout.addWidget(self.SearchTypeComboBox, 0, 1, 1, 2)
|
||||
self.SearchTypeLabel = QtGui.QLabel(self.SongWidget)
|
||||
self.SearchTypeLabel.setObjectName(u'SearchTypeLabel')
|
||||
self.SearchLayout.addWidget(self.SearchTypeLabel, 0, 0, 1, 1)
|
||||
self.SearchTextLabel = QtGui.QLabel(self.SongWidget)
|
||||
self.SearchTextLabel = QtGui.QLabel(self)
|
||||
self.SearchTextLabel.setAlignment(
|
||||
QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft)
|
||||
self.SearchTextLabel.setObjectName(u'SearchTextLabel')
|
||||
self.SearchLayout.addWidget(self.SearchTextLabel, 2, 0, 1, 1)
|
||||
self.SearchTextEdit = QtGui.QLineEdit(self.SongWidget)
|
||||
self.SearchLayout.setWidget(
|
||||
0, QtGui.QFormLayout.LabelRole, self.SearchTextLabel)
|
||||
self.SearchTextEdit = QtGui.QLineEdit(self)
|
||||
self.SearchTextEdit.setObjectName(u'SearchTextEdit')
|
||||
self.SearchLayout.addWidget(self.SearchTextEdit, 2, 1, 1, 2)
|
||||
self.ClearTextButton = QtGui.QPushButton(self.SongWidget)
|
||||
self.ClearTextButton.setObjectName(u'ClearTextButton')
|
||||
self.SearchLayout.addWidget(self.ClearTextButton, 3, 1, 1, 1)
|
||||
self.SearchTextButton = QtGui.QPushButton(self.SongWidget)
|
||||
self.SearchLayout.setWidget(
|
||||
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.SearchButtonLayout = QtGui.QHBoxLayout(self)
|
||||
self.SearchButtonLayout.setMargin(0)
|
||||
self.SearchButtonLayout.setSpacing(4)
|
||||
self.SearchButtonLayout.setObjectName(u'SearchButtonLayout')
|
||||
self.SearchButtonSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.SearchButtonLayout.addItem(self.SearchButtonSpacer)
|
||||
self.SearchTextButton = QtGui.QPushButton(self)
|
||||
self.SearchTextButton.setObjectName(u'SearchTextButton')
|
||||
self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1)
|
||||
# Add the song widget to the page layout
|
||||
self.PageLayout.addWidget(self.SongWidget)
|
||||
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)
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.SearchTextEdit,
|
||||
QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick)
|
||||
QtCore.QObject.connect(self.SearchTextButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick)
|
||||
QtCore.QObject.connect(self.ClearTextButton,
|
||||
@ -113,12 +119,16 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.onSearchTextEditChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'load_song_list'), self.onSearchTextButtonClick)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
||||
|
||||
def configUpdated(self):
|
||||
self.searchAsYouType = str_to_bool(
|
||||
self.parent.config.get_config(u'search as type', u'False'))
|
||||
|
||||
def retranslateUi(self):
|
||||
self.SearchTypeLabel.setText(
|
||||
translate(u'SongMediaItem', u'Search Type:'))
|
||||
self.SearchTextLabel.setText(
|
||||
translate(u'SongMediaItem', u'Search Text:'))
|
||||
self.SearchTextLabel.setText(translate(u'SongMediaItem', u'Search:'))
|
||||
self.SearchTypeLabel.setText(translate(u'SongMediaItem', u'Type:'))
|
||||
self.ClearTextButton.setText(translate(u'SongMediaItem', u'Clear'))
|
||||
self.SearchTextButton.setText(translate(u'SongMediaItem', u'Search'))
|
||||
|
||||
@ -126,6 +136,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Titles'))
|
||||
self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Lyrics'))
|
||||
self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Authors'))
|
||||
self.configUpdated()
|
||||
|
||||
def onSearchTextButtonClick(self):
|
||||
search_keywords = unicode(self.SearchTextEdit.displayText())
|
||||
@ -181,11 +192,12 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.SearchTextEdit.clear()
|
||||
|
||||
def onSearchTextEditChanged(self, text):
|
||||
search_length = 1
|
||||
if self.SearchTypeComboBox.currentIndex() == 1:
|
||||
search_length = 7
|
||||
if len(text) > search_length:
|
||||
self.onSearchTextButtonClick()
|
||||
if self.searchAsYouType:
|
||||
search_length = 1
|
||||
if self.SearchTypeComboBox.currentIndex() == 1:
|
||||
search_length = 7
|
||||
if len(text) > search_length:
|
||||
self.onSearchTextButtonClick()
|
||||
|
||||
def onNewClick(self):
|
||||
self.edit_song_form.newSong()
|
||||
|
@ -22,14 +22,51 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, str_to_bool, translate
|
||||
|
||||
class SongsTab(SettingsTab):
|
||||
"""
|
||||
SongsTab is the songs settings tab in the settings dialog.
|
||||
SongsTab is the Songs settings tab in the settings dialog.
|
||||
"""
|
||||
def __init__(self):
|
||||
SettingsTab.__init__(self, translate(u'SongsTab', u'Songs'), u'Songs')
|
||||
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'SongsTab')
|
||||
self.SongsLayout = QtGui.QFormLayout(self)
|
||||
self.SongsLayout.setObjectName(u'SongsLayout')
|
||||
self.SongsModeGroupBox = QtGui.QGroupBox(self)
|
||||
self.SongsModeGroupBox.setObjectName(u'SongsModeGroupBox')
|
||||
self.SongsModeLayout = QtGui.QVBoxLayout(self.SongsModeGroupBox)
|
||||
self.SongsModeLayout.setSpacing(8)
|
||||
self.SongsModeLayout.setMargin(8)
|
||||
self.SongsModeLayout.setObjectName(u'SongsModeLayout')
|
||||
self.SearchAsTypeCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
|
||||
self.SearchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox')
|
||||
self.SongsModeLayout.addWidget(self.SearchAsTypeCheckBox)
|
||||
self.SongsLayout.setWidget(
|
||||
0, QtGui.QFormLayout.LabelRole, self.SongsModeGroupBox)
|
||||
QtCore.QObject.connect(self.SearchAsTypeCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onSearchAsTypeCheckBoxChanged)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.SongsModeGroupBox.setTitle(translate(u'SongsTab', u'Songs Mode'))
|
||||
self.SearchAsTypeCheckBox.setText(
|
||||
translate(u'SongsTab', u'Enable search as you type:'))
|
||||
|
||||
def onSearchAsTypeCheckBoxChanged(self, check_state):
|
||||
self.bible_search = False
|
||||
# we have a set value convert to True/False
|
||||
if check_state == QtCore.Qt.Checked:
|
||||
self.bible_search = True
|
||||
|
||||
def load(self):
|
||||
self.bible_search = str_to_bool(
|
||||
self.config.get_config(u'search as type', u'False'))
|
||||
self.SearchAsTypeCheckBox.setChecked(self.bible_search)
|
||||
|
||||
def save(self):
|
||||
self.config.set_config(u'search as type', unicode(self.bible_search))
|
||||
|
@ -27,7 +27,7 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Plugin, translate, buildIcon
|
||||
from openlp.plugins.songs.lib import SongManager, SongMediaItem
|
||||
from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab
|
||||
from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
|
||||
OpenSongImportForm, OpenLPExportForm
|
||||
|
||||
@ -62,6 +62,9 @@ class SongsPlugin(Plugin):
|
||||
def can_be_disabled(self):
|
||||
return True
|
||||
|
||||
def get_settings_tab(self):
|
||||
return SongsTab()
|
||||
|
||||
def initialise(self):
|
||||
log.info(u'Songs Initialising')
|
||||
#if self.songmanager is None:
|
||||
|
Loading…
Reference in New Issue
Block a user