This commit is contained in:
andreas 2010-07-19 20:19:25 +02:00
commit 162e673d1a
12 changed files with 67 additions and 242 deletions

View File

@ -654,70 +654,6 @@ class Ui_AmendThemeDialog(object):
QtCore.QObject.connect(self.ThemeButtonBox, QtCore.QObject.connect(self.ThemeButtonBox,
QtCore.SIGNAL(u'rejected()'), AmendThemeDialog.reject) QtCore.SIGNAL(u'rejected()'), AmendThemeDialog.reject)
QtCore.QMetaObject.connectSlotsByName(AmendThemeDialog) QtCore.QMetaObject.connectSlotsByName(AmendThemeDialog)
AmendThemeDialog.setTabOrder(self.ThemeButtonBox, self.ThemeNameEdit)
AmendThemeDialog.setTabOrder(self.ThemeNameEdit, self.ThemeTabWidget)
AmendThemeDialog.setTabOrder(self.ThemeTabWidget,
self.BackgroundComboBox)
AmendThemeDialog.setTabOrder(self.BackgroundComboBox,
self.BackgroundTypeComboBox)
AmendThemeDialog.setTabOrder(self.BackgroundTypeComboBox,
self.Color1PushButton)
AmendThemeDialog.setTabOrder(self.Color1PushButton,
self.Color2PushButton)
AmendThemeDialog.setTabOrder(self.Color2PushButton, self.ImageLineEdit)
AmendThemeDialog.setTabOrder(self.ImageLineEdit, self.ImageToolButton)
AmendThemeDialog.setTabOrder(self.ImageToolButton,
self.GradientComboBox)
AmendThemeDialog.setTabOrder(self.GradientComboBox,
self.FontMainComboBox)
AmendThemeDialog.setTabOrder(self.FontMainComboBox,
self.FontMainColorPushButton)
AmendThemeDialog.setTabOrder(self.FontMainColorPushButton,
self.FontMainSizeSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainSizeSpinBox,
self.FontMainWeightComboBox)
AmendThemeDialog.setTabOrder(self.FontMainWeightComboBox,
self.FontMainLineSpacingSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainLineSpacingSpinBox,
self.FontMainDefaultCheckBox)
AmendThemeDialog.setTabOrder(self.FontMainDefaultCheckBox,
self.FontMainXSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainXSpinBox,
self.FontMainYSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainYSpinBox,
self.FontMainWidthSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainWidthSpinBox,
self.FontMainHeightSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainHeightSpinBox,
self.FontFooterComboBox)
AmendThemeDialog.setTabOrder(self.FontFooterComboBox,
self.FontFooterColorPushButton)
AmendThemeDialog.setTabOrder(self.FontFooterColorPushButton,
self.FontFooterSizeSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox,
self.FontFooterWeightComboBox)
AmendThemeDialog.setTabOrder(self.FontFooterWeightComboBox,
self.FontFooterDefaultCheckBox)
AmendThemeDialog.setTabOrder(self.FontFooterDefaultCheckBox,
self.FontFooterXSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterXSpinBox,
self.FontFooterYSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterYSpinBox,
self.FontFooterWidthSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterWidthSpinBox,
self.FontFooterHeightSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterHeightSpinBox,
self.OutlineCheckBox)
AmendThemeDialog.setTabOrder(self.OutlineCheckBox,
self.OutlineColorPushButton)
AmendThemeDialog.setTabOrder(self.OutlineColorPushButton,
self.ShadowCheckBox)
AmendThemeDialog.setTabOrder(self.ShadowCheckBox,
self.ShadowColorPushButton)
AmendThemeDialog.setTabOrder(self.ShadowColorPushButton,
self.HorizontalComboBox)
AmendThemeDialog.setTabOrder(self.HorizontalComboBox,
self.VerticalComboBox)
def retranslateUi(self, AmendThemeDialog): def retranslateUi(self, AmendThemeDialog):
AmendThemeDialog.setWindowTitle( AmendThemeDialog.setWindowTitle(

View File

@ -264,6 +264,10 @@ class MainDisplay(DisplayWidget):
(self.screen[u'size'].width() - splash_image.width()) / 2, (self.screen[u'size'].width() - splash_image.width()) / 2,
(self.screen[u'size'].height() - splash_image.height()) / 2, (self.screen[u'size'].height() - splash_image.height()) / 2,
splash_image) splash_image)
#build a blank transparent image
self.transparent = QtGui.QPixmap(
self.screen[u'size'].width(), self.screen[u'size'].height())
self.transparent.fill(QtCore.Qt.transparent)
self.displayImage(self.initialFrame) self.displayImage(self.initialFrame)
self.repaint() self.repaint()
#Build a Black screen #Build a Black screen
@ -274,12 +278,6 @@ class MainDisplay(DisplayWidget):
QtGui.QImage.Format_ARGB32_Premultiplied) QtGui.QImage.Format_ARGB32_Premultiplied)
painter.begin(self.blankFrame) painter.begin(self.blankFrame)
painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black) painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black)
#build a blank transparent image
self.transparent = QtGui.QPixmap(
self.screen[u'size'].width(), self.screen[u'size'].height())
self.transparent.fill(QtCore.Qt.transparent)
# self.displayText.setPixmap(self.transparent)
#self.frameView(self.transparent)
# To display or not to display? # To display or not to display?
if not self.screen[u'primary']: if not self.screen[u'primary']:
self.setVisible(True) self.setVisible(True)
@ -410,6 +408,7 @@ class MainDisplay(DisplayWidget):
self.imageDisplay.setPixmap(QtGui.QPixmap.fromImage(frame)) self.imageDisplay.setPixmap(QtGui.QPixmap.fromImage(frame))
else: else:
self.imageDisplay.setPixmap(frame) self.imageDisplay.setPixmap(frame)
self.frameView(self.transparent)
self.videoDisplay.setHtml(u'<html></html>') self.videoDisplay.setHtml(u'<html></html>')
def displayVideo(self, path): def displayVideo(self, path):

View File

@ -118,6 +118,7 @@ class ThemeManager(QtGui.QWidget):
self.checkThemesExists(self.thumbPath) self.checkThemesExists(self.thumbPath)
self.amendThemeForm.path = self.path self.amendThemeForm.path = self.path
self.oldBackgroundImage = None self.oldBackgroundImage = None
self.editingDefault = False
# Last little bits of setting up # Last little bits of setting up
self.global_theme = unicode(QtCore.QSettings().value( self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme', self.settingsSection + u'/global theme',
@ -184,7 +185,6 @@ class ThemeManager(QtGui.QWidget):
Loads the settings for the theme that is to be edited and launches the Loads the settings for the theme that is to be edited and launches the
theme editing form so the user can make their changes. theme editing form so the user can make their changes.
""" """
self.editingDefault = False
if check_item_selected(self.ThemeListWidget, translate('ThemeManager', if check_item_selected(self.ThemeListWidget, translate('ThemeManager',
'You must select a theme to edit.')): 'You must select a theme to edit.')):
item = self.ThemeListWidget.currentItem() item = self.ThemeListWidget.currentItem()
@ -211,6 +211,14 @@ class ThemeManager(QtGui.QWidget):
'You must select a theme to delete.')): 'You must select a theme to delete.')):
item = self.ThemeListWidget.currentItem() item = self.ThemeListWidget.currentItem()
theme = unicode(item.text()) theme = unicode(item.text())
# confirm deletion
answer = QtGui.QMessageBox.question(self,
translate('ThemeManager', 'Delete Confirmation'),
translate('ThemeManager', 'Delete theme?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No), QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
return
# should be the same unless default # should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()): if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
@ -610,6 +618,7 @@ class ThemeManager(QtGui.QWidget):
self.settingsSection + u'/global theme', self.settingsSection + u'/global theme',
QtCore.QVariant(self.global_theme)) QtCore.QVariant(self.global_theme))
Receiver.send_message(u'theme_update_global', self.global_theme) Receiver.send_message(u'theme_update_global', self.global_theme)
self.editingDefault = False
self.pushThemes() self.pushThemes()
else: else:
# Don't close the dialog - allow the user to change the name of # Don't close the dialog - allow the user to change the name of

View File

@ -120,14 +120,6 @@ class Ui_AlertDialog(object):
QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL(u'clicked()'),
AlertDialog.close) AlertDialog.close)
QtCore.QMetaObject.connectSlotsByName(AlertDialog) QtCore.QMetaObject.connectSlotsByName(AlertDialog)
AlertDialog.setTabOrder(self.AlertTextEdit, self.ParameterEdit)
AlertDialog.setTabOrder(self.ParameterEdit, self.AlertListWidget)
AlertDialog.setTabOrder(self.AlertListWidget, self.NewButton)
AlertDialog.setTabOrder(self.NewButton, self.SaveButton)
AlertDialog.setTabOrder(self.SaveButton, self.DeleteButton)
AlertDialog.setTabOrder(self.DeleteButton, self.DisplayButton)
AlertDialog.setTabOrder(self.DisplayButton, self.DisplayCloseButton)
AlertDialog.setTabOrder(self.DisplayCloseButton, self.CloseButton)
def retranslateUi(self, AlertDialog): def retranslateUi(self, AlertDialog):
AlertDialog.setWindowTitle( AlertDialog.setWindowTitle(

View File

@ -136,17 +136,6 @@ class Ui_customEditDialog(object):
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
customEditDialog.closePressed) customEditDialog.closePressed)
QtCore.QMetaObject.connectSlotsByName(customEditDialog) QtCore.QMetaObject.connectSlotsByName(customEditDialog)
customEditDialog.setTabOrder(self.TitleEdit, self.VerseTextEdit)
customEditDialog.setTabOrder(self.VerseTextEdit, self.AddButton)
customEditDialog.setTabOrder(self.AddButton, self.VerseListView)
customEditDialog.setTabOrder(self.VerseListView, self.EditButton)
customEditDialog.setTabOrder(self.EditButton, self.EditAllButton)
customEditDialog.setTabOrder(self.EditAllButton, self.SaveButton)
customEditDialog.setTabOrder(self.SaveButton, self.DeleteButton)
customEditDialog.setTabOrder(self.DeleteButton, self.CreditEdit)
customEditDialog.setTabOrder(self.CreditEdit, self.UpButton)
customEditDialog.setTabOrder(self.UpButton, self.DownButton)
customEditDialog.setTabOrder(self.DownButton, self.ThemeComboBox)
def retranslateUi(self, customEditDialog): def retranslateUi(self, customEditDialog):
customEditDialog.setWindowTitle( customEditDialog.setWindowTitle(

View File

@ -394,48 +394,12 @@ class Ui_EditSongDialog(object):
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save)
self.ButtonBox.setObjectName(u'ButtonBox') self.ButtonBox.setObjectName(u'ButtonBox')
self.verticalLayout.addWidget(self.ButtonBox) self.verticalLayout.addWidget(self.ButtonBox)
self.retranslateUi(EditSongDialog) self.retranslateUi(EditSongDialog)
QtCore.QObject.connect(self.ButtonBox, QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'rejected()'), EditSongDialog.closePressed) QtCore.SIGNAL(u'rejected()'), EditSongDialog.closePressed)
QtCore.QObject.connect(self.ButtonBox, QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'accepted()'), EditSongDialog.accept) QtCore.SIGNAL(u'accepted()'), EditSongDialog.accept)
QtCore.QMetaObject.connectSlotsByName(EditSongDialog) QtCore.QMetaObject.connectSlotsByName(EditSongDialog)
EditSongDialog.setTabOrder(self.SongTabWidget, self.TitleEditItem)
EditSongDialog.setTabOrder(self.TitleEditItem, self.AlternativeEdit)
EditSongDialog.setTabOrder(self.AlternativeEdit, self.VerseListWidget)
EditSongDialog.setTabOrder(self.VerseListWidget, self.VerseAddButton)
EditSongDialog.setTabOrder(self.VerseAddButton, self.VerseEditButton)
EditSongDialog.setTabOrder(self.VerseEditButton,
self.VerseEditAllButton)
EditSongDialog.setTabOrder(self.VerseEditAllButton,
self.VerseDeleteButton)
EditSongDialog.setTabOrder(self.VerseDeleteButton, self.VerseOrderEdit)
EditSongDialog.setTabOrder(self.VerseOrderEdit,
self.AuthorsSelectionComboItem)
EditSongDialog.setTabOrder(self.AuthorsSelectionComboItem,
self.AuthorAddButton)
EditSongDialog.setTabOrder(self.AuthorAddButton, self.AuthorsListView)
EditSongDialog.setTabOrder(self.AuthorsListView,
self.AuthorRemoveButton)
EditSongDialog.setTabOrder(self.AuthorRemoveButton,
self.MaintenanceButton)
EditSongDialog.setTabOrder(self.MaintenanceButton, self.SongTopicCombo)
EditSongDialog.setTabOrder(self.SongTopicCombo, self.TopicAddButton)
EditSongDialog.setTabOrder(self.TopicAddButton, self.TopicsListView)
EditSongDialog.setTabOrder(self.TopicsListView, self.TopicRemoveButton)
EditSongDialog.setTabOrder(self.TopicRemoveButton, self.SongbookCombo)
EditSongDialog.setTabOrder(self.SongbookCombo,
self.ThemeSelectionComboItem)
EditSongDialog.setTabOrder(self.ThemeSelectionComboItem,
self.ThemeAddButton)
EditSongDialog.setTabOrder(self.ThemeAddButton, self.CopyrightEditItem)
EditSongDialog.setTabOrder(self.CopyrightEditItem,
self.CopyrightInsertButton)
EditSongDialog.setTabOrder(self.CopyrightInsertButton,
self.CCLNumberEdit)
EditSongDialog.setTabOrder(self.CCLNumberEdit, self.CommentsEdit)
EditSongDialog.setTabOrder(self.CommentsEdit, self.ButtonBox)
def retranslateUi(self, EditSongDialog): def retranslateUi(self, EditSongDialog):
EditSongDialog.setWindowTitle( EditSongDialog.setWindowTitle(

View File

@ -178,7 +178,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
SettingsManager.get_last_dir(self.songsplugin.settingsSection, 1)) SettingsManager.get_last_dir(self.songsplugin.settingsSection, 1))
if filename: if filename:
editbox.setText(filename) editbox.setText(filename)
self.config.set_last_dir(filename, 1) SettingsManager.set_last_dir(self.songsplugin.settingsSection,
filename, 1)
def incrementProgressBar(self, status_text): def incrementProgressBar(self, status_text):
log.debug(u'IncrementBar %s', status_text) log.debug(u'IncrementBar %s', status_text)

View File

@ -109,16 +109,16 @@ class Ui_SongImportWizard(object):
self.OpenLyricsButtonLayout.setSpacing(8) self.OpenLyricsButtonLayout.setSpacing(8)
self.OpenLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout') self.OpenLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout')
self.OpenLyricsAddButton = QtGui.QPushButton(self.OpenLyricsPage) self.OpenLyricsAddButton = QtGui.QPushButton(self.OpenLyricsPage)
self.OpenLyricsAddButton.setIcon( openIcon = build_icon(u':/general/general_open.png')
build_icon(u':/general/general_open.png')) self.OpenLyricsAddButton.setIcon(openIcon)
self.OpenLyricsAddButton.setObjectName(u'OpenLyricsAddButton') self.OpenLyricsAddButton.setObjectName(u'OpenLyricsAddButton')
self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsAddButton) self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsAddButton)
self.OpenLyricsButtonSpacer = QtGui.QSpacerItem(40, 20, self.OpenLyricsButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.OpenLyricsButtonLayout.addItem(self.OpenLyricsButtonSpacer) self.OpenLyricsButtonLayout.addItem(self.OpenLyricsButtonSpacer)
self.OpenLyricsRemoveButton = QtGui.QPushButton(self.OpenLyricsPage) self.OpenLyricsRemoveButton = QtGui.QPushButton(self.OpenLyricsPage)
self.OpenLyricsRemoveButton.setIcon( deleteIcon = build_icon(u':/general/general_delete.png')
build_icon(u':/general/general_delete.png')) self.OpenLyricsRemoveButton.setIcon(deleteIcon)
self.OpenLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton') self.OpenLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton')
self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsRemoveButton) self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsRemoveButton)
self.OpenLyricsLayout.addLayout(self.OpenLyricsButtonLayout) self.OpenLyricsLayout.addLayout(self.OpenLyricsButtonLayout)
@ -136,14 +136,14 @@ class Ui_SongImportWizard(object):
self.OpenSongButtonLayout.setSpacing(8) self.OpenSongButtonLayout.setSpacing(8)
self.OpenSongButtonLayout.setObjectName(u'OpenSongButtonLayout') self.OpenSongButtonLayout.setObjectName(u'OpenSongButtonLayout')
self.OpenSongAddButton = QtGui.QPushButton(self.OpenSongPage) self.OpenSongAddButton = QtGui.QPushButton(self.OpenSongPage)
self.OpenSongAddButton.setIcon(self.OpenIcon) self.OpenSongAddButton.setIcon(openIcon)
self.OpenSongAddButton.setObjectName(u'OpenSongAddButton') self.OpenSongAddButton.setObjectName(u'OpenSongAddButton')
self.OpenSongButtonLayout.addWidget(self.OpenSongAddButton) self.OpenSongButtonLayout.addWidget(self.OpenSongAddButton)
self.OpenSongButtonSpacer = QtGui.QSpacerItem(40, 20, self.OpenSongButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.OpenSongButtonLayout.addItem(self.OpenSongButtonSpacer) self.OpenSongButtonLayout.addItem(self.OpenSongButtonSpacer)
self.OpenSongRemoveButton = QtGui.QPushButton(self.OpenSongPage) self.OpenSongRemoveButton = QtGui.QPushButton(self.OpenSongPage)
self.OpenSongRemoveButton.setIcon(self.DeleteIcon) self.OpenSongRemoveButton.setIcon(deleteIcon)
self.OpenSongRemoveButton.setObjectName(u'OpenSongRemoveButton') self.OpenSongRemoveButton.setObjectName(u'OpenSongRemoveButton')
self.OpenSongButtonLayout.addWidget(self.OpenSongRemoveButton) self.OpenSongButtonLayout.addWidget(self.OpenSongRemoveButton)
self.OpenSongLayout.addLayout(self.OpenSongButtonLayout) self.OpenSongLayout.addLayout(self.OpenSongButtonLayout)
@ -161,14 +161,14 @@ class Ui_SongImportWizard(object):
self.CCLIButtonLayout.setSpacing(8) self.CCLIButtonLayout.setSpacing(8)
self.CCLIButtonLayout.setObjectName(u'CCLIButtonLayout') self.CCLIButtonLayout.setObjectName(u'CCLIButtonLayout')
self.CCLIAddButton = QtGui.QPushButton(self.CCLIPage) self.CCLIAddButton = QtGui.QPushButton(self.CCLIPage)
self.CCLIAddButton.setIcon(self.OpenIcon) self.CCLIAddButton.setIcon(openIcon)
self.CCLIAddButton.setObjectName(u'CCLIAddButton') self.CCLIAddButton.setObjectName(u'CCLIAddButton')
self.CCLIButtonLayout.addWidget(self.CCLIAddButton) self.CCLIButtonLayout.addWidget(self.CCLIAddButton)
self.CCLIButtonSpacer = QtGui.QSpacerItem(40, 20, self.CCLIButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.CCLIButtonLayout.addItem(self.CCLIButtonSpacer) self.CCLIButtonLayout.addItem(self.CCLIButtonSpacer)
self.CCLIRemoveButton = QtGui.QPushButton(self.CCLIPage) self.CCLIRemoveButton = QtGui.QPushButton(self.CCLIPage)
self.CCLIRemoveButton.setIcon(self.DeleteIcon) self.CCLIRemoveButton.setIcon(deleteIcon)
self.CCLIRemoveButton.setObjectName(u'CCLIRemoveButton') self.CCLIRemoveButton.setObjectName(u'CCLIRemoveButton')
self.CCLIButtonLayout.addWidget(self.CCLIRemoveButton) self.CCLIButtonLayout.addWidget(self.CCLIRemoveButton)
self.CCLILayout.addLayout(self.CCLIButtonLayout) self.CCLILayout.addLayout(self.CCLIButtonLayout)
@ -190,7 +190,7 @@ class Ui_SongImportWizard(object):
self.CSVFilenameEdit.setObjectName(u'CSVFilenameEdit') self.CSVFilenameEdit.setObjectName(u'CSVFilenameEdit')
self.CSVFileLayout.addWidget(self.CSVFilenameEdit) self.CSVFileLayout.addWidget(self.CSVFilenameEdit)
self.CSVBrowseButton = QtGui.QToolButton(self.CSVPage) self.CSVBrowseButton = QtGui.QToolButton(self.CSVPage)
self.CSVBrowseButton.setIcon(self.OpenIcon) self.CSVBrowseButton.setIcon(openIcon)
self.CSVBrowseButton.setObjectName(u'CSVBrowseButton') self.CSVBrowseButton.setObjectName(u'CSVBrowseButton')
self.CSVFileLayout.addWidget(self.CSVBrowseButton) self.CSVFileLayout.addWidget(self.CSVBrowseButton)
self.CSVLayout.setLayout(0, QtGui.QFormLayout.FieldRole, self.CSVLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
@ -213,14 +213,11 @@ class Ui_SongImportWizard(object):
self.ImportProgressBar.setObjectName(u'ImportProgressBar') self.ImportProgressBar.setObjectName(u'ImportProgressBar')
self.ImportLayout.addWidget(self.ImportProgressBar) self.ImportLayout.addWidget(self.ImportProgressBar)
SongImportWizard.addPage(self.ImportPage) SongImportWizard.addPage(self.ImportPage)
self.retranslateUi(SongImportWizard) self.retranslateUi(SongImportWizard)
self.FormatStackedWidget.setCurrentIndex(0) self.FormatStackedWidget.setCurrentIndex(0)
QtCore.QObject.connect( QtCore.QObject.connect(self.FormatComboBox,
self.FormatComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.FormatStackedWidget.setCurrentIndex self.FormatStackedWidget.setCurrentIndex)
)
QtCore.QMetaObject.connectSlotsByName(SongImportWizard) QtCore.QMetaObject.connectSlotsByName(SongImportWizard)
def retranslateUi(self, SongImportWizard): def retranslateUi(self, SongImportWizard):
@ -275,4 +272,3 @@ class Ui_SongImportWizard(object):
translate('SongsPlugin.ImportWizardForm', 'Ready.')) translate('SongsPlugin.ImportWizardForm', 'Ready.'))
self.ImportProgressBar.setFormat( self.ImportProgressBar.setFormat(
translate('SongsPlugin.ImportWizardForm', '%p%')) translate('SongsPlugin.ImportWizardForm', '%p%'))

View File

@ -137,7 +137,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def checkAuthor(self, new_author, edit=False): def checkAuthor(self, new_author, edit=False):
""" """
Returns False when the given Author is already in the list elsewise Returns False if the given Author is already in the list otherwise
True. True.
""" """
authors = self.songmanager.get_all_objects_filtered(Author, authors = self.songmanager.get_all_objects_filtered(Author,
@ -163,11 +163,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def checkTopic(self, new_topic, edit=False): def checkTopic(self, new_topic, edit=False):
""" """
Returns False when the given Topic is already in the list elsewise True. Returns False if the given Topic is already in the list otherwise True.
""" """
topics = self.songmanager.get_all_objects_filtered(Topic, topics = self.songmanager.get_all_objects_filtered(Topic,
Topic.name == new_topic.name Topic.name == new_topic.name)
)
if len(topics) > 0: if len(topics) > 0:
# If we edit an existing Topic, we need to make sure that we do # If we edit an existing Topic, we need to make sure that we do
# not return False when nothing has changed (because this would # not return False when nothing has changed (because this would
@ -184,25 +183,22 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def checkBook(self, new_book, edit=False): def checkBook(self, new_book, edit=False):
""" """
Returns False when the given Book is already in the list elsewise True. Returns False if the given Book is already in the list otherwise True.
""" """
books = self.songmanager.get_all_objects_filtered(Book, books = self.songmanager.get_all_objects_filtered(Book,
and_( and_(Book.name == new_book.name,
Book.name == new_book.name, Book.publisher == new_book.publisher))
Book.publisher == new_book.publisher
)
)
if len(books) > 0: if len(books) > 0:
# If we edit an existing Book, we need to make sure that we do # If we edit an existing Book, we need to make sure that we do
# not return False when nothing has changed (because this would # not return False when nothing has changed (because this would
# cause an error message later on). # cause an error message later on).
if edit: if edit:
if books[0].id == new_book.id: if books[0].id == new_book.id:
return True return True
else:
return False
else: else:
return False return False
else:
return False
else: else:
return True return True

View File

@ -142,7 +142,7 @@ class SofImport(OooImport):
self.blanklines += 1 self.blanklines += 1
if self.blanklines > 1: if self.blanklines > 1:
return return
if self.song.get_title() != u'': if self.song.title != u'':
self.finish_verse() self.finish_verse()
return return
self.blanklines = 0 self.blanklines = 0
@ -166,8 +166,8 @@ class SofImport(OooImport):
self.finish_verse() self.finish_verse()
self.song.repeat_verse() self.song.repeat_verse()
return return
if self.song.get_title() == u'': if self.song.title == u'':
if self.song.get_copyright() == u'': if self.song.copyright == u'':
self.add_author(text) self.add_author(text)
else: else:
self.song.add_copyright(text) self.song.add_copyright(text)
@ -187,10 +187,10 @@ class SofImport(OooImport):
return text return text
if textportion.CharWeight == BOLD: if textportion.CharWeight == BOLD:
boldtext = text.strip() boldtext = text.strip()
if boldtext.isdigit() and self.song.get_song_number() == '': if boldtext.isdigit() and self.song.song_number == '':
self.add_songnumber(boldtext) self.add_songnumber(boldtext)
return u'' return u''
if self.song.get_title() == u'': if self.song.title == u'':
text = self.uncap_text(text) text = self.uncap_text(text)
self.add_title(text) self.add_title(text)
return text return text
@ -220,20 +220,17 @@ class SofImport(OooImport):
Add a song number, store as alternate title. Also use the song Add a song number, store as alternate title. Also use the song
number to work out which songbook we're in number to work out which songbook we're in
""" """
self.song.set_song_number(song_no) self.song.song_number = song_no
self.song.set_alternate_title(song_no + u'.') self.song.alternate_title = song_no + u'.'
self.song.song_book_pub = u'Kingsway Publications'
if int(song_no) <= 640: if int(song_no) <= 640:
self.song.set_song_book(u'Songs of Fellowship 1', self.song.song_book = u'Songs of Fellowship 1'
u'Kingsway Publications')
elif int(song_no) <= 1150: elif int(song_no) <= 1150:
self.song.set_song_book(u'Songs of Fellowship 2', self.song.song_book = u'Songs of Fellowship 2'
u'Kingsway Publications')
elif int(song_no) <= 1690: elif int(song_no) <= 1690:
self.song.set_song_book(u'Songs of Fellowship 3', self.song.song_book = u'Songs of Fellowship 3'
u'Kingsway Publications')
else: else:
self.song.set_song_book(u'Songs of Fellowship 4', self.song.song_book = u'Songs of Fellowship 4'
u'Kingsway Publications')
def add_title(self, text): def add_title(self, text):
""" """
@ -245,7 +242,7 @@ class SofImport(OooImport):
title = title[1:] title = title[1:]
if title.endswith(u','): if title.endswith(u','):
title = title[:-1] title = title[:-1]
self.song.set_title(title) self.song.title = title
def add_author(self, text): def add_author(self, text):
""" """
@ -283,7 +280,7 @@ class SofImport(OooImport):
splitat = None splitat = None
else: else:
versetag = u'V' versetag = u'V'
splitat = self.verse_splits(self.song.get_song_number()) splitat = self.verse_splits(self.song.song_number)
if splitat: if splitat:
ln = 0 ln = 0
verse = u'' verse = u''
@ -538,4 +535,3 @@ class SofImport(OooImport):
if song_number == 1119: if song_number == 1119:
return 7 return 7
return None return None

View File

@ -123,53 +123,10 @@ class SongImport(object):
if len(lines) == 1: if len(lines) == 1:
self.parse_author(lines[0]) self.parse_author(lines[0])
return return
if not self.get_title(): if not self.title:
self.set_title(lines[0]) self.title = lines[0]
self.add_verse(text) self.add_verse(text)
def get_title(self):
"""
Return the title
"""
return self.title
def get_copyright(self):
"""
Return the copyright
"""
return self.copyright
def get_song_number(self):
"""
Return the song number
"""
return self.song_number
def set_title(self, title):
"""
Set the title
"""
self.title = title
def set_alternate_title(self, title):
"""
Set the alternate title
"""
self.alternate_title = title
def set_song_number(self, song_number):
"""
Set the song number
"""
self.song_number = song_number
def set_song_book(self, song_book, publisher):
"""
Set the song book name and publisher
"""
self.song_book_name = song_book
self.song_book_pub = publisher
def add_copyright(self, copyright): def add_copyright(self, copyright):
""" """
Build the copyright field Build the copyright field
@ -303,28 +260,22 @@ class SongImport(object):
author = self.manager.get_object_filtered(Author, author = self.manager.get_object_filtered(Author,
Author.display_name == authortext) Author.display_name == authortext)
if author is None: if author is None:
author = Author() author = Author.populate(display_name = authortext,
author.display_name = authortext last_name=authortext.split(u' ')[-1],
author.last_name = authortext.split(u' ')[-1] first_name=u' '.join(authortext.split(u' ')[:-1]))
author.first_name = u' '.join(authortext.split(u' ')[:-1])
self.manager.save_object(author)
song.authors.append(author) song.authors.append(author)
if self.song_book_name: if self.song_book_name:
song_book = self.manager.get_object_filtered(Book, song_book = self.manager.get_object_filtered(Book,
Book.name == self.song_book_name) Book.name == self.song_book_name)
if song_book is None: if song_book is None:
song_book = Book() song_book = Book.populate(name=self.song_book_name,
song_book.name = self.song_book_name publisher=self.song_book_pub)
song_book.publisher = self.song_book_pub song.book = song_book
self.manager.save_object(song_book)
song.song_book_id = song_book.id
for topictext in self.topics: for topictext in self.topics:
topic = self.manager.get_object_filtered(Topic, topic = self.manager.get_object_filtered(Topic,
Topic.name == topictext) Topic.name == topictext)
if topic is None: if topic is None:
topic = Topic() topic = Topic.populate(name=topictext)
topic.name = topictext
self.manager.save_object(topic)
song.topics.append(topictext) song.topics.append(topictext)
self.manager.save_object(song) self.manager.save_object(song)

View File

@ -366,10 +366,6 @@ class Song(object):
if len(self.search_title) < 1: if len(self.search_title) < 1:
raise SongTitleError(u'The searchable title is empty') raise SongTitleError(u'The searchable title is empty')
def get_title(self):
"""Return title value"""
return self.title
def from_ccli_text_buffer(self, textList): def from_ccli_text_buffer(self, textList):
""" """
Create song from a list of texts (strings) - CCLI text format expected Create song from a list of texts (strings) - CCLI text format expected
@ -688,7 +684,7 @@ class Song(object):
raise SongSlideError(u'Slide number too high') raise SongSlideError(u'Slide number too high')
res = [] res = []
if self.show_title: if self.show_title:
title = self.get_title() title = self.title
else: else:
title = "" title = ""
if self.show_author_list: if self.show_author_list: