Skip to content

Commit 718df10

Browse files
committed
Introduce separate print_template title, which strips tenant subdir prefix
1 parent 097a9e9 commit 718df10

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/config_generator/qgs_reader.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ def __print_templates(self, root, shortname_map):
200200
}
201201
print_template = {}
202202
print_template['name'] = template.get('name')
203+
print_template['title'] = template.get('name')
203204
print_map = {}
204205
print_map['name'] = "map0"
205206
print_map['x'] = float(position[0]) * tomm.get(position[2], 1)
@@ -225,10 +226,10 @@ def __print_templates(self, root, shortname_map):
225226

226227
print_templates.append(print_template)
227228

228-
project_template_names = [template['name'] for template in print_templates]
229+
project_template_titles = [template['title'] for template in print_templates]
229230
return print_templates + [
230231
template for template in self.global_print_layouts
231-
if template["name"] not in project_template_names
232+
if template["title"] not in project_template_titles
232233
]
233234

234235

src/config_generator/theme_reader.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def __search_global_print_layouts(self):
8181
if subdirpath and not dirpath.startswith(subdirpath):
8282
continue
8383
relpath = dirpath[len(qgis_print_layouts_dir.rstrip('/')) + 1:]
84+
subdirrelpath = dirpath[len(subdirpath or qgis_print_layouts_dir.rstrip('/')) + 1:]
8485

8586
for filename in files:
8687
if Path(filename).suffix != ".qpt":
@@ -100,6 +101,7 @@ def __search_global_print_layouts(self):
100101
position = composer_map.get('positionOnPage').split(',')
101102
print_template = OrderedDict()
102103
print_template['name'] = os.path.join(relpath, layout.get('name'))
104+
print_template['title'] = os.path.join(subdirrelpath, layout.get('name'))
103105
print_map = OrderedDict()
104106
print_map['name'] = "map0"
105107
print_map['x'] = float(position[0])

0 commit comments

Comments
 (0)