本文整理汇总了Python中quodlibet.util.dprint.print_d函数的典型用法代码示例。如果您正苦于以下问题:Python print_d函数的具体用法?Python print_d怎么用?Python print_d使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_d函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: search_complete
def search_complete(self, res):
self.disconnect(sci)
if res:
print_d(res)
self.download(Soup.Message.new('GET', res[0]))
else:
return self.fail('No cover was found')
开发者ID:pschwede,项目名称:quodlibet-plugins,代码行数:7,代码来源:jamendo.py
示例2: _load_item
def _load_item(self, item):
"""Load (add) an item into this library"""
# Subclasses should override this if they want to check
# item validity; see `FileLibrary`.
print_d("Loading %r." % item.key, self)
self.dirty = True
self._contents[item.key] = item
开发者ID:kriskielce88,项目名称:xn--ls8h,代码行数:7,代码来源:libraries.py
示例3: check_wrapper_changed
def check_wrapper_changed(library, parent, songs):
needs_write = filter(lambda s: s._needs_write, songs)
if needs_write:
win = WritingWindow(parent, len(needs_write))
win.show()
for song in needs_write:
try:
song._song.write()
except AudioFileError as e:
qltk.ErrorMessage(
None, _("Unable to edit song"),
_("Saving <b>%s</b> failed. The file "
"may be read-only, corrupted, or you "
"do not have permission to edit it.") %
util.escape(song('~basename'))).run()
print_d("Couldn't save song %s (%s)" % (song("~filename"), e))
if win.step():
break
win.destroy()
changed = []
for song in songs:
if song._was_updated():
changed.append(song._song)
elif not song.valid() and song.exists():
library.reload(song._song)
library.changed(changed)
开发者ID:faubiguy,项目名称:quodlibet,代码行数:29,代码来源:songwrapper.py
示例4: get_players
def get_players(self):
""" Returns (and caches) a list of the Squeezebox players available"""
if self.players:
return self.players
pairs = self.__request("players 0 99", True).split(" ")
def demunge(string):
s = urllib.unquote(string)
cpos = s.index(":")
return (s[0:cpos], s[cpos + 1:])
# Do a meaningful URL-unescaping and tuplification for all values
pairs = map(demunge, pairs)
# First element is always count
count = int(pairs.pop(0)[1])
self.players = []
for pair in pairs:
if pair[0] == "playerindex":
playerindex = int(pair[1])
self.players.append(SqueezeboxPlayerSettings())
else:
# Don't worry playerindex is always the first entry...
self.players[playerindex][pair[0]] = pair[1]
if self._debug:
print_d("Found %d player(s): %s" %
(len(self.players), self.players))
assert (count == len(self.players))
return self.players
开发者ID:bernd-wechner,项目名称:quodlibet,代码行数:29,代码来源:server.py
示例5: get_data
def get_data(self, key):
"""Gets the pattern for a given key"""
try:
return self.commands[key]
except (KeyError, TypeError):
print_d("Invalid key %s" % key)
return None
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:7,代码来源:custom_commands.py
示例6: remove_songs
def remove_songs(self, songs, library, leave_dupes=False):
"""
Removes `songs` from this playlist if they are there,
removing only the first reference if `leave_dupes` is True
"""
changed = False
for song in songs:
# TODO: document the "library.masked" business
if library.masked(song("~filename")):
while True:
try:
self[self.index(song)] = song("~filename")
except ValueError:
break
else:
changed = True
else:
while song in self.songs:
print_d("Removing \"%s\" from playlist \"%s\"..."
% (song["~filename"], self.name))
self.songs.remove(song)
if leave_dupes:
changed = True
break
else:
changed = True
# Evict song from cache entirely
try:
del self._song_map_cache[song]
print_d("Removed playlist cache for \"%s\"" % song["~filename"])
except KeyError: pass
return changed
开发者ID:silkecho,项目名称:glowing-silk,代码行数:32,代码来源:collection.py
示例7: enable
def enable(self, plugin, status, force=False):
"""Enable or disable a plugin."""
if not force and self.enabled(plugin) == bool(status):
return
if not status:
print_d("Disable %r" % plugin.id)
for handler in plugin.handlers:
handler.plugin_disable(plugin)
self.__enabled.discard(plugin.id)
instance = plugin.instance
if instance and hasattr(instance, "disabled"):
try:
instance.disabled()
except Exception:
util.print_exc()
else:
print_d("Enable %r" % plugin.id)
obj = plugin.get_instance()
if obj and hasattr(obj, "enabled"):
try:
obj.enabled()
except Exception:
util.print_exc()
for handler in plugin.handlers:
handler.plugin_enable(plugin)
self.__enabled.add(plugin.id)
开发者ID:mistotebe,项目名称:quodlibet,代码行数:30,代码来源:__init__.py
示例8: __init__
def __init__(self, library):
print_d("Creating Soundcloud Browser")
super(SoundcloudBrowser, self).__init__(spacing=12)
self.set_orientation(Gtk.Orientation.VERTICAL)
if not self.instances():
self._init(library)
self._register_instance()
self.connect('destroy', self.__destroy)
self.connect('uri-received', self.__handle_incoming_uri)
self.__auth_sig = self.api_client.connect('authenticated',
self.__on_authenticated)
connect_destroy(self.library, 'changed', self.__changed)
self.login_state = (State.LOGGED_IN if self.online
else State.LOGGED_OUT)
self._create_searchbar(self.library)
vbox = Gtk.VBox()
vbox.pack_start(self._create_footer(), False, False, 6)
vbox.pack_start(self._create_category_widget(), True, True, 0)
vbox.pack_start(self.create_login_button(), False, False, 6)
vbox.show()
pane = qltk.ConfigRHPaned("browsers", "soundcloud_pos", 0.4)
pane.show()
pane.pack1(vbox, resize=False, shrink=False)
self._songs_box = songs_box = Gtk.VBox(spacing=6)
songs_box.pack_start(self._searchbox, False, True, 0)
songs_box.show()
pane.pack2(songs_box, resize=True, shrink=False)
self.pack_start(pane, True, True, 0)
self.show()
开发者ID:zsau,项目名称:quodlibet,代码行数:31,代码来源:main.py
示例9: __save
def __save(self, *data):
"""Save the cover and spawn the program to edit it if selected"""
save_format = self.name_combo.get_active_text()
# Allow use of patterns in creating cover filenames
pattern = ArbitraryExtensionFileFromPattern(
save_format.decode("utf-8"))
filename = pattern.format(self.song)
print_d("Using '%s' as filename based on %s" % (filename, save_format))
file_path = os.path.join(self.dirname, filename)
if os.path.exists(file_path):
resp = ConfirmFileReplace(self, file_path).run()
if resp != ConfirmFileReplace.RESPONSE_REPLACE:
return
try:
f = open(file_path, 'wb')
f.write(self.current_data)
f.close()
except IOError:
qltk.ErrorMessage(None, _('Saving failed'),
_('Unable to save "%s".') % file_path).run()
else:
if self.open_check.get_active():
try:
util.spawn([self.cmd.get_text(), file_path])
except:
pass
app.cover_manager.cover_changed([self.song])
self.main_win.destroy()
开发者ID:vrasidas,项目名称:quodlibet,代码行数:33,代码来源:albumart.py
示例10: send_nowplaying
def send_nowplaying(self):
data = {"s": self.session_id}
for key, val in self.nowplaying_song.items():
data[key] = val.encode("utf-8")
print_d("Now playing song: %s - %s" % (self.nowplaying_song["a"], self.nowplaying_song["t"]))
return self._check_submit(self.nowplaying_url, data)
开发者ID:mistotebe,项目名称:quodlibet,代码行数:7,代码来源:qlscrobbler.py
示例11: add_station
def add_station(uri):
"""Fetches the URI content and extracts IRFiles
Returns None in error, else a possibly filled list of stations"""
irfs = []
if uri.lower().endswith(".pls") or uri.lower().endswith(".m3u"):
try:
sock = urlopen(uri)
except EnvironmentError as err:
err = text_type(err)
print_d("Got %s from %s" % (uri, err))
ErrorMessage(None, _("Unable to add station"), escape(err)).run()
return None
if uri.lower().endswith(".pls"):
irfs = ParsePLS(sock)
elif uri.lower().endswith(".m3u"):
irfs = ParseM3U(sock)
sock.close()
else:
try:
irfs = [IRFile(uri)]
except ValueError as err:
ErrorMessage(None, _("Unable to add station"), err).run()
return irfs
开发者ID:elfalem,项目名称:quodlibet,代码行数:28,代码来源:iradio.py
示例12: register_translation
def register_translation(domain, localedir=None):
"""Register a translation domain
Args:
domain (str): the gettext domain
localedir (pathlike): A directory used for translations, if None the
system one will be used.
Returns:
GlibTranslations
"""
global _debug_text, _translations, _initialized
assert _initialized
if localedir is None:
iterdirs = iter_locale_dirs
else:
iterdirs = lambda: iter([localedir])
for dir_ in iterdirs():
try:
t = gettext.translation(domain, dir_, class_=GlibTranslations)
except OSError:
continue
else:
print_d("Translations loaded: %r" % unexpand(t.path))
break
else:
print_d("No translation found for the domain %r" % domain)
t = GlibTranslations()
t.set_debug_text(_debug_text)
_translations[domain] = t
return t
开发者ID:LudoBike,项目名称:quodlibet,代码行数:35,代码来源:i18n.py
示例13: add_station
def add_station(uri):
"""Fetches the URI content and extracts IRFiles
Returns None in error, else a possibly filled list of stations"""
irfs = []
if uri.lower().endswith(".pls") or uri.lower().endswith(".m3u"):
if not re.match('^([^/:]+)://', uri):
# Assume HTTP if no protocol given. See #2731
uri = 'http://' + uri
print_d("Assuming http: %s" % uri)
try:
sock = urlopen(uri)
except EnvironmentError as err:
err = "%s\n\nURL: %s" % (text_type(err), uri)
print_d("Got %s from %s" % (err, uri))
ErrorMessage(None, _("Unable to add station"), escape(err)).run()
return None
if uri.lower().endswith(".pls"):
irfs = ParsePLS(sock)
elif uri.lower().endswith(".m3u"):
irfs = ParseM3U(sock)
sock.close()
else:
try:
irfs = [IRFile(uri)]
except ValueError as err:
ErrorMessage(None, _("Unable to add station"), err).run()
return irfs
开发者ID:LudoBike,项目名称:quodlibet,代码行数:32,代码来源:iradio.py
示例14: init
def init():
global device_manager
if not dbus: return
device_manager = None
print_d(_("Initializing device backend."))
try_text = _("Trying '%s'")
#DKD maintainers will change the naming of dbus, app stuff
#in january 2010 or so (already changed in trunk), so try both
if device_manager is None:
print_d(try_text % "DeviceKit Disks")
try: device_manager = DKD(("DeviceKit", "Disks"))
except (LookupError, dbus.DBusException): pass
if device_manager is None:
print_d(try_text % "UDisks")
try: device_manager = DKD(("UDisks",))
except (LookupError, dbus.DBusException): pass
if device_manager is None:
print_d(try_text % "HAL")
try: device_manager = HAL()
except (LookupError, dbus.DBusException): pass
if device_manager is None:
print_w(_("Couldn't connect to a device backend."))
else:
print_d(_("Device backend initialized."))
return device_manager
开发者ID:silkecho,项目名称:glowing-silk,代码行数:31,代码来源:__init__.py
示例15: __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
示例16: _try_build_device
def _try_build_device(self, object_path, block, fs):
"""Returns a Device instance or None.
None if it wasn't a media player etc..
"""
drive = self._drives.get(block["Drive"])
if not drive:
# I think this shouldn't happen, but check anyway
return
dev_path = dbus_barray_to_str(block["Device"])
print_d("Found device: %r" % dev_path)
media_player_id = get_media_player_id(self._udev, dev_path)
if not media_player_id:
print_d("%r not a media player" % dev_path)
return
protocols = get_media_player_protocols(media_player_id)
device_id = drive["Id"]
dev = self.create_device(object_path, unicode(device_id), protocols)
icon_name = block["HintIconName"]
if icon_name:
dev.icon = icon_name
return dev
开发者ID:virtuald,项目名称:quodlibet,代码行数:27,代码来源:__init__.py
示例17: rename
def rename(self, song, newname, changed=None):
"""Rename the song in all libraries it belongs to.
The 'changed' signal will fire for any library the song is in
except if a set() is passed as changed.
"""
# This needs to poke around inside the library directly. If
# it uses add/remove to handle the songs it fires incorrect
# signals. If it uses the library's rename method, it breaks
# the call for future libraries because the item's key has
# changed. So, it needs to reimplement the method.
re_add = []
print_d("Renaming %r to %r" % (song.key, newname), self)
for library in self.libraries.itervalues():
try:
del library._contents[song.key]
except KeyError:
pass
else:
re_add.append(library)
song.rename(newname)
for library in re_add:
library._contents[song.key] = song
if changed is None:
library._changed({song})
else:
print_d("Delaying changed signal for %r." % library, self)
changed.add(song)
开发者ID:SimonLarsen,项目名称:quodlibet,代码行数:28,代码来源:librarians.py
示例18: plugin_songs
def plugin_songs(self, songs):
songs = [s for s in songs if s.is_file]
print_d("Trying to browse folders...")
if not self._handle(songs):
ErrorMessage(self.plugin_window,
_("Unable to open folders"),
_("No program available to open folders.")).run()
开发者ID:bernd-wechner,项目名称:quodlibet,代码行数:7,代码来源:browsefolders.py
示例19: rescan
def rescan(self):
"""Scan for plugin changes or to initially load all plugins"""
print_d("Rescanning..")
removed, added = self.__scanner.rescan()
# remember IDs of enabled plugin that get reloaded, so we can enable
# them again
reload_ids = []
for name in removed:
if name not in added:
continue
mod = self.__modules[name]
for plugin in mod.plugins:
if self.enabled(plugin):
reload_ids.append(plugin.id)
for name in removed:
# share the namespace with ModuleScanner for now
self.__remove_module(name)
# restore enabled state
self.__enabled.update(reload_ids)
for name in added:
new_module = self.__scanner.modules[name]
self.__add_module(name, new_module.module)
print_d("Rescanning done.")
开发者ID:mistotebe,项目名称:quodlibet,代码行数:30,代码来源:__init__.py
示例20: init
def init(icon=None, proc_title=None, name=None):
global quodlibet
print_d("Entering quodlibet.init")
_gtk_init()
_gtk_icons_init(get_image_dir(), icon)
_gst_init()
_dbus_init()
_init_debug()
from gi.repository import GLib
if proc_title:
GLib.set_prgname(proc_title)
set_process_title(proc_title)
# Issue 736 - set after main loop has started (gtk seems to reset it)
GLib.idle_add(set_process_title, proc_title)
if name:
GLib.set_application_name(name)
mkdir(get_user_dir(), 0750)
print_d("Finished initialization.")
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:25,代码来源:__init__.py
注:本文中的quodlibet.util.dprint.print_d函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论