removed the temporal icons

master
kirbylife 2019-11-30 16:49:14 -06:00
parent ee7834b455
commit eee6b1a765
1 changed files with 14 additions and 9 deletions

View File

@ -6,11 +6,11 @@ import os
import pathlib import pathlib
import sys import sys
from copy import deepcopy from copy import deepcopy
from datetime import datetime
from random import randint from random import randint
from shutil import rmtree from shutil import rmtree
from threading import Thread from threading import Thread
from time import sleep from time import sleep
from datetime import datetime
import pystray import pystray
from PIL import Image, ImageTk from PIL import Image, ImageTk
@ -22,24 +22,32 @@ from config import get_config
from dir_to_json import get_json from dir_to_json import get_json
from misc import check_network 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): class MunyalClient(pystray.Icon):
def __init__(self): def __init__(self):
super(MunyalClient, self).__init__("Munyal") super(MunyalClient, self).__init__("Munyal")
self.icon = Image.open("img/icons/standby.png") self.icon = _standby_icon
self.config = get_config() self.config = get_config()
self.stack = [] self.stack = []
def is_online(self): def is_online(self):
ping = check_network("http://google.com", 443) ping = check_network("http://google.com", 443)
if ping: if ping:
self.icon = Image.open("img/icons/online.png") self.icon = _online_icon
else: else:
self.icon = Image.open("img/icons/offline.png") self.icon = _offline_icon
def start(self): def start(self):
thread_uploader = Thread(target=self.uploader, name="uploader", daemon=True) thread_uploader = Thread(target=self.uploader,
thread_downloader = Thread(target=self.downloader, name="downloader", daemon=True) name="uploader",
daemon=True)
thread_downloader = Thread(target=self.downloader,
name="downloader",
daemon=True)
thread_uploader.start() thread_uploader.start()
thread_downloader.start() thread_downloader.start()
self.run(self.__run) self.run(self.__run)
@ -57,8 +65,6 @@ class MunyalClient(pystray.Icon):
print("Uploader") print("Uploader")
while True: while True:
sleep(5) sleep(5)
self.icon = Image.open("img/icons/online.png")
def __upload(self, path): def __upload(self, path):
pass pass
@ -67,7 +73,6 @@ class MunyalClient(pystray.Icon):
print("Downloader") print("Downloader")
while True: while True:
sleep(7) sleep(7)
self.icon = Image.open("img/icons/offline.png")
def __download(self, path): def __download(self, path):
pass pass