Skip to content

Commit 4d0d63a

Browse files
broodsfabiencastan
authored andcommitted
[ui] change SubmittedOrRunning function to only Running, string computation, function naming
1 parent b30c092 commit 4d0d63a

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

meshroom/core/node.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,12 @@ def process(self, forceCompute=False):
410410
try:
411411
self.node.nodeDesc.processChunk(self)
412412
except Exception as e:
413+
self._status.elapsedTime = time.time() - startTime
413414
if self._status.status != Status.STOPPED:
414-
self._status.elapsedTime = time.time() - startTime
415415
self.upgradeStatusTo(Status.ERROR)
416416
raise
417417
except (KeyboardInterrupt, SystemError, GeneratorExit) as e:
418+
self._status.elapsedTime = time.time() - startTime
418419
self.upgradeStatusTo(Status.STOPPED)
419420
raise
420421
finally:
@@ -802,6 +803,14 @@ def clearData(self):
802803
shutil.rmtree(self.internalFolder)
803804
self.updateStatusFromCache()
804805

806+
@Slot(result=str)
807+
def getStartDateTime(self):
808+
""" Return the date (str) of the first running chunk """
809+
if not self.isAlreadySubmittedOrFinished() or len(self._chunks) == 0:
810+
return ""
811+
dateTime = [chunk._status.startDateTime for chunk in self._chunks if chunk._status.startDateTime != ""]
812+
return min(dateTime) if len(dateTime) != 0 else ""
813+
805814
def isAlreadySubmitted(self):
806815
for chunk in self._chunks:
807816
if chunk.isAlreadySubmitted():
@@ -824,13 +833,10 @@ def isSubmittedOrRunning(self):
824833
return True
825834
return False
826835

827-
@Slot(result=str)
828-
def getFirstChunkRunning(self):
829-
""" Return the date (str) of the first running chunk """
830-
if not self.isAlreadySubmittedOrFinished() or len(self._chunks) == 0:
831-
return ""
832-
dateTime = [chunk._status.startDateTime for chunk in self._chunks if chunk._status.startDateTime != ""]
833-
return min(dateTime) if len(dateTime) != 0 else ""
836+
@Slot(result=bool)
837+
def isRunning(self):
838+
""" Return True if at least one chunk of this Node is running, False otherwise. """
839+
return any(chunk.isRunning() for chunk in self._chunks)
834840

835841
@Slot(result=bool)
836842
def isFinishedOrRunning(self):

meshroom/ui/qml/GraphEditor/NodeEditor.qml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Panel {
2727

2828
onNodeChanged: {
2929
nodeStartDateTime = ""
30-
if (node !== null && node.isSubmittedOrRunning()) {
30+
if (node !== null && node.isRunning()) {
3131
timer.start()
3232
}
3333
else if (node !== null && (node.isFinishedOrRunning() || node.globalStatus=="ERROR")) {
@@ -46,23 +46,25 @@ Panel {
4646
interval: 2500
4747
triggeredOnStart: true
4848
repeat: true
49-
running: node !== null && node.isSubmittedOrRunning()
49+
running: node !== null && node.isRunning()
5050
onTriggered: {
5151
if (nodeStartDateTime === "") {
52-
nodeStartDateTime = new Date(node.getFirstChunkRunning()).getTime()
53-
}
52+
nodeStartDateTime = new Date(node.getStartDateTime()).getTime()
53+
}
5454
var now = new Date().getTime()
55-
parent.text=Format.getTimeStr((now-nodeStartDateTime)/1000)
55+
var runningTime=Format.getTimeStr((now-nodeStartDateTime)/1000)
5656

57-
var chunkCompletion=0
58-
if (node.chunks.count>1) {
57+
var chunksCompleted = 0
58+
var chunkCompletion = ""
59+
if (node.chunks.count>0) {
5960
for (var i = 0; i < node.chunks.count; i++) {
6061
if (node.chunks.at(i).statusName == "SUCCESS") {
61-
chunkCompletion++
62+
chunksCompleted++
6263
}
6364
}
64-
parent.text+= " | "+ chunkCompletion + "/" + node.chunks.count + " chunks"
65+
chunkCompletion = " | "+ chunksCompleted + "/" + node.chunks.count + " chunk" + (node.chunks.count == 1 ? "" : "s")
6566
}
67+
parent.text = runningTime + chunkCompletion
6668

6769
}
6870
}

0 commit comments

Comments
 (0)