mirror of
https://github.com/ldericher/fftcgtool
synced 2025-01-15 23:03:00 +00:00
better inheritance
This commit is contained in:
parent
e889689bcc
commit
c34b7856a4
3 changed files with 3 additions and 5 deletions
|
@ -7,8 +7,6 @@ class Cards(list[Card]):
|
||||||
__API_URL = "https://fftcg.square-enix-games.com/de/get-cards"
|
__API_URL = "https://fftcg.square-enix-games.com/de/get-cards"
|
||||||
|
|
||||||
def __init__(self, params: dict[str, any]):
|
def __init__(self, params: dict[str, any]):
|
||||||
list.__init__(self)
|
|
||||||
|
|
||||||
# required params:
|
# required params:
|
||||||
# text
|
# text
|
||||||
# supported params:
|
# supported params:
|
||||||
|
@ -20,7 +18,7 @@ class Cards(list[Card]):
|
||||||
params["text"] = ""
|
params["text"] = ""
|
||||||
|
|
||||||
req = requests.post(Cards.__API_URL, json=params)
|
req = requests.post(Cards.__API_URL, json=params)
|
||||||
self.extend([Card(card_data) for card_data in req.json()["cards"]])
|
super().__init__([Card(card_data) for card_data in req.json()["cards"]])
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return "\n".join(str(card) for card in self)
|
return "\n".join(str(card) for card in self)
|
||||||
|
|
|
@ -9,7 +9,7 @@ from PIL import Image
|
||||||
|
|
||||||
class ImageLoader(threading.Thread):
|
class ImageLoader(threading.Thread):
|
||||||
def __init__(self, url_queue: queue.Queue, resolution: tuple[int, int], language: str):
|
def __init__(self, url_queue: queue.Queue, resolution: tuple[int, int], language: str):
|
||||||
threading.Thread.__init__(self)
|
super().__init__()
|
||||||
|
|
||||||
self.__queue = url_queue
|
self.__queue = url_queue
|
||||||
self.__resolution = resolution
|
self.__resolution = resolution
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Opus(Cards):
|
||||||
self.__number = "?"
|
self.__number = "?"
|
||||||
self.__name = "?"
|
self.__name = "?"
|
||||||
|
|
||||||
Cards.__init__(self, params)
|
super().__init__(params)
|
||||||
|
|
||||||
# remove reprints
|
# remove reprints
|
||||||
for card in self:
|
for card in self:
|
||||||
|
|
Loading…
Reference in a new issue