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 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