Skip to content

Commit

Permalink
Layer title instead of id (#44)
Browse files Browse the repository at this point in the history
* layer title instead of id

* show metadata again in the manage tab
  • Loading branch information
ghtmtt committed Dec 23, 2021
1 parent 5866ecc commit ab76c3e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qgreenland_dowload.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def _fill_manage_tree(self):
parent_item = self.list_model_manage.itemFromIndex(candidate_indices[0])

# create the child (checkable)
child = QStandardItem(layer['id'])
child = QStandardItem(layer['title'])
# set the custom data for the item as the unique id of each layer
child.setData(layer['id'], Qt.UserRole)
child.setFlags(Qt.ItemIsEnabled|Qt.ItemIsSelectable|Qt.ItemIsUserCheckable)
Expand Down Expand Up @@ -508,7 +508,7 @@ def display_information_manage(self, current, previous):
for layer in self.downloaded_layers:

# get the correspondence between the clicked layer in the treeView and the title in the dictionary
if layer['id'] == item.text():
if layer['title'] == item.text():
# Format layer details, replacing newlines with html `<br>` elements.
layer_details = layer['layer_details'].replace('\n', '<br>')

Expand Down Expand Up @@ -893,14 +893,14 @@ def load_layers(self):
if file_extension not in raster_extension:
map_layer = QgsVectorLayer(
file_path,
layer['id'],
layer['title'],
'ogr'
)
# raster layers
else:
map_layer = QgsRasterLayer(
file_path,
layer['id']
layer['title']
)

# add to the project, without automatically creating a legend node for the layer...
Expand Down

0 comments on commit ab76c3e

Please sign in to comment.