aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/defconQt/glyphView.py15
-rw-r--r--Lib/defconQt/representationFactories/glyphViewFactory.py2
2 files changed, 13 insertions, 4 deletions
diff --git a/Lib/defconQt/glyphView.py b/Lib/defconQt/glyphView.py
index 88073ae..840b317 100644
--- a/Lib/defconQt/glyphView.py
+++ b/Lib/defconQt/glyphView.py
@@ -305,6 +305,13 @@ class OffCurvePointItem(QGraphicsEllipseItem):
self.setRect(-offHalf/scale, -offHalf/scale, offWidth/scale, offHeight/scale)
self.setPen(QPen(offCurvePointStrokeColor, offCurvePenWidth/scale))
+class ComponentItem(QGraphicsPathItem):
+ def __init__(self, path, component):
+ super(ComponentItem, self).__init__()
+ self._component = component
+ self.setFlag(QGraphicsItem.ItemIsMovable)
+ self.setFlag(QGraphicsItem.ItemIsSelectable)
+
class OnCurvePointItem(QGraphicsPathItem):
def __init__(self, x, y, isSmooth, contour, point, scale=1, parent=None):
super(OnCurvePointItem, self).__init__(parent)
@@ -1284,9 +1291,11 @@ class GlyphView(QGraphicsView):
scene._outlineItem.setZValue(-995)
scene._glyphObject = self._glyph
# components
- paths = self._glyph.getRepresentation("defconQt.OnlyComponentsQPainterPath")
- for path in paths:
- scene.addPath(path, brush=QBrush(componentFillColor))
+ components = self._glyph.getRepresentation("defconQt.OnlyComponentsQPainterPath")
+ scene._componentItems = []
+ for path, component in components:
+ component_path = scene.addPath(path, brush=QBrush(componentFillColor))
+ scene._componentItems.append(ComponentItem(component_path, component))
def addPoints(self):
scene = self.scene()
diff --git a/Lib/defconQt/representationFactories/glyphViewFactory.py b/Lib/defconQt/representationFactories/glyphViewFactory.py
index 1b96cdc..c98c9ae 100644
--- a/Lib/defconQt/representationFactories/glyphViewFactory.py
+++ b/Lib/defconQt/representationFactories/glyphViewFactory.py
@@ -63,7 +63,7 @@ class OnlyComponentsQtPen(BasePen):
pen.path.setFillRule(Qt.WindingFill)
tPen = TransformPen(pen, transformation)
glyph.draw(tPen)
- self.paths.append(pen.path)
+ self.paths.append([pen.path, glyph])
# ----------
# point data