357
358
359
360
361
362
363
364
365
366
367
368
369
370
371 | 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"), ("*.wpl", "*.wpl"), ("*","*")]):
# 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 |
|
| 357
358
359
360
361
362
363
364
365
366
367
368
369
370
371 | 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 |
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407 |
# Callback for changed FileFilter, updates current filename extension
@staticmethod
def save_file_filterchange(c):
fn, ext = c.get_filename(), c.get_filter().get_name()
if fn and ext:
fn = os.path.basename(fn)
c.set_current_name(re.sub(r"\.(m3u|pls|xspf|jspf|asx|json|smil|wpl)$", ext.strip("*"), fn))
# Spool gtk update calls from non-main threads (optional immediate=1 flag to run task next, not last)
@staticmethod
def do(callback, *args, **kwargs):
name = inspect.getsource(callback).strip() if callback.__name__=='<lambda>' else str(callback) |
|
| 393
394
395
396
397
398
399
400
401
402
403
404
405
406
407 |
# Callback for changed FileFilter, updates current filename extension
@staticmethod
def save_file_filterchange(c):
fn, ext = c.get_filename(), c.get_filter().get_name()
if fn and ext:
fn = os.path.basename(fn)
c.set_current_name(re.sub(r"\.(m3u|pls|xspf|jspf|asx|json|smil|desktop|url|wpl)8?$", ext.strip("*"), fn))
# Spool gtk update calls from non-main threads (optional immediate=1 flag to run task next, not last)
@staticmethod
def do(callback, *args, **kwargs):
name = inspect.getsource(callback).strip() if callback.__name__=='<lambda>' else str(callback) |