本文整理汇总了Python中quodlibet.util.copool.add函数的典型用法代码示例。如果您正苦于以下问题:Python add函数的具体用法?Python add怎么用?Python add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __drag_data_received
def __drag_data_received(self, widget, ctx, x, y, sel, tid, etime):
assert tid == DND_URI_LIST
uris = sel.get_uris()
dirs = []
error = False
for uri in uris:
try:
uri = URI(uri)
except ValueError:
continue
if uri.is_filename:
loc = os.path.normpath(uri.filename)
if os.path.isdir(loc):
dirs.append(loc)
else:
loc = os.path.realpath(loc)
if loc not in self.__library:
self.__library.add_filename(loc)
elif app.player.can_play_uri(uri):
if uri not in self.__library:
self.__library.add([RemoteFile(uri)])
else:
error = True
break
Gtk.drag_finish(ctx, not error, False, etime)
if error:
ErrorMessage(self, _("Unable to add songs"), _("%s uses an unsupported protocol.") % util.bold(uri)).run()
else:
if dirs:
copool.add(self.__library.scan, dirs, cofuncid="library", funcid="library")
开发者ID:virtuald,项目名称:quodlibet,代码行数:33,代码来源:quodlibetwindow.py
示例2: test_timeout
def test_timeout(self):
copool.add(self.__set_buffer, funcid="test", timeout=100)
copool.pause("test")
copool.resume("test")
copool.remove("test")
with pytest.raises(ValueError):
copool.step("test")
开发者ID:LudoBike,项目名称:quodlibet,代码行数:7,代码来源:test_util_copool.py
示例3: __changed_and_signal_library
def __changed_and_signal_library(self, entry, section, name):
config.set(section, name, str(entry.get_value()))
print_d("Signalling \"changed\" to entire library. Hold tight...")
# Cache over clicks
self._songs = self._songs or app.library.values()
copool.add(emit_signal, self._songs, funcid="library changed",
name=_("Updating for new ratings"))
开发者ID:faubiguy,项目名称:quodlibet,代码行数:7,代码来源:prefs.py
示例4: 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
示例5: __drag_data_received
def __drag_data_received(self, ctx, x, y, sel, tid, etime):
if tid == 1: uris = sel.get_uris()
if tid == 2:
uri = sel.data.decode('utf16', 'replace').split('\n')[0]
uris = [uri.encode('ascii', 'replace')]
dirs = []
error = False
for uri in uris:
try: uri = URI(uri)
except ValueError: continue
if uri.is_filename:
loc = os.path.normpath(uri.filename)
if os.path.isdir(loc): dirs.append(loc)
else:
loc = os.path.realpath(loc)
if loc not in self.__library:
self.__library.add_filename(loc)
elif player.can_play_uri(uri):
if uri not in self.__library:
self.__library.add([RemoteFile(uri)])
else:
error = True
break
ctx.finish(not error, False, etime)
if error:
ErrorMessage(
self, _("Unable to add songs"),
_("<b>%s</b> uses an unsupported protocol.") % uri).run()
else:
if dirs:
copool.add(
self.__library.scan, dirs, self.__status.bar.progress,
cofuncid="library", funcid="library")
开发者ID:silkecho,项目名称:glowing-silk,代码行数:35,代码来源:quodlibetwindow.py
示例6: test_step
def test_step(self):
copool.add(self.__set_buffer, funcid="test")
copool.pause("test")
self.assertTrue(copool.step("test"))
self.go = False
self.assertFalse(copool.step("test"))
self.assertRaises(ValueError, copool.step, "test")
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:7,代码来源:test_util_copool.py
示例7: test_pause_all
def test_pause_all(self):
self.buffer = None
copool.add(self.__set_buffer, funcid="test")
self._assert_eventually(True)
copool.pause_all()
self.buffer = None
self._assert_never(True)
开发者ID:LudoBike,项目名称:quodlibet,代码行数:7,代码来源:test_util_copool.py
示例8: test_step
def test_step(self):
copool.add(self.__set_buffer, funcid="test")
copool.pause("test")
assert copool.step("test")
self.go = False
assert not copool.step("test")
with pytest.raises(ValueError):
copool.step("test")
开发者ID:LudoBike,项目名称:quodlibet,代码行数:8,代码来源:test_util_copool.py
示例9: _add_location
def _add_location(app, value):
if os.path.isfile(value):
ret = app.library.add_filename(value)
if not ret:
print_e("Couldn't add file to library")
elif os.path.isdir(value):
copool.add(app.library.scan, [value], cofuncid="library",
funcid="library")
else:
print_e("Invalid location")
开发者ID:zsau,项目名称:quodlibet,代码行数:10,代码来源:commands.py
示例10: set_tag
def set_tag(self, tag, library):
if not config.getboolean("settings", "eager_search"):
return
elif tag is None:
return
elif tag in ("bpm date discnumber isrc originaldate recordingdate " "tracknumber title").split() + MACHINE_TAGS:
return
elif tag in formats.PEOPLE:
tag = "~people"
copool.add(self.__fill_tag, tag, library)
开发者ID:faubiguy,项目名称:quodlibet,代码行数:10,代码来源:completion.py
示例11: test_add_remove
def test_add_remove(self):
copool.add(self.__set_buffer)
gtk.main_iteration(block=False)
gtk.main_iteration(block=False)
self.assertEquals(self.buffer, True)
copool.remove(self.__set_buffer)
self.buffer = None
gtk.main_iteration(block=False)
gtk.main_iteration(block=False)
self.assertEquals(self.buffer, None)
开发者ID:silkecho,项目名称:glowing-silk,代码行数:10,代码来源:test_util_copool.py
示例12: test_add_remove_with_funcid
def test_add_remove_with_funcid(self):
copool.add(self.__set_buffer, funcid="test")
gtk.main_iteration(block=False)
gtk.main_iteration(block=False)
self.assertEquals(self.buffer, True)
copool.remove("test")
self.buffer = None
gtk.main_iteration(block=False)
gtk.main_iteration(block=False)
self.assertEquals(self.buffer, None)
开发者ID:silkecho,项目名称:glowing-silk,代码行数:10,代码来源:test_util_copool.py
示例13: test_add_remove
def test_add_remove(self):
copool.add(self.__set_buffer)
Gtk.main_iteration_do(False)
Gtk.main_iteration_do(False)
self.assertEquals(self.buffer, True)
copool.remove(self.__set_buffer)
self.buffer = None
Gtk.main_iteration_do(False)
Gtk.main_iteration_do(False)
self.assertEquals(self.buffer, None)
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:10,代码来源:test_util_copool.py
示例14: test_pause_all
def test_pause_all(self):
copool.add(self.__set_buffer, funcid="test")
Gtk.main_iteration_do(False)
Gtk.main_iteration_do(False)
self.failUnless(self.buffer)
copool.pause_all()
self.buffer = None
Gtk.main_iteration_do(False)
Gtk.main_iteration_do(False)
self.failIf(self.buffer)
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:10,代码来源:test_util_copool.py
示例15: scan_library
def scan_library(library, force):
"""Start the global library re-scan
Args:
library (Library)
force (bool): if True, reload all existing valid items
"""
paths = get_scan_dirs()
exclude = get_exclude_dirs()
copool.add(library.rebuild, paths, force, exclude, cofuncid="library", funcid="library")
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:11,代码来源:library.py
示例16: test_pause_resume
def test_pause_resume(self):
copool.add(self.__set_buffer)
self._assert_eventually(True)
copool.pause(self.__set_buffer)
self.buffer = None
self._assert_never(True)
copool.resume(self.__set_buffer)
self._assert_eventually(True)
copool.remove(self.__set_buffer)
self.buffer = None
self._assert_never(True)
开发者ID:LudoBike,项目名称:quodlibet,代码行数:11,代码来源:test_util_copool.py
示例17: __init__
def __init__(self, library):
super(LibraryTagCompletion, self).__init__()
try: model = self.__model
except AttributeError:
model = type(self).__model = gtk.ListStore(str)
library.connect('changed', self.__update_song, model)
library.connect('added', self.__update_song, model)
library.connect('removed', self.__update_song, model)
copool.add(self.__build_model, library, model)
self.set_model(model)
self.set_text_column(0)
开发者ID:silkecho,项目名称:glowing-silk,代码行数:11,代码来源:completion.py
示例18: scan_library
def scan_library(library, force):
"""Start the global library re-scan
If `force` is True, reload all existing valid items.
"""
paths = get_scan_dirs()
exclude = split_scan_dirs(config.get("library", "exclude"))
exclude = [bytes2fsnative(e) for e in exclude]
copool.add(library.rebuild, paths, force, exclude,
cofuncid="library", funcid="library")
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:11,代码来源:library.py
示例19: open_chooser
def open_chooser(self, action):
last_dir = self.last_dir
if not os.path.exists(last_dir):
last_dir = get_home_dir()
class MusicFolderChooser(FolderChooser):
def __init__(self, parent, init_dir):
super(MusicFolderChooser, self).__init__(
parent, _("Add Music"), init_dir)
cb = Gtk.CheckButton(_("Watch this folder for new songs"))
# enable if no folders are being watched
cb.set_active(not get_scan_dirs())
cb.show()
self.set_extra_widget(cb)
def run(self):
fns = super(MusicFolderChooser, self).run()
cb = self.get_extra_widget()
return fns, cb.get_active()
class MusicFileChooser(FileChooser):
def __init__(self, parent, init_dir):
super(MusicFileChooser, self).__init__(
parent, _("Add Music"), formats.filter, init_dir)
if action.get_name() == "AddFolders":
dialog = MusicFolderChooser(self, last_dir)
fns, do_watch = dialog.run()
dialog.destroy()
if fns:
fns = map(glib2fsnative, fns)
# scan them
self.last_dir = fns[0]
copool.add(self.__library.scan, fns, cofuncid="library",
funcid="library")
# add them as library scan directory
if do_watch:
dirs = get_scan_dirs()
for fn in fns:
if fn not in dirs:
dirs.append(fn)
set_scan_dirs(dirs)
else:
dialog = MusicFileChooser(self, last_dir)
fns = dialog.run()
dialog.destroy()
if fns:
fns = map(glib2fsnative, fns)
self.last_dir = os.path.dirname(fns[0])
for filename in map(os.path.realpath, fns):
self.__library.add_filename(filename)
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:53,代码来源:quodlibetwindow.py
示例20: test_pause_resume_with_funcid
def test_pause_resume_with_funcid(self):
self.buffer = None
copool.add(self.__set_buffer, funcid="test")
self._assert_eventually(True)
copool.pause("test")
self.buffer = None
self._assert_never(True)
copool.resume("test")
copool.resume("test")
self._assert_eventually(True)
copool.remove("test")
self.buffer = None
self._assert_never(True)
开发者ID:LudoBike,项目名称:quodlibet,代码行数:13,代码来源:test_util_copool.py
注:本文中的quodlibet.util.copool.add函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论