Example #1
0
    def save_playlist_callback(self):
        filenames = qtutil.get_file_from_filechooser(self,
                                                     save_file=True,
                                                     save_to=True)
        if not filenames:
            return False

        filename = filenames[0]
        if os.path.isfile(filename):
            response = qtutil.dialog(
                self.main_window, _('File already exists!'),
                _('The file %s already exists. You can choose another name or '
                  'overwrite the existing file.') % os.path.basename(filename),
                False, True, True, True)

            if response == QtGui.QMessageBox.Cancel:
                return None
            elif response == QtGui.QMessageBox.Discard:
                return self.save_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
Example #2
0
    def save_playlist_callback(self):
        filenames = qtutil.get_file_from_filechooser(self, save_file=True, save_to=True)
        if not filenames:
            return False

        filename = filenames[0]
        if os.path.isfile(filename):
            response = qtutil.dialog(self.main_window,  _('File already exists!'),
                _('The file %s already exists. You can choose another name or '
                  'overwrite the existing file.') % os.path.basename(filename), False, True, True, True)

            if response == QtGui.QMessageBox.Cancel:
                return None
            elif response == QtGui.QMessageBox.Discard:
                return self.save_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
Example #3
0
 def add_folder_callback(self):
     filenames = qtutil.get_file_from_filechooser(self, folder=True)
     if filenames:
         self._play_file(filenames[0].encode('utf-8'))
Example #4
0
 def play_one_callback(self):
     filenames = qtutil.get_file_from_filechooser(self)
     if filenames:
         self.clear_playlist_callback()
         self._play_file(filenames[0].encode('utf-8'))
Example #5
0
 def add_folder_callback(self):
     filenames = qtutil.get_file_from_filechooser(self, folder=True)
     if filenames:
         self._play_file(filenames[0].encode('utf-8'))
Example #6
0
 def play_one_callback(self):
     filenames = qtutil.get_file_from_filechooser(self)
     if filenames:
         self.clear_playlist_callback()
         self._play_file(filenames[0].encode('utf-8'))