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


Python QMap.size方法代码示例

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


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

示例1: constructAdditionalTable

# 需要导入模块: from pyqtcore import QMap [as 别名]
# 或者: from pyqtcore.QMap import size [as 别名]
 def constructAdditionalTable(self, props, propOrder):
     tableString = QString()
     unhandledProps = QMap(props)
     # Remove handled properties
     for i in range(0, propOrder.size()):
         unhandledProps.remove(propOrder[i])
     
     # Construct the Lua string
     if (unhandledProps.size() > 0) :
         tableString = "{"
         for i in unhandledProps:
             tableString = "%s%s=%s,"%tableString, i[0], i[1]
         
         tableString = "%s}"%tableString
     
     return tableString
开发者ID:theall,项目名称:Python-Tiled,代码行数:18,代码来源:tengineplugin.py

示例2: TilesetManager

# 需要导入模块: from pyqtcore import QMap [as 别名]
# 或者: from pyqtcore.QMap import size [as 别名]
class TilesetManager(QObject):
    mInstance = None
    ##
    # Emitted when a tileset's images have changed and views need updating.
    ##
    tilesetChanged = pyqtSignal(Tileset)
    ##
    # Emitted when any images of the tiles in the given \a tileset have
    # changed. This is used to trigger repaints for displaying tile
    # animations.
    ##
    repaintTileset = pyqtSignal(Tileset)

    ##
    # Constructor. Only used by the tileset manager it
    ##
    def __init__(self):
        super().__init__()

        ##
        # Stores the tilesets and maps them to the number of references.
        ##
        self.mTilesets = QMap()
        self.mChangedFiles = QSet()
        self.mWatcher = FileSystemWatcher(self)
        self.mAnimationDriver = TileAnimationDriver(self)
        self.mReloadTilesetsOnChange = False
        self.mChangedFilesTimer = QTimer()

        self.mWatcher.fileChanged.connect(self.fileChanged)
        self.mChangedFilesTimer.setInterval(500)
        self.mChangedFilesTimer.setSingleShot(True)
        self.mChangedFilesTimer.timeout.connect(self.fileChangedTimeout)
        self.mAnimationDriver.update.connect(self.advanceTileAnimations)

    ##
    # Destructor.
    ##
    def __del__(self):
        # Since all MapDocuments should be deleted first, we assert that there are
        # no remaining tileset references.
        self.mTilesets.size() == 0

    ##
    # Requests the tileset manager. When the manager doesn't exist yet, it
    # will be created.
    ##
    def instance():
        if (not TilesetManager.mInstance):
            TilesetManager.mInstance = TilesetManager()
        return TilesetManager.mInstance

    ##
    # Deletes the tileset manager instance, when it exists.
    ##
    def deleteInstance():
        del TilesetManager.mInstance
        TilesetManager.mInstance = None

    def findTileset(self, arg):
        tp = type(arg)
        if tp in [QString, str]:
            ##
            # Searches for a tileset matching the given file name.
            # @return a tileset matching the given file name, or 0 if none exists
            ##
            fileName = arg
            for tileset in self.tilesets():
                if (tileset.fileName() == fileName):
                    return tileset
            return None
        elif tp==TilesetSpec:
            ##
            # Searches for a tileset matching the given specification.
            # @return a tileset matching the given specification, or 0 if none exists
            ##
            spec = arg
            for tileset in self.tilesets():
                if (tileset.imageSource() == spec.imageSource
                    and tileset.tileWidth() == spec.tileWidth
                    and tileset.tileHeight() == spec.tileHeight
                    and tileset.tileSpacing() == spec.tileSpacing
                    and tileset.margin() == spec.margin):

                    return tileset

            return None

    ##
    # Adds a tileset reference. This will make sure the tileset is watched for
    # changes and can be found using findTileset().
    ##
    def addReference(self, tileset):
        if (self.mTilesets.contains(tileset)):
            self.mTilesets[tileset] += 1
        else:
            self.mTilesets.insert(tileset, 1)
            imgSrc = tileset.imageSource()
            if (imgSrc != ''):
                self.mWatcher.addPath(imgSrc)
#.........这里部分代码省略.........
开发者ID:theall,项目名称:Python-Tiled,代码行数:103,代码来源:tilesetmanager.py


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