From b0457462828ecc6b8e49c8a08616cf7401a97d91 Mon Sep 17 00:00:00 2001 From: Daniel Maturana Date: Thu, 20 Jul 2017 23:33:09 -0400 Subject: [PATCH 1/3] override polygon shape --- sloth/gui/annotationscene.py | 2 +- sloth/items/items.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sloth/gui/annotationscene.py b/sloth/gui/annotationscene.py index 85a9bcc..4e7197f 100644 --- a/sloth/gui/annotationscene.py +++ b/sloth/gui/annotationscene.py @@ -410,7 +410,7 @@ def drawForeground(self, painter, rect): self._message_text_item.paint(painter, QStyleOptionGraphicsItem(), None) - # + # # utility functions # diff --git a/sloth/items/items.py b/sloth/items/items.py index 2b41bc3..6e9c7a6 100644 --- a/sloth/items/items.py +++ b/sloth/items/items.py @@ -769,6 +769,7 @@ def __init__(self, model_item=None, prefix="", parent=None): self._polygon = None self._updatePolygon(self._dataToPolygon(self._model_item)) + LOG.debug("Constructed polygon %s for model item %s" % (self._polygon, model_item)) @@ -830,3 +831,10 @@ def paint(self, painter, option, widget=None): def dataChange(self): polygon = self._dataToPolygon(self._model_item) self._updatePolygon(polygon) + + def shape(self): + shape = QPainterPath() + for pt in self._polygon: + shape.lineTo(pt) + shape.lineTo(self._polygon[0]) + return shape From 8fe1b17540b89b67907ac8687b10f41281c3684f Mon Sep 17 00:00:00 2001 From: Daniel Maturana Date: Thu, 20 Jul 2017 23:44:13 -0400 Subject: [PATCH 2/3] undo extra comment --- sloth/gui/annotationscene.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sloth/gui/annotationscene.py b/sloth/gui/annotationscene.py index 4e7197f..0a0b883 100644 --- a/sloth/gui/annotationscene.py +++ b/sloth/gui/annotationscene.py @@ -410,6 +410,7 @@ def drawForeground(self, painter, rect): self._message_text_item.paint(painter, QStyleOptionGraphicsItem(), None) + # # # utility functions # From 128236f21cfb626315a19413315b21b6479aed1b Mon Sep 17 00:00:00 2001 From: Daniel Maturana Date: Thu, 20 Jul 2017 23:45:39 -0400 Subject: [PATCH 3/3] Revert "undo extra comment" This reverts commit 8fe1b17540b89b67907ac8687b10f41281c3684f. --- sloth/gui/annotationscene.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sloth/gui/annotationscene.py b/sloth/gui/annotationscene.py index 0a0b883..4e7197f 100644 --- a/sloth/gui/annotationscene.py +++ b/sloth/gui/annotationscene.py @@ -410,7 +410,6 @@ def drawForeground(self, painter, rect): self._message_text_item.paint(painter, QStyleOptionGraphicsItem(), None) - # # # utility functions #