def save_to_playlist_callback(self, widget=None): filename = gtkutil.get_file_from_filechooser( self, save_file=True, save_to='playlist.m3u' ) if filename is None: return False if os.path.isfile(filename): response = gtkutil.dialog( self.main_window, _('File already exists'), _('File already exists'), _('The file %s already exists. You can choose another name or ' 'overwrite the existing file.') % os.path.basename(filename), affirmative_button=gtk.STOCK_SAVE, negative_button=_('Rename file')) if response is None: return None elif response: pass elif not response: return self.save_to_playlist_callback() ext = util.detect_filetype(filename) if not self.playlist.save_to_new_playlist(filename, ext): self.notify(_('Error saving playlist...')) return False return True
def check_queue(self): """ Makes sure the queue is saved if it has been modified True means a new file can be opened False means the user does not want to continue """ if not self.__ignore_queue_check and self.playlist.queue_modified: response = gtkutil.dialog( self.main_window, _('Save current playlist'), _('Current playlist has been modified'), _('Opening a new file will replace the current playlist. ') + _('Do you want to save it before creating a new one?'), affirmative_button=gtk.STOCK_SAVE, negative_button=_('Discard changes')) self.__log.debug('Response to "Save Queue?": %s', response) if response is None: return False elif response: return self.save_to_playlist_callback() elif not response: return True else: return False else: return True
def save_to_playlist_callback(self, widget=None): filename = gtkutil.get_file_from_filechooser(self, save_file=True, save_to='playlist.m3u') if filename is None: return False if os.path.isfile(filename): response = gtkutil.dialog( self.main_window, _('File already exists'), _('File already exists'), _('The file %s already exists. You can choose another name or ' 'overwrite the existing file.') % os.path.basename(filename), affirmative_button=gtk.STOCK_SAVE, negative_button=_('Rename file')) if response is None: return None elif response: pass elif not response: return self.save_to_playlist_callback() ext = util.detect_filetype(filename) if not self.playlist.save_to_new_playlist(filename, ext): self.notify(_('Error saving playlist...')) return False return True
def delete_all_bookmarks_callback(self, widget=None): response = gtkutil.dialog( self.main_window, _('Delete All Bookmarks'), _('Would you like to delete all bookmarks?'), _('By accepting all bookmarks in the database will be deleted.'), negative_button=None) self.__log.debug('Response to "Delete all bookmarks?": %s', response) if response: self.playlist.delete_all_bookmarks() model = self.__playlist_tab.treeview.get_model() for row in iter(model): while model.iter_has_child(row.iter): bkmk_iter = model.iter_children(row.iter) model.remove(bkmk_iter)