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 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 open_file_callback(self, widget=None): # set __ingnore__queue_check because we already did the check self.__ignore_queue_check = True filename = gtkutil.get_file_from_filechooser(self) if filename is not None: self._play_file(filename) self.__ignore_queue_check = False
def play_one_callback(self, widget=None): filename = gtkutil.get_file_from_filechooser(self) if filename is not None: self.empty_playlist_callback(None) self._play_file(filename)
def open_dir_callback(self, widget=None): filename = gtkutil.get_file_from_filechooser(self, folder=True) if filename is not None: self._play_file(filename)
def add_directory(self, widget): directory = gtkutil.get_file_from_filechooser(self.main, folder=True ) if directory is not None: self.playlist.load(directory)
def add_file(self, widget): filename = gtkutil.get_file_from_filechooser(self.main) if filename is not None: self.playlist.load(filename)
def add_directory(self, widget): directory = gtkutil.get_file_from_filechooser(self.main, folder=True) if directory is not None: self.playlist.load(directory)