當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。