[ui] Removal of useless option for Compute and Submit selected nodes

It is now included directly in Compute and Submit options.
This commit is contained in:
Aurore LAFAURIE 2024-07-17 11:30:49 +02:00
parent 887844541c
commit cc6acbc610

View file

@ -448,26 +448,24 @@ Item {
MenuItem { MenuItem {
text: "Compute" text: "Compute"
visible: nodeMenu.currentNode ? nodeMenu.currentNode.isComputable : false visible: {
height: visible ? implicitHeight : 0 for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
enabled: nodeMenu.canComputeNode && (nodeMenu.canSubmitOrCompute%2 == 1) //canSubmit if canSubmitOrCompute == 1(can compute) or 3(can compute & submit) if (!uigraph.selectedNodes.at(i).isComputable)
onTriggered: { return false
computeRequest(nodeMenu.currentNode) }
return uigraph.selectedNodes.count > 0
} }
}
MenuItem {
text: "Compute Selected Node(s)"
visible: uigraph.selectedNodes.count > 0
height: visible ? implicitHeight : 0 height: visible ? implicitHeight : 0
enabled: { enabled: {
var canCompute = false var canCompute = false
for (var i = 0; i < uigraph.selectedNodes.count; ++i) { for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
if (uigraph.graph.canCompute(uigraph.selectedNodes.at(i)) && uigraph.graph.canSubmitOrCompute(uigraph.selectedNodes.at(i))%2 == 1){ if (uigraph.graph.canCompute(uigraph.selectedNodes.at(i)) && uigraph.graph.canSubmitOrCompute(uigraph.selectedNodes.at(i)) % 2 == 1) {
canCompute = true canCompute = true
} }
} }
return canCompute return canCompute //canSubmit if canSubmitOrCompute == 1(can compute) or 3(can compute & submit)
} }
onTriggered: { onTriggered: {
@ -476,29 +474,25 @@ Item {
} }
MenuItem { MenuItem {
text: "Submit" text: "Submit"
enabled: nodeMenu.canComputeNode && nodeMenu.canSubmitOrCompute > 1 visible: {
visible: nodeMenu.currentNode ? nodeMenu.currentNode.isComputable : uigraph ? uigraph.canSubmit : false for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
height: visible ? implicitHeight : 0 if (!uigraph.selectedNodes.at(i).isComputable)
onTriggered: submitRequest(nodeMenu.currentNode) return false
} }
MenuItem { return uigraph.selectedNodes.count > 0 || uigraph.canSubmit
text: "Submit Selected Node(s)" }
visible: uigraph.selectedNodes.count > 0
height: visible ? implicitHeight : 0 height: visible ? implicitHeight : 0
enabled: { enabled: {
var canSubmit = false var canSubmit = false
for (var i = 0; i < uigraph.selectedNodes.count; ++i) { for (var i = 0; i < uigraph.selectedNodes.count; ++i) {
if (uigraph.graph.canCompute(uigraph.selectedNodes.at(i)) && uigraph.graph.canSubmitOrCompute(uigraph.selectedNodes.at(i)) > 1){ if (uigraph.graph.canCompute(uigraph.selectedNodes.at(i)) && uigraph.graph.canSubmitOrCompute(uigraph.selectedNodes.at(i)) > 1) {
canSubmit = true canSubmit = true
} }
} }
return canSubmit return canSubmit
} }
onTriggered: submitRequest(uigraph.selectedNodes)
onTriggered: {
submitRequest(uigraph.selectedNodes)
}
} }
MenuItem { MenuItem {
text: "Stop Computation" text: "Stop Computation"