Пример #1
0
    def on_finished(self, evt):
        if evt.id != operations.ERROR:
            return

        gtkutil.dialog_error(
            _("Converting files failed"),
            _("Writing to disc didn't start so it is still usable."), self.win)
Пример #2
0
    def start(self):
        if len(self.errors) == 0:
            e = operations.FinishedEvent(self, operations.SUCCESSFUL)
            for l in self.listeners:
                l.on_finished(e)
            return

        elif len(self.errors) > 1:
            title = _("Unsupported file types")
        else:
            title = _("Unsupported file type")

        filenames = []
        for e in self.errors:
            filenames.append(gnomevfs.URI(e.hints['location']).short_name)
        del self.__errors

        if len(filenames) == 1:
            msg = _("The following files were not added:") + "\n"
        else:
            msg = _("The following files were not added:") + "\n"

        msg += " " + filenames[0]

        for f in filenames[1:]:
            msg += ", " + f
        gtkutil.dialog_error(title, msg, self.parent)

        e = operations.FinishedEvent(self, operations.SUCCESSFUL)
        for l in self.listeners:
            l.on_finished(e)
Пример #3
0
    def run_dialog(self, *args):
        app = self.parent.application
        win = self.parent

        self.__sync_file_filters()

        if self.file_dlg.run() == gtk.RESPONSE_OK:
            filename = self.file_dlg.get_filename()
            basename = os.path.basename(filename)
            if os.path.exists(filename) and gtkutil.dialog_ok_cancel(
                    _("Replace existing file"),
                    _("A file named <i>%s</i> already exists. "
                      "Do you want to replace it with the one "
                      "you are saving?") % basename, win) != gtk.RESPONSE_OK:

                self.file_dlg.unselect_all()
                self.file_dlg.hide()
                return

            try:
                oper = app.savePlaylist.save(filename)
            except SerpentineNotSupportedError:
                gtkutil.dialog_error(
                    _("Unsupported Format"),
                    _("The playlist format you used (by the file extension) is "
                      "currently not supported."), win)
            oper.listeners.append(self)
            oper.start()

        self.file_dlg.unselect_all()
        self.file_dlg.hide()
Пример #4
0
    def start (self):
        if len (self.errors) == 0:
            e = operations.FinishedEvent (self, operations.SUCCESSFUL)
            for l in self.listeners:
                l.on_finished (e)
            return
                
        elif len (self.errors) > 1:
            title = _("Unsupported file types")
        else:
            title = _("Unsupported file type")
            
        filenames = []
        for e in self.errors:
            filenames.append (urlutil.basename(e.hints['location']))
        del self.__errors
        
        if len (filenames) == 1:
            msg = _("The following files were not added:") + "\n"
        else:
            msg = _("The following files were not added:") + "\n"
        
        msg += " "
        msg += ", ".join (filenames)

        gtkutil.dialog_error (title, msg, parent = self.parent)
        
        e = operations.FinishedEvent (self, operations.SUCCESSFUL)
        for l in self.listeners:
            l.on_finished (e)
Пример #5
0
 def start (self):
     if len (self.errors) == 0:
         e = operations.FinishedEvent (self, operations.SUCCESSFUL)
         for l in self.listeners:
             l.on_finished (e)
         return
             
     elif len (self.errors) > 1:
         title = _("Unsupported file types")
     else:
         title = _("Unsupported file type")
         
     filenames = []
     for e in self.errors:
         filenames.append (gnomevfs.URI(e.hints['location']).short_name)
     del self.__errors
     
     if len (filenames) == 1:
         msg = _("The following files were not added:") + "\n"
     else:
         msg = _("The following files were not added:") + "\n"
     
     msg +=  " " + filenames[0]
     
     for f in filenames[1:]:
         msg += ", " + f
     gtkutil.dialog_error (title, msg, self.parent)
     
     e = operations.FinishedEvent (self, operations.SUCCESSFUL)
     for l in self.listeners:
         l.on_finished (e)
Пример #6
0
 def run_dialog (self, *args):
     app = self.parent.application
     win = self.parent
     
     self.__sync_file_filters ()
     
     if self.file_dlg.run () == gtk.RESPONSE_OK:
         filename = self.file_dlg.get_filename ()
         basename = os.path.basename (filename)
         if os.path.exists (filename) and gtkutil.dialog_ok_cancel (
             _("Replace existing file"),
             _("A file named <i>%s</i> already exists. "
             "Do you want to replace it with the one "
             "you are saving?") % basename,
             win
         ) != gtk.RESPONSE_OK:
             
             self.file_dlg.unselect_all()
             self.file_dlg.hide()
             return
             
         try:
             oper = app.savePlaylist.save (filename)
         except SerpentineNotSupportedError:
             gtkutil.dialog_error (
                 _("Unsupported Format"),
                 _("The playlist format you used (by the file extension) is "
                 "currently not supported."),
                 win
             )
         oper.listeners.append (self)
         oper.start ()
     
     self.file_dlg.unselect_all()
     self.file_dlg.hide()
Пример #7
0
    def on_finished(self, evt):
        win = self.parent

        if evt.id != operations.SUCCESSFUL:
            gtkutil.dialog_error(
                _("Playlist Not Saved"),
                _("There was an error while saving the playlist."),
                parent=win)
Пример #8
0
 def on_finished (self, evt):
     win = self.parent
         
     if evt.id != operations.SUCCESSFUL:
         gtkutil.dialog_error (
             _("Playlist Not Saved"),
             _("There was an error while saving the playlist."),
             parent = win
         )
Пример #9
0
 def on_finished (self, evt):
     if evt.id != operations.ERROR:
         return
     
     gtkutil.dialog_error (
         _("Converting files failed"),
         _("Writing to disc didn't start so it is still usable."),
         self.win
     )
Пример #10
0
    def on_finished(self, evt):
        win = self.parent

        if evt.id == operations.SUCCESSFUL:
            gtkutil.dialog_warn(_("Playlist Saved"),
                                _("Playlist was saved successfully."), win)
        else:
            gtkutil.dialog_error(
                _("Playlist Not Saved"),
                _("There was an error while saving the playlist."), win)
Пример #11
0
    def on_finished(self, evt):
        if evt.id == operations.SUCCESSFUL:
            return

        gtkutil.dialog_error (
            evt.id == operations.ERROR and        \
                      _("Writing to disc failed") or \
                      _("Writing to disc canceled"),
            _("The writing operation as started so the disc might be unusable."),
            self.win
        )
Пример #12
0
 def on_finished (self, evt):
     if evt.id == operations.SUCCESSFUL:
         return
     
     gtkutil.dialog_error (
         evt.id == operations.ERROR and        \
                   _("Writing to disc failed") or \
                   _("Writing to disc canceled"),
         _("The writing operation as started so the disc might be unusable."),
         self.win
     )
Пример #13
0
    def on_finished(self, evt):
        if evt.id == operations.SUCCESSFUL:
            return

        if evt.id == operations.ERROR:
            title = _("Writing to disc failed")
        else:
            title = _("Writing to disc canceled")

        if evt.error is None:
            msg = _("The writing operation has started. The disc may " "be unusable.")
        else:
            msg = str(evt.error)

        gtkutil.dialog_error(title, str(msg), parent=self.win)
Пример #14
0
 def on_finished (self, evt):
     win = self.parent
         
     if evt.id == operations.SUCCESSFUL:
         gtkutil.dialog_warn (
             _("Playlist Saved"),
             _("Playlist was saved successfully."),
             parent = win
         )
     else:
         gtkutil.dialog_error (
             _("Playlist Not Saved"),
             _("There was an error while saving the playlist."),
             parent = win
         )
Пример #15
0
    def on_finished(self, evt):
        if evt.id == operations.SUCCESSFUL:
            return

        if evt.id == operations.ERROR:
            title = _("Writing to disc failed")
        else:
            title = _("Writing to disc canceled")

        if evt.error is None:
            msg = _("The writing operation has started. The disc may "
                    "be unusable.")
        else:
            msg = str(evt.error)

        gtkutil.dialog_error(title, str(msg), parent=self.win)
Пример #16
0
    def on_finished(self, evt):
        if evt.id != operations.ERROR:
            return
        err = evt.error

        # Handle missing files
        if isinstance(err, gst.GError) and err.code == gst.RESOURCE_ERROR_NOT_FOUND:
            gtkutil.dialog_error(
                _("Converting files failed"),
                _("Some of the files were missing. The disc is still usable."),
                parent=self.win,
            )
            return

        gtkutil.dialog_error(
            _("Converting files failed"), _("Writing to disc didn't start so it is still usable."), parent=self.win
        )
Пример #17
0
    def on_finished(self, evt):
        if evt.id != operations.ERROR:
            return
        err = evt.error

        # Handle missing files
        if isinstance(err,
                      gst.GError) and err.code == gst.RESOURCE_ERROR_NOT_FOUND:
            gtkutil.dialog_error(
                _("Converting files failed"),
                _("Some of the files were missing. The disc is still usable."),
                parent=self.win)
            return

        gtkutil.dialog_error(
            _("Converting files failed"),
            _("Writing to disc didn't start so it is still usable."),
            parent=self.win)
Пример #18
0
    def run_dialog (self, *args):
        app = self.parent.application
        win = self.parent
        
        self.__sync_file_filters ()
        
        while self.file_dlg.run () == gtk.RESPONSE_OK:
            filename = self.file_dlg.get_filename ()
            basename = os.path.basename (filename)
            index = self.combo.get_active ()
            if index == 0:
                extension = None
            else:
                extension = self.store[index][1]
                
            if os.path.exists (filename) and gtkutil.dialog_ok_cancel (
                _("Replace existing file"),
                _("A file named <i>%s</i> already exists. "
                "Do you want to replace it with the one "
                "you are saving?") % basename,
                parent = win
            ) != gtk.RESPONSE_OK:
                
                self.file_dlg.unselect_all()
                self.file_dlg.hide()
                return
            
            try:
                oper = app.savePlaylist.save (filename, extension)
                oper.listeners.append (self)
                oper.start ()
                break

            except SerpentineNotSupportedError:
                # In this case the user supplied a wrong extension
                # let's ask for him to choose one
                
                if extension is None:
                    # convert to strings
                    items = map(lambda row: row[0], self.store)
                    # First row is useless
                    del items[0]
                    
                    indexes, response = gtkutil.choice_dialog(
                        _("Select one playlist format"),
                        _("Serpentine will open any of these formats so the "
                          "one you choose only matters if you are going to "
                          "open with other applications."),
                        one_text_item = _("Do you want to save as the %s "
                                          "format?"),
                        min_select = 1,
                        max_select = 1,
                        parent = win,
                        items = items,
                        ok_button = gtk.STOCK_SAVE,
                    )
                    if len(indexes) != 0:
                        index, = indexes
                        # Since we deleted the first row from the items then
                        # the index have an offset of 1
                        index += 1
                        row = self.store[index]
                        extension = row[1]
                        
                        # Save the file
                        oper = app.savePlaylist.save (filename, extension)
                        oper.listeners.append (self)
                        oper.start ()
                        
                        # Select the option in the list store
                        self.combo.set_active(index)
                        break
                        
                        
                else:
                    gtkutil.dialog_error (
                        _("Unsupported Format"),
                        _("The playlist format you used (by the file extension) is "
                        "currently not supported."),
                        parent = win
                    )
                    
            
        self.file_dlg.unselect_all()
        self.file_dlg.hide()
Пример #19
0
    def run_dialog(self, *args):
        app = self.parent.application
        win = self.parent

        self.__sync_file_filters()

        while self.file_dlg.run() == gtk.RESPONSE_OK:
            filename = self.file_dlg.get_filename()
            basename = os.path.basename(filename)
            index = self.combo.get_active()
            if index == 0:
                extension = None
            else:
                extension = self.store[index][1]

            if os.path.exists(filename) and gtkutil.dialog_ok_cancel(
                    _("Replace existing file"),
                    _("A file named <i>%s</i> already exists. "
                      "Do you want to replace it with the one "
                      "you are saving?") % basename,
                    parent=win) != gtk.RESPONSE_OK:

                self.file_dlg.unselect_all()
                self.file_dlg.hide()
                return

            try:
                oper = app.savePlaylist.save(filename, extension)
                oper.listeners.append(self)
                oper.start()
                break

            except SerpentineNotSupportedError:
                # In this case the user supplied a wrong extension
                # let's ask for him to choose one

                if extension is None:
                    # convert to strings
                    items = map(lambda row: row[0], self.store)
                    # First row is useless
                    del items[0]

                    indexes, response = gtkutil.choice_dialog(
                        _("Select one playlist format"),
                        _("Serpentine will open any of these formats so the "
                          "one you choose only matters if you are going to "
                          "open with other applications."),
                        one_text_item=_("Do you want to save as the %s "
                                        "format?"),
                        min_select=1,
                        max_select=1,
                        parent=win,
                        items=items,
                        ok_button=gtk.STOCK_SAVE,
                    )
                    if len(indexes) != 0:
                        index, = indexes
                        # Since we deleted the first row from the items then
                        # the index have an offset of 1
                        index += 1
                        row = self.store[index]
                        extension = row[1]

                        # Save the file
                        oper = app.savePlaylist.save(filename, extension)
                        oper.listeners.append(self)
                        oper.start()

                        # Select the option in the list store
                        self.combo.set_active(index)
                        break

                else:
                    gtkutil.dialog_error(
                        _("Unsupported Format"),
                        _("The playlist format you used (by the file extension) is "
                          "currently not supported."),
                        parent=win)

        self.file_dlg.unselect_all()
        self.file_dlg.hide()