From eee6b1a7656acf5af06e24695a77c844aff07c65 Mon Sep 17 00:00:00 2001 From: kirbylife Date: Sat, 30 Nov 2019 16:49:14 -0600 Subject: [PATCH] removed the temporal icons --- client.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/client.py b/client.py index e0a890a..09b2b7a 100755 --- a/client.py +++ b/client.py @@ -6,11 +6,11 @@ import os import pathlib import sys from copy import deepcopy +from datetime import datetime from random import randint from shutil import rmtree from threading import Thread from time import sleep -from datetime import datetime import pystray from PIL import Image, ImageTk @@ -22,24 +22,32 @@ from config import get_config from dir_to_json import get_json from misc import check_network +_online_icon = Image.open("img/icons/online.png") +_offline_icon = Image.open("img/icons/offline.png") +_standby_icon = Image.open("img/icons/offline.png") + class MunyalClient(pystray.Icon): def __init__(self): super(MunyalClient, self).__init__("Munyal") - self.icon = Image.open("img/icons/standby.png") + self.icon = _standby_icon self.config = get_config() self.stack = [] def is_online(self): ping = check_network("http://google.com", 443) if ping: - self.icon = Image.open("img/icons/online.png") + self.icon = _online_icon else: - self.icon = Image.open("img/icons/offline.png") + self.icon = _offline_icon def start(self): - thread_uploader = Thread(target=self.uploader, name="uploader", daemon=True) - thread_downloader = Thread(target=self.downloader, name="downloader", daemon=True) + thread_uploader = Thread(target=self.uploader, + name="uploader", + daemon=True) + thread_downloader = Thread(target=self.downloader, + name="downloader", + daemon=True) thread_uploader.start() thread_downloader.start() self.run(self.__run) @@ -57,8 +65,6 @@ class MunyalClient(pystray.Icon): print("Uploader") while True: sleep(5) - self.icon = Image.open("img/icons/online.png") - def __upload(self, path): pass @@ -67,7 +73,6 @@ class MunyalClient(pystray.Icon): print("Downloader") while True: sleep(7) - self.icon = Image.open("img/icons/offline.png") def __download(self, path): pass