(self, vId, ignoreAnimation=False)
| 314 | self.maxFrameRate = 30.0 |
| 315 | |
| 316 | def pushRender(self, vId, ignoreAnimation=False): |
| 317 | if vId not in self.trackingViews: |
| 318 | return |
| 319 | |
| 320 | if not self.trackingViews[vId]["enabled"]: |
| 321 | return |
| 322 | |
| 323 | if not ignoreAnimation and len(self.viewsInAnimations) > 0: |
| 324 | return |
| 325 | |
| 326 | if "originalSize" not in self.trackingViews[vId]: |
| 327 | view = self.getView(vId) |
| 328 | self.trackingViews[vId]["originalSize"] = list(view.GetSize()) |
| 329 | |
| 330 | if "ratio" not in self.trackingViews[vId]: |
| 331 | self.trackingViews[vId]["ratio"] = 1 |
| 332 | |
| 333 | ratio = self.trackingViews[vId]["ratio"] |
| 334 | mtime = self.trackingViews[vId]["mtime"] |
| 335 | quality = self.trackingViews[vId]["quality"] |
| 336 | size = [int(s * ratio) for s in self.trackingViews[vId]["originalSize"]] |
| 337 | |
| 338 | reply = self.stillRender( |
| 339 | {"view": vId, "mtime": mtime, "quality": quality, "size": size} |
| 340 | ) |
| 341 | stale = reply["stale"] |
| 342 | if reply["image"]: |
| 343 | # depending on whether the app has encoding enabled: |
| 344 | if self.decode: |
| 345 | reply["image"] = base64.standard_b64decode(reply["image"]) |
| 346 | |
| 347 | reply["image"] = self.addAttachment(reply["image"]) |
| 348 | reply["format"] = "jpeg" |
| 349 | # save mtime for next call. |
| 350 | self.trackingViews[vId]["mtime"] = reply["mtime"] |
| 351 | # echo back real ID, instead of -1 for 'active' |
| 352 | reply["id"] = vId |
| 353 | self.publish("viewport.image.push.subscription", reply) |
| 354 | if stale: |
| 355 | self.lastStaleTime = time.time() |
| 356 | if self.staleHandlerCount == 0: |
| 357 | self.staleHandlerCount += 1 |
| 358 | schedule_callback( |
| 359 | self.deltaStaleTimeBeforeRender, lambda: self.renderStaleImage(vId) |
| 360 | ) |
| 361 | else: |
| 362 | self.lastStaleTime = 0 |
| 363 | |
| 364 | def renderStaleImage(self, vId): |
| 365 | self.staleHandlerCount -= 1 |
no test coverage detected