HEAD r1933

This commit is contained in:
Armin Köhler 2012-04-03 20:43:48 +02:00
commit d7496056d8
14 changed files with 115 additions and 110 deletions

View File

@ -195,33 +195,20 @@ class AdvancedTab(SettingsTab):
# Service Item Slide Limits # Service Item Slide Limits
self.slideGroupBox = QtGui.QGroupBox(self.rightColumn) self.slideGroupBox = QtGui.QGroupBox(self.rightColumn)
self.slideGroupBox.setObjectName(u'slideGroupBox') self.slideGroupBox.setObjectName(u'slideGroupBox')
self.slideLayout = QtGui.QFormLayout(self.slideGroupBox) self.slideLayout = QtGui.QVBoxLayout(self.slideGroupBox)
self.slideLayout.setLabelAlignment(
QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.slideLayout.setFormAlignment(
QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.slideLayout.setObjectName(u'slideLayout') self.slideLayout.setObjectName(u'slideLayout')
self.slideLabel = QtGui.QLabel(self.slideGroupBox)
self.slideLabel.setWordWrap(True)
self.slideLayout.addWidget(self.slideLabel)
self.endSlideRadioButton = QtGui.QRadioButton(self.slideGroupBox) self.endSlideRadioButton = QtGui.QRadioButton(self.slideGroupBox)
self.endSlideRadioButton.setObjectName(u'endSlideRadioButton') self.endSlideRadioButton.setObjectName(u'endSlideRadioButton')
self.endSlideLabel = QtGui.QLabel(self.slideGroupBox) self.slideLayout.addWidget(self.endSlideRadioButton)
self.endSlideLabel.setWordWrap(True)
self.endSlideLabel.setObjectName(u'endSlideLabel')
self.slideLayout.addRow(self.endSlideRadioButton, self.endSlideLabel)
self.wrapSlideRadioButton = QtGui.QRadioButton(self.slideGroupBox) self.wrapSlideRadioButton = QtGui.QRadioButton(self.slideGroupBox)
self.wrapSlideRadioButton.setObjectName(u'wrapSlideRadioButton') self.wrapSlideRadioButton.setObjectName(u'wrapSlideRadioButton')
self.wrapSlideLabel = QtGui.QLabel(self.slideGroupBox) self.slideLayout.addWidget(self.wrapSlideRadioButton)
self.wrapSlideLabel.setWordWrap(True)
self.wrapSlideLabel.setObjectName(u'wrapSlideLabel')
self.slideLayout.addRow(self.wrapSlideRadioButton,
self.wrapSlideLabel)
self.nextItemRadioButton = QtGui.QRadioButton(self.slideGroupBox) self.nextItemRadioButton = QtGui.QRadioButton(self.slideGroupBox)
self.nextItemRadioButton.setChecked(True)
self.nextItemRadioButton.setObjectName(u'nextItemRadioButton') self.nextItemRadioButton.setObjectName(u'nextItemRadioButton')
self.nextItemLabel = QtGui.QLabel(self.slideGroupBox) self.slideLayout.addWidget(self.nextItemRadioButton)
self.nextItemLabel.setWordWrap(True)
self.nextItemLabel.setObjectName(u'nextItemLabel')
self.slideLayout.addRow(self.nextItemRadioButton,
self.nextItemLabel)
self.rightLayout.addWidget(self.slideGroupBox) self.rightLayout.addWidget(self.slideGroupBox)
self.x11GroupBox = QtGui.QGroupBox(self.leftColumn) self.x11GroupBox = QtGui.QGroupBox(self.leftColumn)
self.x11GroupBox.setObjectName(u'x11GroupBox') self.x11GroupBox.setObjectName(u'x11GroupBox')
@ -340,22 +327,14 @@ class AdvancedTab(SettingsTab):
# Slide Limits # Slide Limits
self.slideGroupBox.setTitle( self.slideGroupBox.setTitle(
translate('OpenLP.GeneralTab', 'Service Item Slide Limits')) translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
self.slideLabel.setText(translate('OpenLP.GeneralTab',
'Behavior of next/previous on the last/first slide:'))
self.endSlideRadioButton.setText( self.endSlideRadioButton.setText(
translate('OpenLP.GeneralTab', '&End Slide')) translate('OpenLP.GeneralTab', '&Remain on Slide'))
self.endSlideLabel.setText(
translate('OpenLP.GeneralTab', 'Up and down arrow keys '
'stop at the top and bottom slides of each Service Item.'))
self.wrapSlideRadioButton.setText( self.wrapSlideRadioButton.setText(
translate('OpenLP.GeneralTab', '&Wrap Slide')) translate('OpenLP.GeneralTab', '&Wrap around'))
self.wrapSlideLabel.setText( self.nextItemRadioButton.setText(translate('OpenLP.GeneralTab',
translate('OpenLP.GeneralTab', 'Up and down arrow keys ' '&Move to next/previous service item'))
'wrap around at the top and bottom slides of each Service Item.'))
self.nextItemRadioButton.setText(
translate('OpenLP.GeneralTab', '&Next Item'))
self.nextItemLabel.setText(
translate('OpenLP.GeneralTab', 'Up and down arrow keys '
'advance to the next or previous Service Item from the '
'top and bottom slides of each Service Item.'))
def load(self): def load(self):
""" """

View File

@ -77,7 +77,7 @@ class ServiceManagerList(QtGui.QTreeWidget):
if event.buttons() != QtCore.Qt.LeftButton: if event.buttons() != QtCore.Qt.LeftButton:
event.ignore() event.ignore()
return return
if not self.selectedItems(): if not self.itemAt(self.mapFromGlobal(QtGui.QCursor.pos())):
event.ignore() event.ignore()
return return
drag = QtGui.QDrag(self) drag = QtGui.QDrag(self)
@ -1106,7 +1106,7 @@ class ServiceManager(QtGui.QWidget):
self.mainwindow.servicemanagerSettingsSection + self.mainwindow.servicemanagerSettingsSection +
u'/service theme', u'/service theme',
QtCore.QVariant(self.service_theme)) QtCore.QVariant(self.service_theme))
self.regenerateServiceItems() self.regenerateServiceItems(True)
def themeChange(self): def themeChange(self):
""" """
@ -1118,7 +1118,7 @@ class ServiceManager(QtGui.QWidget):
self.themeLabel.setVisible(visible) self.themeLabel.setVisible(visible)
self.themeComboBox.setVisible(visible) self.themeComboBox.setVisible(visible)
def regenerateServiceItems(self): def regenerateServiceItems(self, changed=False):
""" """
Rebuild the service list as things have changed and a Rebuild the service list as things have changed and a
repaint is the easiest way to do this. repaint is the easiest way to do this.
@ -1154,6 +1154,7 @@ class ServiceManager(QtGui.QWidget):
repaint=False, selected=item[u'selected']) repaint=False, selected=item[u'selected'])
# Set to False as items may have changed rendering # Set to False as items may have changed rendering
# does not impact the saved song so True may also be valid # does not impact the saved song so True may also be valid
if changed:
self.setModified() self.setModified()
# Repaint it once only at the end # Repaint it once only at the end
self.repaintServiceList(-1, -1) self.repaintServiceList(-1, -1)
@ -1439,7 +1440,7 @@ class ServiceManager(QtGui.QWidget):
theme = None theme = None
item = self.findServiceItem()[0] item = self.findServiceItem()[0]
self.serviceItems[item][u'service_item'].update_theme(theme) self.serviceItems[item][u'service_item'].update_theme(theme)
self.regenerateServiceItems() self.regenerateServiceItems(True)
def _getParentItemData(self, item): def _getParentItemData(self, item):
parentitem = item.parent() parentitem = item.parent()

View File

@ -291,7 +291,7 @@ class SlideController(Controller):
self.toolbar.widgetForAction(self.audioPauseItem).setPopupMode( self.toolbar.widgetForAction(self.audioPauseItem).setPopupMode(
QtGui.QToolButton.MenuButtonPopup) QtGui.QToolButton.MenuButtonPopup)
self.nextTrackItem = create_action(self, u'nextTrackItem', self.nextTrackItem = create_action(self, u'nextTrackItem',
text=translate('OpenLP.SlideController', 'Next Track'), text=UiStrings().NextTrack,
icon=u':/slides/media_playback_next.png', tooltip=translate( icon=u':/slides/media_playback_next.png', tooltip=translate(
'OpenLP.SlideController', 'Go to next audio track.'), 'OpenLP.SlideController', 'Go to next audio track.'),
category=self.category, context=QtCore.Qt.WindowShortcut, category=self.category, context=QtCore.Qt.WindowShortcut,

View File

@ -220,6 +220,8 @@ class ThemeManager(QtGui.QWidget):
name = unicode(translate('OpenLP.ThemeManager', name = unicode(translate('OpenLP.ThemeManager',
'%s (default)')) % new_name '%s (default)')) % new_name
self.themeListWidget.item(count).setText(name) self.themeListWidget.item(count).setText(name)
self.deleteToolbarAction.setVisible(
item not in self.themeListWidget.selectedItems())
def changeGlobalFromScreen(self, index=-1): def changeGlobalFromScreen(self, index=-1):
""" """

View File

@ -71,24 +71,28 @@ class ThemesTab(SettingsTab):
self.SongLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.SongLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox)
self.SongLevelRadioButton.setObjectName(u'SongLevelRadioButton') self.SongLevelRadioButton.setObjectName(u'SongLevelRadioButton')
self.SongLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.SongLevelLabel = QtGui.QLabel(self.LevelGroupBox)
self.SongLevelLabel.setWordWrap(True)
self.SongLevelLabel.setObjectName(u'SongLevelLabel') self.SongLevelLabel.setObjectName(u'SongLevelLabel')
self.LevelLayout.addRow(self.SongLevelRadioButton, self.SongLevelLabel) self.LevelLayout.addRow(self.SongLevelRadioButton, self.SongLevelLabel)
self.ServiceLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.ServiceLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox)
self.ServiceLevelRadioButton.setObjectName(u'ServiceLevelRadioButton') self.ServiceLevelRadioButton.setObjectName(u'ServiceLevelRadioButton')
self.ServiceLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.ServiceLevelLabel = QtGui.QLabel(self.LevelGroupBox)
self.ServiceLevelLabel.setWordWrap(True)
self.ServiceLevelLabel.setObjectName(u'ServiceLevelLabel') self.ServiceLevelLabel.setObjectName(u'ServiceLevelLabel')
self.LevelLayout.addRow(self.ServiceLevelRadioButton, self.LevelLayout.addRow(self.ServiceLevelRadioButton,
self.ServiceLevelLabel) self.ServiceLevelLabel)
self.GlobalLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.GlobalLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox)
self.GlobalLevelRadioButton.setChecked(True)
self.GlobalLevelRadioButton.setObjectName(u'GlobalLevelRadioButton') self.GlobalLevelRadioButton.setObjectName(u'GlobalLevelRadioButton')
self.GlobalLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.GlobalLevelLabel = QtGui.QLabel(self.LevelGroupBox)
self.GlobalLevelLabel.setWordWrap(True)
self.GlobalLevelLabel.setObjectName(u'GlobalLevelLabel') self.GlobalLevelLabel.setObjectName(u'GlobalLevelLabel')
self.LevelLayout.addRow(self.GlobalLevelRadioButton, self.LevelLayout.addRow(self.GlobalLevelRadioButton,
self.GlobalLevelLabel) self.GlobalLevelLabel)
label_top_margin = (self.SongLevelRadioButton.sizeHint().height() -
self.SongLevelLabel.sizeHint().height()) / 2
for label in [self.SongLevelLabel, self.ServiceLevelLabel,
self.GlobalLevelLabel]:
rect = label.rect()
rect.setTop(rect.top() + label_top_margin)
label.setFrameRect(rect)
label.setWordWrap(True)
self.rightLayout.addWidget(self.LevelGroupBox) self.rightLayout.addWidget(self.LevelGroupBox)
self.rightLayout.addStretch() self.rightLayout.addStretch()
QtCore.QObject.connect(self.SongLevelRadioButton, QtCore.QObject.connect(self.SongLevelRadioButton,
@ -131,9 +135,8 @@ class ThemesTab(SettingsTab):
settings = QtCore.QSettings() settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
self.theme_level = settings.value( self.theme_level = settings.value(
u'theme level', QtCore.QVariant(ThemeLevel.Global)).toInt()[0] u'theme level', ThemeLevel.Song).toInt()[0]
self.global_theme = unicode(settings.value( self.global_theme = unicode(settings.value(u'global theme').toString())
u'global theme', QtCore.QVariant(u'')).toString())
settings.endGroup() settings.endGroup()
if self.theme_level == ThemeLevel.Global: if self.theme_level == ThemeLevel.Global:
self.GlobalLevelRadioButton.setChecked(True) self.GlobalLevelRadioButton.setChecked(True)

View File

@ -276,11 +276,10 @@ class BiblesTab(SettingsTab):
'end marks may be defined.\nThey have to be separated by a ' 'end marks may be defined.\nThey have to be separated by a '
'vertical bar "|".\nPlease clear this edit line to use the ' 'vertical bar "|".\nPlease clear this edit line to use the '
'default value.')) 'default value.'))
self.languageSelectionGroupBox.setTitle( self.languageSelectionGroupBox.setTitle(translate('BiblesPlugin.BiblesTab',
translate('BiblesPlugin.BiblesTab', 'Preferred Bookname Language')) 'Default Search Field Language'))
self.languageSelectionLabel.setText(translate('BiblesPlugin.BiblesTab', self.languageSelectionLabel.setText(translate('BiblesPlugin.BiblesTab',
'Choose the language in which the book names of the\nBible should ' 'Book name language in search field:'))
'be displayed in the Bible search:'))
self.languageSelectionComboBox.setItemText(LanguageSelection.Bible, self.languageSelectionComboBox.setItemText(LanguageSelection.Bible,
translate('BiblesPlugin.BiblesTab', 'Bible language')) translate('BiblesPlugin.BiblesTab', 'Bible language'))
self.languageSelectionComboBox.setItemText( self.languageSelectionComboBox.setItemText(
@ -288,11 +287,6 @@ class BiblesTab(SettingsTab):
translate('BiblesPlugin.BiblesTab', 'Application language')) translate('BiblesPlugin.BiblesTab', 'Application language'))
self.languageSelectionComboBox.setItemText(LanguageSelection.English, self.languageSelectionComboBox.setItemText(LanguageSelection.English,
translate('BiblesPlugin.BiblesTab', 'English')) translate('BiblesPlugin.BiblesTab', 'English'))
self.languageSelectionComboBox.setToolTip(
translate('BiblesPlugin.BiblesTab', 'Multiple options:\n '
'Bible language - the language in which the Bible book names '
'were imported\n Application language - the language you have '
'chosen for OpenLP\n English - always use English book names'))
def onBibleThemeComboBoxChanged(self): def onBibleThemeComboBoxChanged(self):
self.bible_theme = self.bibleThemeComboBox.currentText() self.bible_theme = self.bibleThemeComboBox.currentText()

View File

@ -72,16 +72,25 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
""" """
Adds a slide split at the cursor. Adds a slide split at the cursor.
""" """
if self.slideTextEdit.textCursor().columnNumber() != 0: self.insertSingleLineTextAtCursor(u'[===]')
self.slideTextEdit.insertPlainText(u'\n')
self.slideTextEdit.insertPlainText(u'[===]\n')
self.slideTextEdit.setFocus() self.slideTextEdit.setFocus()
def onSplitButtonPressed(self): def onSplitButtonPressed(self):
""" """
Adds a virtual split at cursor. Adds a virtual split at cursor.
""" """
if self.slideTextEdit.textCursor().columnNumber() != 0: self.insertSingleLineTextAtCursor(u'[---]')
self.slideTextEdit.insertPlainText(u'\n')
self.slideTextEdit.insertPlainText(u'[---]')
self.slideTextEdit.setFocus() self.slideTextEdit.setFocus()
def insertSingleLineTextAtCursor(self, text):
"""
Adds ``text`` in a single line at the cursor position.
"""
full_text = self.slideTextEdit.toPlainText()
position = self.slideTextEdit.textCursor().position()
if position and full_text[position-1] != u'\n':
text = u'\n' + text
if position == len(full_text) or full_text[position] != u'\n':
text += u'\n'
self.slideTextEdit.insertPlainText(text)

View File

@ -53,6 +53,7 @@ class ImageTab(SettingsTab):
self.formLayout.addRow(self.colorLayout) self.formLayout.addRow(self.colorLayout)
self.informationLabel = QtGui.QLabel(self.bgColorGroupBox) self.informationLabel = QtGui.QLabel(self.bgColorGroupBox)
self.informationLabel.setObjectName(u'InformationLabel') self.informationLabel.setObjectName(u'InformationLabel')
self.informationLabel.setWordWrap(True)
self.formLayout.addRow(self.informationLabel) self.formLayout.addRow(self.informationLabel)
self.leftLayout.addWidget(self.bgColorGroupBox) self.leftLayout.addWidget(self.bgColorGroupBox)
self.leftLayout.addStretch() self.leftLayout.addStretch()
@ -69,8 +70,8 @@ class ImageTab(SettingsTab):
self.backgroundColorLabel.setText( self.backgroundColorLabel.setText(
translate('ImagesPlugin.ImageTab', 'Default Color:')) translate('ImagesPlugin.ImageTab', 'Default Color:'))
self.informationLabel.setText( self.informationLabel.setText(
translate('ImagesPlugin.ImageTab', 'Provides border where image ' translate('ImagesPlugin.ImageTab', 'Visible background for images '
'is not the correct dimensions for the screen when resized.')) 'with aspect ratio different to screen.'))
def onbackgroundColorButtonClicked(self): def onbackgroundColorButtonClicked(self):
new_color = QtGui.QColorDialog.getColor( new_color = QtGui.QColorDialog.getColor(

View File

@ -69,12 +69,8 @@ class Ui_EditSongDialog(object):
self.lyricsLabel.setObjectName(u'lyricsLabel') self.lyricsLabel.setObjectName(u'lyricsLabel')
self.lyricsTabLayout.addWidget(self.lyricsLabel, 2, 0, self.lyricsTabLayout.addWidget(self.lyricsLabel, 2, 0,
QtCore.Qt.AlignTop) QtCore.Qt.AlignTop)
self.verseListWidget = QtGui.QTableWidget(self.lyricsTab) self.verseListWidget = SingleColumnTableWidget(self.lyricsTab)
self.verseListWidget.horizontalHeader().setVisible(False)
self.verseListWidget.horizontalHeader().setStretchLastSection(True)
self.verseListWidget.horizontalHeader().setMinimumSectionSize(16)
self.verseListWidget.setAlternatingRowColors(True) self.verseListWidget.setAlternatingRowColors(True)
self.verseListWidget.setColumnCount(1)
self.verseListWidget.setSelectionBehavior( self.verseListWidget.setSelectionBehavior(
QtGui.QAbstractItemView.SelectRows) QtGui.QAbstractItemView.SelectRows)
self.verseListWidget.setSelectionMode( self.verseListWidget.setSelectionMode(
@ -373,3 +369,24 @@ def editSongDialogComboBox(parent, name):
comboBox.setInsertPolicy(QtGui.QComboBox.NoInsert) comboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
comboBox.setObjectName(name) comboBox.setObjectName(name)
return comboBox return comboBox
class SingleColumnTableWidget(QtGui.QTableWidget):
"""
Class to for a single column table widget to use for the verse table widget.
"""
def __init__(self, parent):
"""
Constrctor
"""
QtGui.QTableWidget.__init__(self, parent)
self.horizontalHeader().setVisible(False)
self.setColumnCount(1)
def resizeEvent(self, event):
"""
Resize the first column together with the widget.
"""
QtGui.QTableWidget.resizeEvent(self, event)
if self.columnCount():
self.setColumnWidth(0, event.size().width())
self.resizeRowsToContents()

View File

@ -193,19 +193,19 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.song = None self.song = None
self.initialise() self.initialise()
self.songTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.titleEdit.setText(u'') self.titleEdit.clear()
self.alternativeEdit.setText(u'') self.alternativeEdit.clear()
self.copyrightEdit.setText(u'') self.copyrightEdit.clear()
self.verseOrderEdit.setText(u'') self.verseOrderEdit.clear()
self.commentsEdit.setText(u'') self.commentsEdit.clear()
self.CCLNumberEdit.setText(u'') self.CCLNumberEdit.clear()
self.verseListWidget.clear() self.verseListWidget.clear()
self.verseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
self.authorsListView.clear() self.authorsListView.clear()
self.topicsListView.clear() self.topicsListView.clear()
self.audioListWidget.clear() self.audioListWidget.clear()
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason) self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
self.songBookNumberEdit.setText(u'') self.songBookNumberEdit.clear()
self.loadAuthors() self.loadAuthors()
self.loadTopics() self.loadTopics()
self.loadBooks() self.loadBooks()
@ -233,10 +233,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.loadMediaFiles() self.loadMediaFiles()
self.song = self.manager.get_object(Song, id) self.song = self.manager.get_object(Song, id)
self.titleEdit.setText(self.song.title) self.titleEdit.setText(self.song.title)
if self.song.alternate_title: self.alternativeEdit.setText(
self.alternativeEdit.setText(self.song.alternate_title) self.song.alternate_title if self.song.alternate_title else u'')
else:
self.alternativeEdit.setText(u'')
if self.song.song_book_id != 0: if self.song.song_book_id != 0:
book_name = self.manager.get_object(Book, self.song.song_book_id) book_name = self.manager.get_object(Book, self.song.song_book_id)
find_and_set_in_combo_box( find_and_set_in_combo_box(
@ -244,24 +242,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.song.theme_name: if self.song.theme_name:
find_and_set_in_combo_box( find_and_set_in_combo_box(
self.themeComboBox, unicode(self.song.theme_name)) self.themeComboBox, unicode(self.song.theme_name))
if self.song.copyright: self.copyrightEdit.setText(
self.copyrightEdit.setText(self.song.copyright) self.song.copyright if self.song.copyright else u'')
else: self.commentsEdit.setPlainText(
self.copyrightEdit.setText(u'') self.song.comments if self.song.comments else u'')
self.verseListWidget.clear() self.CCLNumberEdit.setText(
self.verseListWidget.setRowCount(0) self.song.ccli_number if self.song.ccli_number else u'')
if self.song.comments: self.songBookNumberEdit.setText(
self.commentsEdit.setPlainText(self.song.comments) self.song.song_number if self.song.song_number else u'')
else:
self.commentsEdit.setPlainText(u'')
if self.song.ccli_number:
self.CCLNumberEdit.setText(self.song.ccli_number)
else:
self.CCLNumberEdit.setText(u'')
if self.song.song_number:
self.songBookNumberEdit.setText(self.song.song_number)
else:
self.songBookNumberEdit.setText(u'')
# lazy xml migration for now # lazy xml migration for now
self.verseListWidget.clear() self.verseListWidget.clear()
self.verseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
@ -355,7 +343,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
row_def = u'%s%s' % (verse_tag, verse_def[1:]) row_def = u'%s%s' % (verse_tag, verse_def[1:])
row_label.append(row_def) row_label.append(row_def)
self.verseListWidget.setVerticalHeaderLabels(row_label) self.verseListWidget.setVerticalHeaderLabels(row_label)
self.verseListWidget.setColumnWidth(0, self.width)
self.verseListWidget.resizeRowsToContents() self.verseListWidget.resizeRowsToContents()
self.verseListWidget.repaint() self.verseListWidget.repaint()

View File

@ -75,10 +75,14 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
self.verseTextEdit.setFocus() self.verseTextEdit.setFocus()
def onSplitButtonClicked(self): def onSplitButtonClicked(self):
verse_type_index = self.verseTypeComboBox.currentIndex() text = self.verseTextEdit.toPlainText()
if self.verseTextEdit.textCursor().columnNumber() != 0: position = self.verseTextEdit.textCursor().position()
self.verseTextEdit.insertPlainText(u'\n') insert_string = u'[---]'
self.verseTextEdit.insertPlainText(u'[---]') if position and text[position-1] != u'\n':
insert_string = u'\n' + insert_string
if position == len(text) or text[position] != u'\n':
insert_string += u'\n'
self.verseTextEdit.insertPlainText(insert_string)
self.verseTextEdit.setFocus() self.verseTextEdit.setFocus()
def onInsertButtonClicked(self): def onInsertButtonClicked(self):
@ -113,8 +117,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
verse_num = int(match.group(2)) verse_num = int(match.group(2))
except ValueError: except ValueError:
verse_num = 1 verse_num = 1
verse_type_index = VerseType.from_loose_input(verse_tag, None) if VerseType.from_loose_input(verse_tag, False):
if verse_type_index is not None:
self.verseNumberBox.setValue(verse_num) self.verseNumberBox.setValue(verse_num)
def onCursorPositionChanged(self): def onCursorPositionChanged(self):

View File

@ -326,7 +326,7 @@ def clean_song(manager, song):
# Rebuild the verse order, to convert translated verse tags, which might # Rebuild the verse order, to convert translated verse tags, which might
# have been added prior to 1.9.5. # have been added prior to 1.9.5.
if song.verse_order: if song.verse_order:
order = song.verse_order.strip().split() order = CONTROL_CHARS.sub(u'', song.verse_order).strip().split()
else: else:
order = [] order = []
new_order = [] new_order = []
@ -358,6 +358,8 @@ def clean_song(manager, song):
author = Author.populate( author = Author.populate(
display_name=name, last_name=u'', first_name=u'') display_name=name, last_name=u'', first_name=u'')
song.authors.append(author) song.authors.append(author)
if song.copyright:
song.copyright = CONTROL_CHARS.sub(u'', song.copyright).strip()
from xml import OpenLyrics, SongXML from xml import OpenLyrics, SongXML
from songstab import SongsTab from songstab import SongsTab

View File

@ -227,9 +227,17 @@ class OpenSongImport(SongImport):
verses[verse_tag][verse_num][inst].append(this_line) verses[verse_tag][verse_num][inst].append(this_line)
# done parsing # done parsing
# add verses in original order # add verses in original order
verse_joints = {}
for (verse_tag, verse_num, inst) in our_verse_order: for (verse_tag, verse_num, inst) in our_verse_order:
verse_def = u'%s%s' % (verse_tag, verse_num)
lines = u'\n'.join(verses[verse_tag][verse_num][inst]) lines = u'\n'.join(verses[verse_tag][verse_num][inst])
length = 0
while(length < len(verse_num) and verse_num[length].isnumeric()):
length += 1
verse_def = u'%s%s' % (verse_tag, verse_num[:length])
verse_joints[verse_def] = \
u'%s\n[---]\n%s' % (verse_joints[verse_def], lines) \
if verse_def in verse_joints else lines
for verse_def, lines in verse_joints.iteritems():
self.addVerse(lines, verse_def) self.addVerse(lines, verse_def)
if not self.verses: if not self.verses:
self.addVerse('') self.addVerse('')

View File

@ -82,9 +82,8 @@ class SongsTab(SettingsTab):
'Display verses on live tool bar')) 'Display verses on live tool bar'))
self.updateOnEditCheckBox.setText( self.updateOnEditCheckBox.setText(
translate('SongsPlugin.SongsTab', 'Update service from song edit')) translate('SongsPlugin.SongsTab', 'Update service from song edit'))
self.addFromServiceCheckBox.setText( self.addFromServiceCheckBox.setText(translate('SongsPlugin.SongsTab',
translate('SongsPlugin.SongsTab', 'Import missing songs from service files'))
'Add missing songs when opening service'))
def onSearchAsTypeCheckBoxChanged(self, check_state): def onSearchAsTypeCheckBoxChanged(self, check_state):
self.song_search = False self.song_search = False