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


Python Properties.contains方法代码示例

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


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

示例1: Object

# 需要导入模块: from properties import Properties [as 别名]
# 或者: from properties.Properties import contains [as 别名]
class Object():
    LayerType = 0
    MapObjectType = 1
    MapType = 2
    TerrainType = 3
    TilesetType = 4
    TileType = 5
    
    def __init__(self, arg):
        tp = type(arg)
        self.mProperties = Properties()

        if tp==int:
            self.mTypeId = arg
        elif tp==Object:
            self.mTypeId = arg.mTypeId
            self.mProperties = arg.mProperties

    ##
    # Virtual destructor.
    ##
    def __del__(self):
        pass
    ##
    # Returns the type of this object.
    ##
    def typeId(self):
        return self.mTypeId

    ##
    # Returns the properties of this object.
    ##
    def properties(self):
        return self.mProperties

    ##
    # Replaces all existing properties with a new set of properties.
    ##
    def setProperties(self, properties):
        self.mProperties = properties
    ##
    # Merges \a properties with the existing properties. Properties with the
    # same name will be overridden.
    #
    # \sa Properties.merge
    ##
    def mergeProperties(self, properties):
        self.mProperties.merge(properties)
    ##
    # Returns the value of the object's \a name property.
    ##
    def property(self, name):
        return self.mProperties.value(name,'')
    ##
    # Returns whether this object has a property with the given \a name.
    ##
    def hasProperty(self, name):
        return self.mProperties.contains(name)
    ##
    # Sets the value of the object's \a name property to \a value.
    ##
    def setProperty(self, name, value):
        self.mProperties.insert(name, value)
    ##
    # Removes the property with the given \a name.
    ##
    def removeProperty(self, name):
        self.mProperties.remove(name)
开发者ID:theall,项目名称:Python-Tiled,代码行数:70,代码来源:object.py

示例2: PropertyBrowser

# 需要导入模块: from properties import Properties [as 别名]
# 或者: from properties.Properties import contains [as 别名]

#.........这里部分代码省略.........
            mapDocument.selectedObjectsChanged.connect(self.selectedObjectsChanged)
            mapDocument.selectedTilesChanged.connect(self.selectedTilesChanged)

    ##
    # Returns whether the given \a item displays a custom property.
    ##
    def isCustomPropertyItem(self, item):
        return item and self.mPropertyToId[item.property()] == PropertyId.CustomProperty

    ##
    # Makes the custom property with the \a name the currently edited one,
    # if it exists.
    ##
    def editCustomProperty(self, name):
        property = self.mNameToProperty.value(name)
        if (not property):
            return
        propertyItems = self.items(property)
        if (not propertyItems.isEmpty()):
            self.editItem(propertyItems.first())

    def event(self, event):
        if event.type() == QEvent.LanguageChange:
            self.retranslateUi()

        return super().event(event)

    def mapChanged(self):
        if (self.mObject == self.mMapDocument.map()):
            self.updateProperties()

    def objectsChanged(self, objects):
        if (self.mObject and self.mObject.typeId() == Object.MapObjectType):
            if (objects.contains(self.mObject)):
                self.updateProperties()

    def layerChanged(self, index):
        if (self.mObject == self.mMapDocument.map().layerAt(index)):
            self.updateProperties()

    def objectGroupChanged(self, objectGroup):
        if (self.mObject == objectGroup):
            self.updateProperties()

    def imageLayerChanged(self, imageLayer):
        if (self.mObject == imageLayer):
            self.updateProperties()

    def tilesetChanged(self, tileset):
        if (self.mObject == tileset):
            self.updateProperties()

    def tileChanged(self, tile):
        if (self.mObject == tile):
            self.updateProperties()

    def terrainChanged(self, tileset, index):
        if (self.mObject == tileset.terrain(index)):
            self.updateProperties()

    def propertyAdded(self, object, name):
        if (not self.mMapDocument.currentObjects().contains(object)):
            return
        if (self.mNameToProperty.contains(name)):
            if (self.mObject == object):
                self.mUpdating = True
开发者ID:theall,项目名称:Python-Tiled,代码行数:70,代码来源:propertybrowser.py


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