Skip to content

Commit

Permalink
Added tooltips in tree
Browse files Browse the repository at this point in the history
  • Loading branch information
situx committed Nov 29, 2021
1 parent c604282 commit 870ec62
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
4 changes: 4 additions & 0 deletions tasks/classtreequerytask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())+": <br>"+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())+": <br>"+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())+": <br>"+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())+": <br>"+SPARQLUtils.treeNodeToolTip)

if subval not in self.subclassmap:
self.subclassmap[subval]=set()
Expand Down
10 changes: 6 additions & 4 deletions tasks/geocollectionsquerytask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]+")"
Expand All @@ -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()) + ": <br>" + SPARQLUtils.treeNodeToolTip)
else:
item.setIcon(SPARQLUtils.geometrycollectionicon)
item.setToolTip("GeometryCollection " + str(item.text()) + ": <br>" + SPARQLUtils.treeNodeToolTip)
self.geoClassList.appendRow(item)
self.sparql.updateNewClassList()
self.geoClassListGui.selectionModel().setCurrentIndex(self.geoClassList.index(0, 0),
Expand Down
2 changes: 2 additions & 0 deletions tasks/geoconceptsquerytask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())+": <br>"+SPARQLUtils.treeNodeToolTip)
#item.appendRow(QStandardItem("Child"))
self.rootNode.appendRow(item)
if self.triplestoreconf["name"] == "Wikidata":
Expand Down Expand Up @@ -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())+": <br>"+SPARQLUtils.treeNodeToolTip)
#item.appendRow(QStandardItem("Child"))
self.rootNode.appendRow(item)
if self.triplestoreconf["name"] == "Wikidata":
Expand Down
6 changes: 4 additions & 2 deletions tasks/instancelistquerytask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()) + ": <br>" + SPARQLUtils.treeNodeToolTip)
else:
item.setData(SPARQLUtils.instancenode,257)
item.setIcon(SPARQLUtils.instanceicon)
item.setText(self.queryresult[concept]["label"])
item.setToolTip("Instance " + str(item.text()) + ": <br>" + SPARQLUtils.treeNodeToolTip)
self.treeNode.appendRow(item)
1 change: 1 addition & 0 deletions util/sparqlutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 870ec62

Please sign in to comment.