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