def __SignalOnQueryEditSong(self, message = None): """ The song needs to be edited, we catch a signal from the view manager to allow other GUI elements to also issue this edit action Subscribed to VIEWMGR """ s = self._filter._selectedSong if s <> None: dlg = NewSongDlg.NewSongDlg(self) dlg.LoadFromSong(s) if dlg.ShowModal() == wx.ID_OK: # we first remember the last dir if we have one, and then # see what the new dir will be. If we have a change, notify path_before = appcfg.GetAbsWorkPathFromSong(s) dlg.SaveToSong(s) path_after = appcfg.GetAbsWorkPathFromSong(s) # if we have a new attachments path, notify user if path_before.upper() != path_after.upper() and os.path.exists(path_before): wx.MessageBox('The attachment path is changed!\n' + \ 'Make sure you manually copy all files to the new attachments directory', 'Path is changed', wx.ICON_WARNING | wx.OK) # update the song in the database sp = db.songs_peer.SongPeer(db.engine.GetDb()) sp.Update(s, all = True) # signal everyone the song is updated viewmgr.signalSongUpdated(s) dlg.Destroy()
def __OnEditCategories(self, event): """ Menu handler to edit the categories belonging to the song """ s = self._filter._selectedSong if s <> None: dlg = CategoriesDlg.CategoriesDlg(self) dlg.SetCurrentSong(s) if dlg.ShowModal() == wx.ID_OK: # update the song in the database sp = db.songs_peer.SongPeer(db.engine.GetDb()) sp.Update(s, all = True) # tell all views we updated viewmgr.signalSongUpdated(s) dlg.Destroy()