当前位置: 首页>>代码示例>>Python>>正文


Python QImageReader.supportedImageFormats方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QImageReader.supportedImageFormats方法的典型用法代码示例。如果您正苦于以下问题:Python QImageReader.supportedImageFormats方法的具体用法?Python QImageReader.supportedImageFormats怎么用?Python QImageReader.supportedImageFormats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui.QImageReader的用法示例。


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

示例1: string_handler

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
def string_handler(key, value, **kwargs):
    def parse_links():
        strings = value.split(',')
        pairs = [tuple(parts.split('|')) for parts in strings]
        handlers = []
        for pair in pairs:
            url = pair[0]
            if not any(url.startswith(proto) for proto in ['http:', 'file:']):
                continue
            try:
                name = pair[1]
            except IndexError:
                name = url
            handlers.append('<a href="{}">{}</a>'.format(url, name))
        if handlers:
            return ','.join(handlers)

    def try_image(value):
        _, extension = os.path.splitext(value)
        if extension[1:].lower() in supportedformats:
            if not os.path.exists(value):
                value = os.path.join(kwargs.get('imagepath', ''), value)
            return image_handler(key, value, imagetype='file')

        base64 = QByteArray.fromBase64(value)
        image = QPixmap()
        loaded = image.loadFromData(base64)
        if loaded:
            return image_handler(key, base64, imagetype='base64')

    global supportedformats
    if not supportedformats:
        supportedformats = [f.data() for f in QImageReader.supportedImageFormats()]

    return parse_links() or try_image(value) or value
开发者ID:HeatherHillers,项目名称:RoamMac,代码行数:37,代码来源:htmlviewer.py

示例2: printSupportedImageFormats

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
def printSupportedImageFormats():
    from PyQt4.QtGui import QImageReader
    
    formats = QImageReader.supportedImageFormats()
    print "\nSupported Image Formats:"
    for f in formats:
        print "\t" + str(f)
    print "\n"
开发者ID:gubatron,项目名称:blooploader,代码行数:10,代码来源:__init__.py

示例3: dump_configinfo

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
 def dump_configinfo(self):
     from qgis.core import QgsApplication, QgsProviderRegistry
     from PyQt4.QtGui import QImageReader, QImageWriter
     yield QgsProviderRegistry.instance().pluginList()
     yield QImageReader.supportedImageFormats()
     yield QImageWriter.supportedImageFormats()
     yield QgsApplication.libraryPaths()
     yield "Translation file: {}".format(self.translationFile)
开发者ID:Kenyat1989,项目名称:Roam,代码行数:10,代码来源:environ.py

示例4: fileOpen

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
 def fileOpen(self):
     if not self.okToContinue():
         return
     dir = (os.path.dirname(self.filename)
            if self.filename is not None else ".")
     formats = (["*.{0}".format(unicode(format).lower())
             for format in QImageReader.supportedImageFormats()])
     fname = unicode(QFileDialog.getOpenFileName(self,
             "Image Changer - Choose Image", dir,
             "Image files ({0})".format(" ".join(formats))))
     if fname:
         self.loadFile(fname)
开发者ID:imagingearth,项目名称:PyQt4-Examples,代码行数:14,代码来源:MainWindow_ans.py

示例5: string_handler

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
def string_handler(key, value):
    global supportedformats
    if not supportedformats:
        supportedformats = [f.data() for f in QImageReader.supportedImageFormats()]

    base64 = QByteArray.fromBase64(value)
    image = QPixmap()
    loaded = image.loadFromData(base64)
    if loaded:
        return image_handler(key, base64, imagetype='base64')
    _, extension = os.path.splitext(value)
    if extension[1:] in supportedformats:
        return image_handler(key, value, imagetype='file')

    return value
开发者ID:henriquespedro,项目名称:Roam,代码行数:17,代码来源:htmlviewer.py

示例6: on_iconSelect_clicked

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
    def on_iconSelect_clicked(self):
        """ Signal handler for select icon button.

        @return None
        """
        item = self.editItem
        if item:
            formats = str.join(' ', ['*.%s' % str(fmt) for fmt in
                                     QImageReader.supportedImageFormats()])
            filename = QFileDialog.getOpenFileName(
                self, 'Select Symbol Icon', '', 'Images (%s)' % formats)
            if filename:
                icon = QIcon(filename)
                item.setIcon(icon)
                self.iconPreview.setPixmap(icon.pixmap(32,32))
                settings = self.settings
                settings.setValue('%s/icon' % item.symbol, icon)
                self.emit(Signals.modified)
开发者ID:InfiniteAlpha,项目名称:profitpy,代码行数:20,代码来源:main.py

示例7: __init__

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
    def __init__(self, tree_widget, controls_ui, controller, logger):
        self.tree = tree_widget
        self.controls_ui = controls_ui
        self.controller = controller
        self.datahandler = controller.datahandler
        self.logger = logger

        self.root_folder = None
        self.last_clicked = None
        self.connection = None
        self.selected_data = None
        self.current_public_link = None
        self.loading_ui = None
        
        # Treeview header init
        headers = self.tree.headerItem()
        headers.setTextAlignment(0, Qt.AlignLeft|Qt.AlignVCenter)
        headers.setTextAlignment(1, Qt.AlignRight|Qt.AlignVCenter)

        font = headers.font(0)
        font.setPointSize(12)
        headers.setFont(0, font)
        headers.setFont(1, font)
        
        self.tree.header().resizeSections(QHeaderView.ResizeToContents)
        
        # Click tracking
        self.clicked_items = {}
        
        # Supported thumb image formats
        self.supported_reader_formats = QImageReader.supportedImageFormats()
        
        # Thumbs init
        self.thumbs = {}

        # Current loading anim list
        self.load_animations = []
        
        # Connects
        self.tree.itemSelectionChanged.connect(self.item_selection_changed)
        self.tree.itemClicked.connect(self.item_clicked)
        self.tree.itemExpanded.connect(self.item_expanded)
        self.tree.itemCollapsed.connect(self.item_collapsed)
开发者ID:Sohil876,项目名称:DropN900,代码行数:45,代码来源:uicontroller.py

示例8: on_actionAbout_triggered

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
    def on_actionAbout_triggered(self):
        dlg = QMessageBox(self)
        dlg.setWindowTitle("About Point Tracker")
        dlg.setIconPixmap(self.windowIcon().pixmap(64, 64))
        #dlg.setTextFormat(Qt.RichText)

        dlg.setText("""Point Tracker Tool version %s rev %s
Developper: Pierre Barbier de Reuille <[email protected]>
Copyright 2008
""" % (__version__, __revision__))

        img_read = ", ".join(str(s) for s in QImageReader.supportedImageFormats())
        img_write = ", ".join(str(s) for s in QImageWriter.supportedImageFormats())

        dlg.setDetailedText("""Supported image formats:
  - For reading: %s

  - For writing: %s
""" % (img_read, img_write))
        dlg.exec_()
开发者ID:PierreBdR,项目名称:point_tracker,代码行数:22,代码来源:tracking_window.py

示例9: excepthook

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
import roam.utils
from roam.mainwindow import MainWindow

def excepthook(errorhandler, exctype, value, traceback):
    errorhandler(exctype, value, traceback)
    roam.utils.error("Uncaught exception", exc_info=(exctype, value, traceback))

start = time.time()
roam.utils.info("Loading Roam")

QgsApplication.setPrefixPath(prefixpath, True)
QgsApplication.initQgis()

roam.utils.info(QgsApplication.showSettings())
roam.utils.info(QgsProviderRegistry.instance().pluginList())
roam.utils.info(QImageReader.supportedImageFormats())
roam.utils.info(QImageWriter.supportedImageFormats())
roam.utils.info(QgsApplication.libraryPaths())

QApplication.setStyle("Plastique")
QApplication.setFont(QFont('Segoe UI'))

class Settings:
    def __init__(self, path):
        self.path = path
        self.settings = {}

    def load(self):
        settingspath = self.path
        with open(settingspath, 'r') as f:
            self.settings = yaml.load(f)
开发者ID:vpicavet,项目名称:Roam,代码行数:33,代码来源:__main__.py

示例10: supportedImageFormats

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
def supportedImageFormats():
    return [bytes(fmt).decode("ascii")
            for fmt in QImageReader.supportedImageFormats()]
开发者ID:ajdapretnar,项目名称:orange3-imageanalytics,代码行数:5,代码来源:owimageimport.py

示例11: str

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
    'txt'   :   UTF8TextFile,
    'tar'   :   TarFileType,
    'gz'    :   ArchiveFileType,
    'bz2'   :   ArchiveFileType,
    'gzip'  :   ArchiveFileType,
    'zip'   :   ArchiveFileType,
    'xz'    :   ArchiveFileType,
    'tgz'   :   ArchiveFileType,
    'properties':   PropsFileType,
}


__cachedFileTypes = {}
__magicModule = None
__QTSupportedImageFormats = [ str( fmt ) for fmt in
                              QImageReader.supportedImageFormats() ]


def __isMagicAvailable():
    " Checks if the magic module is able to be loaded "
    try:
        import magic
        m = magic.Magic()
        m.close()
        return True
    except:
        return False

# Cached value to avoid unnecessary searches for a name
MAGIC_AVAILABLE = __isMagicAvailable()
开发者ID:eaglexmw,项目名称:codimension,代码行数:32,代码来源:fileutils.py

示例12: import

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
import os
from types import NoneType
from string import Template

from PyQt4.QtCore import QUrl, QByteArray, QDate, QDateTime, QTime
from PyQt4.QtGui import (QDialog, QWidget, QGridLayout, QPixmap,
                         QImageReader, QDesktopServices)
from PyQt4.QtWebKit import QWebView, QWebPage

from roam import utils


images = {}
formats = [f.data() for f in QImageReader.supportedImageFormats()]


def image_handler(key, value, **kwargs):
    imageblock = '''
                    <a href="{}" class="thumbnail">
                      <img width="200" height="200" src="{}"\>
                    </a>'''

    imagetype = kwargs.get('imagetype', 'base64' )
    global images
    images[key] = (value, imagetype)
    if imagetype == 'base64':
        src = 'data:image/png;base64,${}'.format(value.toBase64())
    else:
        src = value
    return imageblock.format(key, src)
开发者ID:vpicavet,项目名称:Roam,代码行数:32,代码来源:htmlviewer.py

示例13: dump_configinfo

# 需要导入模块: from PyQt4.QtGui import QImageReader [as 别名]
# 或者: from PyQt4.QtGui.QImageReader import supportedImageFormats [as 别名]
 def dump_configinfo(self):
     yield QgsProviderRegistry.instance().pluginList()
     yield QImageReader.supportedImageFormats()
     yield QImageWriter.supportedImageFormats()
     yield QgsApplication.libraryPaths()
     yield "Translation file: {}".format(self.translationFile)
开发者ID:mdouchin,项目名称:Roam,代码行数:8,代码来源:environ.py


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