本文整理汇总了Python中quodlibet.qltk.songlist.SongList.set_all_column_headers方法的典型用法代码示例。如果您正苦于以下问题:Python SongList.set_all_column_headers方法的具体用法?Python SongList.set_all_column_headers怎么用?Python SongList.set_all_column_headers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quodlibet.qltk.songlist.SongList
的用法示例。
在下文中一共展示了SongList.set_all_column_headers方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __apply
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import set_all_column_headers [as 别名]
def __apply(self, button, buttons, tiv, aip, fip, aio):
new_headers = set()
# Get the checked headers
for key, name in self.PREDEFINED_TAGS:
if buttons[key].get_active():
new_headers.add(key)
# And the customs
new_headers.update(set(self.other_cols))
on_to_off = dict((on, off) for (w, off, on) in self._toggle_data)
result = []
cur_cols = get_columns()
for h in cur_cols:
if h in new_headers:
result.append(h)
else:
try:
alternative = on_to_off[h]
if alternative in new_headers:
result.append(alternative)
except KeyError:
pass
# Add new ones on the end
result.extend(new_headers - set(result))
# After this, do the substitutions
for (check, off, on) in self._toggle_data:
if check.get_active():
try:
result[result.index(off)] = on
except ValueError:
pass
SongList.set_all_column_headers(result)
示例2: __apply
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import set_all_column_headers [as 别名]
def __apply(self, button, buttons, tiv, aip, fip, others):
headers = []
for key in ["~#disc", "~#track", "title", "album", "artist",
"date", "~basename", "~#rating", "~#length"]:
if buttons[key].get_active(): headers.append(key)
if tiv.get_active():
try: headers[headers.index("title")] = "~title~version"
except ValueError: pass
if aip.get_active():
try: headers[headers.index("album")] = "~album~discsubtitle"
except ValueError: pass
if fip.get_active():
try: headers[headers.index("~basename")] = "~filename"
except ValueError: pass
headers.extend(others.get_text().split())
if "~current" in headers: headers.remove("~current")
headers = [header.lower() for header in headers]
SongList.set_all_column_headers(headers)
示例3: __apply
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import set_all_column_headers [as 别名]
def __apply(self, button, buttons):
result = self.__get_current_columns(buttons)
SongList.set_all_column_headers(result)
示例4: test_set_all_column_headers
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import set_all_column_headers [as 别名]
def test_set_all_column_headers(self):
SongList.set_all_column_headers(self.HEADERS)
headers = [col.header_name for col in self.songlist.get_columns()]
self.failUnlessEqual(headers, self.HEADERS)
示例5: except
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import set_all_column_headers [as 别名]
try: ratings = config.getint("settings", "ratings")
except (ValueError, TypeError): pass
else: util.RATING_PRECISION = 1.0/ratings
try: default_rating = config.getfloat("settings", "default_rating")
except (ValueError, TypeError): pass
else: const.DEFAULT_RATING = default_rating
try: symbol = config.get("settings", "rating_symbol").decode("utf-8")
except UnicodeDecodeError: pass
else: util.RATING_SYMBOL = symbol
if config.get("settings", "headers").split() == []:
config.set("settings", "headers", "title")
headers = config.get("settings", "headers").split()
SongList.set_all_column_headers(headers)
for opt in config.options("header_maps"):
val = config.get("header_maps", opt)
util.tags.add(opt, val)
in_all =("~filename ~uri ~#lastplayed ~#rating ~#playcount ~#skipcount "
"~#added ~#bitrate ~current ~#laststarted ~basename "
"~dirname").split()
for Kind in browsers.browsers:
if Kind.headers is not None: Kind.headers.extend(in_all)
Kind.init(library)
pm = quodlibet.init_plugins(no_plugins)
if hasattr(player, "init_plugins"):
示例6: main
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import set_all_column_headers [as 别名]
def main(argv):
import quodlibet
quodlibet.init_cli()
try:
# we want basic commands not to import gtk (doubles process time)
assert "gi.repository.Gtk" not in sys.modules
sys.modules["gi.repository.Gtk"] = None
startup_actions, cmds_todo = process_arguments(argv)
finally:
sys.modules.pop("gi.repository.Gtk", None)
quodlibet.init()
from quodlibet import app
from quodlibet.qltk import add_signal_watch, Icons
add_signal_watch(app.quit)
import quodlibet.player
import quodlibet.library
from quodlibet import config
from quodlibet import browsers
from quodlibet import util
from quodlibet.util.string import decode
app.name = "Quod Libet"
app.id = "quodlibet"
quodlibet.set_application_info(Icons.QUODLIBET, app.id, app.name)
config.init(os.path.join(quodlibet.get_user_dir(), "config"))
library_path = os.path.join(quodlibet.get_user_dir(), "songs")
print_d("Initializing main library (%s)" % (
quodlibet.util.path.unexpand(library_path)))
library = quodlibet.library.init(library_path)
app.library = library
# this assumes that nullbe will always succeed
from quodlibet.player import PlayerError
wanted_backend = os.environ.get(
"QUODLIBET_BACKEND", config.get("player", "backend"))
backend_traceback = None
for backend in [wanted_backend, "nullbe"]:
try:
player = quodlibet.player.init_player(backend, app.librarian)
except PlayerError:
backend_traceback = decode(traceback.format_exc())
else:
break
app.player = player
os.environ["PULSE_PROP_media.role"] = "music"
os.environ["PULSE_PROP_application.icon_name"] = "quodlibet"
browsers.init()
from quodlibet.qltk.songlist import SongList, get_columns
from quodlibet.util.collection import Album
try:
cover_size = config.getint("browsers", "cover_size")
except config.Error:
pass
else:
if cover_size > 0:
Album.COVER_SIZE = cover_size
headers = get_columns()
SongList.set_all_column_headers(headers)
for opt in config.options("header_maps"):
val = config.get("header_maps", opt)
util.tags.add(opt, val)
in_all = ("~filename ~uri ~#lastplayed ~#rating ~#playcount ~#skipcount "
"~#added ~#bitrate ~current ~#laststarted ~basename "
"~dirname").split()
for Kind in browsers.browsers:
if Kind.headers is not None:
Kind.headers.extend(in_all)
Kind.init(library)
pm = quodlibet.init_plugins("no-plugins" in startup_actions)
if hasattr(player, "init_plugins"):
player.init_plugins()
from quodlibet.qltk import unity
unity.init("quodlibet.desktop", player)
from quodlibet.qltk.songsmenu import SongsMenu
SongsMenu.init_plugins()
from quodlibet.util.cover import CoverManager
app.cover_manager = CoverManager()
app.cover_manager.init_plugins()
#.........这里部分代码省略.........
示例7: main
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import set_all_column_headers [as 别名]
def main():
try:
# we want basic commands not to import gtk (doubles process time)
assert "gi.repository.Gtk" not in sys.modules
sys.modules["gi.repository.Gtk"] = None
startup_actions = process_arguments()
# this will exit if it succeeds
control('focus', ignore_error=True)
finally:
sys.modules.pop("gi.repository.Gtk", None)
import quodlibet
from quodlibet import app
from quodlibet.qltk import add_signal_watch, icons
add_signal_watch(app.quit)
import quodlibet.player
import quodlibet.library
from quodlibet import config
from quodlibet import browsers
from quodlibet import const
from quodlibet import util
config.init(const.CONFIG)
app.name = "Quod Libet"
app.id = "quodlibet"
quodlibet.init(icon=icons.QUODLIBET, name=app.name, proc_title=app.id)
print_d("Initializing main library (%s)" % (
quodlibet.util.path.unexpand(const.LIBRARY)))
library = quodlibet.library.init(const.LIBRARY)
app.library = library
from quodlibet.player import PlayerError
# this assumes that nullbe will always succeed
for backend in [config.get("player", "backend"), "nullbe"]:
try:
player = quodlibet.init_backend(backend, app.librarian)
except PlayerError as error:
print_e("%s. %s" % (error.short_desc, error.long_desc))
else:
break
app.player = player
os.environ["PULSE_PROP_media.role"] = "music"
os.environ["PULSE_PROP_application.icon_name"] = "quodlibet"
browsers.init()
from quodlibet.qltk.songlist import SongList, get_columns
from quodlibet.util.collection import Album
try:
cover_size = config.getint("browsers", "cover_size")
except config.Error:
pass
else:
if cover_size > 0:
Album.COVER_SIZE = cover_size
headers = get_columns()
SongList.set_all_column_headers(headers)
for opt in config.options("header_maps"):
val = config.get("header_maps", opt)
util.tags.add(opt, val)
in_all = ("~filename ~uri ~#lastplayed ~#rating ~#playcount ~#skipcount "
"~#added ~#bitrate ~current ~#laststarted ~basename "
"~dirname").split()
for Kind in browsers.browsers:
if Kind.headers is not None:
Kind.headers.extend(in_all)
Kind.init(library)
pm = quodlibet.init_plugins("no-plugins" in startup_actions)
if hasattr(player, "init_plugins"):
player.init_plugins()
from quodlibet.qltk import unity
unity.init("quodlibet.desktop", player)
from quodlibet.qltk.songsmenu import SongsMenu
SongsMenu.init_plugins()
from quodlibet.util.cover import CoverManager
app.cover_manager = CoverManager()
app.cover_manager.init_plugins()
from quodlibet.plugins.playlist import PLAYLIST_HANDLER
PLAYLIST_HANDLER.init_plugins()
from quodlibet.qltk.quodlibetwindow import QuodLibetWindow
app.window = window = QuodLibetWindow(library, player)
#.........这里部分代码省略.........
示例8: main
# 需要导入模块: from quodlibet.qltk.songlist import SongList [as 别名]
# 或者: from quodlibet.qltk.songlist.SongList import set_all_column_headers [as 别名]
def main(argv=None):
if argv is None:
argv = sys_argv
import quodlibet
config_file = os.path.join(quodlibet.get_user_dir(), "config")
quodlibet.init_cli(config_file=config_file)
try:
# we want basic commands not to import gtk (doubles process time)
assert "gi.repository.Gtk" not in sys.modules
sys.modules["gi.repository.Gtk"] = None
startup_actions, cmds_todo = process_arguments(argv)
finally:
sys.modules.pop("gi.repository.Gtk", None)
quodlibet.init()
from quodlibet import app
from quodlibet.qltk import add_signal_watch, Icons
add_signal_watch(app.quit)
import quodlibet.player
import quodlibet.library
from quodlibet import config
from quodlibet import browsers
from quodlibet import util
app.name = "Quod Libet"
app.description = _("Music player and music library manager")
app.id = "quodlibet"
quodlibet.set_application_info(Icons.QUODLIBET, app.id, app.name)
library_path = os.path.join(quodlibet.get_user_dir(), "songs")
print_d("Initializing main library (%s)" % (
quodlibet.util.path.unexpand(library_path)))
library = quodlibet.library.init(library_path)
app.library = library
# this assumes that nullbe will always succeed
from quodlibet.player import PlayerError
wanted_backend = environ.get(
"QUODLIBET_BACKEND", config.get("player", "backend"))
try:
player = quodlibet.player.init_player(wanted_backend, app.librarian)
except PlayerError:
print_exc()
player = quodlibet.player.init_player("nullbe", app.librarian)
app.player = player
environ["PULSE_PROP_media.role"] = "music"
environ["PULSE_PROP_application.icon_name"] = "quodlibet"
browsers.init()
from quodlibet.qltk.songlist import SongList, get_columns
headers = get_columns()
SongList.set_all_column_headers(headers)
for opt in config.options("header_maps"):
val = config.get("header_maps", opt)
util.tags.add(opt, val)
in_all = ("~filename ~uri ~#lastplayed ~#rating ~#playcount ~#skipcount "
"~#added ~#bitrate ~current ~#laststarted ~basename "
"~dirname").split()
for Kind in browsers.browsers:
if Kind.headers is not None:
Kind.headers.extend(in_all)
Kind.init(library)
pm = quodlibet.init_plugins("no-plugins" in startup_actions)
if hasattr(player, "init_plugins"):
player.init_plugins()
from quodlibet.qltk import unity
unity.init("quodlibet.desktop", player)
from quodlibet.qltk.songsmenu import SongsMenu
SongsMenu.init_plugins()
from quodlibet.util.cover import CoverManager
app.cover_manager = CoverManager()
app.cover_manager.init_plugins()
from quodlibet.plugins.playlist import PLAYLIST_HANDLER
PLAYLIST_HANDLER.init_plugins()
from quodlibet.plugins.query import QUERY_HANDLER
QUERY_HANDLER.init_plugins()
from gi.repository import GLib
#.........这里部分代码省略.........