本文整理汇总了Python中models.Activity.createDiff方法的典型用法代码示例。如果您正苦于以下问题:Python Activity.createDiff方法的具体用法?Python Activity.createDiff怎么用?Python Activity.createDiff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Activity
的用法示例。
在下文中一共展示了Activity.createDiff方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _createNewActivity
# 需要导入模块: from models import Activity [as 别名]
# 或者: from models.Activity import createDiff [as 别名]
def _createNewActivity(id=None, otherActivity=None):
# Connect to the protocol signal
self.connect(self.activityProtocol, SIGNAL("created( bool, int, QString )"), _createNewActivityFinished)
# Create a new Uuid
if id is not None:
uid = QPlainUuid(id)
else:
uid = QPlainUuid(QUuid.createUuid())
tagGroups = list(TagGroup() for i in range(len(groups)))
# attrs is a dictionary: key = field index, value = QgsFeatureAttribute
# show all attributes and their values
self.log("Attribute list:")
for (k, attr) in attrs.iteritems():
if k is not identifierColumnIndex:
self.log("%s: %s" % (fieldIndexMap[k], attr.toString()))
# First search the correct taggroup to append
attributeName = provider.fields()[k].name()
currentTagGroup = 0
for g in groups:
if attributeName in g:
break
else:
currentTagGroup += 1
if attr is not None and attr.toString() != '':
tag = Tag(key=fieldIndexMap[k], value=attr.toString())
tagGroups[currentTagGroup].addTag(tag)
if tagGroups[currentTagGroup].mainTag() is None:
tagGroups[currentTagGroup].setMainTag(tag)
a = Activity(id=uid)
a.setGeometry(feature.geometry())
for tg in tagGroups:
if len(tg.tags) > 0:
a.addTagGroup(tg)
wrapperObj = {}
wrapperObj['activities'] = [a.createDiff(otherActivity)]
self.activityProtocol.add(json.dumps(wrapperObj, sort_keys=True, indent=4 * ' '))