def replyMonitors(self, msg):
"""Handle reply to monitors request"""
self.monitors = msg["replydata"]
for monitor in self.monitors:
if monitor not in self.monitorState: # Monitor is newly available
self.monitorState[monitor] = {}
self.monitorState[monitor]["treeItem"] = QTreeWidgetItem(1002) # Type 1002 for monitor item
self.monitorState[monitor]["treeItem"].setText(0, monitor)
self.monitorState[monitor]["treeItem"].setIcon(0, self.monitorOkIcon)
self.treeItem.addChild(self.monitorState[monitor]["treeItem"])
self.treeItem.setExpanded(True)
self.monitorState[monitor]["state"] = "stop"
self.monitorState[monitor]["sheet"] = None
for monitor in self.monitorState:
if monitor not in self.monitors: # Monitor exists in state, but is not available anymore
self.monitorState[monitor]["state"] = "gone"
self.monitorState[monitor]["treeItem"].setIcon(0, self.monitorGoneIcon)
# TODO: Set sheet item state here (blue for active, but no sheet, red for gone, black for all good)
评论列表
文章目录