• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python log.warning函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中picard.log.warning函数的典型用法代码示例。如果您正苦于以下问题:Python warning函数的具体用法?Python warning怎么用?Python warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了warning函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: create_action_toolbar

    def create_action_toolbar(self):
        if self.toolbar:
            self.toolbar.clear()
            self.removeToolBar(self.toolbar)
        self.toolbar = toolbar = QtWidgets.QToolBar(_("Actions"))
        self.insertToolBar(self.search_toolbar, self.toolbar)
        self.update_toolbar_style()
        toolbar.setObjectName("main_toolbar")

        def add_toolbar_action(action):
            toolbar.addAction(action)
            widget = toolbar.widgetForAction(action)
            widget.setFocusPolicy(QtCore.Qt.TabFocus)
            widget.setAttribute(QtCore.Qt.WA_MacShowFocusRect)

        for action in config.setting['toolbar_layout']:
            if action == 'cd_lookup_action':
                add_toolbar_action(self.cd_lookup_action)
                if len(self.cd_lookup_menu.actions()) > 1:
                    button = toolbar.widgetForAction(self.cd_lookup_action)
                    button.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
                    button.setMenu(self.cd_lookup_menu)
            elif action == 'separator':
                toolbar.addSeparator()
            else:
                try:
                    add_toolbar_action(getattr(self, action))
                except AttributeError:
                    log.warning('Warning: Unknown action name "%r" found in config. Ignored.', action)
        self.show_toolbar()
开发者ID:phw,项目名称:picard,代码行数:30,代码来源:mainwindow.py


示例2: load_remote_image

 def load_remote_image(self, url, mime, data):
     try:
         coverartimage = CoverArtImage(url=url.toString(), data=data)
     except CoverArtImageError as e:
         log.warning("Can't load image: %s" % unicode(e))
         return
     pixmap = QtGui.QPixmap()
     pixmap.loadFromData(data)
     self.__set_data([mime, data], pixmap=pixmap)
     if isinstance(self.item, Album):
         album = self.item
         album.metadata.append_image(coverartimage)
         for track in album.tracks:
             track.metadata.append_image(coverartimage)
         for file in album.iterfiles():
             file.metadata.append_image(coverartimage)
     elif isinstance(self.item, Track):
         track = self.item
         track.metadata.append_image(coverartimage)
         for file in track.iterfiles():
             file.metadata.append_image(coverartimage)
     elif isinstance(self.item, File):
         file = self.item
         file.metadata.append_image(coverartimage)
     self.currentImage = len(self.metadata.images) - 1
     self.__update_image_count()
开发者ID:Typz,项目名称:picard,代码行数:26,代码来源:coverartbox.py


示例3: main

def main(localedir=None, autoupdate=True):
    # Some libs (ie. Phonon) require those to be set
    QtWidgets.QApplication.setApplicationName(PICARD_APP_NAME)
    QtWidgets.QApplication.setOrganizationName(PICARD_ORG_NAME)

    signal.signal(signal.SIGINT, signal.SIG_DFL)

    picard_args, unparsed_args = process_picard_args()
    if picard_args.version:
        return version()
    if picard_args.long_version:
        return longversion()

    tagger = Tagger(picard_args, unparsed_args, localedir, autoupdate)

    # Initialize Qt default translations
    translator = QtCore.QTranslator()
    locale = QtCore.QLocale()
    translation_path = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)
    log.debug("Looking for Qt locale %s in %s", locale.name(), translation_path)
    if translator.load(locale, "qtbase_", directory=translation_path):
        tagger.installTranslator(translator)
    else:
        log.warning('Error loading Qt locale %s', locale.name())

    tagger.startTimer(1000)
    sys.exit(tagger.run())
开发者ID:mineo,项目名称:picard,代码行数:27,代码来源:tagger.py


示例4: load_plugindir

 def load_plugindir(self, plugindir):
     plugindir = os.path.normpath(plugindir)
     if not os.path.isdir(plugindir):
         log.warning("Plugin directory %r doesn't exist", plugindir)
         return
     #  first, handle eventual plugin updates
     for updatepath in [os.path.join(plugindir, file) for file in os.listdir(plugindir) if file.endswith(".update")]:
         path = os.path.splitext(updatepath)[0]
         name = is_zip(path)
         if not name:
             name = _plugin_name_from_path(path)
         if name:
             self.remove_plugin(name)
             os.rename(updatepath, path)
             log.debug("Updating plugin %r (%r))", name, path)
         else:
             log.error("Cannot get plugin name from %r", updatepath)
     # now load found plugins
     names = set()
     for path in [os.path.join(plugindir, file) for file in os.listdir(plugindir)]:
         name = is_zip(path)
         if not name:
             name = _plugin_name_from_path(path)
         if name:
             names.add(name)
     log.debug("Looking for plugins in directory %r, %d names found", plugindir, len(names))
     for name in sorted(names):
         self.load_plugin(name, plugindir)
开发者ID:opatel99,项目名称:picard,代码行数:28,代码来源:plugin.py


示例5: _coverart_downloaded

    def _coverart_downloaded(self, coverartimage, data, http, error):
        """Handle finished download, save it to metadata"""
        self.album._requests -= 1

        if error:
            self.album.error_append(u'Coverart error: %s' % (unicode(http.errorString())))
        elif len(data) < 1000:
            log.warning("Not enough data, skipping %s" % coverartimage)
        else:
            self._message(
                N_("Cover art of type '%(type)s' downloaded for %(albumid)s from %(host)s"),
                {
                    'type': coverartimage.types_as_string(),
                    'albumid': self.album.id,
                    'host': coverartimage.host
                },
                echo=None
            )
            try:
                self._set_metadata(coverartimage, data)
            except CoverArtImageIOError:
                # It doesn't make sense to store/download more images if we can't
                # save them in the temporary folder, abort.
                return

        self.next_in_queue()
开发者ID:Freso,项目名称:picard,代码行数:26,代码来源:__init__.py


示例6: create_action_toolbar

    def create_action_toolbar(self):
        if getattr(self, 'toolbar', None):
            self.toolbar.clear()
            self.removeToolBar(self.toolbar)
        self.toolbar = toolbar = QtGui.QToolBar(_(u"Actions"))
        self.insertToolBar(self.search_toolbar, self.toolbar)
        self.toolbar_toggle_action = self.toolbar.toggleViewAction()
        self.update_toolbar_style()
        toolbar.setObjectName("main_toolbar")

        def add_toolbar_action(action):
            toolbar.addAction(action)
            widget = toolbar.widgetForAction(action)
            widget.setFocusPolicy(QtCore.Qt.TabFocus)
            widget.setAttribute(QtCore.Qt.WA_MacShowFocusRect)

        for action in config.setting['toolbar_layout']:
            if action not in ('cd_lookup_action', 'separator'):
                try:
                    add_toolbar_action(getattr(self, action))
                except AttributeError:
                    log.warning('Warning: Unknown action name "%r" found in config. Ignored.', action)
            elif action == 'cd_lookup_action':
                add_toolbar_action(self.cd_lookup_action)
                drives = get_cdrom_drives()
                if len(drives) > 1:
                    self.cd_lookup_menu = QtGui.QMenu()
                    for drive in drives:
                        self.cd_lookup_menu.addAction(drive)
                    self.cd_lookup_menu.triggered.connect(self.tagger.lookup_cd)
                    button = toolbar.widgetForAction(self.cd_lookup_action)
                    button.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
                    button.setMenu(self.cd_lookup_menu)
            elif action == 'separator':
                toolbar.addSeparator()
开发者ID:Freso,项目名称:picard,代码行数:35,代码来源:mainwindow.py


示例7: load_remote_image

    def load_remote_image(self, url, mime, data):
        try:
            coverartimage = CoverArtImage(
                url=url.toString(),
                types=['front'],
                data=data
            )
        except CoverArtImageError as e:
            log.warning("Can't load image: %s" % e)
            return

        if config.setting["load_image_behavior"] == 'replace':
            set_image = set_image_replace
            debug_info = "Replacing with dropped %r in %r"
        else:
            set_image = set_image_append
            debug_info = "Appending dropped %r to %r"

        update = True
        if isinstance(self.item, Album):
            album = self.item
            album.enable_update_metadata_images(False)
            set_image(album, coverartimage)
            for track in album.tracks:
                set_image(track, coverartimage)
                track.metadata_images_changed.emit()
            for file in album.iterfiles():
                set_image(file, coverartimage)
                file.metadata_images_changed.emit()
                file.update()
            album.enable_update_metadata_images(True)
            album.update_metadata_images()
            album.update(False)
        elif isinstance(self.item, Track):
            track = self.item
            track.album.enable_update_metadata_images(False)
            set_image(track, coverartimage)
            track.metadata_images_changed.emit()
            for file in track.iterfiles():
                set_image(file, coverartimage)
                file.metadata_images_changed.emit()
                file.update()
            track.album.enable_update_metadata_images(True)
            track.album.update_metadata_images()
            track.album.update(False)
        elif isinstance(self.item, File):
            file = self.item
            set_image(file, coverartimage)
            file.metadata_images_changed.emit()
            file.update()
        else:
            debug_info = "Dropping %r to %r is not handled"
            update = False

        log.debug(debug_info, coverartimage, self.item)

        if update:
            self.cover_art.set_metadata(self.item.metadata)
            self.show()
开发者ID:mineo,项目名称:picard,代码行数:59,代码来源:coverartbox.py


示例8: queue_images

 def queue_images(self):
     # this method has to return CoverArtProvider.FINISHED or
     # CoverArtProvider.WAIT
     old = getattr(self, 'queue_downloads') #compat with old plugins
     if callable(old):
         log.warning('CoverArtProvider: queue_downloads() was replaced by queue_images()')
         return old()
     else:
         raise NotImplementedError
开发者ID:Sophist-UK,项目名称:Sophist_picard,代码行数:9,代码来源:__init__.py


示例9: on_remote_image_fetched

 def on_remote_image_fetched(self, data, reply, error):
     mime = reply.header(QtNetwork.QNetworkRequest.ContentTypeHeader)
     if mime in ('image/jpeg', 'image/png'):
         self.load_remote_image(mime, data)
     elif reply.url().hasQueryItem("imgurl"):
         # This may be a google images result, try to get the URL which is encoded in the query
         url = QtCore.QUrl(reply.url().queryItemValue("imgurl"))
         self.fetch_remote_image(url)
     else:
         log.warning("Can't load image with MIME-Type %s", mime)
开发者ID:m42i,项目名称:picard,代码行数:10,代码来源:coverartbox.py


示例10: _display_artwork

    def _display_artwork(self, images, col):
        """Draw artwork in corresponding cell if image type matches type in Type column.

        Arguments:
        images -- The images to be drawn.
        col -- Column in which images are to be drawn. Can be _new_cover_col or _existing_cover_col.
        """
        row = 0
        row_count = self.artwork_table.rowCount()
        for image in images:
            while row != row_count:
                image_type = self.artwork_table.item(row, self.artwork_table._type_col)
                if image_type and image_type.data(QtCore.Qt.UserRole) == image.types_as_string():
                    break
                row += 1
            if row == row_count:
                continue
            data = None
            try:
                if image.thumbnail:
                    try:
                        data = image.thumbnail.data
                    except CoverArtImageIOError as e:
                        log.warning(e)
                        pass
                else:
                    data = image.data
            except CoverArtImageIOError:
                log.error(traceback.format_exc())
                continue
            item = QtWidgets.QTableWidgetItem()
            item.setData(QtCore.Qt.UserRole, image)
            pixmap = QtGui.QPixmap()
            if data is not None:
                pixmap.loadFromData(data)
                item.setToolTip(
                    _("Double-click to open in external viewer\n"
                      "Temporary file: %s\n"
                      "Source: %s") % (image.tempfile_filename, image.source))
            infos = []
            if image.comment:
                infos.append(image.comment)
            infos.append("%s (%s)" %
                         (bytes2human.decimal(image.datalength),
                          bytes2human.binary(image.datalength)))
            if image.width and image.height:
                infos.append("%d x %d" % (image.width, image.height))
            infos.append(image.mimetype)

            img_wgt = self.artwork_table.get_coverart_widget(pixmap, "\n".join(infos))
            self.artwork_table.setCellWidget(row, col, img_wgt)
            self.artwork_table.setItem(row, col, item)
            row += 1
开发者ID:JDLH,项目名称:picard,代码行数:53,代码来源:infodialog.py


示例11: _coverart_downloaded

    def _coverart_downloaded(self, coverartimage, data, http, error):
        """Handle finished download, save it to metadata"""
        self.album._requests -= 1

        if error:
            self.album.error_append(u'Coverart error: %s' % (unicode(http.errorString())))
        elif len(data) < 1000:
            log.warning("Not enough data, skipping %s" % coverartimage)
        else:
            self._message(
                N_("Cover art of type '%(type)s' downloaded for %(albumid)s from %(host)s"),
                {
                    'type': coverartimage.types_as_string(),
                    'albumid': self.album.id,
                    'host': coverartimage.host
                },
                echo=None
            )
            try:
                coverartimage.set_data(data)
                if coverartimage.can_be_saved_to_metadata:
                    log.debug("Cover art image downloaded: %r [%s]" %
                        (
                            coverartimage,
                            coverartimage.imageinfo_as_string()
                        )
                    )
                    self.metadata.append_image(coverartimage)
                    for track in self.album._new_tracks:
                        track.metadata.append_image(coverartimage)
                    # If the image already was a front image,
                    # there might still be some other non-CAA front
                    # images in the queue - ignore them.
                    if not self.front_image_found:
                        self.front_image_found = coverartimage.is_front_image()
                else:
                    log.debug("Thumbnail for cover art image downloaded: %r [%s]" %
                        (
                            coverartimage,
                            coverartimage.imageinfo_as_string()
                        )
                    )
            except CoverArtImageIOError as e:
                self.album.error_append(unicode(e))
                self.album._finalize_loading(error=True)
                # It doesn't make sense to store/download more images if we can't
                # save them in the temporary folder, abort.
                return
            except CoverArtImageIdentificationError as e:
                self.album.error_append(unicode(e))

        self.download_next_in_queue()
开发者ID:SRITANU,项目名称:picard,代码行数:52,代码来源:coverart.py


示例12: _save_and_rename

 def _save_and_rename(self, old_filename, metadata):
     """Save the metadata."""
     # Check that file has not been removed since thread was queued
     # Also don't save if we are stopping.
     if self.state == File.REMOVED:
         log.debug("File not saved because it was removed: %r", self.filename)
         return None
     if self.tagger.stopping:
         log.debug("File not saved because %s is stopping: %r", PICARD_APP_NAME, self.filename)
         return None
     new_filename = old_filename
     if not config.setting["dont_write_tags"]:
         save = partial(self._save, old_filename, metadata)
         if config.setting["preserve_timestamps"]:
             try:
                 self._preserve_times(old_filename, save)
             except self.PreserveTimesStatError as why:
                 log.warning(why)
                 # we didn't save the file yet, bail out
                 return None
             except self.FilePreserveTimesUtimeError as why:
                 log.warning(why)
         else:
             save()
     # Rename files
     if config.setting["rename_files"] or config.setting["move_files"]:
         new_filename = self._rename(old_filename, metadata)
     # Move extra files (images, playlists, etc.)
     if config.setting["move_files"] and config.setting["move_additional_files"]:
         self._move_additional_files(old_filename, new_filename)
     # Delete empty directories
     if config.setting["delete_empty_dirs"]:
         dirname = os.path.dirname(old_filename)
         try:
             self._rmdir(dirname)
             head, tail = os.path.split(dirname)
             if not tail:
                 head, tail = os.path.split(head)
             while head and tail:
                 try:
                     self._rmdir(head)
                 except BaseException:
                     break
                 head, tail = os.path.split(head)
         except EnvironmentError:
             pass
     # Save cover art images
     if config.setting["save_images_to_files"]:
         self._save_images(os.path.dirname(new_filename), metadata)
     return new_filename
开发者ID:metabrainz,项目名称:picard,代码行数:50,代码来源:file.py


示例13: _coverart_downloaded

    def _coverart_downloaded(self, coverartimage, data, http, error):
        """Handle finished download, save it to metadata"""
        self.album._requests -= 1

        if error:
            self._coverart_http_error(http)
        elif len(data) < 1000:
            log.warning("Not enough data, skipping %s" % coverartimage)
        else:
            self._message(
                N_("Cover art of type '%(type)s' downloaded for %(albumid)s from %(host)s"),
                {
                    'type': ','.join(coverartimage.types),
                    'albumid': self.album.id,
                    'host': coverartimage.host
                }
            )
            mime = mimetype.get_from_data(data, default="image/jpeg")

            try:
                self.metadata.make_and_add_image(
                    mime,
                    data,
                    types=coverartimage.types,
                    comment=coverartimage.comment,
                    is_front=coverartimage.is_front
                )
                for track in self.album._new_tracks:
                    track.metadata.make_and_add_image(
                        mime,
                        data,
                        types=coverartimage.types,
                        comment=coverartimage.comment,
                        is_front=coverartimage.is_front
                    )
                # If the image already was a front image,
                # there might still be some other non-CAA front
                # images in the queue - ignore them.
                if not self.front_image_found:
                    self.front_image_found = coverartimage.is_front_image()

            except (IOError, OSError) as e:
                self.album.error_append(e.message)
                self.album._finalize_loading(error=True)
                # It doesn't make sense to store/download more images if we can't
                # save them in the temporary folder, abort.
                return

        self._download_next_in_queue()
开发者ID:m42i,项目名称:picard,代码行数:49,代码来源:coverart.py


示例14: load_plugin

    def load_plugin(self, name, plugindir):
        try:
            info = imp.find_module(name, [plugindir])
        except ImportError:
            log.error("Failed loading plugin %r", name)
            return None

        plugin = None
        try:
            index = None
            for i, p in enumerate(self.plugins):
                if name == p.module_name:
                    log.warning("Module %r conflict: unregistering previously" \
                              " loaded %r version %s from %r",
                              p.module_name,
                              p.name,
                              p.version,
                              p.file)
                    _unregister_module_extensions(name)
                    index = i
                    break
            plugin_module = imp.load_module(_PLUGIN_MODULE_PREFIX + name, *info)
            plugin = PluginWrapper(plugin_module, plugindir, file=info[1])
            versions = [version_from_string(v) for v in
                        list(plugin.api_versions)]
            compatible_versions = list(set(versions) & self._api_versions)
            if compatible_versions:
                log.debug("Loading plugin %r version %s, compatible with API: %s",
                          plugin.name,
                          plugin.version,
                          ", ".join([version_to_string(v, short=True) for v in
                                     sorted(compatible_versions)]))
                plugin.compatible = True
                setattr(picard.plugins, name, plugin_module)
                if index is not None:
                    self.plugins[index] = plugin
                else:
                    self.plugins.append(plugin)
            else:
                log.warning("Plugin '%s' from '%s' is not compatible"
                            " with this version of Picard."
                            % (plugin.name, plugin.file))
        except VersionError as e:
            log.error("Plugin %r has an invalid API version string : %s", name, e)
        except:
            log.error("Plugin %r : %s", name, traceback.format_exc())
        if info[0] is not None:
            info[0].close()
        return plugin
开发者ID:KLuken,项目名称:picard,代码行数:49,代码来源:plugin.py


示例15: load_plugindir

 def load_plugindir(self, plugindir):
     plugindir = os.path.normpath(plugindir)
     if not os.path.isdir(plugindir):
         log.warning("Plugin directory %r doesn't exist", plugindir)
         return
     names = set()
     for path in [os.path.join(plugindir, file) for file in os.listdir(plugindir)]:
         name = _plugin_name_from_path(path)
         if name:
             names.add(name)
     log.debug("Looking for plugins in directory %r, %d names found",
               plugindir,
               len(names))
     for name in sorted(names):
         self.load_plugin(name, plugindir)
开发者ID:KLuken,项目名称:picard,代码行数:15,代码来源:plugin.py


示例16: zip_import

def zip_import(path):
    if (not is_zip(path) or not os.path.isfile(path)):
        return (None, None, None)
    try:
        zip_importer = zipimport.zipimporter(path)
        plugin_name = _plugin_name_from_path(path)
        manifest_data = None
        if is_zipped_package(path):
            try:
                manifest_data = load_manifest(path)
            except Exception as why:
                log.warning("Failed to load manifest data from json: %s", why)
        return (zip_importer, plugin_name, manifest_data)
    except zipimport.ZipImportError:
        return (None, None, None)
开发者ID:metabrainz,项目名称:picard,代码行数:15,代码来源:pluginmanager.py


示例17: _save_and_rename

 def _save_and_rename(self, old_filename, metadata):
     """Save the metadata."""
     # Check that file has not been removed since thread was queued
     # Also don't save if we are stopping.
     if self.state == File.REMOVED:
         log.debug("File not saved because it was removed: %r", self.filename)
         return None
     if self.tagger.stopping:
         log.debug("File not saved because %s is stopping: %r", PICARD_APP_NAME, self.filename)
         return None
     new_filename = old_filename
     if not config.setting["dont_write_tags"]:
         encoded_old_filename = encode_filename(old_filename)
         info = os.stat(encoded_old_filename)
         self._save(old_filename, metadata)
         if config.setting["preserve_timestamps"]:
             try:
                 os.utime(encoded_old_filename, (info.st_atime, info.st_mtime))
             except OSError:
                 log.warning("Couldn't preserve timestamp for %r", old_filename)
     # Rename files
     if config.setting["rename_files"] or config.setting["move_files"]:
         new_filename = self._rename(old_filename, metadata)
     # Move extra files (images, playlists, etc.)
     if config.setting["move_files"] and config.setting["move_additional_files"]:
         self._move_additional_files(old_filename, new_filename)
     # Delete empty directories
     if config.setting["delete_empty_dirs"]:
         dirname = encode_filename(os.path.dirname(old_filename))
         try:
             self._rmdir(dirname)
             head, tail = os.path.split(dirname)
             if not tail:
                 head, tail = os.path.split(head)
             while head and tail:
                 try:
                     self._rmdir(head)
                 except:
                     break
                 head, tail = os.path.split(head)
         except EnvironmentError:
             pass
     # Save cover art images
     if config.setting["save_images_to_files"]:
         self._save_images(os.path.dirname(new_filename), metadata)
     return new_filename
开发者ID:goldphish,项目名称:picard,代码行数:46,代码来源:file.py


示例18: install_plugin

 def install_plugin(self, path, dest):
     plugin_name = _plugin_name_from_path(path)
     if plugin_name:
         try:
             dest_exists = os.path.exists(dest)
             same_file = os_path_samefile(path, dest) if dest_exists else False
             if os.path.isfile(path) and not (dest_exists and same_file):
                 shutil.copy(path, dest)
             elif os.path.isdir(path) and not same_file:
                 if dest_exists:
                     shutil.rmtree(dest)
                 shutil.copytree(path, dest)
             plugin = self.load_plugin(plugin_name, USER_PLUGIN_DIR)
             if plugin is not None:
                 self.plugin_installed.emit(plugin, False)
         except (OSError, IOError):
             log.warning("Unable to copy %s to plugin folder %s" % (path, USER_PLUGIN_DIR))
开发者ID:KLuken,项目名称:picard,代码行数:17,代码来源:plugin.py


示例19: _display_artwork_tab

    def _display_artwork_tab(self):
        tab = self.ui.artwork_tab
        images = self.obj.metadata.images
        if not images:
            self.tab_hide(tab)
            return

        self.ui.artwork_list.itemDoubleClicked.connect(self.show_item)
        for image in images:
            data = None
            try:
                if image.thumbnail:
                    try:
                        data = image.thumbnail.data
                    except CoverArtImageIOError as e:
                        log.warning(unicode(e))
                        pass
                else:
                    data = image.data
            except CoverArtImageIOError:
                log.error(traceback.format_exc())
                continue
            item = QtGui.QListWidgetItem()
            item.setData(QtCore.Qt.UserRole, image)
            if data is not None:
                pixmap = QtGui.QPixmap()
                pixmap.loadFromData(data)
                icon = QtGui.QIcon(pixmap)
                item.setIcon(icon)
                item.setToolTip(
                    _("Double-click to open in external viewer\n"
                      "Temporary file: %s\n"
                      "Source: %s") % (image.tempfile_filename, image.source))
            infos = []
            infos.append(image.types_as_string())
            if image.comment:
                infos.append(image.comment)
            infos.append(u"%s (%s)" %
                         (bytes2human.decimal(image.datalength),
                          bytes2human.binary(image.datalength)))
            if image.width and image.height:
                infos.append(u"%d x %d" % (image.width, image.height))
            infos.append(image.mimetype)
            item.setText(u"\n".join(infos))
            self.ui.artwork_list.addItem(item)
开发者ID:DanielAttia,项目名称:picard,代码行数:45,代码来源:infodialog.py


示例20: on_remote_image_fetched

 def on_remote_image_fetched(self, url, data, reply, error, fallback_data=None):
     mime = reply.header(QtNetwork.QNetworkRequest.ContentTypeHeader)
     if mime in ('image/jpeg', 'image/png'):
         self.load_remote_image(url, mime, data)
     elif url.hasQueryItem("imgurl"):
         # This may be a google images result, try to get the URL which is encoded in the query
         url = QtCore.QUrl(url.queryItemValue("imgurl"))
         self.fetch_remote_image(url)
     else:
         log.warning("Can't load remote image with MIME-Type %s", mime)
         if fallback_data:
             # Tests for image format obtained from file-magic
             try:
                 mime = imageinfo.identify(fallback_data)[2]
             except imageinfo.IdentificationError as e:
                 log.error("Unable to identify dropped data format: %s" % e)
             else:
                 log.debug("Trying the dropped %s data", mime)
                 self.load_remote_image(url, mime, fallback_data)
开发者ID:JDLH,项目名称:picard,代码行数:19,代码来源:coverartbox.py



注:本文中的picard.log.warning函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pkg_resources.invalid_marker函数代码示例发布时间:2022-05-27
下一篇:
Python log.info函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap