本文整理汇总了Python中quodlibet.config.getboolean函数的典型用法代码示例。如果您正苦于以下问题:Python getboolean函数的具体用法?Python getboolean怎么用?Python getboolean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getboolean函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_toggle
def test_toggle(self):
config.set("memory", "bar", "on")
c = ConfigCheckMenuItem("dummy", "memory", "bar")
c.set_active(True)
self.failUnless(config.getboolean("memory", "bar") and c.get_active())
c.set_active(False)
while gtk.events_pending(): gtk.main_iteration()
self.failIf(config.getboolean("memory", "bar") or c.get_active())
示例2: previous
def previous(self):
"""Go to the previous song"""
keep_songs = config.getboolean("memory", "queue_keep_songs", False)
q_ignore = config.getboolean("memory", "queue_ignore", False)
if q_ignore or self.pl.sourced or not keep_songs:
self.pl.previous()
else:
self.q.previous()
self._check_sourced()
示例3: ConfigCheckButton
def ConfigCheckButton(cls, label, name, default=False):
"""
Create a new `ConfigCheckButton` for `name`, pre-populated correctly
"""
option = cls._config_key(name)
try:
config.getboolean(PM.CONFIG_SECTION, option)
except config.Error:
cls.config_set(name, default)
return ConfigCheckButton(label, PM.CONFIG_SECTION,
option, populate=True)
示例4: next_ended
def next_ended(self):
"""Switch to the next song (action comes from the user)"""
keep_songs = config.getboolean("memory", "queue_keep_songs", False)
q_ignore = config.getboolean("memory", "queue_ignore", False)
if (self.q.is_empty()
or (q_ignore and not (keep_songs and self.q.sourced))):
self.pl.next_ended()
else:
self.q.next_ended()
self._check_sourced()
示例5: __init__
def __init__(self, parent):
if self.is_not_unique(): return
super(Preferences, self).__init__()
self.set_border_width(12)
self.set_title(_("Album List Preferences") + " - Quod Libet")
self.set_default_size(400, 270)
self.set_transient_for(qltk.get_top_parent(parent))
box = gtk.VBox(spacing=6)
cb = ConfigCheckButton(
_("Show album _covers"), "browsers", "album_covers")
cb.set_active(config.getboolean("browsers", "album_covers"))
gobject_weak(cb.connect, 'toggled', lambda s: AlbumList.toggle_covers())
box.pack_start(cb, expand=False)
cb = ConfigCheckButton(
_("Inline _search includes people"),
"browsers", "album_substrings")
cb.set_active(config.getboolean("browsers", "album_substrings"))
box.pack_start(cb, expand=False)
vbox = gtk.VBox(spacing=6)
label = gtk.Label()
label.set_alignment(0.0, 0.5)
edit = PatternEditBox(PATTERN)
edit.text = AlbumList._pattern_text
gobject_weak(edit.apply.connect, 'clicked', self.__set_pattern, edit)
gobject_weak(edit.buffer.connect_object, 'changed',
self.__preview_pattern, edit, label, parent=edit)
vbox.pack_start(label, expand=False)
vbox.pack_start(edit)
self.__preview_pattern(edit, label)
f = qltk.Frame(_("Album Display"), child=vbox)
box.pack_start(f)
main_box = gtk.VBox(spacing=12)
close = gtk.Button(stock=gtk.STOCK_CLOSE)
close.connect('clicked', lambda *x: self.destroy())
b = gtk.HButtonBox()
b.set_layout(gtk.BUTTONBOX_END)
b.pack_start(close)
main_box.pack_start(box)
main_box.pack_start(b, expand=False)
self.add(main_box)
close.grab_focus()
self.show_all()
示例6: __search_func
def __search_func(self, model, column, key, iter_, data):
album = model.get_album(iter_)
if album is None:
return config.getboolean("browsers", "covergrid_all", False)
key = key.decode('utf-8').lower()
title = album.title.lower()
if key in title:
return False
if config.getboolean("browsers", "album_substrings"):
people = (p.lower() for p in album.list("~people"))
for person in people:
if key in person:
return False
return True
示例7: do_draw
def do_draw(self, cairo_context):
pixbuf = self._get_pixbuf()
if not pixbuf:
return
alloc = self.get_allocation()
width, height = alloc.width, alloc.height
scale_factor = get_scale_factor(self)
width *= scale_factor
height *= scale_factor
if self._path:
if width < 2 or height < 2:
return
round_thumbs = config.getboolean("albumart", "round")
pixbuf = scale(
pixbuf, (width - 2 * scale_factor, height - 2 * scale_factor))
pixbuf = add_border_widget(pixbuf, self, None, round_thumbs)
else:
pixbuf = scale(pixbuf, (width, height))
style_context = self.get_style_context()
pbosf = get_pbosf_for_pixbuf(self, pixbuf)
pbosf_render(style_context, cairo_context, pbosf, 0, 0)
示例8: iter_backends
def iter_backends():
try:
from .gnome import GnomeBackend, MateBackend
except MMKeysImportError:
pass
else:
yield GnomeBackend
yield MateBackend
try:
from .keybinder import KeybinderBackend
except MMKeysImportError:
pass
else:
yield KeybinderBackend
try:
from .pyhook import PyHookBackend
except MMKeysImportError:
pass
else:
yield PyHookBackend
if config.getboolean("settings", "osx_mmkeys"):
try:
from .osx import OSXBackend
except MMKeysImportError:
pass
else:
yield OSXBackend
示例9: __init__
def __init__(self, library):
super(SearchBar, self).__init__()
self.set_spacing(6)
self.set_orientation(Gtk.Orientation.VERTICAL)
self._query = None
self._library = library
completion = LibraryTagCompletion(library.librarian)
self.accelerators = Gtk.AccelGroup()
show_limit = config.getboolean("browsers", "search_limit")
sbb = LimitSearchBarBox(completion=completion,
accel_group=self.accelerators,
show_limit=show_limit)
sbb.connect('query-changed', self.__text_parse)
sbb.connect('focus-out', self.__focus)
self._sb_box = sbb
prefs = PreferencesButton(sbb)
sbb.pack_start(prefs, False, True, 0)
align = Align(sbb, left=6, right=6, top=6)
self.pack_start(align, False, True, 0)
self.connect('destroy', self.__destroy)
self.show_all()
示例10: __about_to_finish_sync
def __about_to_finish_sync(self):
"""Returns the next song uri to play or None"""
print_d("About to finish (sync)")
# Chained oggs falsely trigger a gapless transition.
# At least for radio streams we can safely ignore it because
# transitions don't occur there.
# https://github.com/quodlibet/quodlibet/issues/1454
# https://bugzilla.gnome.org/show_bug.cgi?id=695474
if self.song.multisong:
print_d("multisong: ignore about to finish")
return
# mod + gapless deadlocks
# https://github.com/quodlibet/quodlibet/issues/2780
if isinstance(self.song, ModFile):
return
if config.getboolean("player", "gst_disable_gapless"):
print_d("Gapless disabled")
return
# this can trigger twice, see issue 987
if self._in_gapless_transition:
return
self._in_gapless_transition = True
print_d("Select next song in mainloop..")
self._source.next_ended()
print_d("..done.")
song = self._source.current
if song is not None:
return song("~uri")
示例11: __about_to_finish_sync
def __about_to_finish_sync(self):
"""Returns a tuple (ok, next_song). ok is True if the next song
should be set.
"""
print_d("About to finish (sync)")
# Chained oggs falsely trigger a gapless transition.
# At least for radio streams we can safely ignore it because
# transitions don't occur there.
# https://github.com/quodlibet/quodlibet/issues/1454
# https://bugzilla.gnome.org/show_bug.cgi?id=695474
if self.song.multisong:
print_d("multisong: ignore about to finish")
return (False, None)
if config.getboolean("player", "gst_disable_gapless"):
print_d("Gapless disabled")
return (False, None)
# this can trigger twice, see issue 987
if self._in_gapless_transition:
return (False, None)
self._in_gapless_transition = True
print_d("Select next song in mainloop..")
self._source.next_ended()
print_d("..done.")
return (True, self._source.current)
示例12: __update_image
def __update_image(self):
height = self.__size
if not height: return
if self.__resize:
height = min(self.__max_size, height)
width = self.__max_size
else:
width = height
if self.__path is None:
pixbuf = self.__get_no_cover(width, height)
else:
try:
round_thumbs = config.getboolean("albumart", "round")
pixbuf = thumbnails.get_thumbnail(self.__path, (width, height))
pixbuf = thumbnails.add_border(pixbuf, 80, round_thumbs)
except gobject.GError:
pixbuf = self.__get_no_cover(width, height)
self.set_from_pixbuf(pixbuf)
if self.__resize:
self.__ignore = True
self.__sig = self.connect_after("size-allocate",
self.__stop_ignore)
示例13: bind_config
def bind_config(self, section, option):
self.set_active(config.getboolean(section, option))
def toggled_cb(*args):
config.set(section, option, self.get_active())
self.connect('toggled', toggled_cb)
示例14: iter_backends
def iter_backends():
if config.getboolean("settings", "disable_mmkeys"):
return
try:
from .gnome import GnomeBackend, MateBackend
except MMKeysImportError:
pass
else:
yield GnomeBackend
yield MateBackend
try:
from .keybinder import KeybinderBackend
except MMKeysImportError:
pass
else:
yield KeybinderBackend
try:
from .winhook import WinHookBackend
except MMKeysImportError:
pass
else:
yield WinHookBackend
try:
from .osx import OSXBackend
except MMKeysImportError:
pass
else:
yield OSXBackend
示例15: plugin_songs
def plugin_songs(self, songs):
value = -1
while not 0 <= value <= 1:
input_string = GetStringDialog(
self.plugin_window,
self.PLUGIN_NAME,
_("Please give your desired rating on a scale "
"from 0.0 to 1.0"),
_("_Apply"),
Icons.NONE
).run()
if input_string is None:
return
try:
value = float(input_string)
except ValueError:
continue
count = len(songs)
if (count > 1 and config.getboolean("browsers",
"rating_confirm_multiple")):
confirm_dialog = ConfirmRateMultipleDialog(
self.plugin_window, count, value)
if confirm_dialog.run() != Gtk.ResponseType.YES:
return
for song in songs:
song["~#rating"] = value