Skip to content

Commit c882b53

Browse files
broodsfabiencastan
authored andcommitted
[ui] add node computation time in real time in node editor
[ui] add node computation time in real time in node editor [ui] add node computation time in real time in node editor
1 parent 45fd86e commit c882b53

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed

meshroom/core/node.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,14 @@ def isSubmittedOrRunning(self):
823823
return True
824824
return False
825825

826+
@Slot(result=str)
827+
def getFirstChunkRunning(self):
828+
""" Return the date (str) of the first running chunk """
829+
if not self.isAlreadySubmittedOrFinished() or len(self._chunks) == 0:
830+
return ""
831+
dateTime = [chunk._status.startDateTime for chunk in self._chunks if chunk._status.startDateTime != ""]
832+
return min(dateTime) if len(dateTime) != 0 else ""
833+
826834
@Slot(result=bool)
827835
def isFinishedOrRunning(self):
828836
""" Return True if all chunks of this Node is either finished or running, False otherwise. """

meshroom/ui/qml/GraphEditor/NodeEditor.qml

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,42 @@ Panel {
1717
property variant node
1818
property bool readOnly: false
1919
property bool isCompatibilityNode: node && node.compatibilityIssue !== undefined
20+
property string nodeStartDateTime: ""
2021

2122
signal attributeDoubleClicked(var mouse, var attribute)
2223
signal upgradeRequest()
2324

2425
title: "Node" + (node !== null ? " - <b>" + node.label + "</b>" + (node.label !== node.defaultLabel ? " (" + node.defaultLabel + ")" : "") : "")
2526
icon: MaterialLabel { text: MaterialIcons.tune }
2627

28+
onNodeChanged: {
29+
nodeStartDateTime = ""
30+
if (node !== null && node.isSubmittedOrRunning()) {
31+
timer.start()
32+
}
33+
else if (node !== null && node.isFinishedOrRunning()) {
34+
computationInfo.text = Format.getTimeStr(node.elapsedTime)
35+
}
36+
else {
37+
computationInfo.text = ""
38+
}
39+
}
40+
2741
headerBar: RowLayout {
2842
Label {
29-
text: {
30-
if (node !== null && node.isSubmittedOrRunning()) {
31-
// Some chunks might be submitted but they'll all run eventually
32-
if (node.elapsedTime > 0) { // At least a chunk is done running
33-
return "Running for: " + Format.getTimeStr(node.elapsedTime)
34-
} else {
35-
return (node.chunks.count > 1) ? "First chunk running" : "Node running"
43+
id: computationInfo
44+
Timer {
45+
id: timer
46+
interval: 2500
47+
triggeredOnStart: true
48+
repeat: true
49+
running: node !== null && node.isSubmittedOrRunning()
50+
onTriggered: {
51+
if (nodeStartDateTime === "") {
52+
nodeStartDateTime = new Date(node.getFirstChunkRunning()).getTime()
3653
}
37-
} else if (node !== null && node.isFinishedOrRunning()) {
38-
/* Either all chunks finished running or the last one is running
39-
* Placed inside an "else if" instead of "else" to avoid entering the functions
40-
* when there is no real use */
41-
return Format.getTimeStr(node.elapsedTime)
42-
} else {
43-
return ""
54+
var now = new Date().getTime()
55+
parent.text=Format.getTimeStr((now-nodeStartDateTime)/1000)
4456
}
4557
}
4658
padding: 2
@@ -184,7 +196,10 @@ Panel {
184196
MenuItem {
185197
enabled: root.node !== null
186198
text: "Clear Pending Status"
187-
onClicked: node.clearSubmittedChunks()
199+
onClicked: {
200+
node.clearSubmittedChunks()
201+
timer.stop()
202+
}
188203
}
189204
}
190205
}

0 commit comments

Comments
 (0)