forked from openlp/openlp
update title and copyright
This commit is contained in:
parent
a576962181
commit
a6d64ef20e
@ -155,21 +155,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
Check the validity of the form. Only display the 'save' if the data can be saved.
|
Check the validity of the form. Only display the 'save' if the data can be saved.
|
||||||
"""
|
"""
|
||||||
valid = True # Lets be nice and assume the data is correct.
|
valid = True # Lets be nice and assume the data is correct.
|
||||||
if len(self.TitleEditItem.displayText()) == 0: #Song title missing
|
if len(self.TitleEditItem.displayText()) == 0:
|
||||||
valid = False
|
valid = False
|
||||||
#self._color_widget(self.TitleEditItem, True)
|
if len(self.CopyrightEditItem.displayText()) == 0:
|
||||||
#else:
|
|
||||||
#self._color_widget(self.TitleEditItem, False)
|
|
||||||
if len(self.CopyrightEditItem.displayText()) == 0: #Song title missing
|
|
||||||
valid = False
|
valid = False
|
||||||
#self._color_widget(self.CopyrightEditItem, True)
|
|
||||||
#else:
|
|
||||||
#self._color_widget(self.CopyrightEditItem, False)
|
|
||||||
|
|
||||||
if valid:
|
|
||||||
self.ButtonBox.addButton(self.savebutton, QtGui.QDialogButtonBox.AcceptRole) # hide the save button tile screen is valid
|
|
||||||
else:
|
|
||||||
self.ButtonBox.removeButton(self.savebutton) # hide the save button tile screen is valid
|
|
||||||
|
|
||||||
def _color_widget(self, slot, invalid):
|
def _color_widget(self, slot, invalid):
|
||||||
r = Qt.QPalette(slot.palette())
|
r = Qt.QPalette(slot.palette())
|
||||||
@ -193,4 +182,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.CopyrightEditItem.setCursorPosition(pos + 1)
|
self.CopyrightEditItem.setCursorPosition(pos + 1)
|
||||||
|
|
||||||
def onAccept(self):
|
def onAccept(self):
|
||||||
a = c
|
#self.song.topics.append(9) << need opject here
|
||||||
|
self.song.title = unicode(self.TitleEditItem.displayText())
|
||||||
|
self.song.copyright = unicode(self.CopyrightEditItem.displayText())
|
||||||
|
self.songmanager.save_song(self.song)
|
||||||
|
self.close()
|
||||||
|
@ -34,8 +34,8 @@ class SongManager():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
global log
|
global log
|
||||||
log = logging.getLogger('SongManager')
|
log = logging.getLogger(u'SongManager')
|
||||||
log.info('Song manager loaded')
|
log.info(u'Song manager loaded')
|
||||||
|
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
"""
|
"""
|
||||||
@ -43,7 +43,7 @@ class SongManager():
|
|||||||
don't exist.
|
don't exist.
|
||||||
"""
|
"""
|
||||||
self.config = config
|
self.config = config
|
||||||
log.debug('Song Initialising')
|
log.debug(u'Song Initialising')
|
||||||
self.db_url = u''
|
self.db_url = u''
|
||||||
db_type = self.config.get_config(u'db type', u'sqlite')
|
db_type = self.config.get_config(u'db type', u'sqlite')
|
||||||
if db_type == u'sqlite':
|
if db_type == u'sqlite':
|
||||||
@ -58,7 +58,7 @@ class SongManager():
|
|||||||
self.session = init_models(self.db_url)
|
self.session = init_models(self.db_url)
|
||||||
if not songs_table.exists():
|
if not songs_table.exists():
|
||||||
metadata.create_all()
|
metadata.create_all()
|
||||||
log.debug('Song Initialised')
|
log.debug(u'Song Initialised')
|
||||||
|
|
||||||
def process_dialog(self, dialogobject):
|
def process_dialog(self, dialogobject):
|
||||||
self.dialogobject = dialogobject
|
self.dialogobject = dialogobject
|
||||||
@ -99,6 +99,8 @@ class SongManager():
|
|||||||
self.session.commit()
|
self.session.commit()
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
|
log.error(u'Errow thrown %s', sys.exc_info()[1])
|
||||||
|
print u'Errow thrown ', sys.exc_info()[1]
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def delete_song(self, song):
|
def delete_song(self, song):
|
||||||
@ -130,6 +132,7 @@ class SongManager():
|
|||||||
self.session.commit()
|
self.session.commit()
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
|
log.error(u'Errow thrown %s', sys.exc_info()[1])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def delete_author(self, authorid):
|
def delete_author(self, authorid):
|
||||||
@ -142,7 +145,7 @@ class SongManager():
|
|||||||
self.session.commit()
|
self.session.commit()
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
log.error("Errow thrown %s", sys.exc_info()[1])
|
log.error(u'Errow thrown %s', sys.exc_info()[1])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_topics(self):
|
def get_topics(self):
|
||||||
@ -166,6 +169,7 @@ class SongManager():
|
|||||||
self.session.commit()
|
self.session.commit()
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
|
log.error(u'Errow thrown %s', sys.exc_info()[1])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def delete_topic(self, topicid):
|
def delete_topic(self, topicid):
|
||||||
@ -178,7 +182,7 @@ class SongManager():
|
|||||||
self.session.commit()
|
self.session.commit()
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
log.error("Errow thrown %s", sys.exc_info()[1])
|
log.error(u'Errow thrown %s', sys.exc_info()[1])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_books(self):
|
def get_books(self):
|
||||||
@ -214,5 +218,5 @@ class SongManager():
|
|||||||
self.session.commit()
|
self.session.commit()
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
log.error("Errow thrown %s", sys.exc_info()[1])
|
log.error(u'Errow thrown %s', sys.exc_info()[1])
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user