Skip to content

Commit

Permalink
Use repository name instead of hash for symbol identifiers (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
havatv authored Apr 21, 2020
1 parent 45bc316 commit b00a604
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions resource_sharing/resource_handler/symbol_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _get_parent_group_or_tag(self):
or parent tag (for QGIS3) for the styles.
Returns the id of the (existing or new) group or tag."""
parent_group_name = '%s (%s)' % (
self.collection['name'], self.collection_id)
self.collection['name'], self.collection['repository_name'])
try:
# QGIS 2
group = self.style.groupId(parent_group_name)
Expand Down Expand Up @@ -67,7 +67,7 @@ def _get_child_group_tag(self, group_or_tag_id, file_name):
except AttributeError:
# not QGIS 2, so hopefully QGIS 3
#tag_name = self.style.tag(group_or_tag_id) + '/' + file_name
tag_name = ('%s (%s)/') % (self.collection['name'], self.collection_id) + file_name
tag_name = ('%s (%s)/') % (self.collection['name'], self.collection['repository_name']) + file_name
tag = self.style.tagId(tag_name)
if tag != 0:
return tag
Expand All @@ -76,7 +76,7 @@ def _get_child_group_tag(self, group_or_tag_id, file_name):
def _get_child_groups_tags_ids(self):
"""Retrieve ids for the child groups (for QGIS2) or tags (for QGIS3)."""
parent_group_name = '%s (%s)' % (
self.collection['name'], self.collection_id)
self.collection['name'], self.collection['repository_name'])
try:
# QGIS 2
return [self.style.groupId(n) for n in
Expand Down Expand Up @@ -162,14 +162,14 @@ def install(self):
# Add all symbols and colorramps and group / tag them
symbol_xml_extractor = SymbolXMLExtractor(symbol_file)
for symbol in symbol_xml_extractor.symbols:
symbol_name = '%s (%s)' % (symbol['name'], self.collection_id)
symbol_name = '%s (%s)' % (symbol['name'], self.collection['repository_name'])
# self.resolve_dependency(symbol[SYMBOL])
if self.style.addSymbol(symbol_name, symbol[SYMBOL], True):
self._group_or_tag(QgsStyle.SymbolEntity, symbol_name,
groupOrTag_id)
for colorramp in symbol_xml_extractor.colorramps:
colorramp_name = '%s (%s)' % (
colorramp['name'], self.collection_id)
colorramp['name'], self.collection['repository_name'])
if self.style.addColorRamp(
colorramp_name, colorramp['colorramp'], True):
self._group_or_tag(
Expand Down

0 comments on commit b00a604

Please sign in to comment.