/usr/share/pyshared/quodlibet/qltk/chooser.py is in exfalso 3.0.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # -*- coding: utf-8 -*-
# Copyright 2004-2005 Joe Wreschnig, Michael Urman, IƱigo Serna
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation
from gi.repository import Gtk
from quodlibet.qltk import get_top_parent
# Choose folders and return them when run.
class FolderChooser(Gtk.FileChooserDialog):
def __init__(self, parent, title, initial_dir=None,
action=Gtk.FileChooserAction.SELECT_FOLDER):
super(FolderChooser, self).__init__(
title=title, parent=get_top_parent(parent), action=action,
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
if initial_dir:
self.set_current_folder(initial_dir)
self.set_local_only(True)
self.set_select_multiple(True)
def run(self):
resp = super(FolderChooser, self).run()
fns = self.get_filenames()
if resp == Gtk.ResponseType.OK:
return fns
else:
return []
# Choose files and return them when run.
class FileChooser(FolderChooser):
def __init__(self, parent, title, filter=None, initial_dir=None):
super(FileChooser, self).__init__(
parent, title, initial_dir, Gtk.FileChooserAction.OPEN)
if filter:
def new_filter(args, realfilter):
return realfilter(args.filename)
f = Gtk.FileFilter()
f.set_name(_("Songs"))
f.add_custom(Gtk.FileFilterFlags.FILENAME, new_filter, filter)
self.add_filter(f)
|