def __OnApply(self, event): """ Revert or apply the text. Revert will restore the information from the class else it will store the information in the database and update all views """ s = viewmgr.Get()._selectedSong if self.__applySelection.GetSelection() == 0: s._information = self.__infoEdit.GetValue() # write the song to the database sp = songs_peer.SongPeer(db.engine.GetDb()) sp.Update(s) # issue an update signal of the song viewmgr.signalSongUpdated(s) else: # revert self.__infoEdit.SetValue(s._information) # always revert to save action self.__applySelection.SetSelection(0)
def __OnApply(self, event): """ Revert or apply the text. Revert will restore the information from the class else it will store the information in the database and update all views """ s = viewmgr.Get()._selectedSong if s: if self.__applySelection.GetSelection(): # revert the lyrics self.__lyrics.SetValue(s._lyrics) else: # update only the basic fields s._lyrics = self.__lyrics.GetValue() sp = songs_peer.SongPeer(db.engine.GetDb()) sp.Update(s, all = False) # issue a song update to the audience viewmgr.signalSongUpdated(s) # always revert to save action self.__applySelection.SetSelection(0)