From 870ec62552042874009591a7f7df7ceccd51650c Mon Sep 17 00:00:00 2001 From: Timo Homburg Date: Mon, 29 Nov 2021 20:07:21 +0100 Subject: [PATCH] Added tooltips in tree --- tasks/classtreequerytask.py | 4 ++++ tasks/geocollectionsquerytask.py | 10 ++++++---- tasks/geoconceptsquerytask.py | 2 ++ tasks/instancelistquerytask.py | 6 ++++-- util/sparqlutils.py | 1 + 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tasks/classtreequerytask.py b/tasks/classtreequerytask.py index 57dfececd..50b1d2bc7 100644 --- a/tasks/classtreequerytask.py +++ b/tasks/classtreequerytask.py @@ -82,20 +82,24 @@ def run(self): result["label"]["value"]+" ("+SPARQLUtils.labelFromURI(subval,self.triplestoreconf["prefixesrev"])+")") self.classtreemap[subval].setIcon(SPARQLUtils.geoclassicon) self.classtreemap[subval].setData(SPARQLUtils.geoclassnode, 257) + self.classtreemap[subval].setToolTip("GeoClass "+str(self.classtreemap[subval].text())+":
"+SPARQLUtils.treeNodeToolTip) else: self.classtreemap[subval].setText( result["label"]["value"]+" ("+SPARQLUtils.labelFromURI(subval,self.triplestoreconf["prefixesrev"])+")") self.classtreemap[subval].setIcon(SPARQLUtils.classicon) self.classtreemap[subval].setData(SPARQLUtils.classnode, 257) + self.classtreemap[subval].setToolTip("Class "+str(self.classtreemap[subval].text())+":
"+str(SPARQLUtils.treeNodeToolTip)) else: if "hasgeo" in result: self.classtreemap[subval].setText(SPARQLUtils.labelFromURI(subval,self.triplestoreconf["prefixesrev"])) self.classtreemap[subval].setIcon(SPARQLUtils.geoclassicon) self.classtreemap[subval].setData(SPARQLUtils.geoclassnode, 257) + self.classtreemap[subval].setToolTip("GeoClass "+str(self.classtreemap[subval].text())+":
"+SPARQLUtils.treeNodeToolTip) else: self.classtreemap[subval].setText(SPARQLUtils.labelFromURI(subval,self.triplestoreconf["prefixesrev"])) self.classtreemap[subval].setIcon(SPARQLUtils.classicon) self.classtreemap[subval].setData(SPARQLUtils.classnode, 257) + self.classtreemap[subval].setToolTip("Class "+str(self.classtreemap[subval].text())+":
"+SPARQLUtils.treeNodeToolTip) if subval not in self.subclassmap: self.subclassmap[subval]=set() diff --git a/tasks/geocollectionsquerytask.py b/tasks/geocollectionsquerytask.py index 64ece9e24..da3966b39 100644 --- a/tasks/geocollectionsquerytask.py +++ b/tasks/geocollectionsquerytask.py @@ -106,10 +106,6 @@ def finished(self, result): item = QStandardItem() item.setData(concept["uri"], 256) item.setData(SPARQLUtils.collectionclassnode, 257) - if self.featureOrGeoCollection: - item.setIcon(SPARQLUtils.featurecollectionicon) - else: - item.setIcon(SPARQLUtils.geometrycollectionicon) itemtext="" if "label" in concept: itemtext=concept["label"]+" ("+concept["uri"][concept["uri"].rfind('/') + 1:]+")" @@ -118,6 +114,12 @@ def finished(self, result): if "members" in concept: itemtext+=" ["+str(concept["members"])+"]" item.setText(itemtext) + if self.featureOrGeoCollection: + item.setIcon(SPARQLUtils.featurecollectionicon) + item.setToolTip("FeatureCollection " + str(item.text()) + ":
" + SPARQLUtils.treeNodeToolTip) + else: + item.setIcon(SPARQLUtils.geometrycollectionicon) + item.setToolTip("GeometryCollection " + str(item.text()) + ":
" + SPARQLUtils.treeNodeToolTip) self.geoClassList.appendRow(item) self.sparql.updateNewClassList() self.geoClassListGui.selectionModel().setCurrentIndex(self.geoClassList.index(0, 0), diff --git a/tasks/geoconceptsquerytask.py b/tasks/geoconceptsquerytask.py index cc534140c..300b99b38 100644 --- a/tasks/geoconceptsquerytask.py +++ b/tasks/geoconceptsquerytask.py @@ -72,6 +72,7 @@ def finished(self, result): item.setEditable(False) item.setIcon(SPARQLUtils.geoclassicon) item.setData(SPARQLUtils.geoclassnode, 257) + item.setToolTip("GeoClass "+str(item.text())+":
"+SPARQLUtils.treeNodeToolTip) #item.appendRow(QStandardItem("Child")) self.rootNode.appendRow(item) if self.triplestoreconf["name"] == "Wikidata": @@ -99,6 +100,7 @@ def finished(self, result): item.setEditable(False) item.setIcon(SPARQLUtils.geoclassicon) item.setData(SPARQLUtils.geoclassnode, 257) + item.setToolTip("GeoClass "+str(item.text())+":
"+SPARQLUtils.treeNodeToolTip) #item.appendRow(QStandardItem("Child")) self.rootNode.appendRow(item) if self.triplestoreconf["name"] == "Wikidata": diff --git a/tasks/instancelistquerytask.py b/tasks/instancelistquerytask.py index f2ed3f1d8..f829f72f6 100644 --- a/tasks/instancelistquerytask.py +++ b/tasks/instancelistquerytask.py @@ -66,11 +66,13 @@ def finished(self, result): for concept in self.queryresult: item = QStandardItem() item.setData(concept, 256) + item.setText(self.queryresult[concept]["label"]) if self.treeNode.data(257)==SPARQLUtils.geoclassnode or self.treeNode.data(257)==SPARQLUtils.collectionclassnode: item.setData(SPARQLUtils.geoinstancenode,257) - item.setIcon(SPARQLUtils.earthinstanceicon) + item.setIcon(SPARQLUtils.earthinstanceicon) + item.setToolTip("GeoInstance " + str(item.text()) + ":
" + SPARQLUtils.treeNodeToolTip) else: item.setData(SPARQLUtils.instancenode,257) item.setIcon(SPARQLUtils.instanceicon) - item.setText(self.queryresult[concept]["label"]) + item.setToolTip("Instance " + str(item.text()) + ":
" + SPARQLUtils.treeNodeToolTip) self.treeNode.appendRow(item) diff --git a/util/sparqlutils.py b/util/sparqlutils.py index f2cf74222..95f8fc534 100644 --- a/util/sparqlutils.py +++ b/util/sparqlutils.py @@ -35,6 +35,7 @@ class SPARQLUtils: geoinstancenode="GeoInstance" collectionclassnode="CollectionClass" instancesloadedindicator="InstancesLoaded" + treeNodeToolTip="Double click to load, right click for menu" @staticmethod def executeQuery(triplestoreurl, query,triplestoreconf=None):