diff --git a/gui.py b/gui.py index c076caf..3d55ab1 100644 --- a/gui.py +++ b/gui.py @@ -13,10 +13,6 @@ from typing import ( Any, Optional, List, Dict, Set, Tuple, TypedDict, Iterable, NoReturn, TYPE_CHECKING ) -try: - from PIL import Image -except ModuleNotFoundError as exc: - raise ImportError("You have to run 'pip install Pillow' first") from exc try: import pystray except ModuleNotFoundError as exc: @@ -41,6 +37,15 @@ def resource_path(relative_path): return os.path.join(base_path, relative_path) +class ICOImage: + def __init__(self, path: str): + with open(path, 'rb') as file: + self._data = file.read() + + def save(self, file, format): + file.write(self._data) + + class TKOutputHandler(logging.Handler): def __init__(self, output: GUIManager): super().__init__() @@ -702,7 +707,7 @@ class TrayIcon: ) self._icon = pystray.Icon( "twitch_miner", - Image.open(resource_path("pickaxe.ico")), + ICOImage(resource_path("pickaxe.ico")), "Twitch Drops Miner", menu, ) @@ -954,9 +959,9 @@ if __name__ == "__main__": gui._root.update() gui.channels.get_selection() # Tray - # gui.tray.minimize() - # await asyncio.sleep(1) - # gui.tray.notify("Bounty Coins (3/7)", "Mined Drop") + gui.tray.minimize() + await asyncio.sleep(1) + gui.tray.notify("Bounty Coins (3/7)", "Mined Drop") # Drop progress drop = create_drop("Wardrobe Cleaning", "Fancy Pants", 2, 7, 239, 240) gui.progress.display(drop) diff --git a/requirements.txt b/requirements.txt index b3cbb08..121f094 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ aiohttp>2.0,<4.0 -Pillow pystray