Attempt to fix a bug where the song list is never updated.

This commit is contained in:
Raoul Snyman 2009-09-08 17:21:30 +02:00
parent 3c4e9a957f
commit 4cfd7dfbaa
4 changed files with 73 additions and 54 deletions

View File

@ -1,19 +1,23 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley, Carsten Tinggaard
This program is free software; you can redistribute it and/or modify it under ###############################################################################
the terms of the GNU General Public License as published by the Free Software # OpenLP - Open Source Lyrics Projection #
Foundation; version 2 of the License. # --------------------------------------------------------------------------- #
# Copyright (c) 2008 Raoul Snyman #
This program is distributed in the hope that it will be useful, but WITHOUT ANY # Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg #
PARTICULAR PURPOSE. See the GNU General Public License for more details. # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
You should have received a copy of the GNU General Public License along with # under the terms of the GNU General Public License as published by the Free #
this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Software Foundation; version 2 of the License. #
Place, Suite 330, Boston, MA 02111-1307 USA # #
""" # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -1,25 +1,26 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman ###############################################################################
# OpenLP - Open Source Lyrics Projection #
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, # --------------------------------------------------------------------------- #
# Copyright (c) 2008 Raoul Snyman #
This program is free software; you can redistribute it and/or modify it under # Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, #
the terms of the GNU General Public License as published by the Free Software # --------------------------------------------------------------------------- #
Foundation; version 2 of the License. # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
This program is distributed in the hope that it will be useful, but WITHOUT ANY # Software Foundation; version 2 of the License. #
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # #
PARTICULAR PURPOSE. See the GNU General Public License for more details. # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
You should have received a copy of the GNU General Public License along with # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
this program; if not, write to the Free Software Foundation, Inc., 59 Temple # more details. #
Place, Suite 330, Boston, MA 02111-1307 USA # #
""" # You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import sys import sys
import logging, logging.handlers import logging, logging.handlers

View File

@ -29,8 +29,8 @@ class BaseListWithDnD(QtGui.QListWidget):
Please put a short description of what this class does in here. Please put a short description of what this class does in here.
""" """
def __init__(self,parent = None): def __init__(self, parent=None):
QtGui.QListWidget.__init__(self,parent) QtGui.QListWidget.__init__(self, parent)
# this must be set by the class which is inheriting # this must be set by the class which is inheriting
assert(self.PluginName) assert(self.PluginName)

View File

@ -73,8 +73,16 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
QtCore.SIGNAL(u'activated(int)'), self.onThemeComboChanged) QtCore.SIGNAL(u'activated(int)'), self.onThemeComboChanged)
QtCore.QObject.connect(self.MaintenanceButton, QtCore.QObject.connect(self.MaintenanceButton,
QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
QtCore.QObject.connect(self.TitleEditItem,
QtCore.SIGNAL(u'lostFocus()'), self.onTitleEditItemLostFocus)
QtCore.QObject.connect(self.CCLNumberEdit,
QtCore.SIGNAL(u'lostFocus()'), self.onCCLNumberEditLostFocus)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'update_themes'), self.loadThemes) QtCore.SIGNAL(u'update_themes'), self.loadThemes)
QtCore.QObject.connect(self.CommentsEdit,
QtCore.SIGNAL(u'lostFocus()'), self.onCommentsEditLostFocus)
QtCore.QObject.connect(self.VerseOrderEdit,
QtCore.SIGNAL(u'lostFocus()'), self.onVerseOrderEditLostFocus)
# Create other objects and forms # Create other objects and forms
self.songmanager = songmanager self.songmanager = songmanager
self.parent = parent self.parent = parent
@ -322,35 +330,41 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
message = u'' message = u''
if len(self.TitleEditItem.displayText()) == 0: if len(self.TitleEditItem.displayText()) == 0:
valid = False valid = False
self.TitleEditItem.setStyleSheet(u'background-color: red; color: white') ##self.TitleEditItem.setStyleSheet(u'background-color: red; color: white')
message = translate(u'SongFormDialog', u'You need to enter a song title \n') self.SongTabWidget.setCurrentIndex(0)
else: self.TitleEditItem.setFocus()
self.TitleEditItem.setStyleSheet(u'') return False, translate(u'SongFormDialog', u'You need to enter a song title.')
#else:
#self.TitleEditItem.setStyleSheet(u'')
if self.VerseListWidget.count() == 0: if self.VerseListWidget.count() == 0:
valid = False valid = False
self.VerseListWidget.setStyleSheet(u'background-color: red; color: white') #self.VerseListWidget.setStyleSheet(u'background-color: red; color: white')
message = message + translate(u'SongFormDialog', u'You need to enter some verse text \n') self.SongTabWidget.setCurrentIndex(0)
else: self.VerseListWidget.setFocus()
self.VerseListWidget.setStyleSheet(u'') return False, translate(u'SongFormDialog', u'You need to enter some verses.')
#else:
#self.VerseListWidget.setStyleSheet(u'')
if self.AuthorsListView.count() == 0: if self.AuthorsListView.count() == 0:
valid = False valid = False
self.AuthorsListView.setStyleSheet(u'background-color: red; color: white') #self.AuthorsListView.setStyleSheet(u'background-color: red; color: white')
message = message + translate(u'SongFormDialog', u'You need to provide an author') self.SongTabWidget.setCurrentIndex(2)
else: self.AuthorsListView.setFocus()
self.AuthorsListView.setStyleSheet(u'') return False, translate(u'SongFormDialog', u'You need to provide at least one author.')
#else:
#self.AuthorsListView.setStyleSheet(u'')
return valid, message return valid, message
def on_TitleEditItem_lostFocus(self): def onTitleEditItemLostFocus(self):
self.song.title = self.TitleEditItem.text() self.song.title = self.TitleEditItem.text()
self.title_change = True self.title_change = True
def on_VerseOrderEdit_lostFocus(self): def onVerseOrderEditLostFocus(self):
self.song.verse_order = self.VerseOrderEdit.text() self.song.verse_order = self.VerseOrderEdit.text()
def on_CommentsEdit_lostFocus(self): def onCommentsEditLostFocus(self):
self.song.comments = self.CommentsEdit.text() self.song.comments = self.CommentsEdit.text()
def on_CCLNumberEdit_lostFocus(self): def onCCLNumberEditLostFocus(self):
self.song.ccli_number = self.CCLNumberEdit.text() self.song.ccli_number = self.CCLNumberEdit.text()
def onCopyrightInsertButtonTriggered(self): def onCopyrightInsertButtonTriggered(self):