forked from openlp/openlp
Fixes to Renderer etc
bzr-revno: 640
This commit is contained in:
commit
b6ada60177
@ -105,6 +105,7 @@ class OpenLP(QtGui.QApplication):
|
||||
if show_splash:
|
||||
# now kill the splashscreen
|
||||
self.splash.finish(self.mainWindow)
|
||||
self.mainWindow.versionCheck()
|
||||
return self.exec_()
|
||||
|
||||
def main():
|
||||
|
@ -72,9 +72,11 @@ class Renderer(object):
|
||||
self._theme = theme
|
||||
self.bg_frame = None
|
||||
self.bg_image = None
|
||||
self._bg_image_filename = None
|
||||
self.theme_name = theme.theme_name
|
||||
self._set_theme_font()
|
||||
if theme.background_type == u'image':
|
||||
print theme.background_filename
|
||||
if theme.background_filename is not None:
|
||||
self.set_bg_image(theme.background_filename)
|
||||
|
||||
@ -110,8 +112,8 @@ class Renderer(object):
|
||||
painter.begin(self.bg_image)
|
||||
self.background_offsetx = (width - realwidth) / 2
|
||||
self.background_offsety = (height - realheight) / 2
|
||||
painter.drawImage(self.background_offsetx, self.background_offsety,
|
||||
preview)
|
||||
painter.drawImage(self.background_offsetx,
|
||||
self.background_offsety, preview)
|
||||
painter.end()
|
||||
|
||||
def set_frame_dest(self, frame_width, frame_height, preview=False):
|
||||
|
@ -431,7 +431,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
QtGui.QColor(self.theme.background_endColor), self).name()
|
||||
self.Color2PushButton.setStyleSheet(
|
||||
u'background-color: %s' % unicode(self.theme.background_endColor))
|
||||
|
||||
self.previewTheme(self.theme)
|
||||
#
|
||||
#Other Tab
|
||||
@ -486,12 +485,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
||||
self.BackgroundComboBox.setCurrentIndex(0)
|
||||
else:
|
||||
self.BackgroundComboBox.setCurrentIndex(1)
|
||||
self.ImageLineEdit.setText(u'')
|
||||
if theme.background_type == u'solid':
|
||||
self.BackgroundTypeComboBox.setCurrentIndex(0)
|
||||
elif theme.background_type == u'gradient':
|
||||
self.BackgroundTypeComboBox.setCurrentIndex(1)
|
||||
else:
|
||||
self.BackgroundTypeComboBox.setCurrentIndex(2)
|
||||
self.ImageLineEdit.setText(self.theme.background_filename)
|
||||
if self.theme.background_direction == u'horizontal':
|
||||
self.GradientComboBox.setCurrentIndex(0)
|
||||
elif self.theme.background_direction == u'vertical':
|
||||
|
@ -76,6 +76,16 @@ class GeneralTab(SettingsTab):
|
||||
self.ShowSplashCheckBox.setObjectName(u'ShowSplashCheckBox')
|
||||
self.StartupLayout.addWidget(self.ShowSplashCheckBox)
|
||||
self.GeneralLeftLayout.addWidget(self.StartupGroupBox)
|
||||
self.SettingsGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget)
|
||||
self.SettingsGroupBox.setObjectName(u'SettingsGroupBox')
|
||||
self.SettingsLayout = QtGui.QVBoxLayout(self.SettingsGroupBox)
|
||||
self.SettingsLayout.setSpacing(8)
|
||||
self.SettingsLayout.setMargin(8)
|
||||
self.SettingsLayout.setObjectName(u'SettingsLayout')
|
||||
self.SaveCheckServiceCheckBox = QtGui.QCheckBox(self.SettingsGroupBox)
|
||||
self.SaveCheckServiceCheckBox.setObjectName(u'SaveCheckServiceCheckBox')
|
||||
self.SettingsLayout.addWidget(self.SaveCheckServiceCheckBox)
|
||||
self.GeneralLeftLayout.addWidget(self.SettingsGroupBox)
|
||||
self.GeneralLeftSpacer = QtGui.QSpacerItem(20, 40,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.GeneralLeftLayout.addItem(self.GeneralLeftSpacer)
|
||||
@ -124,6 +134,8 @@ class GeneralTab(SettingsTab):
|
||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onAutoOpenCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.ShowSplashCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onShowSplashCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.SaveCheckServiceCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onSaveCheckServiceCheckBox)
|
||||
QtCore.QObject.connect(self.NumberEdit,
|
||||
QtCore.SIGNAL(u'editingFinished()'), self.onNumberEditLostFocus)
|
||||
QtCore.QObject.connect(self.UsernameEdit,
|
||||
@ -138,6 +150,8 @@ class GeneralTab(SettingsTab):
|
||||
self.WarningCheckBox.setText(self.trUtf8(u'Show blank screen warning'))
|
||||
self.AutoOpenCheckBox.setText(self.trUtf8(u'Automatically open the last service'))
|
||||
self.ShowSplashCheckBox.setText(self.trUtf8(u'Show the splash screen'))
|
||||
self.SettingsGroupBox.setTitle(self.trUtf8(u'Application Settings'))
|
||||
self.SaveCheckServiceCheckBox.setText(self.trUtf8(u'Prompt to save Sevice before starting New'))
|
||||
self.CCLIGroupBox.setTitle(self.trUtf8(u'CCLI Details'))
|
||||
self.NumberLabel.setText(self.trUtf8(u'CCLI Number:'))
|
||||
self.UsernameLabel.setText(self.trUtf8(u'SongSelect Username:'))
|
||||
@ -155,6 +169,9 @@ class GeneralTab(SettingsTab):
|
||||
def onWarningCheckBoxChanged(self, value):
|
||||
self.Warning = (value == QtCore.Qt.Checked)
|
||||
|
||||
def onSaveCheckServiceCheckBox(self, value):
|
||||
self.PromptSaveService = (value == QtCore.Qt.Checked)
|
||||
|
||||
def onNumberEditLostFocus(self):
|
||||
self.CCLNumber = self.NumberEdit.displayText()
|
||||
|
||||
@ -175,9 +192,11 @@ class GeneralTab(SettingsTab):
|
||||
self.Warning = str_to_bool(self.config.get_config(u'Blank Warning', u'False'))
|
||||
self.AutoOpen = str_to_bool(self.config.get_config(u'Auto Open', u'False'))
|
||||
self.ShowSplash = str_to_bool(self.config.get_config(u'show splash', u'True'))
|
||||
self.PromptSaveService = str_to_bool(self.config.get_config(u'prompt save service', u'False'))
|
||||
self.CCLNumber = unicode(self.config.get_config(u'CCL Number', u'XXX'))
|
||||
self.Username = unicode(self.config.get_config(u'User Name', u''))
|
||||
self.Password = unicode(self.config.get_config(u'Password', u''))
|
||||
self.SaveCheckServiceCheckBox.setChecked(self.PromptSaveService)
|
||||
# Set a few things up
|
||||
self.MonitorComboBox.setCurrentIndex(self.MonitorNumber)
|
||||
self.WarningCheckBox.setChecked(self.Warning)
|
||||
@ -192,6 +211,7 @@ class GeneralTab(SettingsTab):
|
||||
self.config.set_config(u'Blank Warning', self.Warning)
|
||||
self.config.set_config(u'Auto Open', self.AutoOpen)
|
||||
self.config.set_config(u'show splash', self.ShowSplash)
|
||||
self.config.set_config(u'prompt save service', self.PromptSaveService)
|
||||
self.config.set_config(u'CCL Number', self.CCLNumber)
|
||||
self.config.set_config(u'User Name', self.Username)
|
||||
self.config.set_config(u'Password', self.Password)
|
||||
|
@ -562,7 +562,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
screen_number = self.getMonitorNumber()
|
||||
self.mainDisplay.setup(screen_number)
|
||||
self.setFocus()
|
||||
self.versionCheck()
|
||||
if str_to_bool(self.generalConfig.get_config(u'Auto Open', False)):
|
||||
self.ServiceManagerContents.onLoadService(True)
|
||||
if str_to_bool(self.generalConfig.get_config(u'Screen Blank', False)) \
|
||||
|
@ -30,7 +30,8 @@ import zipfile
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
|
||||
ServiceType, contextMenuAction, contextMenuSeparator, Receiver, contextMenu
|
||||
ServiceType, contextMenuAction, contextMenuSeparator, Receiver, \
|
||||
contextMenu, str_to_bool
|
||||
|
||||
class ServiceManagerList(QtGui.QTreeWidget):
|
||||
|
||||
@ -128,8 +129,12 @@ class ServiceManager(QtGui.QWidget):
|
||||
self.parent = parent
|
||||
self.serviceItems = []
|
||||
self.serviceName = u''
|
||||
#is a new service and has not been saved
|
||||
self.isNew = True
|
||||
#Indicates if remoteTriggering is active. If it is the next addServiceItem call
|
||||
#will replace the currently selected one.
|
||||
self.remoteEditTriggered = False
|
||||
#start with the layout
|
||||
self.Layout = QtGui.QVBoxLayout(self)
|
||||
self.Layout.setSpacing(0)
|
||||
self.Layout.setMargin(0)
|
||||
@ -354,6 +359,19 @@ class ServiceManager(QtGui.QWidget):
|
||||
"""
|
||||
Clear the list to create a new service
|
||||
"""
|
||||
if self.parent.serviceNotSaved and \
|
||||
str_to_bool(PluginConfig(u'General').
|
||||
get_config(u'prompt save service', u'False')):
|
||||
ret = QtGui.QMessageBox.question(None,
|
||||
self.trUtf8(u'Save Changes to Service?'),
|
||||
self.trUtf8(u'Your service is unsaved, do you want to save those '
|
||||
u'changes before creating a new one ?'),
|
||||
QtGui.QMessageBox.StandardButtons(
|
||||
QtGui.QMessageBox.Cancel |
|
||||
QtGui.QMessageBox.Save),
|
||||
QtGui.QMessageBox.Save)
|
||||
if ret == QtGui.QMessageBox.Save:
|
||||
self.onSaveService()
|
||||
self.ServiceManagerList.clear()
|
||||
self.serviceItems = []
|
||||
self.serviceName = u''
|
||||
|
@ -95,9 +95,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
QtCore.SIGNAL(u'lostFocus()'), self.onCommentsEditLostFocus)
|
||||
QtCore.QObject.connect(self.VerseOrderEdit,
|
||||
QtCore.SIGNAL(u'lostFocus()'), self.onVerseOrderEditLostFocus)
|
||||
previewButton = QtGui.QPushButton()
|
||||
previewButton.setText(self.trUtf8(u'Save && Preview'))
|
||||
self.ButtonBox.addButton(previewButton, QtGui.QDialogButtonBox.ActionRole)
|
||||
self.previewButton = QtGui.QPushButton()
|
||||
self.previewButton.setText(self.trUtf8(u'Save && Preview'))
|
||||
self.ButtonBox.addButton(
|
||||
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
|
||||
QtCore.QObject.connect(self.ButtonBox,
|
||||
QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
|
||||
# Create other objects and forms
|
||||
@ -167,7 +168,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.loadTopics()
|
||||
self.loadBooks()
|
||||
|
||||
def loadSong(self, id):
|
||||
def loadSong(self, id, preview):
|
||||
log.debug(u'Load Song')
|
||||
self.SongTabWidget.setCurrentIndex(0)
|
||||
self.loadAuthors()
|
||||
@ -236,6 +237,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self._validate_song()
|
||||
self.title_change = False
|
||||
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason)
|
||||
#if not preview hide the preview button
|
||||
self.previewButton.setVisible(False)
|
||||
if preview:
|
||||
self.previewButton.setVisible(True)
|
||||
|
||||
def onAuthorAddButtonClicked(self):
|
||||
item = int(self.AuthorsSelectionComboItem.currentIndex())
|
||||
@ -434,31 +439,34 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
|
||||
def processLyrics(self):
|
||||
log.debug(u'processLyrics')
|
||||
sxml = SongXMLBuilder()
|
||||
sxml.new_document()
|
||||
sxml.add_lyrics_to_song()
|
||||
count = 1
|
||||
text = u' '
|
||||
verse_order = u''
|
||||
for i in range (0, self.VerseListWidget.count()):
|
||||
sxml.add_verse_to_lyrics(u'Verse', unicode(count),
|
||||
unicode(self.VerseListWidget.item(i).text()))
|
||||
text = text + unicode(self.VerseListWidget.item(i).text()) + u' '
|
||||
verse_order = verse_order + unicode(count) + u' '
|
||||
count += 1
|
||||
if self.song.verse_order is None:
|
||||
self.song.verse_order = verse_order
|
||||
text = text.replace(u'\'', u'')
|
||||
text = text.replace(u',', u'')
|
||||
text = text.replace(u';', u'')
|
||||
text = text.replace(u':', u'')
|
||||
text = text.replace(u'(', u'')
|
||||
text = text.replace(u')', u'')
|
||||
text = text.replace(u'{', u'')
|
||||
text = text.replace(u'}', u'')
|
||||
text = text.replace(u'?', u'')
|
||||
self.song.search_lyrics = unicode(text)
|
||||
self.song.lyrics = unicode(sxml.extract_xml())
|
||||
try:
|
||||
sxml = SongXMLBuilder()
|
||||
sxml.new_document()
|
||||
sxml.add_lyrics_to_song()
|
||||
count = 1
|
||||
text = u' '
|
||||
verse_order = u''
|
||||
for i in range (0, self.VerseListWidget.count()):
|
||||
sxml.add_verse_to_lyrics(u'Verse', unicode(count),
|
||||
unicode(self.VerseListWidget.item(i).text()))
|
||||
text = text + unicode(self.VerseListWidget.item(i).text()) + u' '
|
||||
verse_order = verse_order + unicode(count) + u' '
|
||||
count += 1
|
||||
if self.song.verse_order is None:
|
||||
self.song.verse_order = verse_order
|
||||
text = text.replace(u'\'', u'')
|
||||
text = text.replace(u',', u'')
|
||||
text = text.replace(u';', u'')
|
||||
text = text.replace(u':', u'')
|
||||
text = text.replace(u'(', u'')
|
||||
text = text.replace(u')', u'')
|
||||
text = text.replace(u'{', u'')
|
||||
text = text.replace(u'}', u'')
|
||||
text = text.replace(u'?', u'')
|
||||
self.song.search_lyrics = unicode(text)
|
||||
self.song.lyrics = unicode(sxml.extract_xml())
|
||||
except:
|
||||
log.exception(u'Problem processing song Lyrics \n%s', sxml.dump_xml())
|
||||
|
||||
def processTitle(self):
|
||||
log.debug(u'processTitle')
|
||||
|
@ -53,7 +53,11 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
|
||||
self.song_maintenance_form = SongMaintenanceForm(
|
||||
self.parent.songmanager, self)
|
||||
#fromPreview holds the id of the item if the song editor needs to trigger a preview
|
||||
#without closing. It is set to -1 if this function is inactive
|
||||
self.fromPreview = -1
|
||||
#fromServiceManager holds the id of the item if the song editor needs to trigger posting
|
||||
#to the servicemanager without closing. It is set to -1 if this function is inactive
|
||||
self.fromServiceManager = -1
|
||||
|
||||
def initPluginNameVisible(self):
|
||||
@ -242,7 +246,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
valid = self.parent.songmanager.get_song(songid)
|
||||
if valid is not None:
|
||||
self.fromServiceManager = songid
|
||||
self.edit_song_form.loadSong(songid)
|
||||
self.edit_song_form.loadSong(songid, False)
|
||||
self.edit_song_form.exec_()
|
||||
|
||||
def onEditClick(self, preview=False):
|
||||
@ -252,7 +256,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.fromPreview = -1
|
||||
if preview:
|
||||
self.fromPreview = item_id
|
||||
self.edit_song_form.loadSong(item_id)
|
||||
self.edit_song_form.loadSong(item_id, preview)
|
||||
self.edit_song_form.exec_()
|
||||
|
||||
def onEventEditSong (self):
|
||||
@ -286,6 +290,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
service_item.theme = song.theme_name
|
||||
service_item.editEnabled = True
|
||||
service_item.editId = item_id
|
||||
service_item.verse_order = song.verse_order
|
||||
if song.lyrics.startswith(u'<?xml version='):
|
||||
songXML=SongXMLParser(song.lyrics)
|
||||
verseList = songXML.get_verses()
|
||||
|
Loading…
Reference in New Issue
Block a user