Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified __pycache__/generator.cpython-39.pyc
Binary file not shown.
6 changes: 3 additions & 3 deletions generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. "
"Выберите пустую директорию")
Expand Down
Binary file removed test/back/back.png
Binary file not shown.
Binary file removed test/back/back/back.png
Binary file not shown.
Binary file removed test/back/cards/001.png
Binary file not shown.
Binary file removed test/back/cards/002.png
Binary file not shown.
Binary file removed test/back/cards/003.png
Binary file not shown.
Binary file removed test/back/cards/004.png
Binary file not shown.
Binary file removed test/back/cards/005.png
Binary file not shown.
Binary file removed test/back/cards/006.png
Binary file not shown.
Binary file removed test/back/cards/007.png
Binary file not shown.
Binary file removed test/back/cards/008.png
Binary file not shown.
Binary file removed test/cards/001.png
Binary file not shown.
Binary file removed test/cards/002.png
Binary file not shown.
Binary file removed test/cards/003.png
Binary file not shown.
Binary file removed test/cards/004.png
Binary file not shown.
Binary file removed test/cards/005.png
Binary file not shown.
Binary file removed test/cards/006.png
Binary file not shown.
Binary file removed test/cards/007.png
Binary file not shown.
Binary file removed test/cards/008.png
Binary file not shown.