1
0
Fork 0
mirror of https://github.com/ldericher/fftcgtool synced 2025-01-15 15:02:59 +00:00
fftcgtool/fftcg/book.py
2021-08-04 03:41:14 +02:00

25 lines
607 B
Python

import queue
class Book:
def __init__(self, cards):
self.__cards = cards
def __get_pages(self, grid):
# cards per sheet
r, c = grid
capacity = r * c - 1
# flat copy
cards = self.__cards
# while there are cards
while cards:
# get a chunk
yield cards[:capacity]
# remove that chunk
cards = cards[capacity:]
def populate(self, grid, resolution, threadnum=16):
card_queue = queue.Queue()
for i, card in enumerate(self.__cards):
card_queue.put((i, card))