+ self.data = PlanetLabData()
+
+ self.tree = Tree()
+ self.tree.shouldTreeDelegateFocusToElement = alwaysDelegateFocus
+
+ item = SfaItem("plc", "(authority)", truncate = False)
+ self.tree.addItem(item)
+
+ item = SfaItem("plc.glc", "(authority)", truncate = False)
+ self.tree.addItem(item)
+
+ item = SfaItem("plc.vini", "(authority)", truncate = False)
+ self.tree.addItem(item)
+
+ item = SfaItem("ple", "(authority)", truncate = False)
+ self.tree.addItem(item)
+
+ item = SfaItem("plj", "(authority)", truncate = False)
+ self.tree.addItem(item)
+
+ self.tree.addTreeListener(self)
+
+ self.initWidget(self.tree)
+
+
+ def onTreeItemSelected(self, item):
+ record = self.data.getRecord(item.hrn)
+ p = PopupRecord(record)
+ left = item.getAbsoluteLeft() + 10
+ top = item.getAbsoluteTop() + 10
+ p.setPopupPosition(left, top)
+ p.show()
+
+ def onTreeItemStateChanged(self, item):
+ child = item.getChild(0)
+ if hasattr(child, "isPendingItem"):
+ item.removeItem(child)
+ hrns = sorted(self.data.listChildren(item.hrn),
+ key=lambda hrn: hrn[0])
+ for (hrn, kind) in hrns:
+ item.addItem(SfaItem(hrn, kind))