Remove Pillow dependency
This commit is contained in:
1 parent
eee93b2554
commit
34a1a5b12b
2 files changed
+13
-9
No files matched your search
@@ -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)
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
aiohttp>2.0,<4.0
|
||||
Pillow
|
||||
pystray
|
||||
Reference in new issue
Block a user