提交 cfb2bd7f 编写于 作者: K Kentaro Wada

Use edgeSelected with passing shape as second argument

上级 f9752e46
......@@ -481,7 +481,7 @@ class MainWindow(QtWidgets.QMainWindow):
onShapesPresent=(saveAs, hideAll, showAll),
)
self.canvas.possibleToAddPoint.connect(self.actions.addPointToEdge.setEnabled)
self.canvas.edgeSelected.connect(self.canvasShapeEdgeSelected)
self.menus = utils.struct(
file=self.menu('&File'),
......@@ -718,6 +718,11 @@ class MainWindow(QtWidgets.QMainWindow):
for action in self.actions.onLoadActive:
action.setEnabled(value)
def canvasShapeEdgeSelected(self, selected, shape):
self.actions.addPointToEdge.setEnabled(
selected and shape and shape.canAddPoint()
)
def queueEvent(self, function):
QtCore.QTimer.singleShot(0, function)
......
......@@ -26,7 +26,7 @@ class Canvas(QtWidgets.QWidget):
selectionChanged = QtCore.Signal(list)
shapeMoved = QtCore.Signal()
drawingPolygon = QtCore.Signal(bool)
possibleToAddPoint = QtCore.Signal(bool)
edgeSelected = QtCore.Signal(bool, object)
CREATE, EDIT = 0, 1
......@@ -267,7 +267,7 @@ class Canvas(QtWidgets.QWidget):
self.hShape.highlightClear()
self.update()
self.hVertex, self.hShape, self.hEdge = None, None, None
self.possibleToAddPoint.emit(self.hEdge is not None and self.hShape is not None and self.hShape.canAddPoint())
self.edgeSelected.emit(self.hEdge is not None, self.hShape)
def addPointToEdge(self):
if (self.hShape is None and
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册