Skip to content

Commit 24c4585

Browse files
author
Matthieu Hog
committed
auto update
1 parent f982c1a commit 24c4585

File tree

4 files changed

+32
-6
lines changed

4 files changed

+32
-6
lines changed

meshroom/core/node.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,11 @@ def has3DOutputAttribute(self):
14181418
has3DOutput = Property(bool, has3DOutputAttribute, notify=outputAttrEnabledChanged)
14191419

14201420
isPlugin = Property(bool, lambda self: self.nodeDesc.isPlugin, constant=True)
1421-
isBuilt = Property(bool, lambda self: self.nodeDesc.isBuilt, constant=True)
1421+
1422+
isEnvBuild = (not isPlugin) #init build status false its not a plugin
1423+
buildStatusChanged = Signal() #event to notify change in status
1424+
isBuiltStatus = Property(bool, lambda self: self.isEnvBuild, notify = buildStatusChanged)
1425+
# isBuiltStatus = Property(bool, lambda self: self.nodeDesc.isBuilt, constant=True)
14221426

14231427
class Node(BaseNode):
14241428
"""

meshroom/ui/graph.py

+25-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(self, parent=None):
4444
self._stopFlag = Event()
4545
self._refreshInterval = 5 # refresh interval in seconds
4646
self._files = []
47+
self._nodes = []
4748
if submitters:
4849
self._filePollerRefresh = PollerRefreshStatus.MINIMAL_ENABLED
4950
else:
@@ -53,7 +54,7 @@ def __del__(self):
5354
self._threadPool.terminate()
5455
self._threadPool.join()
5556

56-
def start(self, files=None):
57+
def start(self, files=None, nodes=None):
5758
""" Start polling thread.
5859
5960
Args:
@@ -66,6 +67,7 @@ def start(self, files=None):
6667
return
6768
self._stopFlag.clear()
6869
self._files = files or []
70+
self._nodes = nodes or []
6971
self._thread = Thread(target=self.run)
7072
self._thread.start()
7173

@@ -78,6 +80,15 @@ def setFiles(self, files):
7880
with self._mutex:
7981
self._files = files
8082

83+
def setNodes(self, nodes):
84+
""" Set the list of nodes to monitor
85+
86+
Args:
87+
nodes: the list of nodes to monitor
88+
"""
89+
with self._mutex:
90+
self._nodes = nodes
91+
8192
def stop(self):
8293
""" Request polling thread to stop. """
8394
if not self._thread:
@@ -94,6 +105,13 @@ def getFileLastModTime(f):
94105
except OSError:
95106
return -1
96107

108+
@staticmethod
109+
def updatePluginEnvStatus(n):
110+
""" Will update the status of the plugin env """
111+
print("Refreshing "+str(n))
112+
n.isEnvBuild=n.nodeDesc.isBuilt
113+
n.buildStatusChanged.emit()
114+
97115
def run(self):
98116
""" Poll watched files for last modification time. """
99117
while not self._stopFlag.wait(self._refreshInterval):
@@ -103,6 +121,8 @@ def run(self):
103121
with self._mutex:
104122
if files == self._files:
105123
self.timesAvailable.emit(times)
124+
#update plugin nodes
125+
_ = self._threadPool.map(self.updatePluginEnvStatus, self._nodes)
106126

107127
def onFilePollerRefreshChanged(self, value):
108128
""" Stop or start the file poller depending on the new refresh status. """
@@ -116,7 +136,6 @@ def onFilePollerRefreshChanged(self, value):
116136
filePollerRefresh = Property(int, lambda self: self._filePollerRefresh.value, constant=True)
117137
filePollerRefreshReady = Signal() # The refresh status has been updated and is ready to be used
118138

119-
120139
class ChunksMonitor(QObject):
121140
"""
122141
ChunksMonitor regularly check NodeChunks' status files for modification and trigger their update on change.
@@ -147,6 +166,8 @@ def setChunks(self, chunks):
147166
self.monitorableChunks = chunks
148167
files, monitoredChunks = self.watchedStatusFiles
149168
self._filesTimePoller.setFiles(files)
169+
pluginNodes = [c.node for c in chunks if c.node.isPlugin]
170+
self._filesTimePoller.setNodes(pluginNodes)
150171
self.monitoredChunks = monitoredChunks
151172

152173
def stop(self):
@@ -172,7 +193,8 @@ def watchedStatusFiles(self):
172193
elif self.filePollerRefresh is PollerRefreshStatus.MINIMAL_ENABLED.value:
173194
for c in self.monitorableChunks:
174195
# When a chunk's status is ERROR, it may be externally re-submitted and it should thus still be monitored
175-
if c._status.status is Status.SUBMITTED or c._status.status is Status.RUNNING or c._status.status is Status.ERROR:
196+
#Plugin nodes are always moniotored
197+
if c.node.isPlugin or c._status.status is Status.SUBMITTED or c._status.status is Status.RUNNING or c._status.status is Status.ERROR:
176198
files.append(c.statusFile)
177199
chunks.append(c)
178200
return files, chunks

meshroom/ui/qml/GraphEditor/Node.qml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Item {
2121
readonly property bool isCompatibilityNode: node ? node.hasOwnProperty("compatibilityIssue") : false
2222
/// Whether the node is a plugin that needs to be build
2323
readonly property bool isPlugin: node ? node.isPlugin : false
24-
property bool isNotBuilt: node ? (!node.isBuilt) : false
24+
property bool isNotBuilt: node ? (!node.isBuiltStatus) : false
2525
/// Mouse related states
2626
property bool mainSelected: false
2727
property bool selected: false

meshroom/ui/qml/GraphEditor/NodeEditor.qml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Panel {
1919
property bool isCompatibilityNode: node && node.compatibilityIssue !== undefined
2020
property string nodeStartDateTime: ""
2121
readonly property bool isPlugin: node ? node.isPlugin : false
22-
readonly property bool isNotBuilt: node ? (!node.isBuilt) : false
22+
property bool isNotBuilt: node ? (!node.isBuiltStatus) : false
2323

2424
signal attributeDoubleClicked(var mouse, var attribute)
2525
signal upgradeRequest()

0 commit comments

Comments
 (0)