From f80672b7c1eaa3e992e87d236bdecc3bc813b881 Mon Sep 17 00:00:00 2001 From: Sergey Vartanov Date: Sun, 20 Jun 2021 14:12:54 +0300 Subject: [PATCH] Issue #24: change icon directory. Individual icons are now generated in `icon_set/ids` and `icon_set/names` directories. --- roentgen/grid.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/roentgen/grid.py b/roentgen/grid.py index 09721fe..736c35b 100644 --- a/roentgen/grid.py +++ b/roentgen/grid.py @@ -100,15 +100,20 @@ class IconCollection: return cls(icons) - def draw_icons(self, output_directory: Path): + def draw_icons(self, output_directory: Path, by_name: bool = False): """ :param output_directory: path to the directory to store individual SVG files for icons """ + if by_name: + def get_file_name(x): + return f"Röntgen {' + '.join(x.get_names())}.svg" + else: + def get_file_name(x): + return f"{'___'.join(x.get_shape_ids())}.svg" + for icon in self.icons: - icon.draw_to_file( - output_directory / f"{'___'.join(icon.get_shape_ids())}.svg" - ) + icon.draw_to_file(output_directory / get_file_name(icon)) def draw_grid( self,