361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
|
w.set_current_page(pos)
pass
#-- Save-As dialog
#
@staticmethod
def save_file(title="Save As", parent=None, fn="", formats=[("*.pls", "*.pls"), ("*.xspf", "*.xpsf"), ("*.m3u", "*.m3u"), ("*.jspf", "*.jspf"), ("*.asx", "*.asx"), ("*.json", "*.json"), ("*.smil", "*.smil"), ("*.desktop", "*.desktop"), ("*","*")]):
# With overwrite confirmation
c = gtk.FileChooserDialog(title, parent, action=gtk.FILE_CHOOSER_ACTION_SAVE,
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK))
c.set_do_overwrite_confirmation(True)
# Params
if fn:
c.set_current_name(fn)
fn = ""
for fname,ftype in formats:
f = gtk.FileFilter()
f.set_name(fname)
f.add_pattern(ftype)
c.add_filter(f)
# Yes, that's how to retrieve signals for changed filter selections
try:
filterbox = c.get_children()[0].get_children()[0]
|
>
|
>
|
<
|
|
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
|
w.set_current_page(pos)
pass
#-- Save-As dialog
#
save_formats = [("*.pls", "*.pls"), ("*.xspf", "*.xpsf"), ("*.m3u", "*.m3u"), ("*.jspf", "*.jspf"), ("*.asx", "*.asx"), ("*.json", "*.json"), ("*.smil", "*.smil"), ("*.desktop", "*.desktop"), ("*","*")]
@staticmethod
def save_file(title="Save As", parent=None, fn="", formats=None, action=gtk.FILE_CHOOSER_ACTION_SAVE, action_btn=gtk.STOCK_SAVE):
# With overwrite confirmation
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, action_btn, gtk.RESPONSE_OK)
c = gtk.FileChooserDialog(title, parent, action=action, buttons=buttons)
c.set_do_overwrite_confirmation(True)
# Params
if fn:
c.set_current_name(fn)
fn = ""
for fname,ftype in (formats or self.save_formats):
f = gtk.FileFilter()
f.set_name(fname)
f.add_pattern(ftype)
c.add_filter(f)
# Yes, that's how to retrieve signals for changed filter selections
try:
filterbox = c.get_children()[0].get_children()[0]
|