~ubuntu-branches/ubuntu/trusty/serpentine/trusty

« back to all changes in this revision

Viewing changes to serpentine/mainwindow.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2006-03-03 11:12:42 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060303111242-01ogkka2273vre4x
Tags: 0.6.91-0ubuntu1
New upstream version (UVF exception approved by mdz)

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
    def on_finished (self, evt):
166
166
        win = self.parent
167
167
            
168
 
        if evt.id == operations.SUCCESSFUL:
169
 
            gtkutil.dialog_info (
170
 
                _("Playlist Saved"),
171
 
                _("Playlist was saved successfully."),
172
 
                parent = win
173
 
            )
174
 
        else:
 
168
        if evt.id != operations.SUCCESSFUL:
175
169
            gtkutil.dialog_error (
176
170
                _("Playlist Not Saved"),
177
171
                _("There was an error while saving the playlist."),
229
223
                break
230
224
 
231
225
            except SerpentineNotSupportedError:
232
 
                gtkutil.dialog_error (
233
 
                    _("Unsupported Format"),
234
 
                    _("The playlist format you used (by the file extension) is "
235
 
                    "currently not supported."),
236
 
                    parent = win
237
 
                )
 
226
                # In this case the user supplied a wrong extension
 
227
                # let's ask for him to choose one
 
228
                
 
229
                if extension is None:
 
230
                    # convert to strings
 
231
                    items = map(lambda row: row[0], self.store)
 
232
                    # First row is useless
 
233
                    del items[0]
 
234
                    
 
235
                    indexes, response = gtkutil.choice_dialog(
 
236
                        _("Select one playlist format"),
 
237
                        _("Serpentine will open any of these formats so the "
 
238
                          "one you choose only matters if you are going to "
 
239
                          "open with other applications."),
 
240
                        one_text_item = _("Do you want to save as the %s "
 
241
                                          "format?"),
 
242
                        min_select = 1,
 
243
                        max_select = 1,
 
244
                        parent = win,
 
245
                        items = items,
 
246
                        ok_button = gtk.STOCK_SAVE,
 
247
                    )
 
248
                    if len(indexes) != 0:
 
249
                        index, = indexes
 
250
                        # Since we deleted the first row from the items then
 
251
                        # the index have an offset of 1
 
252
                        index += 1
 
253
                        row = self.store[index]
 
254
                        extension = row[1]
 
255
                        
 
256
                        # Save the file
 
257
                        oper = app.savePlaylist.save (filename, extension)
 
258
                        oper.listeners.append (self)
 
259
                        oper.start ()
 
260
                        
 
261
                        # Select the option in the list store
 
262
                        self.combo.set_active(index)
 
263
                        break
 
264
                        
 
265
                        
 
266
                else:
 
267
                    gtkutil.dialog_error (
 
268
                        _("Unsupported Format"),
 
269
                        _("The playlist format you used (by the file extension) is "
 
270
                        "currently not supported."),
 
271
                        parent = win
 
272
                    )
 
273
                    
238
274
            
239
275
        self.file_dlg.unselect_all()
240
276
        self.file_dlg.hide()