diff --git a/__pycache__/generator.cpython-39.pyc b/__pycache__/generator.cpython-39.pyc index acd05e0..4475eee 100644 Binary files a/__pycache__/generator.cpython-39.pyc and b/__pycache__/generator.cpython-39.pyc differ diff --git a/generator.py b/generator.py index 03c9a60..a38e5b9 100644 --- a/generator.py +++ b/generator.py @@ -17,7 +17,7 @@ def __init__(self, name, pk, category, country, country_code, result_path): self.result_path = result_path - self.file_name = f'cards/{self.pk}.png' + self.file_name = f'{self.result_path}/temp_cards/{self.pk}.png' self.category = category self.country = country @@ -78,7 +78,7 @@ def place_bar_code(self, filename): bar_code = Image.open(filename) width, height = bar_code.size bar_code = bar_code.resize((width * 4, height * 4), Image.ANTIALIAS) - card_name = f'cards/{self.pk}.png' + card_name = f'{self.result_path}/temp_cards/{self.pk}.png' card = Image.open(card_name) bar_code = bar_code.convert("RGBA") card = card.convert("RGBA") @@ -91,7 +91,7 @@ def place_bar_code(self, filename): def draw_bar_code(self): options = {"module_height": 6.5, "text_distance": 0.5} code128 = barcode.get('code128', f'{self.country_code}-{self.pk}-{self.category.upper()}', writer=ImageWriter()) - filename = code128.save(f"{self.path}/media/bar/1", options=options) + filename = code128.save(f"{self.result_path}/bar/{self.pk}", options=options) return self.place_bar_code(filename) def draw_codes(self): diff --git a/interface.py b/interface.py index ef20e46..a5a78ae 100644 --- a/interface.py +++ b/interface.py @@ -68,6 +68,8 @@ def set_dir(self): if self.dir: os.mkdir(f"{self.dir}/cards") os.mkdir(f"{self.dir}/back") + os.mkdir(f"{self.dir}/temp_cards") + os.mkdir(f"{self.dir}/bar") except FileExistsError: messagebox.showerror('Ошибка', "В данной папке уже существуют директории cards и back. " "Выберите пустую директорию") diff --git a/test/back/back.png b/test/back/back.png deleted file mode 100644 index 629386a..0000000 Binary files a/test/back/back.png and /dev/null differ diff --git a/test/back/back/back.png b/test/back/back/back.png deleted file mode 100644 index 629386a..0000000 Binary files a/test/back/back/back.png and /dev/null differ diff --git a/test/back/cards/001.png b/test/back/cards/001.png deleted file mode 100644 index 122c252..0000000 Binary files a/test/back/cards/001.png and /dev/null differ diff --git a/test/back/cards/002.png b/test/back/cards/002.png deleted file mode 100644 index f0c73fe..0000000 Binary files a/test/back/cards/002.png and /dev/null differ diff --git a/test/back/cards/003.png b/test/back/cards/003.png deleted file mode 100644 index 1497e8d..0000000 Binary files a/test/back/cards/003.png and /dev/null differ diff --git a/test/back/cards/004.png b/test/back/cards/004.png deleted file mode 100644 index 7722785..0000000 Binary files a/test/back/cards/004.png and /dev/null differ diff --git a/test/back/cards/005.png b/test/back/cards/005.png deleted file mode 100644 index 6a890ba..0000000 Binary files a/test/back/cards/005.png and /dev/null differ diff --git a/test/back/cards/006.png b/test/back/cards/006.png deleted file mode 100644 index 2f2bb33..0000000 Binary files a/test/back/cards/006.png and /dev/null differ diff --git a/test/back/cards/007.png b/test/back/cards/007.png deleted file mode 100644 index 0f9518a..0000000 Binary files a/test/back/cards/007.png and /dev/null differ diff --git a/test/back/cards/008.png b/test/back/cards/008.png deleted file mode 100644 index b61a057..0000000 Binary files a/test/back/cards/008.png and /dev/null differ diff --git a/test/cards/001.png b/test/cards/001.png deleted file mode 100644 index 5f8cde2..0000000 Binary files a/test/cards/001.png and /dev/null differ diff --git a/test/cards/002.png b/test/cards/002.png deleted file mode 100644 index f46bee4..0000000 Binary files a/test/cards/002.png and /dev/null differ diff --git a/test/cards/003.png b/test/cards/003.png deleted file mode 100644 index 8ac1161..0000000 Binary files a/test/cards/003.png and /dev/null differ diff --git a/test/cards/004.png b/test/cards/004.png deleted file mode 100644 index d1ca9d8..0000000 Binary files a/test/cards/004.png and /dev/null differ diff --git a/test/cards/005.png b/test/cards/005.png deleted file mode 100644 index ff32b44..0000000 Binary files a/test/cards/005.png and /dev/null differ diff --git a/test/cards/006.png b/test/cards/006.png deleted file mode 100644 index 74cb520..0000000 Binary files a/test/cards/006.png and /dev/null differ diff --git a/test/cards/007.png b/test/cards/007.png deleted file mode 100644 index 33495f7..0000000 Binary files a/test/cards/007.png and /dev/null differ diff --git a/test/cards/008.png b/test/cards/008.png deleted file mode 100644 index 76791a8..0000000 Binary files a/test/cards/008.png and /dev/null differ