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


Python QPixmap.load方法代码示例

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


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

示例1: decoration

# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import load [as 别名]
    def decoration(self, index):
        """Defines the decoration of the node.

        Tries to load a banner from the URL, defined by :py:meth:`banner_url`,
        sets a default image while loading and in case the attempt to
        obtain a banner was unsuccesful. If a banner has been cached for the
        given URL, the cached image will be used instead.

        :param index: The index referring to the node to get decoration for.
        :type index: :class:`~.PySide.QtCore.QModelIndex`

        :returns: The :class:`PySide.QtGui.Pixmap` to use as the node's decoration.

        """
        pixmap = QPixmap()
        banner_url = self.banner_url()
        if banner_url:
            placeholder = ":/icons/image-loading.png"
            fetch = True
        else:
            banner_url = placeholder = ":/icons/image-missing.png"
            fetch = False

        if not pixmap_cache.find(banner_url, pixmap):
            if fetch:
                banner_loader.fetch_banner(banner_url, index, self._cache)
            pixmap.load(placeholder)
            if self._scale:
                pixmap = pixmap.scaled(self._scale, Qt.AspectRatioMode.KeepAspectRatio)
            pixmap_cache.insert(banner_url, pixmap)
        return pixmap
开发者ID:toroettg,项目名称:SeriesMarker,代码行数:33,代码来源:decorated_node.py

示例2: paintStartAndFinishLine

# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import load [as 别名]
    def paintStartAndFinishLine(self, painter):
        start = QPixmap()
        start.load('.\\pictures\\start-finish\\start.bmp')
        finish = QPixmap()
        finish.load('.\\pictures\\start-finish\\finish.bmp')

        for y in range(0, self.field.height, start.height()):
            painter.drawPixmap(QPoint(self.field.start_line_x, y) + self.field.focus_point, start)
            painter.drawPixmap(QPoint(self.field.finish_line_x, y) + self.field.focus_point, finish)
开发者ID:akhtyamovpavel,项目名称:mr-ant,代码行数:11,代码来源:game_run_to_anthill.py

示例3: pixmap_cache

# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import load [as 别名]
def pixmap_cache ( name ):
    """ Return the QPixmap corresponding to a filename.  If the filename does
        not contain a path component then the local 'images' directory is used.
    """
    if name[:1] == '@':
        image = image_for( name )
        if image is not None:
            return image.bitmap

    path, _ = os.path.split( name )
    if not path:
        name = os.path.join( os.path.dirname( __file__ ), 'images', name )

    pm = QPixmap()

    if not QPixmapCache.find( name, pm ):
        pm.load( name )
        QPixmapCache.insert( name, pm )

    return pm
开发者ID:davidmorrill,项目名称:facets,代码行数:22,代码来源:helper.py

示例4: finished_request

# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import load [as 别名]
    def finished_request(self, reply):
        """Processes replies and dispatches results to requesters.

        This method will be invoked on each finished request, submitted by
        :py:meth:`.fetch_banner`. It then converts the loaded data into a
        banner and passes the result on to the model of the request's origin.

        :param reply: The network reply from a banner load request.
        :type reply: :class:`.QNetworkReply`

        """
        pixmap = QPixmap()
        if reply.error() == QNetworkReply.NoError:
            image_bytes = reply.readAll()
            pixmap.loadFromData(image_bytes)
        else:
            pixmap.load(":/icons/image-missing.png")

        index = self._ready_signal.pop(reply.request().url().toString())

        index.model().setData(index, pixmap, Qt.DecorationRole)
开发者ID:toroettg,项目名称:SeriesMarker,代码行数:23,代码来源:banner_loader.py

示例5: __init__

# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import load [as 别名]
    def __init__(self, app_tag, app_image_path, app_description_path):
        QWidget.__init__(self)
        # App tag
        self.app_tag_ = QLabel(app_tag)
        # App image
        app_image = QPixmap()
        app_image.load(app_image_path)
        self.app_image_ = QLabel()
        self.app_image_.setPixmap(app_image)
        # App description
        try:
            f = open(app_description_path, "r")
            self.app_description_ = f.read()
            f.close()
        except:
            print "Error opening description. Quitting."

        self.setToolTip(self.app_description_)
        # Layout the child widgets
        self.child_layout_ = QVBoxLayout()
        self.child_layout_.addWidget(self.app_image_)
        self.child_layout_.addWidget(self.app_tag_)

        self.setLayout(self.child_layout_)
开发者ID:jhu-interaction,项目名称:wallframe,代码行数:26,代码来源:wallframe_app_menu_button.py

示例6: MdiArea

# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import load [as 别名]
class MdiArea(QMdiArea):  # MdiArea::MdiArea(MainWindow* mw, QWidget *parent) : QMdiArea(parent), mainWin(mw)
    """
    Subclass of `QMdiArea`_

    TOWRITE
    """

    def __init__(self, mw, parent=None):
        """
        Default class constructor.

        :param `mw`: Pointer to a application main window instance.
        :type `mw`: `MainWindow`_
        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QWidget`_
        """
        super(MdiArea, self).__init__(parent)

        self.mainWin = mw
        self.gSpiralsImgPath = mw.gImgDir + os.sep + 'texture-spirals.png'
        self.gLogoSpiralsImgPath = mw.gImgDir + os.sep + 'logo-spirals.png'

        try:  #if QT_VERSION >= 0x040800
            self.setTabsClosable(True)
        except AttributeError:
            pass

        self.useLogo = False
        self.useTexture = False
        self.useColor = False

        self.bgLogo = QPixmap()
        self.bgTexture = QPixmap(self.gSpiralsImgPath)
        self.bgColor = QColor()

        self.bgLogo = QPixmap(self.gLogoSpiralsImgPath)

        # Brushes
        self.colorBrush = QBrush(QColor(EMBROIDERBLUE1))
        self.backgroundBrush = QBrush(QPixmap(self.gSpiralsImgPath))
        linearGrad = QLinearGradient(QPointF(0, 0), QPointF(400, 400))
        linearGrad.setColorAt(0, QColor(EMBROIDERBLUE1))
        linearGrad.setColorAt(1, QColor(EMBROIDERBLUE2))
        self.gradientBrush = QBrush(linearGrad)

        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.setActivationOrder(QMdiArea.ActivationHistoryOrder)

        self.setFocusPolicy(Qt.WheelFocus)
        self.setFocus()

        self.setAcceptDrops(True)
        self.doSetDocumentMode(True)

    def __del__(self):
        """Class destructor."""
        qDebug("MdiArea Destructor")

    def useBackgroundLogo(self, use):
        """
        TOWRITE

        :param `use`: TOWRITE
        :type `use`: bool
        """
        self.useLogo = use
        self.forceRepaint()

    def useBackgroundTexture(self, use):
        """
        TOWRITE

        :param `use`: TOWRITE
        :type `use`: bool
        """
        self.useTexture = use
        self.forceRepaint()

    def useBackgroundColor(self, use):
        """
        TOWRITE

        :param `use`: TOWRITE
        :type `use`: bool
        """
        self.useColor = use
        self.forceRepaint()

    def setBackgroundLogo(self, fileName):
        """
        TOWRITE

        :param `fileName`: TOWRITE
        :type `fileName`: QString
        """
        self.bgLogo.load(fileName)
        self.forceRepaint()

    def setBackgroundTexture(self, fileName):
#.........这里部分代码省略.........
开发者ID:Allen76,项目名称:Embroidermodder,代码行数:103,代码来源:mdiarea.py

示例7: ImageSource

# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import load [as 别名]
class ImageSource(Source):
    '''
    A celestial object represented by an image, such as a planet or a galaxy.
    
    // These two vectors, along with Source.xyz, determine the position of the
    // image object.  The corners are as follows
    //
    //  xyz-u+v   xyz+u+v
    //     +---------+     ^
    //     |   xyz   |     | v
    //     |    .    |     .
    //     |         |
    //     +---------+
    //  xyz-u-v    xyz+u-v
    //
    //          .--->
    //            u
    '''
    image_scale = 1

    def get_horizontal_corner(self):
        return [self.ux, self.uy, self.uz]
    
    def get_verical_corner(self):
        return [self.vx, self.vy, self.vz]
    
    def set_up_vector(self, up_v):
        p = self.geocentric_coords
        u = negate(normalized(cross_product(p, up_v)))
        v = cross_product(u, p)
        v.scale(self.image_scale)
        u.scale(self.image_scale)
        
        self.ux = u.x
        self.uy = u.y
        self.uz = u.z
        
        self.vx = v.x
        self.vy = v.y
        self.vz = v.z
    
    def set_image_id(self, input_id):
        # hack bool to prevent blank meteors from rendering
        self.is_blank = True if input_id == 'blank' else False
        
        url = "assets/drawable/" + input_id + ".png"
        self.pixmap_image = QPixmap()
        
        if not self.pixmap_image.load(url):
            raise RuntimeError("Could not load image resource")
    
    def __init__(self, geo_coord, new_id, up_v=Vector3(0.0, 1.0, 0.0), im_scale=1):
        '''
        Constructor
        '''
        Source.__init__(self, colors.WHITE, geo_coord)
        self.is_blank = False
        self.requires_blending = False
        self.pixmap_image = None
        self.image_scale = im_scale
        self.set_up_vector(up_v)
        self.set_image_id(new_id)
开发者ID:NBor,项目名称:SkyPython,代码行数:64,代码来源:ImageSource.py


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