本文整理汇总了Python中quodlibet.config.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: refresh_cb
def refresh_cb(button):
from quodlibet.library import library
from quodlibet.util import copool
paths = util.split_scan_dirs(config.get("settings", "scan"))
exclude = config.get("library", "exclude").split(":")
copool.add(library.rebuild,
paths, False, exclude, cofuncid="library", funcid="library")
开发者ID:silkecho,项目名称:glowing-silk,代码行数:7,代码来源:prefs.py
示例2: restore
def restore(self):
text = config.get("browsers", "query_text").decode("utf-8")
entry = self.__search
entry.set_text(text)
# update_filter expects a parsable query
if Query.is_parsable(text):
self.__update_filter(entry, text, scroll_up=False, restore=True)
keys = config.get("browsers", "albums").split("\n")
# FIXME: If albums is "" then it could be either all albums or
# no albums. If it's "" and some other stuff, assume no albums,
# otherwise all albums.
self.__inhibit()
if keys == [""]:
self.view.set_cursor((0,))
else:
def select_fun(row):
album = row[0]
if not album: # all
return False
return album.str_key in keys
self.view.select_by_func(select_fun)
self.__uninhibit()
开发者ID:pfps,项目名称:quodlibet,代码行数:26,代码来源:main.py
示例3: test_get_columns_migrated
def test_get_columns_migrated(self):
self.failIf(config.get("settings", "headers", None))
columns = "~album,~#replaygain_track_gain,foobar"
config.set("settings", "columns", columns)
self.failUnlessEqual(get_columns(),
["~album", "~#replaygain_track_gain", "foobar"])
self.failIf(config.get("settings", "headers", None))
开发者ID:elfalem,项目名称:quodlibet,代码行数:7,代码来源:test_qltk_songlist.py
示例4: __init__
def __init__(self):
super(PreferencesWindow.Tagging, self).__init__(spacing=12)
self.set_border_width(12)
self.title = _("Tags")
vbox = gtk.VBox(spacing=6)
cb = ConfigCheckButton(_("Auto-save tag changes"),
'editing', 'auto_save_changes',
populate=True)
cb.set_tooltip_text(_("Save changes to tags without confirmation "
"when editing multiple files"))
vbox.pack_start(cb, expand=False)
cb = ConfigCheckButton(_("Show _programmatic tags"),
'editing', 'alltags', populate=True)
cb.set_tooltip_text(
_("Access all tags, including machine-generated ones "
"e.g. MusicBrainz or Replay Gain tags"))
vbox.pack_start(cb, expand=False)
hb = gtk.HBox(spacing=6)
e = UndoEntry()
e.set_text(config.get("editing", "split_on"))
e.connect('changed', self.__changed, 'editing', 'split_on')
e.set_tooltip_text(
_("A list of separators to use when splitting tag values. "
"The list is space-separated"))
l = gtk.Label(_("Split _on:"))
l.set_use_underline(True)
l.set_mnemonic_widget(e)
hb.pack_start(l, expand=False)
hb.pack_start(e)
vbox.pack_start(hb, expand=False)
vb2 = gtk.VBox(spacing=6)
cb = ConfigCheckButton(_("Save ratings and play _counts"),
"editing", "save_to_songs", populate=True)
vb2.pack_start(cb)
hb = gtk.HBox(spacing=6)
lab = gtk.Label(_("_Email:"))
entry = UndoEntry()
entry.set_tooltip_text(_("Ratings and play counts will be set "
"for this email address"))
entry.set_text(config.get("editing", "save_email"))
entry.connect('changed', self.__changed, 'editing', 'save_email')
hb.pack_start(lab, expand=False)
hb.pack_start(entry)
lab.set_mnemonic_widget(entry)
lab.set_use_underline(True)
vb2.pack_start(hb)
f = qltk.Frame(_("Tag Editing"), child=vbox)
self.pack_start(f, expand=False)
f = qltk.Frame(_("Ratings"), child=vb2)
self.pack_start(f, expand=False)
self.show_all()
开发者ID:silkecho,项目名称:glowing-silk,代码行数:59,代码来源:prefs.py
示例5: __init__
def __init__(self):
print_d("Starting Soundcloud API...")
super(SoundcloudApiClient, self).__init__(self.API_ROOT)
self.access_token = config.get("browsers", "soundcloud_token", None)
self.online = bool(self.access_token)
self.user_id = config.get("browsers", "soundcloud_user_id", None)
if not self.user_id:
self._get_me()
self.username = None
开发者ID:zsau,项目名称:quodlibet,代码行数:9,代码来源:api.py
示例6: test_get_columns_migrates
def test_get_columns_migrates(self):
self.failIf(config.get("settings", "headers", None))
self.failIf(config.get("settings", "columns", None))
headers = "~album ~#replaygain_track_gain foobar"
config.set("settings", "headers", headers)
columns = get_columns()
self.failUnlessEqual(columns, ["~album", "~#replaygain_track_gain",
"foobar"])
self.failIf(config.get("settings", "headers", None))
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:10,代码来源:test_qltk_songlist.py
示例7: test_get_set_columns
def test_get_set_columns(self):
self.failIf(config.get("settings", "headers", None))
self.failIf(config.get("settings", "columns", None))
columns = ["first", "won't", "two words", "4"]
set_columns(columns)
self.failUnlessEqual(columns, get_columns())
columns += ["~~another~one"]
set_columns(columns)
self.failUnlessEqual(columns, get_columns())
self.failIf(config.get("settings", "headers", None))
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:10,代码来源:test_qltk_songlist.py
示例8: restore
def restore(self):
try:
name = config.get("browsers", "playlist")
except config.Error as e:
print_d("Couldn't get last playlist from config: %s" % e)
else:
self.__view.select_by_func(lambda r: r[0].name == name, one=True)
try:
text = config.get("browsers", "query_text")
except config.Error as e:
print_d("Couldn't get last search string from config: %s" % e)
else:
self._set_text(text)
开发者ID:mistotebe,项目名称:quodlibet,代码行数:13,代码来源:main.py
示例9: connect
def connect(self):
'''Moved from __init__ to ensure we always read the current
configuration data'''
self._host = config.get("connection", "hostname")
self._port = config.get("connection", "port")
self._password = config.get("connection", "password")
try:
self._client.connect(self._host, self._port)
# Catch socket errors
except IOError as (errno, strerror):
raise PollerError("Could not connect to '%s': %s" %
(self._host, strerror))
开发者ID:silkecho,项目名称:glowing-silk,代码行数:13,代码来源:quodmpd.py
示例10: _get_order
def _get_order(self, shuffle):
"""Get the active order for shuffle/inorder mode"""
first_matching = None
if shuffle:
name = config.get("memory", "order_shuffle")
else:
name = config.get("memory", "order")
for order in ORDERS:
if order.is_shuffle == shuffle:
first_matching = first_matching or order
if order.name == name:
return order
return first_matching
开发者ID:tintinyoung,项目名称:quodlibet,代码行数:14,代码来源:playorder.py
示例11: restore
def restore(self):
try:
text = config.get("browsers", "query_text")
except Exception:
return
self._text = text
开发者ID:bossjones,项目名称:quodlibet,代码行数:7,代码来源:empty.py
示例12: __init__
def __init__(self, tag, value):
super(SplitPerson, self).__init__(label=self.title, use_underline=True)
self.set_image(Gtk.Image.new_from_icon_name(
Icons.EDIT_FIND_REPLACE, Gtk.IconSize.MENU))
spls = config.get("editing", "split_on").decode(
'utf-8', 'replace').split()
self.set_sensitive(bool(split_people(value, spls)[1]))
开发者ID:urielz,项目名称:quodlibet,代码行数:7,代码来源:edittags.py
示例13: plugin_on_song_started
def plugin_on_song_started(self, song):
if (song is None and config.get("memory", "order") != "onesong" and
not app.player.paused):
browser = app.window.browser
if not browser.can_filter('album'):
return
albumlib = app.library.albums
albumlib.load()
if browser.can_filter_albums():
keys = browser.list_albums()
values = [albumlib[k] for k in keys]
else:
keys = set(browser.list("album"))
values = [a for a in albumlib if a("album") in keys]
if self.use_weights:
# Select 3% of albums, or at least 3 albums
nr_albums = int(min(len(values), max(0.03 * len(values), 3)))
chosen_albums = random.sample(values, nr_albums)
album_scores = sorted(self._score(chosen_albums))
for score, album in album_scores:
print_d("%0.2f scored by %s" % (score, album("album")))
album = max(album_scores)[1]
else:
album = random.choice(values)
if album is not None:
self.schedule_change(album)
开发者ID:MikeiLL,项目名称:quodlibet,代码行数:31,代码来源:randomalbum.py
示例14: restore
def restore(self):
try:
text = config.get("browsers", "query_text")
except config.Error:
return
self._set_text(text)
开发者ID:kriskielce88,项目名称:xn--ls8h,代码行数:7,代码来源:search.py
示例15: __post_read
def __post_read(self):
email = config.get("editing", "save_email").strip()
maps = {"rating": float, "playcount": int}
for keyed_key, func in maps.items():
for subkey in ["", ":" + const.EMAIL, ":" + email]:
key = keyed_key + subkey
if key in self:
try:
self["~#" + keyed_key] = func(self[key])
except ValueError:
pass
del(self[key])
if "metadata_block_picture" in self:
self.has_images = True
del(self["metadata_block_picture"])
if "coverart" in self:
self.has_images = True
del(self["coverart"])
if "coverartmime" in self:
del(self["coverartmime"])
self.__post_read_total("tracktotal", "totaltracks", "tracknumber")
self.__post_read_total("disctotal", "totaldiscs", "discnumber")
开发者ID:vrasidas,项目名称:quodlibet,代码行数:26,代码来源:xiph.py
示例16: refresh
def refresh(self):
"""Reread the current pipeline config and refresh the list"""
self.handler_block(self.__sig)
model = self.get_model()
model.clear()
self.__fill_model(model)
if not len(model):
self.handler_unblock(self.__sig)
# Translators: Unknown audio output device.
model.append(row=["", _("Unknown")])
self.set_active(0)
self.set_sensitive(False)
return
self.set_sensitive(True)
# Translators: Default audio output device.
model.insert(0, row=["", _("Default")])
dev = config.get("player", "gst_device")
for row in model:
if row[self.DEVICE] == dev:
self.set_active_iter(row.iter)
break
self.handler_unblock(self.__sig)
# If no dev was found, change to default so the config gets reset
if self.get_active() == -1:
self.set_active(0)
开发者ID:silkecho,项目名称:glowing-silk,代码行数:33,代码来源:_gstutils.py
示例17: restore
def restore(self):
try:
names = config.get("browsers", "audiofeeds").split("\t")
except:
pass
else:
self.__view.select_by_func(lambda r: r[0].name in names)
开发者ID:zsau,项目名称:quodlibet,代码行数:7,代码来源:audiofeeds.py
示例18: tag_editing_vbox
def tag_editing_vbox(self):
"""Returns a new VBox containing all tag editing widgets"""
vbox = Gtk.VBox(spacing=6)
cb = CCB(_("Auto-save tag changes"), 'editing',
'auto_save_changes', populate=True,
tooltip=_("Save changes to tags without confirmation "
"when editing multiple files"))
vbox.pack_start(cb, False, True, 0)
hb = Gtk.HBox(spacing=6)
e = UndoEntry()
e.set_text(config.get("editing", "split_on"))
e.connect('changed', self.__changed, 'editing', 'split_on')
e.set_tooltip_text(
_("A list of separators to use when splitting tag values. "
"The list is space-separated"))
def do_revert_split(button, section, option):
config.reset(section, option)
e.set_text(config.get(section, option))
split_revert = Button(_("_Revert"), Icons.DOCUMENT_REVERT)
split_revert.connect("clicked", do_revert_split, "editing",
"split_on")
l = Gtk.Label(label=_("Split _on:"))
l.set_use_underline(True)
l.set_mnemonic_widget(e)
hb.pack_start(l, False, True, 0)
hb.pack_start(e, True, True, 0)
hb.pack_start(split_revert, False, True, 0)
vbox.pack_start(hb, False, True, 0)
return vbox
开发者ID:faubiguy,项目名称:quodlibet,代码行数:31,代码来源:prefs.py
示例19: config_get
def config_get(key, default=''):
"""Returns value for 'key' from config. If key is missing *or empty*,
return default."""
try:
return (config.get("plugins", "scrobbler_%s" % key) or default)
except config.Error:
return default
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:7,代码来源:qlscrobbler.py
示例20: get_init_select_dir
def get_init_select_dir():
scandirs = util.split_scan_dirs(config.get("settings", "scan"))
if scandirs and os.path.isdir(scandirs[-1]):
# start with last added directory
return scandirs[-1]
else:
return const.HOME
开发者ID:silkecho,项目名称:glowing-silk,代码行数:7,代码来源:prefs.py
注:本文中的quodlibet.config.get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论