From 8ee74e400b2f8c41f7c16918c340a4561e98d8bd Mon Sep 17 00:00:00 2001 From: Adrien Tétar Date: Sat, 31 Oct 2015 13:10:35 +0100 Subject: glyphView: rename anchor with double-click --- Lib/defconQt/glyphView.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Lib/defconQt') diff --git a/Lib/defconQt/glyphView.py b/Lib/defconQt/glyphView.py index cca153e..45ba255 100644 --- a/Lib/defconQt/glyphView.py +++ b/Lib/defconQt/glyphView.py @@ -116,7 +116,10 @@ class AddAnchorDialog(QDialog): def __init__(self, pos=None, parent=None): super(AddAnchorDialog, self).__init__(parent) self.setWindowModality(Qt.WindowModal) - self.setWindowTitle("Add anchor…") + if pos is not None: + self.setWindowTitle("Add anchor…") + else: + self.setWindowTitle("Rename anchor…") layout = QGridLayout(self) @@ -136,8 +139,9 @@ class AddAnchorDialog(QDialog): l = 0 layout.addWidget(anchorNameLabel, l, 0) layout.addWidget(self.anchorNameEdit, l, 1, 1, 3) - l += 1 - layout.addWidget(anchorPositionLabel, l, 0, 1, 4) + if pos is not None: + l += 1 + layout.addWidget(anchorPositionLabel, l, 0, 1, 4) l += 1 layout.addWidget(buttonBox, l, 3) self.setLayout(layout) @@ -1017,6 +1021,12 @@ class AnchorItem(QGraphicsPathItem): scene._blocked = False return value + def mouseDoubleClickEvent(self, event): + view = self.scene().views()[0] + newAnchorName, ok = AddAnchorDialog.getNewAnchorName(view) + if ok: + self._anchor.name = newAnchorName + def setPointPath(self, scale=None): path = QPainterPath() if scale is None: -- cgit v1.2.3