本文整理汇总了Python中models.Activity.id方法的典型用法代码示例。如果您正苦于以下问题:Python Activity.id方法的具体用法?Python Activity.id怎么用?Python Activity.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Activity
的用法示例。
在下文中一共展示了Activity.id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: auto_checkout
# 需要导入模块: from models import Activity [as 别名]
# 或者: from models.Activity import id [as 别名]
def auto_checkout():
active_checkins = Checkin.checkins.active()
for checkin in active_checkins:
auto_checkout_activity = Activity()
auto_checkout_activity = checkin.checkin_activity
auto_checkout_activity.time = datetime.datetime.now()
auto_checkout_activity.id = None
auto_checkout_activity.save()
checkin.checkout_activity = auto_checkout_activity
checkin.save()
示例2: OlaInterfaceDialog
# 需要导入模块: from models import Activity [as 别名]
# 或者: from models.Activity import id [as 别名]
class OlaInterfaceDialog(QDialog):
def __init__(self, iface, **kwargs):
QDialog.__init__(self)
self.iface = iface
# Set up the user interface from Designer.
self.ui = Ui_OlaInterfaceDialog()
self.ui.setupUi(self)
self.logger = self.getLogger()
self.treeWidget = self.findChildren(QTreeWidget, "taggroupTreeWidget")[0]
self.settings = QSettings("Land Observatory", "Land Observatory Polygon Editor")
def log(self, message):
if self.logger is not None:
self.logger.log(message)
def getLogger(self):
self.loggingTextEdit = self.findChildren(QPlainTextEdit, "loggingTextEdit")[0]
return Logger(self.loggingTextEdit)
def getActivityByIdFinished(self, success, statusCode, response):
# Disconnect events
self.activityRequestManager.disconnect(
self.activityRequestManager.activityProtocol,
SIGNAL("readSignal( bool, int, QString )"),
self.getActivityByIdFinished,
)
keys = []
for i in self.settings.value("mainkeys").toStringList():
keys.append(i)
try:
data = json.loads(str(response))
self.treeWidget.clear()
self.currentActivity = Activity(id=data["data"][0]["id"], version=data["data"][0]["version"])
layers = []
for taggroup in data["data"][0]["taggroups"]:
try:
tgItem = QTreeWidgetItem(self.treeWidget.invisibleRootItem())
tgItem.setText(0, "%s: %s" % (taggroup["main_tag"]["key"], taggroup["main_tag"]["value"]))
idItem = QTreeWidgetItem(tgItem)
idItem.setText(0, "id: %s" % (taggroup["tg_id"]))
tagNr = 0
for tag in taggroup["tags"]:
tItem = QTreeWidgetItem(tgItem)
tItem.setText(tagNr, "%s: %s" % (tag["key"], tag["value"]))
tagNr += 1
if taggroup["main_tag"]["key"] in keys:
# Create a memory layer per taggroup
l = QgsVectorLayer(
"MultiPolygon?crs=epsg:4326&index=yes",
"%s: %s" % (taggroup["main_tag"]["key"], taggroup["main_tag"]["value"]),
"memory",
)
provider = l.dataProvider()
# update layer's extent when new features have been added
# because change of extent in provider is not propagated to the layer
l.updateExtents()
# pr = taggroupLayer.dataProvider()
self.connect(l, SIGNAL("layerModified( bool )"), self._layer_modified)
if "geometry" in taggroup:
if taggroup["geometry"]["type"].lower() == "MultiPolygon".lower():
polygon_list = []
for polygon in taggroup["geometry"]["coordinates"]:
polyline_list = []
for polyline in polygon:
point_list = []
for point in polyline:
point_list.append(QgsPoint(point[0], point[1]))
polyline_list.append(point_list)
polygon_list.append(polyline_list)
multiPolygon = QgsGeometry.fromMultiPolygon(polygon_list)
feature = QgsFeature()
feature.setGeometry(multiPolygon)
feature.setAttributeMap({})
#.........这里部分代码省略.........