def attributesListClicked(self, event): print "attributesListClicked" print dir(event) print event.class selectedNode = self.pathList.selectedValue if selectedNode: attributeName = self.attributesList.selectedValue print "attributeName", attributeName if attributeName: r = Repository() selectedID = r.symbolIndexForString(selectedNode) attributeID = r.symbolIndexForString(attributeName) attributeValueID = r.find(selectedID, attributeID) print "Result", attributeValueID if attributeValueID: attributeValue = r.stringForSymbolIndex(attributeValueID) print "attributeValue", attributeValue else: attributeValue = "PROBLEM" self.currentEditor.text = attributeValue if event.clickCount == 2: print "double click" self.pathList.model.addElement(attributeValue)
def savePressed(self, event): print "save pressed" r = Repository() selectedNode = self.pathList.selectedValue if selectedNode: selectedID = r.symbolIndexForString(selectedNode) attributeName = self.attributesList.selectedValue if attributeName: attributeID = r.symbolIndexForString(attributeName) attributeValue = self.currentEditor.text valueID = r.symbolIndexForString(attributeValue) result = r.add(selectedID, attributeID, valueID) print "Result", result
def pathListClicked(self, event): print "path changed" selectedNode = self.pathList.selectedValue if selectedNode: r = Repository() model = self.attributesList.model model.clear() if selectedNode: selectedID = r.symbolIndexForString(selectedNode) attributes = r.collectAttributes(selectedID) print attributes for attribute in attributes: attributeName = r.stringForSymbolIndex(attribute) model.addElement(attributeName)
def addAttributePressed(self, event): print "add atribute pressed" selectedNode = self.pathList.selectedValue if selectedNode: attributeName = self.newAttributeTextField.text if attributeName: attributeValue = self.currentEditor.text print "attributeName", attributeName print "value", attributeValue r = Repository() selectedID = r.symbolIndexForString(selectedNode) attributeID = r.symbolIndexForString(attributeName) valueID = r.symbolIndexForString(attributeValue) result = r.add(selectedID, attributeID, valueID) print "Result", result # refresh list self.pathListClicked(None)