コード例 #1
0
ファイル: qtmain.py プロジェクト: shreeja0/panucci
    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
コード例 #2
0
 def delete_bookmarks_callback(self):
     response = qtutil.dialog(
         self.main_window, _('Delete all bookmarks?'),
         _('By accepting all bookmarks in the database will be deleted.'),
         True, False, True, False)
     if response == QtGui.QMessageBox.Ok:
         self.playlist.delete_all_bookmarks()
コード例 #3
0
ファイル: qtmain.py プロジェクト: renemilk/panucci
    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
コード例 #4
0
ファイル: qtmain.py プロジェクト: renemilk/panucci
 def delete_bookmarks_callback(self):
     response = qtutil.dialog(self.main_window,  _('Delete all bookmarks?'),
             _('By accepting all bookmarks in the database will be deleted.'), True, False, True, False)
     if response == QtGui.QMessageBox.Ok:
         self.playlist.delete_all_bookmarks()